Repository navigation
tooling(test-source-alias): a type reference or literal text is not a clocked load - #25781
Merged
Merged
Conversation
… clocked load
The clocked-window rule matched `import('x')` anywhere the import regex
could see it, with `typeof` as the only type-position guard. On the merged
ui/ layout that read seven erased or textual sites as clocked loads: an
`import('p').T` alias or annotation inside a test body, and a dynamic form
written as template text in a scanner's own test.
A dynamic match now counts only when its keyword is executed code (plain
code, or a template interpolation), and an `import(...)` whose tail is an
uncalled member chain is a type reference, neither a finding nor a
compliance token. `require(...).member` stays a load.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mj3sUeTnVuFsWPY37TxDmS
Contributor
Author
|
Dispatch seat record. ACCEPTed on card #25766. Generated by Claude Code |
This was referenced Oct 25, 2026
os-tesla
pushed a commit
that referenced
this pull request
Oct 25, 2026
…of non-ui/ members only (decision F, objectstack#25803) Decision F (17f): adopt the function-body half for the objectui tests (warm module-scope imports, card F) and scope the vitest-alias half of the gate to members outside ui/. objectui's tests resolve their workspace deps through the built dist/ by design; at the import 42 ui/ members read as unaliased with no registry entry. inAliasHalf() keeps those members out of the measured registry population and out of the 'tests import ... no source alias' verdict. The scan still measures their specifiers, so the clocked-window rule reads ui/ exactly as before; the ENOTDIR alias-table rules and config readability are unchanged. A registry entry naming a ui/ member is refused as unneeded. The OK line names how many scanned packages were not asked the alias half. Self-test: fixture (1c) and four baseline assertions; dropping the scope reds three of them. Before: exit 1 (42 alias-half + 57 clocked-window findings on the verify tree). After: self-test 0; scan exit 1 on the 57 clocked-window findings only, the accepted class that #25781 and card F clear. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUXv64KLMfYv3ia2sWi6te
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.
Requested by Tesla · project thread
Fixes #25766
Part of #25677 (cutover prep G, the gate half of decision F; the test-file half is #25763).
Clause-②: no
Metadata-protocol: none
What this changes
One file,
scripts/check-test-source-alias.mjs, the clocked-window rule only (moduleLoadSites). The ledger half of the gate (extractRuntimeImports,KNOWN_UNALIASED_TEST_IMPORTS, the vitest alias reading) is untouched.Before this PR the rule counted every
import('x')the import regex could see in the comment-masked text, and its only type-position guard wastypeofin front of the keyword. Two kinds of sites were therefore read as clocked loads although they load nothing:type T = import('p').Tandconst s: import('p').Schema = ...are erased bytsc. The newisImportTypeReferencedecides this from what FOLLOWS the call: a type reference is always qualified (a bareimport('p')in a type position is a compile error) and its member chain is never called. A runtimeimport()is awaited, assigned, passed, or chained into a call (.then(...), a generic.thencall with a type argument,?.then(...)). The head cannot decide it:{ key: import('p') }is an object-literal load behind the same colon an annotation uses. Type arguments after the member are balanced (braces, semicolons and function-type arrows inside them included), so the token after the closing angle bracket tells a type argument list from a generic call. Only theimport(form is read this way;require('p').memberis the ordinary CJS spelling of a runtime load and stays a load. Anything the reader cannot parse reads as a load (the loud direction).codeOnlyprojection, or a template interpolation interior, whichcodeOnlyblanks too, read fromscanSource'sinterpolationarray. That scan runs only when a keyword is not plain code.Both rules skip the site for the module-scope set as well, matching what the header already said for
typeof: an erased site is neither a finding nor a compliance token. A module-toptype T = import('p').Ttherefore no longer pays, on paper, for a real clockedawait import('p')in the same file.Measurements
Merged layout (verify branch
claude/project-thread-dwhq6r-25697-verifyat 9e37acd, this diff applied at the root withgit apply,node scripts/check-test-source-alias.mjs):The 7 that are gone are exactly the card's table:
spec-symbol-4650.test.tsin plugin-calendar :58, plugin-form :50, plugin-grid :73, plugin-kanban :50,dashboard-global-filters-spec-binding.test.ts:102,data-table.test.ts:66,ui/scripts/__tests__/check-spec-range-floors.test.ts:286. The 30 left are #25763's real ones. Noui/file is edited and nothing is added toKNOWN_UNALIASED_TEST_IMPORTSor any allowlist.objectstack main (merge base ab510f4):
pnpm check:test-source-alias: self-test OK, run OK, same green line as before (76 packages scanned, 60 registered, 55 published subpaths).node scripts/check-test-source-alias.mjs --listbefore and after are identical (60 of 76 packages, 295 package-dependency pairs).SEED_CHILD,WORKER_SOURCE,PROBE,DRIVER_CJS, anos startstub), RuleTester-style code strings, and erased type positions (s is import('typescript').Xpredicates,as import('node:crypto').BinaryLikecasts,{ knex: import('knex').Knex }annotations). None of the files is a finding before or after, because none of these specifiers is in its package's measured set.Self-test
New battery
a type reference or literal text is not a load (#25766), 21 cases. The roster floor goes from 10 to 11 batteries.packages/clocked-type-referenceholds an alias and an annotation (type arguments carrying a semicolon) inside a test body, plus a dynamic import as template text, each putting its specifier in the measured set. A module-top alias of@fx/coresits beside a realawait import('@fx/core'). Only the real load may be reported, and it must be reported.moduleLoadSites. 8 erased rows (alias, annotation, generic annotation, qualified chain with array and indexed access, parameter annotation, string, template body,requirein a template body) and a module-topexport typerow. 9 load rows: unawaited assignment, object-literal value, awaited,.then(...), generic.thencall,?.then(...), a load inside a template interpolation, a load right after an erased alias on the same line (the check-test-source-alias loses a bare side-effectimport 'x';whenever any laterimport … from …follows it, so the clocked-window rule reports a file that already applied the fix it prescribes #12555 lesson: erasing one site must not swallow its neighbour), andrequire('p').member.On scratch copies of the gate (repo root pinned, imports pointed at this tree; the unmutated copy shows 12 relocation-only failures, subtracted below), each mutation reds rows of the new battery:
.then(...)and generic.thenrowsrequirerequire('p').memberrowEvery erased row is reached by at least one mutation. The awaited and
?.then(...)load rows are not reached by these seven; they stand guard against a wider erasure rule.Gates
Derived with
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat 85fe6b0 (1 path, +173/-4). Exit codes were captured before any pipe. Every derived command exits 0:node scripts/check-ci-filter-parity.mjs,check-closing-keyword-parity.mjs(+--self-test),check-comment-mask-corpus.mjs,check-declaration-mirrors.mjs(+--self-test),check-position-name-fold-loaders.mjs(+--self-test),check-scripts-symbol-anchors.mjs(+--self-test),check-self-test-wired.mjs(+--self-test),check-self-test-workflow-commands.mjs(+--self-test),check-whole-set-label-write.mjs(+--self-test),scripts/pm/bare-root-worklist.mjs --self-test;pnpm check:agent-test-spelling,check:bash32-floor,check:cli-command-ids,check:cross-package-test-inputs,check:driver-memory-census,check:entry-guard,check:gitlink-declared,check:nul-bytes,check:parse-guard,check:pm-dispatch-gates,check:pnpm-filter-targets,check:pnpm-flag-spellings,check:ratchet-remedy-authority,check:refd-timer-probe,check:test-source-alias,check:watch-hint-literal.Reconciled at 85fe6b0 with
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran ran.list: 33 derived, 33 run, 0 NOT-MEASURED, 0 UNRUN.The first run of six of them exited 3 (PREREQUISITE NOT MET:
yaml,typescript,@typescript-eslint/parsermissing in a fresh worktree). Afterpnpm install --frozen-lockfileall six exit 0. NOT MEASURED locally, left to CI: the two families that take a value from the workflow (check-shard-attestation.mjs --emit,check-test-completeness.mjs) and the Test Core job steps.No changeset: the root package is private and
scripts/**ships in no package'sfiles[]. The PR carriesskip-changeset.Acceptance notes
extractRuntimeImports) still reads type references and string or template text as runtime imports. That is why such specifiers keep entering a package's measured set (all 7 merged-layout sites were in it). It belongs to the vitest-alias half that the cutover adaptation commit owns. No finding is wrong because of it after this PR, since the clocked rule no longer reports those sites.Generated by Claude Code