Skip to content

[finding] check-required-contexts' self-test proves its own WIRING with text a comment can supply — two presence assertions that go green on prose #10877

Description

@claude

Noticed while implementing #10818 (PR to follow on
claude/issue-10818-required-contexts-comment-strip). That card fixed the recognizer whose
comments were read as WIRING — a false red. This is the same file, the same
comment-vs-code family, and the opposite failure direction, so it was filed rather than
ridden along.

What it is

Two places in scripts/check-required-contexts.mjs's --self-test decide "is this thing
wired up?" by looking for text that a comment can also supply. Both are presence
assertions, so the error direction is a silent green.

1. The lint job wiring block, a second /^\s*#/ filter

Immediately after the block #10818 repaired:

constuncommented=(text)=>text.split('\n').filter((l)=>!/^\s*#/.test(l)).join('\n');constlintJob=uncommented(/* …lint.yml sliced by indentation… */);assert(·/·r·un: pnpmcheck:required-contexts\b/.test(lintJob),'wiring: lint.yml\'s `lint` job … must run `pnpm check:required-contexts` — an unwired pin verifies nothing (#4690)',);

Same whole-line-only filter, but here it feeds a presence test. A trailing comment on a
live line — - uses: actions/checkout@v7 # run: pnpm check:required-contexts is below — is
kept by the filter and satisfies the regex. So the assertion that the pin is actually wired
into Lint & Repo Gates can be answered by prose, and the symptom is a green line over an
unwired gate
: exactly the #4690 shape the assertion's own message names.

The step-level if: assertion beside it (!/^\s*if:/m.test(step)) is line-anchored and is
NOT affected.

2. The caller sweep counts a live MENTION, not an invocation

callers.join(',') === PATROL_WORKFLOW classifies a workflow as running the live read when
the flag appears anywhere in its live text. required-set-patrol.yml satisfies that twice —
once through the genuine node scripts/check-required-contexts.mjs --verify-required-set
step, and once through a step that only talks about it:

run: | echo "::error::check-required-contexts --verify-required-set exited ${{ … }} — …"

Delete the genuine invocation and that echo keeps the patrol classified as the standing
caller, so the presence half stays green over a patrol that reads nothing. This is unchanged
by #10818's PR, which kept the recognizer's width deliberately (wide is the safe direction
for the ABSENCE half sharing the same recognizer) — the two halves want opposite error
directions out of one function, and that tension is the actual finding.

Why it was not fixed there

Not mechanical, and not the same defect direction:

  • site 1 slices lint.yml as raw text by indentation and splits steps on - name: , so
    making it comment-proof means giving that block a structural read of the job and its
    steps — a redesign of the block, not a recognizer swap;
  • site 2 needs the two halves separated: a WIDE recognizer for the absence assertions (a
    false red is loud, a false green is a gate that stopped guarding) and a NARROW,
    invocation-adjacency one for the presence assertion (check-shard-attestation.mjs's
    invokesScript(), which would need its hardcoded SCRIPT_BASENAME parameterised). Which
    of those to build, and whether the sibling's helper should be parameterised or extracted,
    is a judgment call — and fix(scripts): guard check-cross-package-test-inputs dispatch, and stop mirroring globToRegExp #10628 already had to undo one mirrored helper in a neighbouring
    file.

Same family as the open #10570 and #10514, and as #10683 / #10794 (both already shipped) — a recognizer
reading prose as code — but a distinct site, and the only one in this family where the
failure is a false GREEN on a required-context gate's own wiring.

Verified against origin/main at 22f6629988.


Generated by Claude Code


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions