paperlint 20.1.0 → 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 (86) 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/domain/paper-layout.d.ts +18 -6
  7. package/dist/domain/paper-layout.d.ts.map +1 -1
  8. package/dist/domain/paper-layout.js +44 -38
  9. package/dist/domain/paper-layout.js.map +1 -1
  10. package/dist/eslint-rules/papers.js +1 -1
  11. package/dist/folder-layout-hook.js +1 -1
  12. package/dist/latex-log.d.ts +1 -1
  13. package/dist/latex-log.js +1 -1
  14. package/dist/latex-loop.d.ts +1 -1
  15. package/dist/latex-loop.js +1 -1
  16. package/dist/lib/paper-config.d.ts +3 -3
  17. package/dist/lib/paper-config.js +3 -3
  18. package/docs/e2e.md +9 -9
  19. package/docs/install.md +11 -11
  20. package/docs/rules/paper/allowed-files-only.md +31 -28
  21. package/docs/testing.md +3 -4
  22. package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
  23. package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
  24. package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
  25. package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
  26. package/eslint-rules/papers.ts +1 -1
  27. package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
  28. package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
  29. package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
  30. package/eslint.config.mjs +15 -2
  31. package/fixtures/pdf-facts/README.md +1 -1
  32. package/fixtures/render-paper/build-clean.sh +1 -1
  33. package/fixtures/toolchain-mirror/install-tl +1 -1
  34. package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
  35. package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
  36. package/lib/paper-config.ts +3 -3
  37. package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
  38. package/package.json +3 -3
  39. package/presets/acm-acmsmall.jsonc +1 -1
  40. package/scripts/check-workflow.test.ts +368 -0
  41. package/scripts/check.ts +2 -2
  42. package/scripts/eslint-file-length.mjs +9 -9
  43. package/scripts/eslint-report-guard.mjs +1 -1
  44. package/scripts/eslint-report-guard.test.mjs +1 -1
  45. package/scripts/harness-api.test.ts +7 -46
  46. package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
  47. package/scripts/rules-see-files.mjs +1 -1
  48. package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
  49. package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
  50. package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
  51. package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
  52. package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
  53. package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
  54. package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
  55. package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
  56. package/src/adapters/pdfjs/fill.test.ts +1 -1
  57. package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
  58. package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
  59. package/src/{cli.harness.mjs → cli-e2e.test.mjs} +109 -103
  60. package/src/cli.test.ts +2 -2
  61. package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
  62. package/src/domain/paper-layout.test.ts +89 -49
  63. package/src/domain/paper-layout.ts +61 -42
  64. package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
  65. package/src/facts-file.test.ts +1 -1
  66. package/src/folder-layout-hook.test.ts +1 -1
  67. package/src/folder-layout-hook.ts +1 -1
  68. package/src/folder-layout-rule.test.ts +1 -1
  69. package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
  70. package/src/latex-log.test.ts +395 -0
  71. package/src/latex-log.ts +1 -1
  72. package/src/latex-loop.test.ts +553 -0
  73. package/src/latex-loop.ts +1 -1
  74. package/src/layout-docs.test.ts +47 -0
  75. package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
  76. package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
  77. package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
  78. package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
  79. package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
  80. package/src/{structure.harness.ts → structure.test.ts} +12 -10
  81. package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
  82. package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
  83. package/scripts/check.harness.ts +0 -343
  84. package/scripts/harness-api.frozen.json +0 -41
  85. package/src/latex-log.harness.ts +0 -382
  86. package/src/latex-loop.harness.ts +0 -515
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Colocated test for the LaTeX language `eslint-rules/latex-language.mjs`.
3
- * Run: `npx vigiles test eslint-rules/latex-language.harness.mjs`
4
3
  *
5
4
  * FIVE PARTS, AND THE ORDER IS LOAD-BEARING:
6
5
  * 0. THE PROJECTION INVARIANT — length, line count and newline offsets equal the source.
@@ -23,7 +22,7 @@
23
22
  * V. CONFIG — the language is wired to `.tex`, and the glob it is wired on is NOT EMPTY.
