Skip to content

fix(tests): isolate Claude host storage from the invoking home - #4042

Merged
schlessera merged 6 commits into
mainfrom
fix/2902-claude-test-host-storage
Nov 16, 2026
Merged

schlessera merged 6 commits into
mainfrom
fix/2902-claude-test-host-storage

Conversation

@schlessera

@schlessera schlessera commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #2902

What changed

The test launcher supplies a disposable invoking HOME before starting Bun. The shared preload assigns a separate working HOME and CLAUDE_CONFIG_DIR, restores the environment descriptors, and removes its storage after all files finish. After the test process and its children settle, the launcher checks that the invoking Claude sentinel tree has unchanged path membership and exact metadata, then removes it. This covers filesystem writes without modifying filesystem functions or observing another session's user storage.

Default profiles, empty profile environments and explicit owned config overrides retain actual observation records in temporary storage. The Bash confirmation fixture owns a brain directory rather than using all of /tmp, and copied test harnesses carry the home helper.

Why this shape

The issue allows shared-preload isolation, which covers future tests. Assigning the invoking home before Bun starts also fences native HOME fallbacks. The guard runs outside the child process, so fixture spies can save real originals and restore complete descriptors, and native children cannot bypass the filesystem comparison. Production fallback, observation settlement and redirected/aliased-storage refusals remain unchanged. Existing user directories are neither cleaned nor migrated.

Proof

{"version":1,"kind":"brain-check-pr-receipt","head":"2ba3ca8c733ccba891d349843e462c478d74fe97","base":"origin/main","mode":"focused","startedAt":"2026-11-16T03:56:02.176Z","finishedAt":"2026-11-16T03:57:29.530Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12749.044455},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":135.71615399999973},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":112.36635799999931},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":18.30554999999913},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":74317.87495699999}]}

Checklist

  • Current-head local checks and behavioral/mutation receipts are recorded.
  • Fresh hosted feedback passes at the current head.
  • Candidate confirmation and landing remain owned by the orchestrator.
  • PR and issue have verified release milestone 0.45.0.
  • Test-only change; no consumer-visible changeset is needed.
  • Leakage gates pass; machine contracts and production provider history are unchanged.
  • Testing documentation describes the isolation and cleanup.
  • Test containment is limited to owned homes: a mismatch fails the invocation with its cause, then cleanup removes owned state. Production guards are unchanged.

Anything left open

Orchestrator-owned candidate confirmation and landing only. Implementation, local proof and current-head heavy feedback are complete. The worktree is clean, the matching local receipt appears once above, and both release milestones are verified as 0.45.0. The claim remains held for landing. No new follow-up issue was filed; the existing local container limitation is #3318.

@schlessera schlessera added this to the 0.45.0 milestone Nov 15, 2026
@schlessera schlessera added type: fix Something is broken and must behave the way it is documented. area: backends AgentBackend implementations and the seam they share. area: ci CI workflows, the gates they run, release scripts, packaging. labels Nov 15, 2026
@schlessera

Copy link
Copy Markdown
Owner Author

Feedback diagnosis: run 43759114618

The workflow-dispatch revision was main e1ce188d79dd47c88a4478359d38277098444a21, but the unit resource receipts identify the actual tested checkout as PR #4042 head 722c47ce2c1cb23b415b04b4e0ec4cf2be157b6b. Proof jobs ran after admission; this was not an admission-slot timeout.

Log outcome Classification and action
Eleven filesystem assertion failures: native-suite cleanup; resumed-state warning; scratch publication; storage inventory swap; SDK-hook descriptor restoration; maintenance publication; two inbox snapshot races; scratch redirect; worker-state write call count; journal descriptor swap Regressions from this PR's global filesystem spies. Captured originals pointed at shared spy objects, causing recursion, stale call histories (including 1,461 calls), wrong race timing and descriptor restoration failures. Removed global filesystem interception entirely and moved verification into the launcher outside the test process. A focused regression fails with the old preload and passes with the corrected one; pinned-Bun filesystem coverage passes 106 tests.
Nineteen subsequent runtime, freeze/resource-accounting, bridge, attachment and budget test timeouts Conservatively treated as potentially caused by the preceding shared-spy corruption, not waived as unrelated flakes. Fresh hosted feedback is required before declaring these resolved; unsupported local namespaces cannot settle those runtime claims.
Generated Penelope/Odysseus PLANNED_WORKER_FAILURE_AFTER_DIAGNOSTICS lines Expected negative fixture controls, not additional enclosing-suite failures.
Final draft-heavy-feedback aggregate Propagates the four failing unit shards; no independent failure.
Runtime, runtime_host, verify, pack, browser, layout, captures and endurance Passed for the old head only; not relabelled as current-head proof.

The current head is 0c059885f53c46baa599164fe9c8bb16b2f6d59f. Current-head typecheck, pinned-Bun home/profile probes and all local preflight gates pass. Main-preload controls also distinguish the host's native prerequisite failures from the new spy regression: the seven-file control passed 165 tests and failed 27 native cases under local namespace restrictions. A wider local harness run additionally encountered those restrictions and a temporary-filesystem EDQUOT; it is not claimed as hosted proof.

The required one-time heavy-slot check returned three in-progress workflows. No replacement run was dispatched. The branch and claim are retained for the orchestrator: WAITING pr=4042 on=heavy-slot.

@schlessera
schlessera marked this pull request as ready for review November 16, 2026 03:59
@schlessera
schlessera merged commit 8abc051 into main Nov 16, 2026
52 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backends AgentBackend implementations and the seam they share. area: ci CI workflows, the gates they run, release scripts, packaging. type: fix Something is broken and must behave the way it is documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: Claude backend tests write host observation storage into the real ~/.claude

1 participant