Skip to content

[finding] Widening check:comment-mask-adoption to scripts/** costs 11 unmeasured rows and still misses every live scanner there #13274

Description

@os-elon

Part of #13143, and the half its PR (#13269) deliberately does not ride along. #13269 converts the one file;
the watcher this card's parent is actually about is still absent. Everything below is measured on e758630543.

The two misses, and why the cheap route does not work

check-comment-mask-adoption.mjs watches for a NEW private comment-stripper and walks
ROOT_DIR_WATCH_HINTS = ['packages/**', 'examples/**']. check-parse-guard.mjs walks scripts/** for a
different subject — the three TypeScript parser entry points. So a private stripper written under scripts/**
is inside one gate's population and outside its subject, and inside the other's subject and outside its
population. That is the parent card.

Its proposed cheap route was "widen the adoption gate's population to scripts/** and ledger the offender".
Priced, that route does not do what it says, in two independent ways.

1. Widening the POPULATION admits 11 files, not one

Running the gate's own shapesIn() over the 193 sources under scripts/**:

scripts/check-comment-mask-adoption.mjs        [regex-block,regex-line,scanner-decl]
scripts/check-declaration-mirrors.mjs          [scanner-decl]
scripts/check-live-db-isolation.mjs            [regex-block,regex-line]
scripts/check-optional-error-sink-contract.mjs [regex-block,regex-line]
scripts/check-section-landing-index.mjs        [regex-block]
scripts/check-type-check-coverage.mjs          [regex-line]
scripts/check-type-source-resolution.mjs       [regex-line]
scripts/check-undeclared-dep-imports.mjs       [regex-line]
scripts/js-comment-mask.d.mts                  [scanner-decl]
scripts/js-comment-mask.mjs                    [scanner-decl]
scripts/pm/dispatch-gates.mjs                  [regex-line]

At least four are self-references or fabrications rather than private strippers: the adoption gate itself
(its SHAPES regexes and its self-test fixture strings), the shared module js-comment-mask.mjs — which is
that gate's own declared POSITIVE CONTROL — its .d.mts, and a fixture string inside
check-declaration-mirrors.mjs, which already imports the shared mask. A shrink-only ledger acquiring eleven
rows of which several are artefacts is a ledger nobody can re-read, and the ledger's own standard is that a
row is a measurement someone can re-read.

2. It still would not see a single live scanner there — including the one that started this

shapesIn('scripts/check-stack-collection-maps.mjs') returns []. The scanner-decl shape recognises
(strip|mask|remove|without)Comment(s)? and nothing else; that file's scanner was named maskLiterals.
⇒ ledgering it under a widened population fails as a stale row — the gate's shrink-only invariant — on the
very PR that adds it. The route is not executable as written.

Swept independently of that vocabulary (declared name, character-scanner shape, indexOf of a comment
terminator), scripts/** holds four hand-rolled comment scanners that do not import the shared mask:

file scanner shape
scripts/check-stack-collection-maps.mjs maskLiterals careful — converted by #13269
scripts/check-ratchet-remedy-authority.mjs authorFacingMessages careful — inline, regexAllowedAfter
scripts/check-whole-set-label-write.mjs blankComments / blankJsComments careful — opensRegex
scripts/measure-partial-retirement-annotation.mjs extractProse regex-BLIND — treats the // inside a regex literal as a line-comment opener

⚠️ All four exist at 19763458ff, the commit the parent card measured. So "only one" was an artefact of that
card's hand-probe, not drift. Worth keeping straight, because a narrow instrument and a moving tree call for
different follow-ups.

extractProse is the one worth reading first: it is in the naive-// family the adoption gate exists for, in
the FABRICATION direction — it keeps comment text, so a doubled slash inside a regex literal opens a phantom
line comment and hands its measurement prose to match on.

The other axis, priced

Widening the scanner-decl VOCABULARY instead — verbs blank|scrub|elide|extract added, nouns
Literals?|Prose|NonProse|JsComments? added — costs:

  • 0 new rows under today's population (packages/** + examples/**): 5,018 + 205 files walked, nothing
    newly matched.
  • 5 files newly reached under scripts/**, three of them the live scanners above, plus
    check-doc-route-spelling.mjs and check-section-landing-index.mjs.

authorFacingMessages is out of reach of any name-based rule and would need either a shape rule or a row.

What this card is

Do both axes, in one measured pass, the way the SECOND ROUND (#12475) did it: per-row measurement, never a
sweep, each row stating what the private copy does to the population it actually reads. Expect on the order of
a dozen rows, several of which will instead be exemptions — the shared module and its .d.mts cannot be
"private strippers" of the module they are, and the gate's own fixture strings are not callers. Deciding which
of those is a ledger row and which is a structural exemption (the CANONICAL path is already special-cased
once) is the design question this card owes.

⚠️ Note the ordering the prices suggest, offered rather than prescribed: the VOCABULARY widening is free on
today's tree and is the half that would actually have caught the parent card's instance; the POPULATION
widening is the one that costs eleven rows. Doing the population axis alone is measurably not executable.

⛔ The header-note option from the parent card stays refused here too: a sentence declaring scripts/** out of
scope stops being true the first time somebody writes a stripper in it, and this class has already been found
by hand three times.

Generated by Claude Code

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