Skip to content

Pin check-test-source-alias's codeOnly projection with a literal-brace fixture - #17413

Merged
baozhoutao merged 1 commit into
mainfrom
claude/issue-16299-code-only-projection-pin
Sep 10, 2026
Merged

baozhoutao merged 1 commit into
mainfrom
claude/issue-16299-code-only-projection-pin

Conversation

@baozhoutao

Copy link
Copy Markdown
Collaborator

Fixes #16299

Clause-②: no

What

Adds fixture (26) to check-test-source-alias.mjs's --self-test: a dynamic
import('@fx/core') inside an it() callback, preceded by a template
literal whose interior contains a stray ` }` character. This pins the
codeOnly half of maskedProjections — the projection functionBodyRanges
reads to decide module-scope vs CLOCKED — which #16299 measured as pinned by
nothing.

Why this shape: functionBodyRanges walks codeOnly character by character,
pushing a frame on every { and popping (closing a range) on every }. Under
correct masking, maskCommentsAndLiterals blanks the template's interior
(delimiters survive, content does not), so the stray } never reaches the
scanner and the callback's real closing brace is what pairs with its real
opener — the import lands inside [open, close] and is reported CLOCKED.
Under an under-masking codeOnly (either ablation below), the literal }
is read as real code: it pops the callback's frame early, right there inside
the template, before the dynamic import two lines down. The range this
scanner records is [open, thatEarlyClose], the import falls outside it, and
the violation goes silently unreported — the same "silent exemption" failure
mode fixture (25) already pins for the brace scanner's backward walk, but for
the forward brace-count instead.

Two assertions added to the existing "the clocked-window rule (#10126)"
battery (floor raised 10 → 12 per #13799): the fixture's one CLOCKED finding
is reported, at the correct line, naming the correct specifier.

Ablation proof (temporary, not committed)

Both directions #16299 named, applied to scripts/js-comment-mask.mjs's
maskCommentsAndLiterals, then reverted:

ablation --self-test before revert
flags[k] = comment[k] (degrades to maskComments) RED — a \}` inside a template literal closed the real function body early — the dynamic import went unreported`
return source (identity — blanks nothing) RED — same failure

After each ablation: git checkout HEAD -- scripts/js-comment-mask.mjs,
confirmed via git status --short / git diff --stat (both empty) and
git hash-object scripts/js-comment-mask.mjs matching the pre-ablation
HEAD blob hash (7956343dd85bdef8924372cb2cdec45fcd54501d) both times.

Un-ablated, after revert: node scripts/check-test-source-alias.mjs --self-test → check-test-source-alias --self-test OK (exit 0), and the
plain run's output is byte-identical to the pre-change baseline
(check-test-source-alias OK — 73 packages with tests scanned; 61 registered as still resolving a workspace dep through \dist/`; 49 published
subpath(s) resolved through every alias table.`) — the reverse control: the
new fixture is green un-ablated, red under both ablations.

scripts/js-comment-mask.mjs was never committed to — it is a shared file
and #16299 states it is only touched by the ablation, which is reverted.

Scope

Only scripts/check-test-source-alias.mjs changed (fixture + 2 assertions +
floor bump). No change to scripts/js-comment-mask.mjs (shared, out of
scope). Not re-proving #15776's conversion — that proof (6,204 files /
107,177,732 chars byte-for-byte, with a 6,174-file-distinguishing control)
already lives in that PR's body; this card supplies the pin this gate itself
lacked.

Changeset

skip-changeset: scripts/check-test-source-alias.mjs is a root dev/tooling
script — it is not part of any published package's files[] (root package
@objectstack/spec-monorepo is "private": true; grep -rl for the file
across every packages/*/package.json files entry returns nothing), so
nothing published moves. Label applied to the PR.

Local verification

  • node scripts/check-test-source-alias.mjs --self-test and the plain run:
    both green, both before and after the ablation-and-revert cycle.
  • scripts/pm/dispatch-gates.mjs --commands derived 32 commands for this
    diff (1 changed path, scripts/check-test-source-alias.mjs); run directly
    (not through turbo — none is a package build/test), all green so far
    (pnpm check:pm-dispatch-gates still running per its own documented
    detach-and-poll guidance for this container).
  • No workspace package closure (①): the changed file is a root scripts/
    script, not part of any package. pnpm turbo ls --affected reports the
    full 80-package list for this diff, which is turbo's documented blind
    spot for root-level, non-package changes (AGENTS.md: "仓根包不在 turbo ls
    里,根级套件整个在图外") rather than a real per-package signal, so ② is
    also N/A — no package's own test/typecheck is implicated.

Generated by Claude Code

…e fixture

Add a --self-test fixture whose module-scope-vs-CLOCKED verdict hinges on a
`}` inside a template literal -- the exact content maskCommentsAndLiterals
exists to blank. Under correct masking the dynamic import is reported
CLOCKED; under an under-masking codeOnly the stray `}` closes the real
function body early and the violation goes silently unreported.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GKcPZbMoGq7WPzKLfRBTU
@baozhoutao baozhoutao added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 10, 2026 — with Claude
@baozhoutao
baozhoutao marked this pull request as ready for review September 10, 2026 12:45
@baozhoutao
baozhoutao added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 00ac1c8 Sep 10, 2026
36 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-16299-code-only-projection-pin branch September 10, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[finding] check-test-source-alias's codeOnly projection is pinned by nothing — the gate reads identical under a mask that blanks nothing at all

2 participants