Skip to content

Commit 90b4126

Browse files
claude[bot]claude
andauthored
docs(tests): correct four stale claims about what check:cross-package-test-inputs recognises (#10561)
The gate resolves four directory-naming seed spellings plus the walked-file form, not "exactly two". `import.meta.dirname` and `dirname(import.meta.filename)` arrived with #9763 and the walked `import.meta.url` seed with #8995; both extensions updated RECOGNISED_PATH_SPELLINGS, which the gate prints, and neither swept for the count restated in prose elsewhere. Corrected, pointing at RECOGNISED_PATH_SPELLINGS as the single source instead of restating a number that drifts: - managed-extension-fields.test.ts: the seed count, plus two more stale claims measured on this tree — it is no longer the ONLY escaping read the gate sees in plugin-auth (#10161 made rate-limit-storage-isolation.test.ts visible), and that file no longer walks up from process.cwd(). The note also promised a stale-declaration failure that no longer fires: reseeding this file from process.cwd() now leaves the gate GREEN, with packages/**/*.object.ts declared and held by nothing. - managed-api-method-affordance-sweep.test.ts: the same seed count. Its stale-declaration consequence IS still real and is now cited from the measurement (that file is platform-objects' only escaping test; the ablation exits 1 naming the package). - check-type-check-coverage.mjs: the same claim in a TEST_DEBT note, the worst-placed instance since an author reads it while choosing a seed. - serve-multi-node-cap-advisory.pin.test.ts (not named in the card): stale in the opposite direction — it claimed the gate cannot follow a new URL() seed or a resolve() nested into the read. It follows both. The instruction to keep the whole path in one literal stands, for the reason that is actually true: only the flat literal collector needs that spelling. Comments and one note string only — no test code, no type surface. The gate's own repoRelativeLiterals roster for all three test files is unchanged from origin/main, so no declaration and no turbo.json input moves. Part of #10163 Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt Co-authored-by: Claude <noreply@anthropic.com>
1 parent a16ff50 commit 90b4126

4 files changed

Lines changed: 65 additions & 28 deletions

File tree

‎packages/cli/src/commands/serve-multi-node-cap-advisory.pin.test.ts‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,27 @@ const SERVE_SOURCE = readFileSync(resolve(HERE, 'serve.ts'), 'utf8');
4949
* reading `src` also means the pin does not depend on anything being built.
5050
*
5151
* ⚠️ Addressed as a repo-relative literal off an escaping `REPO_ROOT` binding
52-
* on purpose — that is the shape the repo's `check:cross-package-test-inputs`
53-
* gate can follow. (Its script is named without a repo-relative path here: that
54-
* gate collects path literals out of a test's source, comments included, and
55-
* would then require a glob for a file this test never reads.) Spellings it cannot follow (a `new URL('…', import.meta.url)`
56-
* seed, or a `resolve()` nested straight into the `readFileSync` call) read
57-
* identically at runtime but produce no binding and therefore no flag, which
52+
* on purpose — that is the shape BOTH halves of the repo's
53+
* `check:cross-package-test-inputs` gate see. (Its script is named without a
54+
* repo-relative path here: that gate collects path literals out of a test's
55+
* source, comments included, and would then require a glob for a file this test
56+
* never reads.)
57+
*
58+
* This note used to say the gate could not follow a `new URL('…',
59+
* import.meta.url)` seed or a `resolve()` nested straight into the
60+
* `readFileSync` call. It follows both, and has since #9763 — both are on its
61+
* published `RECOGNISED_PATH_SPELLINGS` list, printed in its failure text, and
62+
* each is pinned by a `--self-test` case; measured on ceb33a9f12, both produce
63+
* the escape flag. What they miss is the FLAT literal collector, which sees a
64+
* path only when the whole repo-relative string sits inside ONE quoted literal
65+
* starting at a top-level directory: written ascent-relative, this read's name
66+
* would reach the radius roster only through the resolver's reconstruction,
67+
* where the spelling below reaches it through both. So keep the whole path in
68+
* one literal — but for that reason, not because the alternatives are invisible.
69+
*
70+
* The spellings that genuinely produce no flag are the ones the detector cannot
71+
* resolve at all: a template-literal path, a `findUp` walk from `process.cwd()`,
72+
* segments arriving out of a variable or an array. Reaching for one of those
5873
* would leave this read **undeclared**: `@objectstack/cli` would then be absent
5974
* from `turbo ls --affected` for a cluster-only change and its `test` cache
6075
* would not hash this file, so the pin below would sit green through exactly

‎packages/platform-objects/src/managed-api-method-affordance-sweep.test.ts‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,23 @@ import { MANAGED_API_METHOD_UNAFFORDABLE, validateManagedApiMethods } from '@obj
101101
* in front of tsc, `import.meta` becomes an error in a ledger that may only
102102
* shrink. `__dirname` type-checks under the package's own config and is
103103
* defined at runtime by vitest's transform (verified, not assumed).
104-
* - `check:cross-package-test-inputs` recognises exactly two seeds —
105-
* `dirname(fileURLToPath(import.meta.url))` and `__dirname` — when it detects
106-
* statically that a test escapes its package. Deriving the root any other way
107-
* (walking up to `pnpm-workspace.yaml`, resolving from `process.cwd()`) makes
108-
* this file's real radius INVISIBLE to that gate, which then reports the
109-
* declaration below as stale and asks for its removal. Losing it would put
110-
* the sweep back in #7802's blind spot: turbo would cache a green for a diff
111-
* that changed another package's object file. Measured both ways.
104+
* - `check:cross-package-test-inputs` detects an escaping read STATICALLY, by
105+
* resolving the seed expression, and `__dirname` is one of the spellings it
106+
* resolves. Which spellings those are is published rather than restated
107+
* here: `RECOGNISED_PATH_SPELLINGS` in the detector, printed verbatim in its
108+
* failure text and mirrored in AGENTS.md. Read it there — the set has been
109+
* widened twice (#8995, #9763) since this note was first written, and a
110+
* count copied into a comment goes stale silently while the published list
111+
* cannot. Deriving the root a way the detector does NOT resolve (walking up
112+
* to `pnpm-workspace.yaml`, resolving from `process.cwd()`) makes this
113+
* file's real radius INVISIBLE to that gate, which then reports the
114+
* declaration below as stale and asks for its removal — this file is
115+
* platform-objects' only escaping test, so hiding it empties the package.
116+
* Measured on ceb33a9f12 by reseeding from `process.cwd()`: the gate exits 1
117+
* with "@objectstack/platform-objects declares a cross-package input radius,
118+
* but no test in it reads outside the package any more". Acting on that and
119+
* deleting the entry would put the sweep back in #7802's blind spot: turbo
120+
* would cache a green for a diff that changed another package's object file.
112121
*/
113122
const HERE = __dirname;
114123
/** …/packages/platform-objects/src → repo root */

‎packages/plugins/plugin-auth/src/managed-extension-fields.test.ts‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,29 @@ const COVERED_OBJECTS: readonly string[] = [
305305
* only shrink.
306306
* `__dirname` type-checks under the package's own config and is defined at
307307
* runtime by vitest's transform (verified, not assumed).
308-
* - `check:cross-package-test-inputs` recognises exactly two seeds —
309-
* `dirname(fileURLToPath(import.meta.url))` and `__dirname` — when it
310-
* detects statically that a test escapes its package. This file's walk of
311-
* `PACKAGES_DIR` below is the ONLY escaping read the gate can see in
312-
* plugin-auth, so it is what holds the package's declared radius
313-
* (`packages/**\/*.object.ts`) and the matching `turbo.json` inputs.
314-
* Deriving the root any other way — the `findUp` walk from `process.cwd()`
315-
* that `rate-limit-storage-isolation.test.ts` and
316-
* `member-role-canonical.test.ts` use — makes this radius INVISIBLE to that
317-
* gate, which then reports the declaration as stale and asks for its
318-
* removal. Losing it would put this sweep back in #7802's blind spot:
319-
* turbo would replay a cached green for a diff that changed another
320-
* package's object file. Measured both ways.
308+
* - `check:cross-package-test-inputs` detects an escaping read STATICALLY, by
309+
* resolving the seed expression, and `__dirname` is one of the spellings it
310+
* resolves. Which spellings those are is published rather than restated
311+
* here: `RECOGNISED_PATH_SPELLINGS` in the detector, printed in its failure
312+
* text and mirrored in AGENTS.md. Read it there — the set has been widened
313+
* twice (#8995, #9763) since this note was first written, and a count
314+
* copied into a comment goes stale silently while the published list cannot.
315+
* This file's walk of `PACKAGES_DIR` below is what holds the
316+
* `packages/**\/*.object.ts` half of plugin-auth's declared radius and the
317+
* matching `turbo.json` inputs: it is the only escaping read in this package
318+
* that reaches an object file anywhere in the tree. Deriving the root any
319+
* other way — the `findUp` walk from `process.cwd()` that
320+
* `member-role-canonical.test.ts` uses — makes this radius INVISIBLE to
321+
* that gate, and note what that does NOT do any more: since #10161 gave
322+
* plugin-auth a second visible escaping test
323+
* (`rate-limit-storage-isolation.test.ts`, whose roster is the two consumer
324+
* directories, not this glob), the package no longer goes stale-empty, so
325+
* the gate stays GREEN and this glob is simply held by nothing. Measured on
326+
* ceb33a9f12 by reseeding this file from `process.cwd()`: `--list-escapes`
327+
* dropped this file and `--verify` still exited 0. Losing the seed would put
328+
* this sweep back in #7802's blind spot with no gate reporting it: turbo
329+
* would replay a cached green for a diff that changed another package's
330+
* object file.
321331
*/
322332
const HERE = __dirname;
323333
/** …/packages/plugins/plugin-auth/src → repo root */

‎scripts/check-type-check-coverage.mjs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,10 @@ const TEST_DEBT = {
752752
+ '110 -> 109 here (#9694): src/managed-extension-fields.test.ts held the package\'s only '
753753
+ 'TS1470 -- an `import.meta.url` seed in a package that is CJS-typed and therefore forbids '
754754
+ 'the meta-property under module: NodeNext -- and now seeds from `__dirname`, which '
755-
+ 'type-checks here AND is one of the two seeds check:cross-package-test-inputs recognises, so '
755+
+ 'type-checks here AND is a seed spelling check:cross-package-test-inputs resolves -- the '
756+
+ 'current set is that gate\'s published RECOGNISED_PATH_SPELLINGS, printed verbatim in its '
757+
+ 'failure text, and is deliberately not restated as a count here because a count drifts '
758+
+ 'silently (it has been widened twice, #8995 and #9763) -- so '
756759
+ 'that file\'s repo-wide *.object.ts walk stays visible to the gate holding plugin-auth\'s '
757760
+ 'declared input radius. It contributes nothing to this pile any more.',
758761
},

0 commit comments

Comments
 (0)