24
23
  *
25
24
  * ⚠️ WHAT WAS LOST WHEN THIS TEST LEFT THE PRIVATE CORPUS BEHIND, stated rather than glossed.
26
- * The original harness drove SIX rule modules (walls, prose, claims, structure, craft,
25
+ * The original test drove SIX rule modules (walls, prose, claims, structure, craft,
27
26
  * registry) through this language and froze their finding counts on three real papers
28
27
  * (35 · 52 · 15 at the 2026-08-27 measurement, later 32 · 53 · 20 after captions became
29
28
  * visible on 2026-09-06). None of those modules was extracted, and the papers are private, so:
@@ -37,11 +36,11 @@
37
36
  * That last gap is why part II asserts the projection DIRECTLY on `texToMdast`, rather than
38
37
  * inferring it from someone's finding count.
39
38
  *
40
- * 🔴 Assertions live at MODULE TOP LEVEL: `vigiles test` imports the file and treats "it did
41
- * not throw" as success; an exported `tests` object is run by nothing.
39
+ * The parts are `it` blocks in file order: each one runs, and fails, on its own.
42
40
  */
43
41
  import { ESLint } from "eslint";
44
42
  import assert from "node:assert/strict";
43
+ import { afterAll, it, vi } from "vitest";
45
44
  import {
46
45
  existsSync,
47
46
  mkdirSync,
@@ -58,19 +57,24 @@ import { fileURLToPath } from "node:url";
58
57
  const HERE = dirname(fileURLToPath(import.meta.url));
59
58
  const ROOT = join(HERE, ".."); // eslint-rules → repository root
60
59
  const LANG = join(HERE, "latex-language.ts");
61
- assert.ok(existsSync(LANG), `no entry point for the test: ${LANG}`);
60
+ // A test here lints the whole repository: ~72 s alone, up to 224 s beside the rest of the suite
61
+ // under coverage on 4 cores (measured 2026-11-24), so the limit only catches a hang.
62
+ vi.setConfig({ testTimeout: 600_000 });
62
63
 
63
64
  const { texLanguage, texToMdast } = await import(LANG);
64
65
 
65
66
  const TMP = realpathSync(mkdtempSync(join(tmpdir(), "latex-language-")));
66
- // Cleanup is registered IMMEDIATELY, not at the end of the file: assertions throw, and an
67
- // `rmSync` at the bottom never runs in exactly the runs that are red.
68
- process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
67
+ afterAll(() => {
68
+ rmSync(TMP, { recursive: true, force: true });
69
+ });
69
70
 
70
71
  const CLEAN_FIXTURE = join(ROOT, "fixtures/latex-language/clean.tex");
71
72
  const DEFECT_FIXTURE = join(ROOT, "fixtures/latex-language/defect.tex");
72
- for (const f of [CLEAN_FIXTURE, DEFECT_FIXTURE])
73
- assert.ok(existsSync(f), `missing fixture: ${f}`);
73
+ it("the entry point and both fixtures exist", () => {
74
+ assert.ok(existsSync(LANG), `no entry point for the test: ${LANG}`);
75
+ for (const f of [CLEAN_FIXTURE, DEFECT_FIXTURE])
76
+ assert.ok(existsSync(f), `missing fixture: ${f}`);
77
+ });
74
78
 
75
79
  // ═════════════════════════════════════════════════════════════════════════════
76
80
  // 0. THE PROJECTION INVARIANT
@@ -105,8 +109,12 @@ function project(label, src) {
105
109
 
106
110
  const CLEAN_SRC = readFileSync(CLEAN_FIXTURE, "utf8");
107
111
  const DEFECT_SRC = readFileSync(DEFECT_FIXTURE, "utf8");
108
- const clean = project("fixtures/latex-language/clean.tex", CLEAN_SRC);
109
- const defect = project("fixtures/latex-language/defect.tex", DEFECT_SRC);
112
+ let clean;
113
+ let defect;
114
+ it("0. THE PROJECTION INVARIANT holds on both fixtures", () => {
115
+ clean = project("fixtures/latex-language/clean.tex", CLEAN_SRC);
116
+ defect = project("fixtures/latex-language/defect.tex", DEFECT_SRC);
117
+ });
110
118
 
111
119
  // ═════════════════════════════════════════════════════════════════════════════
112
120
  // I. QUIET ON A CORRECT INPUT — through the repository's real config
@@ -130,12 +138,14 @@ async function lintTex(file) {
130
138
  }));
131
139
  }
132
140
 
133
- assert.deepEqual(
134
- await lintTex(CLEAN_FIXTURE),
135
- [],
136
- "a CORRECT LaTeX paper produced findings — a check that fails a correct input gets switched " +
137
- "off the same day",
138
- );
141
+ it("I. QUIET ON A CORRECT INPUT, through the repository's real config", async () => {
142
+ assert.deepEqual(
143
+ await lintTex(CLEAN_FIXTURE),
144
+ [],
145
+ "a CORRECT LaTeX paper produced findings — a check that fails a correct input gets switched " +
146
+ "off the same day",
147
+ );
148
+ });
139
149
 
140
150
  // ═════════════════════════════════════════════════════════════════════════════
141
151
  // II. THE PROJECTION ACTUALLY DID ITS WORK
@@ -145,7 +155,7 @@ assert.deepEqual(
145
155
  // thing a mutation of that property kills.
146
156
  const headings = (root) => root.children.filter((c) => c.type === "heading");
147
157
 
148
- {
158
+ it("II. headings: synthesised Abstract and References, real sections, ATX projection", () => {
149
159
  const titles = headings(clean.root).map((h) => h.title);
150
160
  // 🔴 SYNTHESIS. Neither `Abstract` nor `References` is written as a heading anywhere in the
151
161
  // fixture: the abstract is an environment, the bibliography is a macro. Measured on the
@@ -180,9 +190,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
180
190
  /^##\s+Introduction\s*$/m,
181
191
  "`\\section{Introduction}` did not project to an ATX heading",
182
192
  );
183
- }
193
+ });
184
194
 
185
- {
195
+ it("II. the preamble cut-off", () => {
186
196
  // 🔴 THE PREAMBLE CUT-OFF. Nothing before `\begin{document}` is a node of the document.
187
197
  // Without the cut-off, one real paper of the source corpus got a FALSE `## References` on
188
198
  // line 178 — its bibliography "began" before the introduction, so the whole paper fell into
@@ -227,9 +237,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
227
237
  8,
228
238
  "References was synthesised in the preamble rather than at the document's bibliography",
229
239
  );
230
- }
240
+ });
231
241
 
232
- {
242
+ it("II. the preamble is blanked", () => {
233
243
  // THE PREAMBLE IS BLANKED. Everything before `\begin{document}` is markup, and if it stays
234
244
  // visible the package list and the author macros become prose.
235
245
  const preEnd =
@@ -243,9 +253,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
243
253
  CLEAN_SRC.includes("\\usepackage{natbib}"),
244
254
  "the fixture lost its preamble content — the assertion above no longer has a subject",
245
255
  );
246
- }
256
+ });
247
257
 
248
- {
258
+ it("II. captions and footnotes are prose", () => {
249
259
  // 🔴 CAPTIONS AND FOOTNOTES ARE PROSE, AND THIS WAS A DOUBLE LOCK. Until 2026-09-06 the text
250
260
  // inside `\caption{}` / `\footnote{}` was invisible to every prose rule reading `.tex`: it
251
261
  // was blanked once as an opaque macro argument, and again as part of the surrounding
@@ -276,9 +286,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
276
286
  !projectedFloat.includes(markup),
277
287
  `float markup «${markup}» survived into the prose projection`,
278
288
  );
279
- }
289
+ });
280
290
 
281
- {
291
+ it("II. opaque macros: name and argument are blanked", () => {
282
292
  // OPAQUE MACROS: name AND argument are blanked. A `\cite` key or a `\label` is not English.
283
293
  for (const token of ["someone2020", "sec:intro", "acmart", "sigconf"])
284
294
  assert.ok(
@@ -290,9 +300,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
290
300
  CLEAN_SRC.includes("\\label{sec:intro}"),
291
301
  "the fixture lost its opaque macros — the assertion above no longer has a subject",
292
302
  );
293
- }
303
+ });
294
304
 
295
- {
305
+ it("II. math is blanked", () => {
296
306
  // MATH IS BLANKED — inline and display alike. A formula is not a sentence, and a word counter
297
307
  // that eats `E = m c^2` reports prose that was never written.
298
308
  assert.ok(
@@ -307,9 +317,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
307
317
  CLEAN_SRC.includes("E = m c^2") && CLEAN_SRC.includes("$n = 10$"),
308
318
  "the fixture lost its math — the assertion above no longer has a subject",
309
319
  );
310
- }
320
+ });
311
321
 
312
- {
322
+ it("II. texttt becomes inline code, with the same character count", () => {
313
323
  // `\texttt{X}` → `` `X` ``: the same character count, so offsets do not move. It is the only
314
324
  // markdown markup the projection can reproduce without shifting — `**` needs TWO characters
315
325
  // after the content, and LaTeX leaves only `}`.
@@ -317,9 +327,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
317
327
  clean.text.includes("`shadow-budget`"),
318
328
  "`\\texttt{X}` no longer projects to a backticked span",
319
329
  );
320
- }
330
+ });
321
331
 
322
- {
332
+ it("II. a bold lead-in at column 1 becomes a strong node", () => {
323
333
  // 🔴 A BOLD LEAD-IN AT COLUMN 1 becomes a `strong` node, and its `**` are written IN PLACE OF
324
334
  // `\te` rather than before the content. A downstream block-note rule locates a lead-in by the
325
335
  // OFFSET of the line's first non-space character; leave spaces at the start of the line and
@@ -344,9 +354,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
344
354
  text.split("\n").some((l) => l.startsWith("**")),
345
355
  "the `**` were not written at the start of the line — a note above the block cannot bind",
346
356
  );
347
- }
357
+ });
348
358
 
349
- {
359
+ it("II. comments, and both of their edges", () => {
350
360
  // 🔴 COMMENTS, AND BOTH OF THEIR EDGES. unified-latex includes the TRAILING newline in a
351
361
  // comment while mdast does not; and a comment that follows a line of text directly comes back
352
362
  // with a position starting at the PREVIOUS newline rather than at `%`. Consumers recognise a
@@ -380,7 +390,7 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
380
390
  "the comment node ends on a newline — its RIGHT edge swallowed the line break, so the gap " +
381
391
  "between the note and what it annotates is empty and the note never binds",
382
392
  );
383
- }
393
+ });
384
394
 
385
395
  // ═════════════════════════════════════════════════════════════════════════════
386
396
  // III. FIRES ON A PLANTED DEFECT
@@ -389,7 +399,7 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
389
399
  // repository is `tex/future-promise`, and it reads the file from disk rather than the
390
400
  // projection. So this run proves the language parses the document and ESLint dispatches through
391
401
  // it — the projection's own both-halves are part II, asserted directly.
392
- {
402
+ it("III. FIRES ON A PLANTED DEFECT: defect.tex through the real config", async () => {
393
403
  const ms = await lintTex(DEFECT_FIXTURE);
394
404
  assert.ok(
395
405
  ms.length >= 1,
@@ -411,7 +421,7 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
411
421
  defect.text.includes("The full table will be released later."),
412
422
  "the caption carrying the defect is invisible in the projection",
413
423
  );
414
- }
424
+ });
415
425
 
416
426
  // ═════════════════════════════════════════════════════════════════════════════
417
427
  // IV. THE LANGUAGE'S BOUNDARIES — pinned by assertions, not only by prose
@@ -420,7 +430,7 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
420
430
  // "fixed" unnoticed, or gets quoted as current a year after it went away. The assertions below
421
431
  // describe CURRENT behaviour. Each is an invitation to rewrite the language's header, not a ban
422
432
  // on changing the code.
423
- {
433
+ it("IV. boundary 2: escaped characters are lost together with the macro name", () => {
424
434
  // BOUNDARY 2: escaped characters are lost together with the macro name.
425
435
  const { text } = texToMdast(
426
436
  "\\documentclass{article}\n\\begin{document}\n" +
@@ -432,8 +442,8 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
432
442
  "the projection of escaped characters changed — rewrite boundary 2 in the language header:\n" +
433
443
  text,
434
444
  );
435
- }
436
- {
445
+ });
446
+ it("IV. boundary 4: the contents of an input file are invisible", () => {
437
447
  // BOUNDARY 4: `\input{}` — the contents of the included file are invisible.
438
448
  const dir = join(TMP, "input-boundary");
439
449
  mkdirSync(join(dir, "sections"), { recursive: true });
@@ -454,8 +464,8 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
454
464
  !text.includes("solver"),
455
465
  "the contents of `\\input{}` became visible — boundary 4 in the language header is stale",
456
466
  );
457
- }
458
- {
467
+ });
468
+ it("IV. boundary 5: appendix is inexpressible in a length-preserving projection", () => {
459
469
  // BOUNDARY 5: `\appendix` is inexpressible in a length-preserving projection (9 characters
460
470
  // against the 11 of `## Appendix`).
461
471
  const src = [
@@ -474,9 +484,9 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
474
484
  !titles.some((t) => /^Appendix/.test(t)),
475
485
  "`\\appendix` started producing a heading — boundary 5 in the language header is stale",
476
486
  );
477
- }
478
- {
479
- // 🔴 BOUNDARY 13, found 2026-09-11 BY THIS HARNESS, by an assertion that expected the
487
+ });
488
+ it("IV. boundary 13: citep and citet leak their key", () => {
489
+ // 🔴 BOUNDARY 13, found 2026-09-11 BY THIS TEST, by an assertion that expected the
480
490
  // opposite: `\citep{}` / `\citet{}` leak their key into the prose, while `\cite{}` does not.
481
491
  // All three are listed in OPAQUE, but OPAQUE blanks a macro name plus the arguments
482
492
  // unified-latex ATTACHED to it, and unified-latex has no signature for the natbib pair — so
@@ -499,8 +509,8 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
499
509
  keyed("citet").includes("keyABC"),
500
510
  "`\\citet{}` stopped leaking its key — boundary 13 was fixed; rewrite it in the language header",
501
511
  );
502
- }
503
- {
512
+ });
513
+ it("IV. boundary 8: an inline eslint config does not work inside .tex", async () => {
504
514
  // BOUNDARY 8: an inline `% eslint {...}` config does NOT work inside `.tex`
505
515
  // (`applyInlineConfig` returns empty), while `% eslint-disable-next-line` DOES.
506
516
  // ⚠️ This one runs on an in-process config rather than the repository's, and deliberately:
@@ -563,12 +573,12 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
563
573
  [],
564
574
  "`% eslint-disable-next-line` stopped working inside `.tex` — boundary 8 is stale",
565
575
  );
566
- }
576
+ });
567
577
 
568
578
  // ═════════════════════════════════════════════════════════════════════════════
569
579
  // V. CONFIG — the language is wired, over a NON-EMPTY glob
570
580
  // ═════════════════════════════════════════════════════════════════════════════
571
- {
581
+ it("V. CONFIG: the language is wired, over a non-empty glob", async () => {
572
582
  const config = (await import(join(ROOT, "eslint.config.mjs"))).default;
573
583
  const tex = config.find((b) => b.language === "tex/latex");
574
584
  assert.ok(
@@ -596,4 +606,4 @@ const headings = (root) => root.children.filter((c) => c.type === "heading");
596
606
  "are four, so the language was invoked on less than its own test data: " +
597
607
  seen.join(", "),
598
608
  );
599
- }
609
+ });
@@ -16,7 +16,10 @@ import { fileURLToPath } from "node:url";
16
16
  import { Linter } from "eslint";
17
17
  import markdown from "@eslint/markdown";
18
18
  import stages from "./paper-stages.ts";
19
- import { createChecker } from "../lib/check.ts";
19
+ import { expect, it, vi } from "vitest";
20
+
21
+ // Several tests here run real ESLint, spawn processes or walk the repository.
22
+ vi.setConfig({ testTimeout: 120_000 });
20
23
 
21
24
  const FIX = join(
22
25
  dirname(fileURLToPath(import.meta.url)),
@@ -26,26 +29,19 @@ const FIX = join(
26
29
  );
27
30
  const linter = new Linter();
28
31
 
29
- const check = createChecker();
30
-
31
- // 🔴 The `n` counter is RUNNING TOTAL across the whole file, so printing it under one rule's
32
- // heading would credit that rule with someone else's asserts. That's exactly what happened: the
33
- // line about `paper/source` reported seventeen, of which ten were actually checking
34
- // `paper/stages`. `since()` hands back the delta for its own block, so the number describes what
35
- // stands next to it again.
36
- let mark = 0;
37
- const since = () => {
38
- const d = check.count - mark;
39
- mark = check.count;
40
- return d;
41
- };
42
-
43
- assert.deepEqual(
44
- Object.keys(stages.rules).sort(),
45
- ["source", "stages"],
46
- "rule set changed",
47
- );
32
+ /** One soft assertion: a failed check does not stop the checks after it in the same test. */
33
+ const check = (label, cond, detail) =>
34
+ expect
35
+ .soft(cond, detail === undefined ? label : `${label}\n${detail}`)
36
+ .toBe(true);
48
37
 
38
+ it("paper-stages: the rule set", () => {
39
+ assert.deepEqual(
40
+ Object.keys(stages.rules).sort(),
41
+ ["source", "stages"],
42
+ "rule set changed",
43
+ );
44
+ });
49
45
  /** Findings for one fixture paper, as plain message strings. */
50
46
  function lint(name) {
51
47
  const file = join(FIX, name, "PIPELINE-STATUS.md");
@@ -74,59 +70,66 @@ function lint(name) {
74
70
  }
75
71
 
76
72
  // ── silent where it must be silent ──────────────────────────────────────────────────────
77
- check("declared and frozen correctly — silent", lint("ok").length === 0);
78
- check(
79
- "nothing shipped, nothing declared — silent, a draft owes nothing",
80
- lint("nothing").length === 0,
81
- );
82
- // A withdrawn version is a deliberate RECORD of a mistake; demanding a declaration for it
83
- // would turn that record into a finding.
84
- check("a STALE version needs no declaration", lint("stale").length === 0);
73
+ it("silent where it must be silent", () => {
74
+ check("declared and frozen correctly — silent", lint("ok").length === 0);
75
+ check(
76
+ "nothing shipped, nothing declared — silent, a draft owes nothing",
77
+ lint("nothing").length === 0,
78
+ );
79
+ // A withdrawn version is a deliberate RECORD of a mistake; demanding a declaration for it
80
+ // would turn that record into a finding.
81
+ check("a STALE version needs no declaration", lint("stale").length === 0);
82
+ });
85
83
 
86
84
  // ── direction one: a claim owes its bytes ───────────────────────────────────────────────
87
- const wrong = lint("wrongsize");
88
- check("wrong byte count is reported", wrong.length === 1);
89
- check(
90
- "and it names BOTH numbers, not just 'mismatch'",
91
- /352357/.test(wrong[0]) && /100/.test(wrong[0]),
92
- );
85
+ it("direction one: a claim owes its bytes", () => {
86
+ const wrong = lint("wrongsize");
87
+ check("wrong byte count is reported", wrong.length === 1);
88
+ check(
89
+ "and it names BOTH numbers, not just 'mismatch'",
90
+ /352357/.test(wrong[0]) && /100/.test(wrong[0]),
91
+ );
93
92
 
94
- const missing = lint("nofile");
95
- check(
96
- "a declared stage with no file on disk is reported",
97
- missing.length === 1 && /not on disk/.test(missing[0]),
98
- );
93
+ const missing = lint("nofile");
94
+ check(
95
+ "a declared stage with no file on disk is reported",
96
+ missing.length === 1 && /not on disk/.test(missing[0]),
97
+ );
98
+ });
99
99
 
100
100
  // ── direction two: bytes owe their declaration ──────────────────────────────────────────
101
101
  // 🔴 The live case this rule was written for: a camera-ready pdf sat frozen for 16 days while
102
102
  // the predecessor's pattern for that stage matched zero times anywhere in the file.
103
- const undeclared = lint("undeclared");
104
- check("a frozen version nobody declared is reported", undeclared.length === 1);
105
- check(
106
- "and it names the file and the stage",
107
- /2026-08-29-camera-ready\.pdf/.test(undeclared[0]) &&
108
- /camera-ready/.test(undeclared[0]),
109
- );
103
+ it("direction two: bytes owe their declaration", () => {
104
+ const undeclared = lint("undeclared");
105
+ check(
106
+ "a frozen version nobody declared is reported",
107
+ undeclared.length === 1,
108
+ );
109
+ check(
110
+ "and it names the file and the stage",
111
+ /2026-08-29-camera-ready\.pdf/.test(undeclared[0]) &&
112
+ /camera-ready/.test(undeclared[0]),
113
+ );
110
114
 
111
- // 🔴 THE ESCAPE HATCH. Without this half the whole rule is switched off by deleting the
112
- // frontmatter — which is the cheapest edit in the file.
113
- const noheader = lint("noheader");
114
- check(
115
- "deleting the frontmatter does NOT silence the rule when bytes exist",
116
- noheader.length === 1 && /ran ahead of the declaration/.test(noheader[0]),
117
- );
115
+ // 🔴 THE ESCAPE HATCH. Without this half the whole rule is switched off by deleting the
116
+ // frontmatter — which is the cheapest edit in the file.
117
+ const noheader = lint("noheader");
118
+ check(
119
+ "deleting the frontmatter does NOT silence the rule when bytes exist",
120
+ noheader.length === 1 && /ran ahead of the declaration/.test(noheader[0]),
121
+ );
122
+ });
118
123
 
119
124
  // ── a LIST, not a map: the same stage twice ─────────────────────────────────────────────
120
125
  // One paper in the source corpus was submitted to one venue, rejected, and resubmitted to
121
126
  // another. A map keyed by stage name holds one of those; the filenames already hold both.
122
- check(
123
- "the same stage declared twice with different dates is accepted",
124
- lint("twice").length === 0,
125
- );
126
-
127
- console.log(
128
- `✓ ${String(since())} assertions passed — paper/stages, both directions`,
129
- );
127
+ it("a LIST, not a map: the same stage twice", () => {
128
+ check(
129
+ "the same stage declared twice with different dates is accepted",
130
+ lint("twice").length === 0,
131
+ );
132
+ });
130
133
 
131
134
  // ── `paper/source`: the SOURCE is frozen on disk, and the bytes are compared ────────────
132
135
  // 🔴 This block replaced a git-based one on 2026-09-16, and the reason is a measurement, not
@@ -134,7 +137,7 @@ console.log(
134
137
  // stopped resolving inside ninety minutes of one session — squash-merge destroyed the branch
135
138
  // commits, `gc` collected them — and three of the four declared stages in the live corpus had
136
139
  // lost their source entirely. A sha is a pointer to a pointer; the outer one evaporates.
137
- {
140
+ it("`paper/source`: the SOURCE is frozen on disk, and the bytes are compared", async () => {
138
141
  const { mkdtempSync, writeFileSync, mkdirSync, rmSync } =
139
142
  await import("node:fs");
140
143
  const root = mkdtempSync(join(FIX, "..", ".tmp-stages-src-"));
@@ -226,10 +229,4 @@ console.log(
226
229
  } finally {
227
230
  rmSync(root, { recursive: true, force: true });
228
231
  }
229
- }
230
-
231
- console.log(
232
- `✓ ${String(since())} assertions passed — paper/source, frozen bytes instead of a sha`,
233
- );
234
-
235
- console.log(`✓ ${String(check.count)} assertions passed in total`);
232
+ });