Skip to content

finding(test-infra): check-vi-mock-inherit's anti-exemption pin reddens on its own header PROSE — naming a swept test file in the docblock matches its exemption-array pattern #8117

Description

@claude

Surfaced while sweeping @object-ui/plugin-form for #6892 (slice 5, PR #8116). Filed unassigned, deliberately not fixed there — changing this pin's assertion is a change to a gate's own test, not part of a specifier sweep.

What was measured

scripts/__tests__/check-vi-mock-inherit.test.ts carries the assertion that keeps the exemption swamp out:

there is NO per-file exception list anywhere in the gate

It implements that by reading the whole of scripts/check-vi-mock-inherit.mjs as text and asserting it does not match

/\.test\.tsx?['"`]\s*[,\]]/

i.e. "a quoted string ending in .test.ts or .test.tsx, followed by a comma or a closing bracket" — the shape a hand-written array of exempt file paths would have.

The character class includes the backtick, and the file it scans is a gate whose header docblock is, by design, the ledger every slice of #6892 writes its sweep into. Naming a converted test file the way that docblock names everything else —

 * `ObjectView.expandFls-7429.test.tsx`, landed by objectui#7429

— matches the pattern exactly. The pin goes red on prose, with a diff that shows the entire 900-line source as the "received" value and no indication of which line did it.

Measured on PR #8116: the pin passed at 69 of 69, then a one-sentence header record naming a swept file reddened it. Rewriting the comma as an em dash made it green again, with no change to the gate's behaviour, no change to the assertion, and no change to what the assertion is actually about.

Why it is worth a card rather than a shrug

  1. It fires on exactly the sentence the process asks for. The widening precondition is "sweep, then record the sweep in the header". Recording a sweep means naming test files. Every remaining slice of finding(test-infra): 298 more vi.mock factories freeze a workspace package's export surface — the per-specifier sweep worklist #6892@object-ui/components at 27, @object-ui/plugin-grid at 25, @object-ui/app-shell at 23, @object-ui/permissions at 23 — will be writing that kind of sentence into that file.
  2. The failure is unreadable. The assertion is not.toMatch, so the report prints the whole scanned source as "received" and never says where the match was. Locating it needs a separate grep -nP with the pattern copied out of the test by hand.
  3. The direction of the risk is the bad one. A pin that reddens on innocent prose gets weakened by the next person it annoys — which is the same failure mode the gate's own header warns about for exemption tables.

Not a proposal, but the shape of the repair is small

The assertion wants to see code, not comments. The gate already exports the masking helper it uses for exactly this distinction (deJsxClosingTags plus the shared js-comment-mask), and the gate's own scanner blanks comments before it judges anything. Running the pin's regular expression over the comment-blanked source would keep every bit of its teeth against a real exemption array while making the header docblock unreachable. An alternative — asserting on the module's exports rather than its text — is a larger change and probably a worse one, since the point is to catch a literal array someone adds.

Either way this is a decision about a gate's test, so it is filed rather than folded into a sweep.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions