Skip to content

Commit 8fb5d51

Browse files
feat(devx): re-derive the comment-mask corpus sweep as a script, and gate on it (#10670)
* feat(scripts): add the comment-mask corpus sweep (#10640) * feat(scripts): wire the comment-mask corpus sweep and correct the header's instrument ordering (#10640) * docs(scripts): correct the shebang count now that the sweep is in its own corpus (#10640) --------- Co-authored-by: claude[bot] <jack@objectstack.ai>
1 parent dd8172e commit 8fb5d51

3 files changed

Lines changed: 554 additions & 5 deletions

File tree

‎.github/workflows/lint.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,45 @@ jobs:
236236
- name: scripts/ TypeScript parses go through one module
237237
run: pnpm check:parse-guard
238238

239+
# The comment-mask CORPUS sweep (#10640) — the other instrument for the
240+
# module the two gates above delegate "is this span a comment, or code?"
241+
# to. `js-comment-mask.mjs --self-test` pins the SHAPES someone wrote
242+
# down; this parses every .{ts,tsx,mts,cts,js,mjs,cjs,jsx} file in the
243+
# tree with @typescript-eslint/parser and diffs its comment ranges
244+
# against the mask's, byte for byte. Neither subsumes the other, and that
245+
# is measured in both directions on this tree rather than assumed:
246+
# deleting the `{` counting inside `${...}` fails a pinned case and the
247+
# sweep reads 0 disagreements over 4,741 files (the tree does not write
248+
# that shape), while dropping `return` from REGEX_AFTER_KEYWORD passes all
249+
# 23 pinned cases and the sweep names check-test-source-alias.mjs, where
250+
# `return /(^|[^a-z])dist\//` is written today.
251+
# The defect this would have caught shipped: 16 files disagreeing, 15 of
252+
# them reading commented-out text as live code, 10,252 comment bytes in
253+
# one file — and the instrument that found it lived in an agent's
254+
# scratchpad, which is why re-deriving it was impossible until this file.
255+
# WHY A HARD GATE ON EVERY PR, and not an on-demand flag: the sweep's
256+
# verdict depends on the CORPUS as much as on the masker, so a PR that
257+
# writes a shape the mask reads wrong turns ~20 source-scanning gates
258+
# into liars on that file, on a PR that never touched the masker. That
259+
# arrival is not detectable by any convention a human or an agent has to
260+
# remember at the right moment — the failure mode this repo has already
261+
# paid for at #4690 and again here.
262+
# WHY A STEP AND NOT A JOB: a new job's `name:` is a required-context
263+
# contract (scripts/check-required-contexts.mjs) that only a
264+
# maintainer-present Settings change can enrol, and an unenrolled job is
265+
# an advisory gate — #5617 verbatim. This job is already required.
266+
# Invoked as `node` rather than `pnpm check:*` for the same reason as the
267+
# other `node scripts/…` steps in this lane: that alias is a line in root
268+
# package.json, inside the @changesets/cli v3 fence (#9465).
269+
# Runs its own comparator self-test first — 12 cases proving the
270+
# comparison can still REPORT, because "0 files disagree" and "the
271+
# comparison is broken" otherwise print the same line.
272+
# Cost, measured on a contended 4-vCPU container: 4,741 files, 72 MB of
273+
# source, 45–48 s, of which the parser is 45 s. The step prints CI's own
274+
# number on every run.
275+
- name: Comment mask agrees with a real parser over the whole corpus
276+
run: node scripts/check-comment-mask-corpus.mjs
277+
239278
# Stack-collection enumerations vs the schema (#6242). `stack.zod.ts`
240279
# decides which collections a stack may declare; eight other enumerations
241280
# of that same set are hand-maintained (the map-format list, the

0 commit comments

Comments
 (0)