Skip to content

[finding] A private comment-stripper lives in scripts/, where neither check:comment-mask-adoption nor check:parse-guard can see it #13143

Description

@os-elon

Found while writing scripts/check-widget-option-census.mjs for #12926, whose whole difficulty is separating code from prose. Recording the coverage gap; ⛔ not fixed there, and nothing about the card depends on it.

The gap

Two gates watch this subject, and their populations do not overlap where the finding sits:

gate population subject
check-comment-mask-adoption.mjs ROOT_DIR_WATCH_HINTS = ['packages/**', 'examples/**'] a NEW private comment-stripper
check-parse-guard.mjs scripts/** the three TypeScript PARSER entry points

So a private comment-stripper written under scripts/** is inside check-parse-guard's population but outside its subject, and inside check-comment-mask-adoption's subject but outside its population. Nothing reds.

That is the complement of #12307, which was filed for the strippers OUTSIDE scripts/ and produced the adoption gate with the population above. Its ledger's 14 rows are all under packages/**, which is a true statement about the ledger and not about the tree.

The measurement

On 19763458ff:

$ node scripts/check-comment-mask-adoption.mjs --list
# 14 recorded private comment-strippers (shrink-only)      <- all packages/**

# every scripts/*.mjs that rolls its own comment scan and does NOT
# import the shared mask:
scripts/check-stack-collection-maps.mjs

scripts/check-stack-collection-maps.mjs exports maskLiterals(source) -- a hand-rolled left-to-right scanner covering line comments, block comments, the three string forms and regex literals (it carries its own REGEX_PRECEDER), length-preserving. Its docblock records the incident that produced it: a first draft that stripped rather than masked let one unbalanced paren inside .describe('Screen Flows (ADR-0019)') close the schema literal 14 collections early, and the gate then reported 114 deviations, every one of them its own.

⚠️ Stated precisely, because the two are different claims: this is an ABSENCE OF A WATCHER, not a measured disagreement. maskLiterals was NOT diffed against js-comment-mask's scanner here, and by shape it is in the careful family (scanner-decl with regex tracking) rather than the naive-regex one. What is missing is the thing the adoption gate exists to provide -- somebody noticing the next one.

Why it is worth a row rather than a shrug

The adoption gate's own header states the mechanism: the shared module was landed, some callers were converted by hand, and the population that never moved was found again by hand -- three separate cards for one conversion, and this gate is the part that stops a fourth. A stripper the gate cannot see is exactly a caller that will be found by hand later, and scripts/ is where source-scanning gates are written, so it is the likeliest place for the next one.

Options, none chosen here

  • Widen the adoption gate's population to scripts/** and ledger maskLiterals with a measurement, as the second round did for the other 19 rows. Cheapest, and it puts the row where every other row is.
  • Convert check-stack-collection-maps.mjs onto the shared mask and take the population widening as a follow-up. A conversion is a MEASUREMENT (two of the first three converted were deleting live code, Five comment-mask ledger rows are measured DELETING live code — convert them off their private strippers #12834), so this is not a mechanical edit.
  • Declare scripts/** deliberately out of scope in the adoption gate's header. Explicit is better than the current silence, and it is the option that decays.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions