Skip to content

Restore the process runtime state the money journeys pin - #24

Closed
Parad0x-Labs wants to merge 2 commits into
mainfrom
mission/money-probe-home-restore
Closed

Parad0x-Labs wants to merge 2 commits into
mainfrom
mission/money-probe-home-restore

Conversation

@Parad0x-Labs

Copy link
Copy Markdown
Owner

What failed

Shard tests (3) of CI run 35640946053 (PR #22) failed four cases with
cryptography.exceptions.InvalidTag at network/signer.py:302:

  • tests/test_identity_lifecycle.py::test_mesh_message_rejects_revoked_peer
  • tests/test_identity_lifecycle.py::test_signed_write_rejects_revoked_peer
  • tests/legacy/test_learning.py::test_swarm_learning
  • tests/legacy/test_pow_genesis.py::test_sybil_defense

These four also fail on main (8153a96) when the same files run in one
process in this order — reproduced locally in both trees:

pytest tests/effect_budget/test_money_served_api.py::test_the_daemon_serves_money_state_written_by_independent_processes_and_keeps_it_across_restart \
       tests/test_identity_lifecycle.py tests/legacy/test_learning.py tests/legacy/test_pow_genesis.py
→ 4 failed (InvalidTag) on main AND on PR #22's head; 9 passed with this PR.

Main's CI never showed it only because the round-robin shard split (descending
file size) puts test_money_served_api in shard 3 and test_identity_lifecycle
in shard 2 — PR #22's new guard file shifted the indices and collided them.
Any future test-file addition can reshuffle shards the same way.

Root cause

money_race_probe.configure_home pins FOUR pieces of process-global state
(VOOL_HOME env, runtime-home override, default db override, continuity db
override), but every test-side restore was partial:

  • the served-daemon journey's finally restored the override + continuity
    path — never the VOOL_HOME env write (active_vool_home() reads env
    first, so the drift survives configure_runtime_home(None));
  • shared_home had the same two-line partial restore;
  • both provider_home fixtures "restored" with configure_runtime_home(None),
    which CLEARS the session home the root conftest installed instead of undoing
    their pin.

The race children (VOOL_KEY_PASSPHRASE="money-race-probe") seal their node
signer record under the pinned served home; after the journey, the next
signer reload in the same pytest process re-resolves _KEY_DIR into that home
and opens the record with the suite passphrase
(test-suite-only-never-a-real-key) → InvalidTag.

Repair (test-infrastructure only; no production semantics touched)

  • money_race_probe.runtime_state_snapshot() / restore_runtime_state()
    snapshot and put back exactly the four pinned pieces, beside
    configure_home (the mutation owner); pinned_runtime() composes them for
    context-manager callers. The CLI children keep plain configure_home
    (the mutation dies with their process).
  • The served-daemon journey, the cross-process suite's shared_home, and both
    provider_home fixtures restore exactly what they pinned.
  • New guard case test_the_served_daemon_test_leaves_the_process_runtime_home_behind_it
    runs directly after the served-daemon journey in every shard/ordering (same
    module ⇒ same shard ⇒ same order) and pins the invariant against the
    module-import snapshot. Verified it fails with the drift message when the
    restore is removed, and passes with it.

Validation

  • Poisoned four-file order: 4 failed on main → 9 passed with this PR (A/B via
    stash on the same tree).
  • tests/effect_budget/ package: 174 passed, 1 failed —
    test_door_command_machine.py::TestZeroBudgetRefusal::test_zero_command_budget_means_zero_subprocess_transport_and_journal_calls,
    which fails identically on clean main locally and in every CI census (main
    35570948370 and PR runs 35637092451/35637818825/35640946053/35642039754) —
    pre-existing baseline, untouched here (manual-mode approval genus).
  • Cumulative neighbors: effect_budget + daemon_message_security +
    network_identity_defects + maintenance_dht_discovery + mesh_workproof_reward
    • capability_tokens: 211 passed, 3 xpassed, same single baseline failure.
  • Signer families in one process: money served + money cross-process +
    identity_lifecycle + legacy learning/pow + signer_key_storage +
    secret_storage_truth: 42 passed.
  • ruff check . clean (pinned 0.16.7).

Base: main 8153a96. Head: e904c27. Test-only diff (5 files under
tests/effect_budget/).

sls_0x added 2 commits September 22, 2026 02:02
configure_home and the provider_home fixtures pin VOOL_HOME, the
runtime-home override, and the db paths, but every test-side restore
was partial: configure_runtime_home(None) cleared the session home the
root conftest installed, and nothing restored the VOOL_HOME env write.
The race children seal their node signer record under the pinned home
with their own passphrase, so the next signer reload in the same pytest
process resolves into that home and fails with InvalidTag under the
suite passphrase. Measured 2026-09-21: shard tests(3) of PR run
35640946053 sent test_identity_lifecycle (2) and tests/legacy/* (2) red
this way; the same four-file order fails identically on main 8153a96
(shards merely did not collide them there).

money_race_probe gains runtime_state_snapshot/restore_runtime_state
(and pinned_runtime composing them) beside configure_home, the mutation
owner; the served-daemon journey, shared_home, and both provider_home
fixtures restore exactly what they pinned. A guard case directly after
the served-daemon journey pins the invariant.
CI run 35665692856: the guard's module-import snapshot blamed a
runtime-home override that an UNRELATED earlier test in the shard had
cleared and never restored -- correct detection of drift, wrong
attribution. The journey now records the exact state it restored in its
finally, and the guard asserts the present state equals that give-back:
immune to earlier drift, still failing on any leak of the journey itself
(verified by removing the restore and watching the guard name the served
home). The default-db piece is excluded -- the package's own autouse
store fixture repoints it per test by design.
@Parad0x-Labs
Parad0x-Labs deleted the mission/money-probe-home-restore branch September 23, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant