test(dogfood): each file's temporary cwd is created from a base the scratch-dir scan can read - #21935
Merged
objectstack-fleet[bot] merged 1 commit intoOct 6, 2026
Conversation
…cratch-dir scan can read The dispatch-gates self-test refuses a mkdtempSync whose base it cannot read, and the per-file cwd took its base from inject(): a path handed over from the globalSetup. Each file's directory is now made as mkdtempSync(join(tmpdir(), TAG-file-)), where TAG is the run's reserved name (only a name crosses inject(), and a separator in it is refused). The globalSetup sweeps that prefix at run end, then removes the reservation, so the shared boot's handles still live until the run ends and a concurrent run's directories are never touched. Isolation, the leftover guard and the stale-dir clearing are unchanged. Claude-Session: https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU Co-authored-by: Claude <noreply@anthropic.com>
Contributor
📓 Docs Drift Check
What this run could not see
Coarse fallback — 2 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
objectstack-fleet
Bot
deleted the
claude/issue-21924-per-file-cwd-readable-base
branch
October 6, 2026 02:54
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #21924
Clause-②: no
What changes
main's hourlyLint & Type Checkrun is red on onedispatch-gatesself-test case (run37394652870atbe97cf3c93,Lint & Repo Gates, stepPM dispatch-gates self-test):PR #21919 added that site for #21914. The guard is right: a
mkdtempSyncbase handed over throughinject()is an expression the tree's scratch-directory scan cannot read. So the fix is at the site, and nothing in the guard or the scan changes.packages/qa/dogfood/test/per-file-cwd.setup.ts: each file's directory is nowmkdtempSync(join(tmpdir(), perFileDirPrefix(runTag))). The base istmpdir(), outside the tree by construction, and the scan reads it as such.inject()(key renameddogfoodCwdRoottodogfoodRunTag), and only as a name component...is refused.packages/qa/dogfood/test/per-file-cwd.global-setup.ts:.objectstack(unchanged). It reserves the run's tag asmkdtempSync(join(tmpdir(), 'os-dogfood-run-'))(unchanged expression) and provides its basename.perFileDirPrefix, exported here and imported by the setup module, so the prefix has one spelling), then the reservation.shared-showcaseboot keeps its handles until the run ends. A concurrent run carries another tag and is never touched.packages/qa/dogfood/vitest.config.ts: one comment line ("removes the run's per-file directories at the end").Unchanged from #21914: every file still runs in its own temporary cwd; the cwd is restored in
afterAll; and the throwingafterAllguard onpackages/qa/dogfood/.objectstack/datais untouched.Out of scope here: the rule, the case and
scripts/pm/dispatch-gates.mjsare untouched. Nothing is skipped or recorded as an exception.Evidence
origin/mainfaf8dce4with no change:pnpm check:pm-dispatch-gatesgave✗ dispatch-gates self-test: 1 of 1976 case(s) failed.. The one red case is the line quoted above, atper-file-cwd.setup.ts:60. The battery took 821.9s.2edc5d59:pnpm check:pm-dispatch-gatesgave✓ no mkdtempSync site in this tree takes a base the scan cannot readand✓ dispatch-gates self-test: 1976 cases pass.(780.2s).2edc5d59, andscripts/ablation-replace.mjs(wrap mode) replaced the site withprocess.chdir(mkdtempSync(join(inject('dogfoodRunTag'), 'file-')));. The anchor went from 1 to 0, and the blob fromdc1d3de3to51346b9f.✗ dispatch-gates self-test: 1 of 1976 case(s) failed., and the red case was exactly... UNRESOLVED: packages/qa/dogfood/test/per-file-cwd.setup.ts:73 (a base this scan cannot read: inject('dogfoodRunTag')).dc1d3de3),git diff HEADis empty, andgit status --porcelainis empty. The second worktree was then removed.2edc5d59:pnpm --filter @objectstack/dogfood test:Test Files 208 passed | 1 skipped (209),Tests 1606 passed | 9 skipped (1615). Afterwardspackages/qa/dogfood/.objectstackdoes not exist. Zero/tmp/os-dogfood-run-*entries before the run and zero after it.scripts/ablation-replace.mjs: the centralprocess.chdir(...)was dropped (blobdc1d3de3toad6684f2) and two files were run,showcase-external-autoconnectandshowcase-search. Result:Test Files 2 failed (2). Both failed in the guard:.../packages/qa/dogfood/.objectstack/data exists after this test file ran. Entries: showcase_external.db(plus-shm/-walon the shared-showcase file).git diff HEADempty). The restored leg gave2 passed, exit 0, and left nothing in the package dir. Zero temp entries were left after each leg, the red one included.dispatch-gates --commandsover the 3 changed paths derived 47 families. All 47 ran at2edc5d59, anddispatch-gates --ranreported47 derived famil(ies) accounted for — 47 run, 0 NOT-MEASURED.check:dual-build-cjs-loadsfirst exited 3 (prerequisite:packages/apps/studio/distmissing), then exited 0 after building it.pnpm lintexits 0, andpnpm --filter @objectstack/dogfood typecheckis green.check:pm-dispatch-gatesis path-scoped, so this PR's CI may not schedule it, which is how the red reachedmain. It was run here in full at the head, as above.Acceptance notes
packages/qa/dogfood/vitest.config.ts, in theisolatedproject's alias block (about line 295). This PR changes one comment line near line 146. The hunks do not overlap.main: test(dogfood): every test file runs in its own temporary working directory #21919's own CI did not schedulecheck:pm-dispatch-gates, because that battery is path-scoped and the battery's live-tree half reads every tracked source. This is noted, not filed: the scoping is the merge-group ruling thatlint.ymldocuments, and the hourly full run caught the red as designed.Generated by Claude Code