Skip to content

Commit 1210544

Browse files
test(ui): three ui/ script tests spell their temp bases so the whole-tree scratch-dir sweep reads them (PM dispatch-gates red on main) (#25865)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoCtY9d51b1p6bnTRQmr2tqL)_ Fixes #25851 Part of #25677 (cutover aftercare, bill item 50). Clause-②: no Metadata-protocol: none ## Why main is red `Lint · PM dispatch-gates` runs `pnpm check:pm-dispatch-gates`. On `push` and `schedule` that runs both tiers of the battery; on `pull_request` and the merge queue it runs the fast tier only. That is why every PR run of the cutover sitting was green while every push and schedule run since `fd40831416` (#25825) has been red. Job log of check-run 121332957566 (push run 40247793996, `90a34e2039`), the only two red lines: ``` ✗ every in-tree directory this tree's sources create is covered by a tracked ignore rule, or is tracked itself — EXPOSED: ui/packages/fields/src/hooks (ui/scripts/__tests__/check-node-esm-load.test.ts:141), ui/packages/fields/sub (ui/scripts/__tests__/check-node-esm-load.test.ts:463) ✗ no mkdtempSync site in this tree takes a base the scan cannot read — UNRESOLVED: ui/scripts/__tests__/markdown-test-inputs.test.ts:131 (a bare relative literal, resolved against a cwd this scan cannot see: ''), ui/scripts/__tests__/select-affected-tests-wiring.test.ts:142 (a bare relative literal, resolved against a cwd this scan cannot see: ''), ui/scripts/__tests__/select-affected-tests-wiring.test.ts:198 (a bare relative literal, resolved against a cwd this scan cannot see: '') ✗ dispatch-gates self-test: 2 of 2182 case(s) failed. ``` Both are slow-tier live-tree cases of the scratch-directory sweep (`exposedScratchDirs` in `scripts/pm/dispatch-gates.mjs`). Since the import it reads `ui/` sources too, and it misreads two spellings in three `ui/` script tests: 1. `check-node-esm-load.test.ts` binds `dir` to a temp directory in most tests (`const dir = tmpdir()`, a local helper over `os.tmpdir()`), and to `path.join(REPO_ROOT, 'packages/fields')` and `'packages/auth'` in two tests that only read package files. The sweep does not track scope and lets an in-tree reading win (its stated bias), so every `mkdirSync(path.join(dir, …))` in the file read as a directory created under `ui/packages/fields`. 2. `markdown-test-inputs.test.ts` and `select-affected-tests-wiring.test.ts` declare `let scratch = ''` and assign the real base (`mkdtempSync(path.join(tmpdir(), …))`) in `beforeAll`. The empty literal reads as a cwd-relative `mkdtempSync` base, and the two readings disagree, so the site stays unresolved. ## What this changes The three test sources only. No gate, fixture, workflow or ignore rule changes, and no test changes behaviour. - `check-node-esm-load.test.ts`: the two package-reading tests name their binding `pkgDir`. - `markdown-test-inputs.test.ts`, `select-affected-tests-wiring.test.ts`: `let scratch: string;`, so the `beforeAll` assignment is the only reading. The nine `mkdirSync(path.join(dir, …))` sites in `check-node-esm-load.test.ts` now read as unresolved `mkdirSync` (one `dir` comes from `withTaskLog(…)`, an arrow function the resolver does not follow), the same class line 706 of that file already had. The live case counts only unresolved `mkdtempSync` sites, so they do not red it, and none of them reads as in-tree any more. ## Evidence All on this branch's base, main `e167956e`, with `GITHUB_ACTIONS=true GITHUB_EVENT_NAME=push node scripts/pm/check-dispatch-gates.mjs` (the step's second command, both tiers): | | before (main `e167956e`) | after (this branch, `a5958c7b`) | |---|---|---| | battery | `✗ dispatch-gates self-test: 2 of 2182 case(s) failed.` (exit 1, the same two lines as CI) | `✓ dispatch-gates self-test: 2182 cases pass.` (exit 0) | | live sweep | 2 exposed, 3 unresolved `mkdtempSync` | 0 exposed, 0 unresolved `mkdtempSync` (2388 sites across 18098 tracked sources, 82 in-tree roots) | - `node scripts/pm/check-dispatch-gates.mjs --self-test` with the push environment: exit 0. - `npx vitest run` on the three files (from `ui/`): 3 files, 86 tests pass. - `npx tsc -p tsconfig.scripts.json --noEmit` (from `ui/`): 21 errors before and after, all pre-existing unbuilt `@objectstack/spec` subpath errors, none in these files. - Derived gates: `dispatch-gates --commands` for the three paths derives 18; all 18 ran, exit 0. `dispatch-gates --ran`: `✓ 18 derived famil(ies) accounted for — 18 run, 0 NOT-MEASURED (a DERIVED zero)`. - Since this branch's base, main gained #25852 and #25856. Neither touches these files or adds a `mkdtempSync`/`mkdirSync` call. This PR's own CI runs the fast tier only, so it cannot show the fixed cases. The proof is the first green push run of `Lint & Type Check` on main after this lands; its run id goes on #25851. Tier S: three `ui/scripts/__tests__/` files, no governed surface. `skip-changeset`: publishes nothing. The known Test UI 8/16 and 9/16 reds belong to the next 4b PR and are not touched. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HssnEmZ59WGARsErPSbRpf Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3fca599 commit 1210544

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎ui/scripts/__tests__/check-node-esm-load.test.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,24 +369,24 @@ describe('the scope this gate ratchets, now that the emit question is answered',
369369
// sources — so nothing live left the leg with it. The sources keep a
370370
// STRICTER guard than this heuristic: that config pins `nodenext`, under
371371
// which a missing relative extension is TS2835 in the package's own build.
372-
const dir = path.join(REPO_ROOT, 'packages/fields');
373-
const build = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')).scripts.build;
372+
const pkgDir = path.join(REPO_ROOT, 'packages/fields');
373+
const build = JSON.parse(fs.readFileSync(path.join(pkgDir, 'package.json'), 'utf8')).scripts.build;
374374

375-
expect(effectiveNoEmit(path.join(dir, 'tsconfig.json'))).toBe(true);
376-
expect(buildPreservesSpecifiers(build, dir)).toBe(false);
377-
expect(parseTsconfig(path.join(dir, 'tsconfig.json')).compilerOptions?.noEmit).toBeUndefined();
375+
expect(effectiveNoEmit(path.join(pkgDir, 'tsconfig.json'))).toBe(true);
376+
expect(buildPreservesSpecifiers(build, pkgDir)).toBe(false);
377+
expect(parseTsconfig(path.join(pkgDir, 'tsconfig.json')).compilerOptions?.noEmit).toBeUndefined();
378378
});
379379

380380
it('keeps `@object-ui/auth` in the leg on its DECLARED noEmit, not on a catch', () => {
381381
// Its config throws under the old reader too, so it was in the leg by
382382
// accident. It declares `"noEmit": false` outright, so the verdict is
383383
// unchanged — what changes is that it is now a reading.
384-
const dir = path.join(REPO_ROOT, 'packages/auth');
385-
const build = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')).scripts.build;
384+
const pkgDir = path.join(REPO_ROOT, 'packages/auth');
385+
const build = JSON.parse(fs.readFileSync(path.join(pkgDir, 'package.json'), 'utf8')).scripts.build;
386386

387-
expect(parseTsconfig(path.join(dir, 'tsconfig.json')).compilerOptions?.noEmit).toBe(false);
388-
expect(effectiveNoEmit(path.join(dir, 'tsconfig.json'))).toBe(false);
389-
expect(buildPreservesSpecifiers(build, dir)).toBe(true);
387+
expect(parseTsconfig(path.join(pkgDir, 'tsconfig.json')).compilerOptions?.noEmit).toBe(false);
388+
expect(effectiveNoEmit(path.join(pkgDir, 'tsconfig.json'))).toBe(false);
389+
expect(buildPreservesSpecifiers(build, pkgDir)).toBe(true);
390390
});
391391
});
392392

‎ui/scripts/__tests__/markdown-test-inputs.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const [TYPE_CHECK_STEP, TEST_STEP, DIST_PINS_STEP, E2E_STEP] = STEPS;
113113

114114
type Outcome = { shouldRun: string; log: string };
115115

116-
let scratch = '';
116+
let scratch: string;
117117

118118
function git(cwd: string, ...args: string[]): void {
119119
execFileSync('git', args, { cwd, stdio: 'pipe' });

‎ui/scripts/__tests__/select-affected-tests-wiring.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function parseOutputs(text: string): Record<string, string> {
134134
return outputs;
135135
}
136136

137-
let scratch = '';
137+
let scratch: string;
138138
const nodeDir = path.dirname(process.execPath);
139139

140140
/** Write an executable stand-in for `name` into a fresh bin directory. */

0 commit comments

Comments
 (0)