paperlint 20.1.1 → 20.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +7 -0
  3. package/CLAUDE.md +2 -2
  4. package/CONTRIBUTING.md +2 -2
  5. package/{action.harness.mjs → action.test.mjs} +147 -138
  6. package/dist/eslint-rules/papers.js +1 -1
  7. package/dist/latex-log.d.ts +1 -1
  8. package/dist/latex-log.js +1 -1
  9. package/dist/latex-loop.d.ts +1 -1
  10. package/dist/latex-loop.js +1 -1
  11. package/dist/lib/paper-config.d.ts +3 -3
  12. package/dist/lib/paper-config.js +3 -3
  13. package/docs/e2e.md +9 -9
  14. package/docs/testing.md +3 -4
  15. package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
  16. package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
  17. package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
  18. package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
  19. package/eslint-rules/papers.ts +1 -1
  20. package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
  21. package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
  22. package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
  23. package/eslint.config.mjs +15 -2
  24. package/fixtures/pdf-facts/README.md +1 -1
  25. package/fixtures/render-paper/build-clean.sh +1 -1
  26. package/fixtures/toolchain-mirror/install-tl +1 -1
  27. package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
  28. package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
  29. package/lib/paper-config.ts +3 -3
  30. package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
  31. package/package.json +3 -3
  32. package/presets/acm-acmsmall.jsonc +1 -1
  33. package/scripts/check-workflow.test.ts +368 -0
  34. package/scripts/check.ts +2 -2
  35. package/scripts/eslint-file-length.mjs +9 -9
  36. package/scripts/eslint-report-guard.mjs +1 -1
  37. package/scripts/eslint-report-guard.test.mjs +1 -1
  38. package/scripts/harness-api.test.ts +7 -46
  39. package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
  40. package/scripts/rules-see-files.mjs +1 -1
  41. package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
  42. package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
  43. package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
  44. package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
  45. package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
  46. package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
  47. package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
  48. package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
  49. package/src/adapters/pdfjs/fill.test.ts +1 -1
  50. package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
  51. package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
  52. package/src/{cli.harness.mjs → cli-e2e.test.mjs} +108 -102
  53. package/src/cli.test.ts +1 -1
  54. package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
  55. package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
  56. package/src/facts-file.test.ts +1 -1
  57. package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
  58. package/src/latex-log.test.ts +395 -0
  59. package/src/latex-log.ts +1 -1
  60. package/src/latex-loop.test.ts +553 -0
  61. package/src/latex-loop.ts +1 -1
  62. package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
  63. package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
  64. package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
  65. package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
  66. package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
  67. package/src/{structure.harness.ts → structure.test.ts} +12 -10
  68. package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
  69. package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
  70. package/scripts/check.harness.ts +0 -343
  71. package/scripts/harness-api.frozen.json +0 -41
  72. package/src/latex-log.harness.ts +0 -382
  73. package/src/latex-loop.harness.ts +0 -515
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Colocated test for `eslint-rules/tex-build.mjs` (`tex/future-promise`).
3
- * Run: `npx vigiles test eslint-rules/tex-build.harness.mjs`
4
3
  *
5
4
  * FIVE PARTS, AND THE ORDER IS LOAD-BEARING:
6
5
  * I. FIXTURES ON DISK — `fixtures/tex-build/clean.tex` must be silent, `defect.tex` must
@@ -50,11 +49,11 @@
50
49
  * is what the corpus actually looks like today"; they reproduce the mechanism only. The
51
50
  * measurements from those runs are kept in the comments, the papers are not.
52
51
  *
53
- * 🔴 Assertions live at MODULE TOP LEVEL: `vigiles test` imports the file and treats "it did
54
- * not throw" as success; an exported `tests` object is run by nothing.
52
+ * The parts are `it` blocks in file order: each one runs, and fails, on its own.
55
53
  */
56
54
  import { ESLint } from "eslint";
57
55
  import assert from "node:assert/strict";
56
+ import { afterAll, it, vi } from "vitest";
58
57
  import {
59
58
  existsSync,
60
59
  mkdirSync,
@@ -69,24 +68,29 @@ import { dirname, join, relative } from "node:path";
69
68
  import { fileURLToPath } from "node:url";
70
69
 
71
70
  const HERE = dirname(fileURLToPath(import.meta.url));
71
+ // A test here lints the whole repository: ~72 s alone, up to 224 s beside the rest of the suite
72
+ // under coverage on 4 cores (measured 2026-11-24), so the limit only catches a hang.
73
+ vi.setConfig({ testTimeout: 600_000 });
72
74
  const ROOT = join(HERE, ".."); // eslint-rules → repository root
73
75
  const RULES = join(HERE, "tex-build.ts");
74
- assert.ok(existsSync(RULES), `no entry point for the test: ${RULES}`);
75
76
 
76
77
  const TMP = realpathSync(mkdtempSync(join(tmpdir(), "tex-build-")));
77
- // Cleanup is registered IMMEDIATELY, not at the end of the file: assertions throw, and an
78
- // `rmSync` at the bottom never runs in exactly the runs that are red.
79
- process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
78
+ afterAll(() => {
79
+ rmSync(TMP, { recursive: true, force: true });
80
+ });
80
81
 
81
82
  const { texLanguage } = await import(join(HERE, "latex-language.ts"));
82
83
  const texBuild = (await import(RULES)).default;
83
84
 
84
85
  // A new rule with no declared severity must not slip through unnoticed.
85
- assert.deepEqual(
86
- Object.keys(texBuild).sort(),
87
- ["acm-frontmatter-override", "future-promise"],
88
- "the module's rule set changed — update the config and this harness",
89
- );
86
+ it("the module's rule set is the one the config declares", () => {
87
+ assert.ok(existsSync(RULES), `no entry point for the test: ${RULES}`);
88
+ assert.deepEqual(
89
+ Object.keys(texBuild).sort(),
90
+ ["acm-frontmatter-override", "future-promise"],
91
+ "the module's rule set changed — update the config and this test",
92
+ );
93
+ });
90
94
 
91
95
  const makeEslint = (cwd) =>
92
96
  new ESLint({
@@ -158,92 +162,96 @@ const CLEAN_FIXTURE = join(ROOT, "fixtures/tex-build/clean.tex");
158
162
  const DEFECT_FIXTURE = join(ROOT, "fixtures/tex-build/defect.tex");
159
163
  const real = new ESLint({ cwd: ROOT });
160
164
 
161
- for (const f of [CLEAN_FIXTURE, DEFECT_FIXTURE])
162
- assert.ok(existsSync(f), `missing fixture: ${f}`);
163
-
164
- assert.deepEqual(
165
- await lintTex(real, CLEAN_FIXTURE),
166
- [],
167
- "fixtures/tex-build/clean.tex produced findings — a check that fails a correct input gets " +
168
- "switched off the same day",
169
- );
170
-
171
- // 🔴 AND THE REASON FOR THAT ZERO IS CHECKED SEPARATELY. "Zero because the build is clean" and
172
- // "zero because the build is exempt as review mode" are indistinguishable from the outside; the
173
- // only thing telling them apart is that the exemption sign is genuinely absent from the file.
174
- // Without this assertion, someone editing the fixture into a review build would turn the quiet
175
- // half into a tautology and nothing would notice.
176
- assert.doesNotMatch(
177
- readFileSync(CLEAN_FIXTURE, "utf8"),
178
- /^[^%\n]*(?:\\documentclass\[[^\]]*\breview\b|printacmref=false)/m,
179
- "fixtures/tex-build/clean.tex became a review build — its zero stopped meaning `the rule ran " +
180
- "and found nothing` and started meaning `the rule was exempt`",
181
- );
182
-
183
- // The frozen finding set of the defect fixture: not "some findings", but exactly these two,
184
- // at these addresses, with these captured substrings.
185
- assert.deepEqual(
186
- await lintTex(real, DEFECT_FIXTURE),
187
- [
188
- {
189
- rule: "tex/future-promise",
190
- line: 15,
191
- column: 59,
192
- text: "at camera-ready",
193
- },
194
- {
195
- rule: "tex/future-promise",
196
- line: 22,
197
- column: 52,
198
- text: "will be made publicly available",
199
- },
200
- ],
201
- "fixtures/tex-build/defect.tex: the finding set drifted from the frozen measurement",
202
- );
165
+ it("I. FIXTURES ON DISK, THROUGH THE REPOSITORY'S OWN CONFIG", async () => {
166
+ for (const f of [CLEAN_FIXTURE, DEFECT_FIXTURE])
167
+ assert.ok(existsSync(f), `missing fixture: ${f}`);
168
+
169
+ assert.deepEqual(
170
+ await lintTex(real, CLEAN_FIXTURE),
171
+ [],
172
+ "fixtures/tex-build/clean.tex produced findings — a check that fails a correct input gets " +
173
+ "switched off the same day",
174
+ );
175
+
176
+ // 🔴 AND THE REASON FOR THAT ZERO IS CHECKED SEPARATELY. "Zero because the build is clean" and
177
+ // "zero because the build is exempt as review mode" are indistinguishable from the outside; the
178
+ // only thing telling them apart is that the exemption sign is genuinely absent from the file.
179
+ // Without this assertion, someone editing the fixture into a review build would turn the quiet
180
+ // half into a tautology and nothing would notice.
181
+ assert.doesNotMatch(
182
+ readFileSync(CLEAN_FIXTURE, "utf8"),
183
+ /^[^%\n]*(?:\\documentclass\[[^\]]*\breview\b|printacmref=false)/m,
184
+ "fixtures/tex-build/clean.tex became a review build — its zero stopped meaning `the rule ran " +
185
+ "and found nothing` and started meaning `the rule was exempt`",
186
+ );
187
+
188
+ // The frozen finding set of the defect fixture: not "some findings", but exactly these two,
189
+ // at these addresses, with these captured substrings.
190
+ assert.deepEqual(
191
+ await lintTex(real, DEFECT_FIXTURE),
192
+ [
193
+ {
194
+ rule: "tex/future-promise",
195
+ line: 15,
196
+ column: 59,
197
+ text: "at camera-ready",
198
+ },
199
+ {
200
+ rule: "tex/future-promise",
201
+ line: 22,
202
+ column: 52,
203
+ text: "will be made publicly available",
204
+ },
205
+ ],
206
+ "fixtures/tex-build/defect.tex: the finding set drifted from the frozen measurement",
207
+ );
208
+ });
203
209
 
204
210
  // ═════════════════════════════════════════════════════════════════════════════
205
211
  // II. QUIET ON A CORRECT INPUT — each reason for the silence on its own
206
212
  // ═════════════════════════════════════════════════════════════════════════════
207
- assert.deepEqual(
208
- await findings("clean-build", build("We measured how often a rule fails.")),
209
- [],
210
- "a build with no promises must be silent",
211
- );
212
-
213
- // A promise made DURING PEER REVIEW is true and ordinary. This is not leniency, it is the
214
- // subject: the defect is only a promise that outlived its own delivery.
215
- for (const [label, cls] of [
216
- ["review option", "\\documentclass[sigconf,review]{acmart}"],
217
- [
218
- "printacmref=false",
219
- "\\documentclass[sigconf]{acmart}\n\\settopmatter{printacmref=false}",
220
- ],
221
- ])
213
+ it("II. QUIET ON A CORRECT INPUT, each reason for the silence on its own", async () => {
214
+ assert.deepEqual(
215
+ await findings("clean-build", build("We measured how often a rule fails.")),
216
+ [],
217
+ "a build with no promises must be silent",
218
+ );
219
+
220
+ // A promise made DURING PEER REVIEW is true and ordinary. This is not leniency, it is the
221
+ // subject: the defect is only a promise that outlived its own delivery.
222
+ for (const [label, cls] of [
223
+ ["review option", "\\documentclass[sigconf,review]{acmart}"],
224
+ [
225
+ "printacmref=false",
226
+ "\\documentclass[sigconf]{acmart}\n\\settopmatter{printacmref=false}",
227
+ ],
228
+ ])
229
+ assert.deepEqual(
230
+ await findings(
231
+ `review-${label}`,
232
+ build("The harness ships at camera-ready.", { cls }),
233
+ ),
234
+ [],
235
+ `${label}: a review build must be exempt`,
236
+ );
237
+
238
+ // 🔴 A LaTeX COMMENT IS A LEGITIMATE PLACE FOR THESE WORDS. Author notes of the form
239
+ // `% camera-ready blocker` live in real sources, and a finding on them would be exactly the
240
+ // false positive that kills a check.
222
241
  assert.deepEqual(
223
242
  await findings(
224
- `review-${label}`,
225
- build("The harness ships at camera-ready.", { cls }),
243
+ "promise-in-comment",
244
+ build("% blocker: the harness ships at camera-ready."),
226
245
  ),
227
246
  [],
228
- `${label}: a review build must be exempt`,
247
+ "a promise inside a LaTeX comment is not a finding",
229
248
  );
230
-
231
- // 🔴 A LaTeX COMMENT IS A LEGITIMATE PLACE FOR THESE WORDS. Author notes of the form
232
- // `% camera-ready blocker` live in real sources, and a finding on them would be exactly the
233
- // false positive that kills a check.
234
- assert.deepEqual(
235
- await findings(
236
- "promise-in-comment",
237
- build("% blocker: the harness ships at camera-ready."),
238
- ),
239
- [],
240
- "a promise inside a LaTeX comment is not a finding",
241
- );
249
+ });
242
250
 
243
251
  // ═════════════════════════════════════════════════════════════════════════════
244
252
  // III. FIRES ON A PLANTED DEFECT
245
253
  // ═════════════════════════════════════════════════════════════════════════════
246
- {
254
+ it("III. FIRES ON A PLANTED DEFECT: the defect printed in an accepted camera-ready", async () => {
247
255
  // THE defect: the line printed in an accepted camera-ready on 2026-08-24 in both of the most
248
256
  // read positions, while the Availability paragraph three lines below said the opposite.
249
257
  const ms = await findings(
@@ -265,40 +273,42 @@ assert.deepEqual(
265
273
  "We report the finding (full harness ".length + 1,
266
274
  "the column must point at the start of the match",
267
275
  );
268
- }
276
+ });
269
277
 
270
278
  // Every branch of the promise vocabulary gets its own input. Without that, "a vocabulary of six
271
279
  // forms" is a claim verified by one of the six.
272
- for (const [sentence, want] of [
273
- ["The harness ships at camera-ready.", "at camera-ready"],
274
- ["The harness ships at the camera ready stage.", "at the camera ready"],
275
- ["Upon acceptance we open the repository.", "Upon acceptance"],
276
- ["On acceptance we open the repository.", "On acceptance"],
277
- ["The harness will be released later.", "will be released"],
278
- ["The harness will be published later.", "will be published"],
279
- [
280
- "The data will be made publicly available.",
281
- "will be made publicly available",
282
- ],
283
- ["The data will be made available.", "will be made available"],
284
- ["The harness will be public.", "will be public"],
285
- ["The harness will be open-sourced.", "will be open-sourced"],
286
- ]) {
287
- const ms = await findings(`vocab-${want}`, build(sentence));
288
- assert.equal(
289
- ms.length,
290
- 1,
291
- `vocabulary branch «${want}» did not fire on «${sentence}»`,
292
- );
293
- assert.equal(
294
- ms[0].text,
295
- want,
296
- `vocabulary branch «${want}» caught the wrong substring`,
297
- );
298
- }
280
+ it("III. every branch of the promise vocabulary fires", async () => {
281
+ for (const [sentence, want] of [
282
+ ["The harness ships at camera-ready.", "at camera-ready"],
283
+ ["The harness ships at the camera ready stage.", "at the camera ready"],
284
+ ["Upon acceptance we open the repository.", "Upon acceptance"],
285
+ ["On acceptance we open the repository.", "On acceptance"],
286
+ ["The harness will be released later.", "will be released"],
287
+ ["The harness will be published later.", "will be published"],
288
+ [
289
+ "The data will be made publicly available.",
290
+ "will be made publicly available",
291
+ ],
292
+ ["The data will be made available.", "will be made available"],
293
+ ["The harness will be public.", "will be public"],
294
+ ["The harness will be open-sourced.", "will be open-sourced"],
295
+ ]) {
296
+ const ms = await findings(`vocab-${want}`, build(sentence));
297
+ assert.equal(
298
+ ms.length,
299
+ 1,
300
+ `vocabulary branch «${want}» did not fire on «${sentence}»`,
301
+ );
302
+ assert.equal(
303
+ ms[0].text,
304
+ want,
305
+ `vocabulary branch «${want}» caught the wrong substring`,
306
+ );
307
+ }
308
+ });
299
309
 
300
310
  // Two promises on different lines do not collapse into one (the rule reports EVERY place).
301
- {
311
+ it("IV. two promises on different lines do not collapse into one", async () => {
302
312
  const ms = await findings(
303
313
  "two-lines",
304
314
  build(
@@ -310,7 +320,7 @@ for (const [sentence, want] of [
310
320
  ["4:Upon acceptance", "5:will be made publicly available"],
311
321
  "two promises on different lines must give two findings with their own addresses",
312
322
  );
313
- }
323
+ });
314
324
 
315
325
  // ═════════════════════════════════════════════════════════════════════════════
316
326
  // IV. PROPERTIES NOBODY "SEES", WITHOUT WHICH THE RULE LIES
@@ -323,7 +333,7 @@ for (const [sentence, want] of [
323
333
  // ⚠️ The live half of this assertion (reading the real paper) did not come along with the
324
334
  // extraction — the paper is private. What is left is the synthetic half, which pins the
325
335
  // mechanism but no longer proves the case still occurs in the wild.
326
- {
336
+ it("IV. a commented-out review class does not make a build a review build", async () => {
327
337
  const ms = await findings(
328
338
  "commented-out-review-class",
329
339
  build("The harness ships at camera-ready.", {
@@ -335,11 +345,11 @@ for (const [sentence, want] of [
335
345
  1,
336
346
  "a commented-out review class exempted the build — the `^[^%\\n]*` anchor was lost",
337
347
  );
338
- }
348
+ });
339
349
 
340
350
  // An escaped `\%` is NOT a comment: a line where a percent sign precedes a promise must still
341
351
  // be checked in full.
342
- {
352
+ it("IV. an escaped percent is not a comment", async () => {
343
353
  const ms = await findings(
344
354
  "escaped-percent",
345
355
  build("We cover 95\\% of cases and the harness will be published later."),
@@ -350,11 +360,11 @@ for (const [sentence, want] of [
350
360
  "`\\%` ate the rest of the line — the promise behind it went invisible",
351
361
  );
352
362
  assert.equal(ms[0].text, "will be published");
353
- }
363
+ });
354
364
 
355
365
  // No file on disk (a run through stdin): the rule stays quiet rather than judging content it
356
366
  // never saw.
357
- {
367
+ it("IV. no file on disk: the rule stays quiet", async () => {
358
368
  const [res] = await makeEslint(TMP).lintText(
359
369
  build("The harness ships at camera-ready."),
360
370
  { filePath: join(TMP, "no-such-dir", "paper.tex") },
@@ -370,12 +380,12 @@ for (const [sentence, want] of [
370
380
  "the rule reads the file FROM DISK (the preamble is blanked in the projection), and on a " +
371
381
  "path with no file it must stay quiet rather than judge",
372
382
  );
373
- }
383
+ });
374
384
 
375
385
  // ═════════════════════════════════════════════════════════════════════════════
376
386
  // V. CONFIG — the rule is on, at the measured severity, over a NON-EMPTY glob
377
387
  // ═════════════════════════════════════════════════════════════════════════════
378
- {
388
+ it("V. CONFIG: the rule is on, at the measured severity, over a non-empty glob", async () => {
379
389
  const config = (await import(join(ROOT, "eslint.config.mjs"))).default;
380
390
  const tex = config.find((b) => b.rules?.["tex/future-promise"]);
381
391
  assert.ok(
@@ -411,7 +421,7 @@ for (const [sentence, want] of [
411
421
  "invoked, and this run's zero findings mean nothing. Files linted: " +
412
422
  seen.join(", "),
413
423
  );
414
- }
424
+ });
415
425
 
416
426
  // ═════════════════════════════════════════════════════════════════════════════
417
427
  // VI. tex/acm-frontmatter-override — the module's second rule, tested end to end
@@ -460,18 +470,21 @@ const acm = (
460
470
  "",
461
471
  ].join("\n");
462
472
 
463
- // ── VI.I FIXTURES ON DISK, THROUGH THE REPOSITORY'S OWN CONFIG ───────────────
464
473
  const FM_CLEAN = join(ROOT, "fixtures/tex-build/frontmatter-clean.tex");
465
474
  const FM_DEFECT = join(ROOT, "fixtures/tex-build/frontmatter-defect.tex");
466
- for (const f of [FM_CLEAN, FM_DEFECT])
467
- assert.ok(existsSync(f), `missing fixture: ${f}`);
468
475
 
469
- assert.deepEqual(
470
- await lintTex(real, FM_CLEAN),
471
- [],
472
- "fixtures/tex-build/frontmatter-clean.tex produced findings — a check that fails a correct " +
473
- "input gets switched off the same day",
474
- );
476
+ // ── VI.I FIXTURES ON DISK, THROUGH THE REPOSITORY'S OWN CONFIG ───────────────
477
+ it("VI.I FIXTURES ON DISK, THROUGH THE REPOSITORY'S OWN CONFIG", async () => {
478
+ for (const f of [FM_CLEAN, FM_DEFECT])
479
+ assert.ok(existsSync(f), `missing fixture: ${f}`);
480
+
481
+ assert.deepEqual(
482
+ await lintTex(real, FM_CLEAN),
483
+ [],
484
+ "fixtures/tex-build/frontmatter-clean.tex produced findings — a check that fails a correct " +
485
+ "input gets switched off the same day",
486
+ );
487
+ });
475
488
 
476
489
  // 🔴 AND THE REASONS FOR THAT ZERO, EACH CHECKED SEPARATELY. Three different edits to the
477
490
  // fixture would turn its silence into a tautology, and from the outside all three look the
@@ -481,7 +494,7 @@ assert.deepEqual(
481
494
  // (c) the commented override block disappears → the comment-blanking half of the rule stops
482
495
  // being exercised at all, and that half is the one that protects the accepted sibling
483
496
  // paper of the source corpus, which keeps exactly such a block as a record.
484
- {
497
+ it("VI.I the reasons for the quiet fixture's zero, each checked separately", () => {
485
498
  const src = readFileSync(FM_CLEAN, "utf8");
486
499
  assert.match(
487
500
  src,
@@ -502,151 +515,159 @@ assert.deepEqual(
502
515
  "is the fixture's point: it proves a finding is not raised on an author's record of what " +
503
516
  "the preamble used to do. Without it the quiet half no longer exercises comment blanking",
504
517
  );
505
- }
518
+ });
506
519
 
507
520
  // The frozen finding set of the defect fixture: not "some findings", but exactly these three,
508
521
  // at these addresses, with these captured macros.
509
- assert.deepEqual(
510
- await lintTex(real, FM_DEFECT),
511
- [
512
- {
513
- rule: "tex/acm-frontmatter-override",
514
- line: 10,
515
- column: 1,
516
- text: "\\setcopyright{none}",
517
- },
518
- {
519
- rule: "tex/acm-frontmatter-override",
520
- line: 11,
521
- column: 1,
522
- text: "\\renewcommand\\footnotetextcopyrightpermission",
523
- },
524
- {
525
- rule: "tex/acm-frontmatter-override",
526
- line: 12,
527
- column: 1,
528
- text: "\\pagestyle{plain}",
529
- },
530
- ],
531
- "fixtures/tex-build/frontmatter-defect.tex: the finding set drifted from the frozen measurement",
532
- );
522
+ it("VI.I the frozen finding set of the defect fixture", async () => {
523
+ assert.deepEqual(
524
+ await lintTex(real, FM_DEFECT),
525
+ [
526
+ {
527
+ rule: "tex/acm-frontmatter-override",
528
+ line: 10,
529
+ column: 1,
530
+ text: "\\setcopyright{none}",
531
+ },
532
+ {
533
+ rule: "tex/acm-frontmatter-override",
534
+ line: 11,
535
+ column: 1,
536
+ text: "\\renewcommand\\footnotetextcopyrightpermission",
537
+ },
538
+ {
539
+ rule: "tex/acm-frontmatter-override",
540
+ line: 12,
541
+ column: 1,
542
+ text: "\\pagestyle{plain}",
543
+ },
544
+ ],
545
+ "fixtures/tex-build/frontmatter-defect.tex: the finding set drifted from the frozen measurement",
546
+ );
547
+ });
533
548
 
534
549
  // ── VI.II QUIET ON A CORRECT INPUT — each reason for the silence on its own ──
535
- assert.deepEqual(
536
- await fmFindings("plain-acmart", acm("\\setcopyright{cc}")),
537
- [],
538
- "an acmart build that leaves the front matter alone must be silent",
539
- );
540
-
541
- // OUTSIDE acmart every one of these macros is an ordinary, correct line. `\pagestyle{plain}`
542
- // in an `article` is not a defect in any sense, and a rule that said so would be switched off
543
- // by the first person who writes a non-ACM document.
544
- for (const cls of [
545
- "\\documentclass{article}",
546
- "\\documentclass[11pt]{report}",
547
- "\\documentclass[conference]{IEEEtran}",
548
- ])
550
+ it("VI.II QUIET ON A CORRECT INPUT, each reason for the silence on its own", async () => {
551
+ assert.deepEqual(
552
+ await fmFindings("plain-acmart", acm("\\setcopyright{cc}")),
553
+ [],
554
+ "an acmart build that leaves the front matter alone must be silent",
555
+ );
556
+
557
+ // OUTSIDE acmart every one of these macros is an ordinary, correct line. `\pagestyle{plain}`
558
+ // in an `article` is not a defect in any sense, and a rule that said so would be switched off
559
+ // by the first person who writes a non-ACM document.
560
+ for (const cls of [
561
+ "\\documentclass{article}",
562
+ "\\documentclass[11pt]{report}",
563
+ "\\documentclass[conference]{IEEEtran}",
564
+ ])
565
+ assert.deepEqual(
566
+ await fmFindings(
567
+ `non-acmart-${cls.slice(-12)}`,
568
+ acm("\\pagestyle{plain}", { cls }),
569
+ ),
570
+ [],
571
+ `${cls}: the macros only mean something inside acmart — outside it the rule must not fire`,
572
+ );
573
+
574
+ // `nonacm` is acmart's OWN way of saying "this is not going to an ACM venue", and in that mode
575
+ // the class disables the ACM Reference Format itself (acmart.cls:110-121). A build that says
576
+ // so the supported way is exempt — otherwise the rule would punish the very escape hatch its
577
+ // own message recommends.
578
+ for (const cls of [
579
+ "\\documentclass[sigconf,nonacm]{acmart}",
580
+ "\\documentclass[nonacm,screen]{acmart}",
581
+ ])
582
+ assert.deepEqual(
583
+ await fmFindings(
584
+ `nonacm-${cls.length}`,
585
+ acm("\\setcopyright{none}\n\\pagestyle{plain}", { cls }),
586
+ ),
587
+ [],
588
+ `${cls}: a declared non-ACM build must be exempt`,
589
+ );
590
+
591
+ // A LaTeX COMMENT IS A LEGITIMATE PLACE FOR THESE MACROS — and not a hypothetical one: the
592
+ // accepted paper of the source corpus keeps the whole block commented out as a record of what
593
+ // it used to do. Measured 2026-09-11 on the real files: the rejected paper yields three
594
+ // findings (181,182,183), the accepted one yields ZERO with the same three macros present as
595
+ // comments.
549
596
  assert.deepEqual(
550
597
  await fmFindings(
551
- `non-acmart-${cls.slice(-12)}`,
552
- acm("\\pagestyle{plain}", { cls }),
598
+ "override-in-comment",
599
+ acm(
600
+ "% was: \\setcopyright{none} + \\pagestyle{plain}\n\\setcopyright{cc}",
601
+ ),
553
602
  ),
554
603
  [],
555
- `${cls}: the macros only mean something inside acmart — outside it the rule must not fire`,
604
+ "a commented-out override must not fire — an author's record of a removed line is not the line",
556
605
  );
557
606
 
558
- // `nonacm` is acmart's OWN way of saying "this is not going to an ACM venue", and in that mode
559
- // the class disables the ACM Reference Format itself (acmart.cls:110-121). A build that says
560
- // so the supported way is exempt — otherwise the rule would punish the very escape hatch its
561
- // own message recommends.
562
- for (const cls of [
563
- "\\documentclass[sigconf,nonacm]{acmart}",
564
- "\\documentclass[nonacm,screen]{acmart}",
565
- ])
607
+ // 🔴 AND THE SAME FOR THE ARMING SIDE, which is the half a simpler implementation gets wrong:
608
+ // a `\documentclass` quoted inside a comment must not turn a non-acmart file into an acmart
609
+ // one. Here the REAL class is `article`, and only the comment says `acmart`.
566
610
  assert.deepEqual(
567
611
  await fmFindings(
568
- `nonacm-${cls.length}`,
569
- acm("\\setcopyright{none}\n\\pagestyle{plain}", { cls }),
612
+ "acmart-only-in-comment",
613
+ acm("% was: \\documentclass[sigconf]{acmart}\n\\pagestyle{plain}", {
614
+ cls: "\\documentclass{article}",
615
+ }),
570
616
  ),
571
617
  [],
572
- `${cls}: a declared non-ACM build must be exempt`,
573
- );
574
-
575
- // A LaTeX COMMENT IS A LEGITIMATE PLACE FOR THESE MACROS — and not a hypothetical one: the
576
- // accepted paper of the source corpus keeps the whole block commented out as a record of what
577
- // it used to do. Measured 2026-09-11 on the real files: the rejected paper yields three
578
- // findings (181,182,183), the accepted one yields ZERO with the same three macros present as
579
- // comments.
580
- assert.deepEqual(
581
- await fmFindings(
582
- "override-in-comment",
583
- acm("% was: \\setcopyright{none} + \\pagestyle{plain}\n\\setcopyright{cc}"),
584
- ),
585
- [],
586
- "a commented-out override must not fire — an author's record of a removed line is not the line",
587
- );
588
-
589
- // 🔴 AND THE SAME FOR THE ARMING SIDE, which is the half a simpler implementation gets wrong:
590
- // a `\documentclass` quoted inside a comment must not turn a non-acmart file into an acmart
591
- // one. Here the REAL class is `article`, and only the comment says `acmart`.
592
- assert.deepEqual(
593
- await fmFindings(
594
- "acmart-only-in-comment",
595
- acm("% was: \\documentclass[sigconf]{acmart}\n\\pagestyle{plain}", {
596
- cls: "\\documentclass{article}",
597
- }),
598
- ),
599
- [],
600
- "a `\\documentclass{acmart}` quoted in a comment must not arm the rule on a non-acmart build",
601
- );
602
-
603
- // ── VI.III FIRES ON A PLANTED DEFECT — one input per member of the set ───────
604
- for (const [line, want] of [
605
- ["\\setcopyright{none}", "\\setcopyright{none}"],
606
- ["\\setcopyright{ none }", "\\setcopyright{ none }"],
607
- [
608
- "\\renewcommand\\footnotetextcopyrightpermission[1]{}",
609
- "\\renewcommand\\footnotetextcopyrightpermission",
610
- ],
611
- [
612
- "\\renewcommand{\\footnotetextcopyrightpermission}[1]{}",
613
- "\\renewcommand{\\footnotetextcopyrightpermission",
614
- ],
615
- ["\\pagestyle{plain}", "\\pagestyle{plain}"],
616
- ["\\pagestyle{empty}", "\\pagestyle{empty}"],
617
- ["\\thispagestyle{empty}", "\\thispagestyle{empty}"],
618
- ]) {
619
- const got = await fmFindings(`fire-${want.slice(1, 20)}`, acm(line));
620
- assert.deepEqual(
621
- got.map((f) => f.text),
622
- [want],
623
- `«${line}» must produce exactly one finding capturing «${want}» — got ${JSON.stringify(got)}`,
618
+ "a `\\documentclass{acmart}` quoted in a comment must not arm the rule on a non-acmart build",
624
619
  );
625
- }
620
+ });
626
621
 
627
- // The stage does NOT exempt, and this is the assertion that pins the measurement the rule's
628
- // comment rests on. The obvious design — "only flag these in review mode, the class handles
629
- // it" — is wrong in BOTH directions, so both directions are frozen here: a review build fires,
630
- // and so does a camera-ready one. `acmart.cls:93-99`: the `review` option turns on line
631
- // numbers and `\@ACM@printfoliostrue`, and touches neither the copyright statement nor the
632
- // permission footnote.
633
- for (const cls of [
634
- "\\documentclass[sigconf,review,anonymous]{acmart}",
635
- "\\documentclass[sigconf,screen]{acmart}",
636
- "\\documentclass[manuscript]{acmart}",
637
- ])
638
- assert.deepEqual(
639
- (
640
- await fmFindings(
641
- `stage-${cls.length}`,
642
- acm("\\setcopyright{none}", { cls }),
643
- )
644
- ).map((f) => f.text),
645
- ["\\setcopyright{none}"],
646
- `${cls}: the finding must not depend on the build stage — the overrides strip the same ` +
647
- "furniture in every mode, and in a camera-ready that is worse, because that is the " +
648
- "version the digital library keeps",
649
- );
622
+ // ── VI.III FIRES ON A PLANTED DEFECT — one input per member of the set ───────
623
+ it("VI.III FIRES ON A PLANTED DEFECT, one input per member of the set", async () => {
624
+ for (const [line, want] of [
625
+ ["\\setcopyright{none}", "\\setcopyright{none}"],
626
+ ["\\setcopyright{ none }", "\\setcopyright{ none }"],
627
+ [
628
+ "\\renewcommand\\footnotetextcopyrightpermission[1]{}",
629
+ "\\renewcommand\\footnotetextcopyrightpermission",
630
+ ],
631
+ [
632
+ "\\renewcommand{\\footnotetextcopyrightpermission}[1]{}",
633
+ "\\renewcommand{\\footnotetextcopyrightpermission",
634
+ ],
635
+ ["\\pagestyle{plain}", "\\pagestyle{plain}"],
636
+ ["\\pagestyle{empty}", "\\pagestyle{empty}"],
637
+ ["\\thispagestyle{empty}", "\\thispagestyle{empty}"],
638
+ ]) {
639
+ const got = await fmFindings(`fire-${want.slice(1, 20)}`, acm(line));
640
+ assert.deepEqual(
641
+ got.map((f) => f.text),
642
+ [want],
643
+ `«${line}» must produce exactly one finding capturing «${want}» — got ${JSON.stringify(got)}`,
644
+ );
645
+ }
646
+
647
+ // The stage does NOT exempt, and this is the assertion that pins the measurement the rule's
648
+ // comment rests on. The obvious design — "only flag these in review mode, the class handles
649
+ // it" — is wrong in BOTH directions, so both directions are frozen here: a review build fires,
650
+ // and so does a camera-ready one. `acmart.cls:93-99`: the `review` option turns on line
651
+ // numbers and `\@ACM@printfoliostrue`, and touches neither the copyright statement nor the
652
+ // permission footnote.
653
+ for (const cls of [
654
+ "\\documentclass[sigconf,review,anonymous]{acmart}",
655
+ "\\documentclass[sigconf,screen]{acmart}",
656
+ "\\documentclass[manuscript]{acmart}",
657
+ ])
658
+ assert.deepEqual(
659
+ (
660
+ await fmFindings(
661
+ `stage-${cls.length}`,
662
+ acm("\\setcopyright{none}", { cls }),
663
+ )
664
+ ).map((f) => f.text),
665
+ ["\\setcopyright{none}"],
666
+ `${cls}: the finding must not depend on the build stage — the overrides strip the same ` +
667
+ "furniture in every mode, and in a camera-ready that is worse, because that is the " +
668
+ "version the digital library keeps",
669
+ );
670
+ });
650
671
 
651
672
  // ── VI.IV PROPERTIES NOBODY "SEES", WITHOUT WHICH THE RULE LIES ─────────────
652
673
  // 🔴 THE MODULE-LEVEL REGEXES ARE `/g`, SO THEY CARRY `lastIndex`. Without the reset in the
@@ -654,7 +675,7 @@ for (const cls of [
654
675
  // file's match ended — i.e. findings would depend on the ORDER files were linted in, which is
655
676
  // the exact class of defect that made the previous implementation read the wrong `.tex`. Two
656
677
  // runs of the same input through the same process must agree.
657
- {
678
+ it("VI.IV the module-level regexes carry no lastIndex across files", async () => {
658
679
  const once = (
659
680
  await fmFindings("lastindex-a", acm("\\setcopyright{none}"))
660
681
  ).map((f) => f.text);
@@ -667,11 +688,11 @@ for (const cls of [
667
688
  "the second lint in the same process disagreed with the first — a `/g` regex kept its " +
668
689
  "`lastIndex` across files, and findings became order-dependent",
669
690
  );
670
- }
691
+ });
671
692
 
672
693
  // TWO OVERRIDES ON ONE LINE are two findings, at two columns. A rule reporting once per line
673
694
  // would silently under-count a compacted preamble.
674
- {
695
+ it("VI.IV two overrides on one line are two findings", async () => {
675
696
  const got = await fmFindings(
676
697
  "two-on-one-line",
677
698
  acm("\\setcopyright{none}\\pagestyle{plain}"),
@@ -684,13 +705,13 @@ for (const cls of [
684
705
  ],
685
706
  "two overrides on one line must produce two findings at two columns",
686
707
  );
687
- }
708
+ });
688
709
 
689
710
  // 🔴 AND TWO MATCHES OF THE **SAME** PATTERN ON ONE LINE, which the case above cannot reach:
690
711
  // there each finding comes from a different entry of the table, so a rule that took only the
691
712
  // FIRST match per pattern would still produce two. `\pagestyle` and `\thispagestyle` are one
692
713
  // regex, so this is the only input that distinguishes `while (re.exec(...))` from `if`.
693
- {
714
+ it("VI.IV two matches of the same pattern on one line", async () => {
694
715
  const got = await fmFindings(
695
716
  "same-pattern-twice",
696
717
  acm("\\pagestyle{plain}\\thispagestyle{empty}"),
@@ -704,12 +725,12 @@ for (const cls of [
704
725
  "two matches of the SAME pattern on one line must both be reported — the rule stopped at " +
705
726
  "the first match per pattern",
706
727
  );
707
- }
728
+ });
708
729
 
709
730
  // A FILE THE RULE CANNOT READ MUST BE SILENT, NOT THROWN. The rule reads from disk because the
710
731
  // language's projection blanks the preamble; the price is that a run with no real file behind
711
732
  // it (stdin, a deleted path) has nothing to judge, and judging nothing must not crash the lint.
712
- {
733
+ it("VI.IV a file the rule cannot read is silent, not thrown", async () => {
713
734
  const dir = join(TMP, "unreadable");
714
735
  mkdirSync(dir, { recursive: true });
715
736
  const file = join(dir, "paper.tex");
@@ -730,10 +751,10 @@ for (const cls of [
730
751
  [],
731
752
  "a file that cannot be read made the rule throw — an unreadable path must be silent, not fatal",
732
753
  );
733
- }
754
+ });
734
755
 
735
756
  // ── VI.V CONFIG — the rule is on, at the measured severity ───────────────────
736
- {
757
+ it("VI.V CONFIG: the rule is on, at the measured severity", async () => {
737
758
  const config = (await import(join(ROOT, "eslint.config.mjs"))).default;
738
759
  const tex = config.find((b) => b.rules?.["tex/acm-frontmatter-override"]);
739
760
  assert.ok(
@@ -750,4 +771,4 @@ for (const cls of [
750
771
  "construction, so `error` would only mean `npx eslint .` exits non-zero on a healthy " +
751
772
  "checkout. A consumer linting a real paper sets `error`",
752
773
  );
753
- }
774
+ });