Commit c109edb
fix(scripts): read the fatal-guard adoption check's source as CODE, and assert the guard is CALLED (#10598)
`checkGuardAdoption()` decided both of its questions by regex over the RAW
gate source, comments included. Both guarded gates name
`scripts/eslint-fatal-guard.mjs` in their own docblocks, so the import test
was satisfied by PROSE.
Measured on this tree: deleting check-slot-lookup-ratchet.mjs's real
`import { lintFilesStrict } …` line and leaving its line-27 docblock exactly
as it was gave
ON-DISK: real import lines=0 ; docblock mentions=1
$ node scripts/check-query-options-erasure-ratchet.mjs --self-test
✓ self-test: … both gates still routed through it.
exit=0
— green, with the printed sentence false, on the one check whose whole job is
noticing that a gate went quiet.
Two holes, both closed here:
1. The source is now read through `stripComments()` from
scripts/js-comment-mask.mjs (#9367's ONE answer to "comment or code").
`stripComments` rather than `maskComments` because this check reports
gate NAMES, never a line or an offset.
2. "A guard imported once is not a guard still called" is the docblock's own
thesis and nothing asserted it. `lintFilesStrict(` must now actually be
called; the pre-existing `.lintFiles(` test cannot cover that gap, since a
gate that stopped calling anything has no direct call left to catch.
The per-gate verdict moves into a pure `guardAdoptionProblems(gate, source)`
so the self-test can drive it over synthetic sources in BOTH directions: the
live-tree assertion can only ever confirm the direction this tree is already
in, and both gates are adopted today. Six fixtures, one of them a positive
control that must come back clean.
Both call shapes in those fixtures are spelled with a `+` on purpose:
`checkGuardAdoption()` reads that file, `stripComments` deliberately keeps
string literals, and a contiguous `lintFilesStrict(` or `.lintFiles(` in a
fixture would be a decoy in the gate's own source — the same hole one layer
up. A case LABEL carrying the raw call shape reddened the gate once while this
was being written, which is why the labels avoid it too.
Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
Co-authored-by: Claude <noreply@anthropic.com>1 parent 71a0198 commit c109edb
2 files changed
Lines changed: 145 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
| |||
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
273 | 331 | | |
274 | 332 | | |
275 | 333 | | |
| |||
456 | 514 | | |
457 | 515 | | |
458 | 516 | | |
459 | | - | |
460 | | - | |
461 | | - | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
462 | 531 | | |
463 | 532 | | |
464 | 533 | | |
| |||
544 | 613 | | |
545 | 614 | | |
546 | 615 | | |
547 | | - | |
| 616 | + | |
| 617 | + | |
548 | 618 | | |
549 | 619 | | |
550 | 620 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
74 | 94 | | |
75 | 95 | | |
76 | 96 | | |
77 | 97 | | |
| 98 | + | |
| 99 | + | |
78 | 100 | | |
79 | 101 | | |
80 | 102 | | |
| |||
197 | 219 | | |
198 | 220 | | |
199 | 221 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
212 | 270 | | |
213 | 271 | | |
214 | 272 | | |
0 commit comments