Repository navigation
Commit 9e33ee7
test(dogfood): each file's temporary cwd is created from a base the scratch-dir scan can read (#21935)
Fixes #21924
Clause-②: no
## What changes
`main`'s hourly `Lint & Type Check` run is red on one `dispatch-gates`
self-test case (run `37394652870` at `be97cf3c93`, `Lint & Repo Gates`,
step `PM dispatch-gates self-test`):
> ✗ no mkdtempSync site in this tree takes a base the scan cannot read —
UNRESOLVED: packages/qa/dogfood/test/per-file-cwd.setup.ts:60 (a base
this scan cannot read: inject('dogfoodCwdRoot'))
PR #21919 added that site for #21914. The guard is right: a
`mkdtempSync` base handed over through `inject()` 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 now `mkdtempSync(join(tmpdir(),
perFileDirPrefix(runTag)))`. The base is `tmpdir()`, outside the tree by
construction, and the scan reads it as such.
- Only the run's TAG crosses `inject()` (key renamed `dogfoodCwdRoot` to
`dogfoodRunTag`), and only as a name component.
- A tag carrying a path separator or `..` is refused.
- **`packages/qa/dogfood/test/per-file-cwd.global-setup.ts`**:
- At start it clears a stale `.objectstack` (unchanged). It reserves the
run's tag as `mkdtempSync(join(tmpdir(), 'os-dogfood-run-'))` (unchanged
expression) and provides its basename.
- At END it removes every system-temp entry named with this run's prefix
(`perFileDirPrefix`, exported here and imported by the setup module, so
the prefix has one spelling), then the reservation.
- The removal stays run-level, so the memoized `shared-showcase` boot
keeps its handles until the run ends. A concurrent run carries another
tag and is never touched.
- The teardown still judges nothing.
- **`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 throwing `afterAll` guard on
`packages/qa/dogfood/.objectstack/data` is untouched.
Out of scope here: the rule, the case and
`scripts/pm/dispatch-gates.mjs` are untouched. Nothing is skipped or
recorded as an exception.
## Evidence
- **Reproduced first**, on `origin/main` `faf8dce4` with no change:
`pnpm check:pm-dispatch-gates` gave `✗ dispatch-gates self-test: 1 of
1976 case(s) failed.`. The one red case is the line quoted above, at
`per-file-cwd.setup.ts:60`. The battery took 821.9s.
- **At head `2edc5d59`**: `pnpm check:pm-dispatch-gates` gave `✓ no
mkdtempSync site in this tree takes a base the scan cannot read` and `✓
dispatch-gates self-test: 1976 cases pass.` (780.2s).
- **The case still fails on a planted unreadable base.** A second
worktree was checked out at `2edc5d59`, and
`scripts/ablation-replace.mjs` (wrap mode) replaced the site with
`process.chdir(mkdtempSync(join(inject('dogfoodRunTag'), 'file-')));`.
The anchor went from 1 to 0, and the blob from `dc1d3de3` to `51346b9f`.
- Result: `✗ 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'))`.
- Restore was proven: blob after restore equals HEAD (`dc1d3de3`), `git
diff HEAD` is empty, and `git status --porcelain` is empty. The second
worktree was then removed.
- **#21914's behaviour, re-proven at `2edc5d59`**:
- Whole dogfood suite, `pnpm --filter @objectstack/dogfood test`: `Test
Files 208 passed | 1 skipped (209)`, `Tests 1606 passed | 9 skipped
(1615)`. Afterwards `packages/qa/dogfood/.objectstack` does not exist.
Zero `/tmp/os-dogfood-run-*` entries before the run and zero after it.
- H4 ablation through `scripts/ablation-replace.mjs`: the central
`process.chdir(...)` was dropped (blob `dc1d3de3` to `ad6684f2`) and two
files were run, `showcase-external-autoconnect` and `showcase-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` / `-wal` on the
shared-showcase file).
- The restore was proven (blob equals HEAD, `git diff HEAD` empty). The
restored leg gave `2 passed`, exit 0, and left nothing in the package
dir. Zero temp entries were left after each leg, the red one included.
- **Gates**: `dispatch-gates --commands` over the 3 changed paths
derived 47 families. All 47 ran at `2edc5d59`, and `dispatch-gates
--ran` reported `47 derived famil(ies) accounted for — 47 run, 0
NOT-MEASURED`.
- `check:dual-build-cjs-loads` first exited 3 (prerequisite:
`packages/apps/studio/dist` missing), then exited 0 after building it.
- `pnpm lint` exits 0, and `pnpm --filter @objectstack/dogfood
typecheck` is green.
- `check:pm-dispatch-gates` is path-scoped, so this PR's CI may not
schedule it, which is how the red reached `main`. It was run here in
full at the head, as above.
## Acceptance notes
- Open PR #21930 also edits `packages/qa/dogfood/vitest.config.ts`, in
the `isolated` project's alias block (about line 295). This PR changes
one comment line near line 146. The hunks do not overlap.
- How this red reached `main`: #21919's own CI did not schedule
`check: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 that `lint.yml` documents,
and the hourly full run caught the red as designed.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent cc2300b commit 9e33ee7
3 files changed
Lines changed: 59 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
21 | 33 | | |
22 | 34 | | |
23 | 35 | | |
24 | 36 | | |
25 | 37 | | |
26 | | - | |
| 38 | + | |
27 | 39 | | |
28 | | - | |
| 40 | + | |
29 | 41 | | |
30 | 42 | | |
31 | 43 | | |
| |||
34 | 46 | | |
35 | 47 | | |
36 | 48 | | |
37 | | - | |
38 | | - | |
| 49 | + | |
| 50 | + | |
39 | 51 | | |
40 | 52 | | |
41 | 53 | | |
42 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
43 | 60 | | |
44 | 61 | | |
45 | 62 | | |
46 | | - | |
47 | | - | |
| 63 | + | |
| 64 | + | |
48 | 65 | | |
49 | 66 | | |
50 | 67 | | |
51 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
52 | 74 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
| |||
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
49 | | - | |
50 | | - | |
| 59 | + | |
| 60 | + | |
51 | 61 | | |
52 | | - | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
60 | | - | |
| 73 | + | |
61 | 74 | | |
62 | 75 | | |
63 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
0 commit comments