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,7 +1,6 @@
1
1
  /**
2
- * generated-code.harness.mjs — the linter that reads the analysis scripts BEFORE they produce a
3
- * number, handed scripts that carry each defect it claims to catch.
4
- * `npx vigiles test .claude/skills/paper-pipeline/scripts/generated-code.harness.mjs`.
2
+ * generated-code-fixtures.test.mjs — the linter that reads the analysis scripts BEFORE they produce
3
+ * a number, handed scripts that carry each defect it claims to catch.
5
4
  *
6
5
  * WHY. `repro/` is full of scripts a model wrote, and until now nothing asked whether any of them
7
6
  * would run twice the same way or run at all on another machine. Ported from
@@ -18,12 +17,10 @@
18
17
  * neuter the whole check, so: it prints on a clean run, it prints every reason, an allowance is
19
18
  * scoped to one KIND rather than to a file, and a row naming nothing is reported.
20
19
  *
21
- * 🔴 Assertions run at MODULE TOP LEVEL — `vigiles test` imports the file and treats "did not
22
- * throw" as a pass, so an exported test object would report ✓ having run nothing.
23
- *
24
20
  * Every fixture is a throwaway in a temp dir; no real script is read or written.
25
21
  */
26
22
  import assert from "node:assert/strict";
23
+ import { afterAll, it } from "vitest";
27
24
  import { execFileSync } from "node:child_process";
28
25
  import {
29
26
  mkdtempSync,
@@ -40,8 +37,13 @@ const HERE = dirname(fileURLToPath(import.meta.url));
40
37
 
41
38
  const ROOT = consumerRoot();
42
39
  const SCRIPT = join(HERE, "generated-code.mjs");
43
- const tmp = realpathSync(mkdtempSync(join(tmpdir(), "genrated-code-harness-")));
40
+ const tmp = realpathSync(
41
+ mkdtempSync(join(tmpdir(), "generated-code-fixtures-")),
42
+ );
44
43
  let n = 0;
44
+ afterAll(() => {
45
+ rmSync(tmp, { recursive: true, force: true });
46
+ });
45
47
 
46
48
  function run(dir, flagsOnly = true) {
47
49
  const argv = flagsOnly ? [SCRIPT, dir, "--flags-only"] : [SCRIPT, dir];
@@ -90,7 +92,7 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
90
92
  }
91
93
 
92
94
  // ── 1. NO_SEED fires ───────────────────────────────────────────────────────────────────────────
93
- {
95
+ it("1. NO_SEED fires", () => {
94
96
  const r = run(
95
97
  fixture({
96
98
  scripts: {
@@ -107,13 +109,13 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
107
109
  r.out,
108
110
  );
109
111
  assert.equal(r.code, 1, "it reported NO_SEED and still exited 0");
110
- }
112
+ });
111
113
 
112
114
  // ── 2. NO_SEED stays quiet when the script seeds ───────────────────────────────────────────────
113
115
  // Two spellings, both live in this repository. The `--seed` one is a REGRESSION TEST: the first
114
116
  // draft of the seed pattern opened with `\b`, which never matches before a hyphen preceded by a
115
117
  // quote, so `"--seed"` inside argparse was invisible and a correctly-seeded script was accused.
116
- {
118
+ it("2. NO_SEED stays quiet when the script seeds", () => {
117
119
  for (const [name, src] of [
118
120
  [
119
121
  "explicit",
@@ -139,10 +141,10 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
139
141
  r.out,
140
142
  );
141
143
  }
142
- }
144
+ });
143
145
 
144
146
  // ── 3. ABS_PATH fires, and names the path ──────────────────────────────────────────────────────
145
- {
147
+ it("3. ABS_PATH fires, and names the path", () => {
146
148
  const r = run(
147
149
  fixture({
148
150
  scripts: {
@@ -157,13 +159,13 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
157
159
  "a script that only runs on its author's laptop shipped in the reproduction directory unremarked:\n" +
158
160
  r.out,
159
161
  );
160
- }
162
+ });
161
163
 
162
164
  // ── 4. ABS_PATH stays quiet on the two strings that look like paths and are not ─────────────────
163
165
  // Both guards are lifted from `check-anon.sh` cat. 5, which learned them the hard way: without
164
166
  // case-sensitivity an Express route `/users/export` matches `/Users/`; without the left anchor a
165
167
  // third party's RELATIVE `src/pages/workspace/AGENTS.md` matches `/workspace/`.
166
- {
168
+ it("4. ABS_PATH stays quiet on the two strings that look like paths and are not", () => {
167
169
  const r = run(
168
170
  fixture({
169
171
  scripts: {
@@ -178,10 +180,10 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
178
180
  "a lowercase route and a relative third-party path were reported as absolute local paths:\n" +
179
181
  r.out,
180
182
  );
181
- }
183
+ });
182
184
 
183
185
  // ── 5. IN_PLACE fires on a literal path read then overwritten ──────────────────────────────────
184
- {
186
+ it("5. IN_PLACE fires on a literal path read then overwritten", () => {
185
187
  const r = run(
186
188
  fixture({
187
189
  scripts: {
@@ -197,10 +199,10 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
197
199
  "computes on the last run's output:\n" +
198
200
  r.out,
199
201
  );
200
- }
202
+ });
201
203
 
202
204
  // ── 6. IN_PLACE fires on argv, the classic form ────────────────────────────────────────────────
203
- {
205
+ it("6. IN_PLACE fires on argv, the classic form", () => {
204
206
  const r = run(
205
207
  fixture({
206
208
  scripts: {
@@ -214,14 +216,14 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
214
216
  /IN_PLACE\s+repro\/fix\.py — reads and then overwrites `sys\.argv\[1\]`/,
215
217
  "the argv form of an in-place rewrite was not caught:\n" + r.out,
216
218
  );
217
- }
219
+ });
218
220
 
219
221
  // ── 7. IN_PLACE stays quiet on read-here-write-there, and on a reused variable name ─────────────
220
222
  // 🔴 The second fixture is the one that decided the rule's shape. Matching the OPERAND EXPRESSION
221
223
  // instead of the literal produced seventeen hits on the live repository, essentially all of them a
222
224
  // variable called `file` or `p` reused across two unrelated loops. The rule is textual and literal
223
225
  // on purpose, and the recall that costs is written into the check's own blind-spot list.
224
- {
226
+ it("7. IN_PLACE stays quiet on read-here-write-there, and on a reused variable name", () => {
225
227
  const r = run(
226
228
  fixture({
227
229
  scripts: {
@@ -239,14 +241,14 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
239
241
  "or a variable name reused across two loops was mistaken for dataflow:\n" +
240
242
  r.out,
241
243
  );
242
- }
244
+ });
243
245
 
244
246
  // ── 8. the bundle is NOT scanned — the boundary with check-anon.sh, asserted ────────────────────
245
247
  // 🔴 The two checks grep the same four prefixes and would be a duplicate if they read the same
246
248
  // tree. They do not: check-anon reads the SHIPPED bundle and asks whether it leaks a machine
247
249
  // layout; this reads the WORKING tree and asks whether the script is portable. If this assertion
248
250
  // ever fails, one of the two checks should be deleted rather than both kept.
249
- {
251
+ it("8. the bundle is NOT scanned — the boundary with check-anon.sh, asserted", () => {
250
252
  // Silence asserted through --flags-only rather than through the header's count, so that this case
251
253
  // tests the EXCLUSION and not the count. Sharing the count assertion with case 11 meant a defect
252
254
  // in the header would be caught here instead, which reads as an off-target result and hides
@@ -268,13 +270,13 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
268
270
  "the bundle was skipped and the ledger did not say so, which makes the boundary invisible:\n" +
269
271
  r.out,
270
272
  );
271
- }
273
+ });
272
274
 
273
275
  // ── 9. an allow row is scoped to ONE KIND, not to the file ─────────────────────────────────────
274
276
  // 🔴 The design point. Waving through a hard-coded path in a script must not also wave through a
275
277
  // missing seed in that same script; that is how one justified exemption becomes a file nobody
276
278
  // checks. The fixture carries BOTH defects and allows only one.
277
- {
279
+ it("9. an allow row is scoped to ONE KIND, not to the file", () => {
278
280
  const src =
279
281
  'import random\nrows = random.sample(open("/home/example/x.tsv").read().split(), 3)\n';
280
282
  const r = run(
@@ -303,10 +305,10 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
303
305
  "this whole design is arranged around:\n" +
304
306
  r.out,
305
307
  );
306
- }
308
+ });
307
309
 
308
310
  // ── 10. a row naming nothing on disk is reported ────────────────────────────────────────────────
309
- {
311
+ it("10. a row naming nothing on disk is reported", () => {
310
312
  const r = run(
311
313
  fixture({
312
314
  scripts: { "ok.py": "print(1)\n" },
@@ -319,12 +321,12 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
319
321
  "a row for a script that no longer exists sat unreported, so the list never shrinks:\n" +
320
322
  r.out,
321
323
  );
322
- }
324
+ });
323
325
 
324
326
  // ── 11. the ledger prints on a CLEAN run, and the header states the count ───────────────────────
325
327
  // The count matters beyond tidiness: the ledger is ~20 lines that are not findings, so a caller
326
328
  // counting output lines would read a clean paper as twenty findings.
327
- {
329
+ it("11. the ledger prints on a CLEAN run, and the header states the count", () => {
328
330
  const r = run(
329
331
  fixture({
330
332
  scripts: {
@@ -360,13 +362,13 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
360
362
  "",
361
363
  "--flags-only printed something about a clean tree:\n" + q.out,
362
364
  );
363
- }
365
+ });
364
366
 
365
367
  // ── 12. KNOWN GAP, asserted so it stays visible ────────────────────────────────────────────────
366
368
  // 🔴 A path held in a variable defeats IN_PLACE. This is the price paid for precision in case 7 and
367
369
  // it is written into the check's own output; asserting the CURRENT behaviour so that when the rule
368
370
  // learns dataflow, this flips and must be updated.
369
- {
371
+ it("12. KNOWN GAP, asserted so it stays visible", () => {
370
372
  const r = run(
371
373
  fixture({
372
374
  scripts: {
@@ -380,7 +382,7 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
380
382
  0,
381
383
  "IN_PLACE now follows a path through a variable — good; update this assertion and case 7",
382
384
  );
383
- }
385
+ });
384
386
 
385
387
  // ── 13. a repro/ ONE LEVEL DOWN is found — the input that was invisible ────────────────────────
386
388
  // 🔴 The defect this case exists for, measured 2026-08-26. `<paper-e>` keeps its
@@ -389,7 +391,7 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
389
391
  // one level below, including a reproduction script hard-coding a path into ANOTHER paper's
390
392
  // directory. A guard that tests for a filename rather than for the job; the same class the
391
393
  // `numbers` CI job documents about itself and the same class as the skipped `artifact/reproduce.py`.
392
- {
394
+ it("13. a repro/ ONE LEVEL DOWN is found — the input that was invisible", () => {
393
395
  // Fixture is neutral ON PURPOSE: `/home/example/x.tsv` and the label `typed-shell/repro` stood here —
394
396
  // the owner's home directory and our paper's name in test data. The check does not depend on this:
395
397
  // it needs ANY absolute path.
@@ -411,13 +413,13 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
411
413
  1,
412
414
  "the nested tree was scanned, findings were reported, and it still exited 0",
413
415
  );
414
- }
416
+ });
415
417
 
416
418
  // ── 14. no repro/ ANYWHERE says so, instead of exiting in silence ──────────────────────────────
417
419
  // The half that matters more. Silence has to mean "scanned and clean"; if it can also mean "did not
418
420
  // look", then every clean report in this pipeline is worth nothing. `--flags-only` still stays
419
421
  // quiet, because a hook that speaks when it has nothing to say is removed within a day.
420
- {
422
+ it("14. no repro/ ANYWHERE says so, instead of exiting in silence", () => {
421
423
  const r = run(fixture({ at: null }), false);
422
424
  assert.equal(r.code, 0, "a paper with no repro/ is not an error:\n" + r.out);
423
425
  assert.match(
@@ -433,12 +435,12 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
433
435
  "",
434
436
  "--flags-only spoke about a paper it had nothing to say about:\n" + q.out,
435
437
  );
436
- }
438
+ });
437
439
 
438
440
  // ── 15. a SECOND repro/ root is named in the ledger rather than silently dropped ────────────────
439
441
  // The allow file is scoped to one root, so this check reads one. That is a defensible scope and an
440
442
  // indefensible silence: an unread tree has to be a name you can count.
441
- {
443
+ it("15. a SECOND repro/ root is named in the ledger rather than silently dropped", () => {
442
444
  const d = fixture({ scripts: { "ok.py": "print(1)\n" } });
443
445
  mkdirSync(join(d, "sub", "repro"), { recursive: true });
444
446
  writeFileSync(
@@ -458,13 +460,4 @@ function fixture({ scripts = {}, allow = null, bundle = {}, at = "repro" }) {
458
460
  /sub\/repro/,
459
461
  "the second root was counted but not named:\n" + r.out,
460
462
  );
461
- }
462
-
463
- rmSync(tmp, { recursive: true, force: true });
464
- console.log(
465
- "✓ generated-code: unseeded randomness, a hard-coded absolute path and an in-place overwrite (literal and argv) " +
466
- "each fire; a seeded script, a lowercase route, a relative third-party path, a read-here-write-there script and a reused " +
467
- "variable name all stay quiet; the released bundle is left to check-anon; allowances are per-kind, printed, and reported " +
468
- "when stale; the ledger prints on a clean run and the header states its count; a repro/ one level down is found, " +
469
- "a paper with none says so instead of exiting silent, and a second root is named; 1 known gap recorded",
470
- );
463
+ });
@@ -10,6 +10,8 @@
10
10
  *
11
11
  * The shim imports the compiled package (`dist/`), so `npm run build` runs before this.
12
12
  */
13
+ import { afterAll, expect, it } from "vitest";
14
+ import { failureMessage } from "../../lib/check.ts";
13
15
  import { spawnSync } from "node:child_process";
14
16
  import {
15
17
  cpSync,
@@ -25,7 +27,6 @@ import { tmpdir } from "node:os";
25
27
  import { dirname, join, resolve } from "node:path";
26
28
  import { fileURLToPath } from "node:url";
27
29
  import { z } from "zod";
28
- import { createChecker } from "../../lib/check.ts";
29
30
  import type { ScriptResult } from "../../test/support.ts";
30
31
 
31
32
  /** The facts file, as far as these checks read it. */
@@ -52,7 +53,10 @@ const HERE = dirname(fileURLToPath(import.meta.url));
52
53
  const SHIM = join(HERE, "extract-pdf-facts.mjs");
53
54
  const FIX = resolve(HERE, "..", "..", "fixtures", "pdf-facts");
54
55
 
55
- const check = createChecker();
56
+ // A failed check is recorded and the rest of the test keeps running.
57
+ const check = (label: string, cond: unknown, detail?: unknown): void => {
58
+ expect.soft(cond, failureMessage(label, detail)).toBeTruthy();
59
+ };
56
60
 
57
61
  const root = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-extract-")));
58
62
  /**
@@ -83,7 +87,13 @@ const shim = (args: readonly string[], env: Record<string, string> = {}) =>
83
87
  const said = (r: Pick<ScriptResult, "stdout" | "stderr">) =>
84
88
  `${r.stdout}${r.stderr}`;
85
89
 
86
- try {
90
+ afterAll(() => {
91
+ rmSync(root, { recursive: true, force: true });
92
+ });
93
+ const loose = join(root, "papers", "loose");
94
+
95
+ // ── the exit-code contract, schema 3, and the no-no-yes font ──
96
+ it("the exit-code contract, schema 3, and the no-no-yes font", () => {
87
97
  const paper = join(root, "papers", "mixed");
88
98
  mkdirSync(paper, { recursive: true });
89
99
  cpSync(join(FIX, "t3-mixed.pdf"), join(paper, "paper.pdf"));
@@ -188,9 +198,10 @@ try {
188
198
  missing.status === 3 && /not built/.test(said(missing)),
189
199
  said(missing),
190
200
  );
201
+ }, 60_000);
191
202
 
192
- // ── a PDF named directly, in a directory with no paperlint.json, no project dir set ──
193
- const loose = join(root, "papers", "loose");
203
+ // ── a PDF named directly, in a directory with no paperlint.json, no project dir set ──
204
+ it("a PDF named directly, in a directory with no paperlint.json, no project dir set", () => {
194
205
  mkdirSync(loose, { recursive: true });
195
206
  cpSync(join(FIX, "t3-mixed.pdf"), join(loose, "draft.pdf"));
196
207
  const direct = shim([join(loose, "draft.pdf")], { CLAUDE_PROJECT_DIR: "" });
@@ -214,8 +225,10 @@ try {
214
225
  same.stdout.startsWith(`✅ draft.pdf → ${looseFacts} (`),
215
226
  said(same),
216
227
  );
228
+ });
217
229
 
218
- // ── a file that is not a PDF: refused, strict or not, in the words for the mode ──
230
+ // ── a file that is not a PDF: refused, strict or not, in the words for the mode ──
231
+ it("a file that is not a PDF: refused, strict or not, in the words for the mode", () => {
219
232
  writeFileSync(join(loose, "broken.pdf"), "not a pdf at all\n");
220
233
  const brokenStrict = shim([join(loose, "broken.pdf"), "--strict"]);
221
234
  const brokenLocal = shim([join(loose, "broken.pdf")]);
@@ -231,10 +244,4 @@ try {
231
244
  ),
232
245
  `${said(brokenStrict)}\n---\n${said(brokenLocal)}`,
233
246
  );
234
- } finally {
235
- rmSync(root, { recursive: true, force: true });
236
- }
237
-
238
- console.log(
239
- `✓ ${String(check.count)} assertions passed — extract-pdf-facts: the exit-code contract, schema 3, and the no-no-yes font`,
240
- );
247
+ });
@@ -6,6 +6,7 @@
6
6
  * passes; the TeX e2e suite does that. The commands are documented in `docs/render.md`.
7
7
  */
8
8
  import assert from "node:assert/strict";
9
+ import { it } from "vitest";
9
10
  import {
10
11
  copyFileSync,
11
12
  existsSync,
@@ -28,7 +29,7 @@ import {
28
29
 
29
30
  // The TeX package pins that stood here (texlive-fonts-extra, texlive-plain-generic in
30
31
  // ensure-toolchain.sh) moved with the list itself: the venue profiles declare the packages, and
31
- // src/tex-requirements.harness.ts asserts that every acmart venue declares libertine, inconsolata,
32
+ // src/tex-requirements-tables.test.ts asserts that every acmart venue declares libertine, inconsolata,
32
33
  // newtx, kastrup (binhex.tex) and fancyhdr — each proved by the file whose absence broke a build.
33
34
 
34
35
  // ── TEXINPUTS: WHERE THE SCRIPTS LOOK FOR `paper-guards.tex` ─────────────────
@@ -46,7 +47,7 @@ import {
46
47
  // What these assertions do NOT prove: that the found file is correct, that pdflatex read it, and
47
48
  // that the guard fired. That's caught by `paper-guards.tex` itself (it fails with
48
49
  // `\PackageError`) — here it's only "a directory was found, and found in the right order."
49
- {
50
+ it("TEXINPUTS: WHERE THE SCRIPTS LOOK FOR `paper-guards.tex`", () => {
50
51
  const HERE = dirname(fileURLToPath(import.meta.url));
51
52
  const CHECK = join(HERE, "check-render.sh");
52
53
  const run = (args, opts = {}) =>
@@ -170,7 +171,7 @@ import {
170
171
  pkgVenues,
171
172
  "with both candidates present, the INSTALLED package wins, not the copy the script ships in",
172
173
  );
173
- }
174
+ });
174
175
 
175
176
  // ── THE SAME LADDER IN THE PAPER's build.sh, AND WHY THE ASSERTION DIFFERS ───
176
177
  //
@@ -201,7 +202,7 @@ import {
201
202
  // The counter below is printed ALWAYS and grows together with the verdict, not before it: "0
202
203
  // consumer scripts" is an honest result (in a checkout of the package itself it should be zero),
203
204
  // whereas a silently-produced "0" would be indistinguishable from a verified corpus.
204
- {
205
+ it("THE SAME LADDER IN THE PAPER's build.sh, AND WHY THE ASSERTION DIFFERS", () => {
205
206
  const HERE = dirname(fileURLToPath(import.meta.url));
206
207
 
207
208
  /** The property of a paper's build script. A pure function — so it can also be BROKEN. */
@@ -278,7 +279,7 @@ import {
278
279
  ? " (no papers root on disk — package checkout)"
279
280
  : ` under ${root}/`),
280
281
  );
281
- }
282
+ });
282
283
 
283
284
  // ── AN IEEEtran BST CONTROL ENTRY IS NOT A MISSING REFERENCE ─────────────────
284
285
  // `\\bstctlcite{key}` cites an `@IEEEtranBSTCTL{key, …}` entry, so the key lands in the .aux like any
@@ -288,7 +289,7 @@ import {
288
289
  // `** IEEEtran BST control entry "key" detected.`: BibTeX wrote it after parsing the build's
289
290
  // databases, so a record BibTeX never read (a .bib the build does not use, a record inside
290
291
  // `@comment{…}`) or a misspelled key exempts nothing, and a genuinely missing key is still reported.
291
- {
292
+ it("AN IEEEtran BST CONTROL ENTRY IS NOT A MISSING REFERENCE", () => {
292
293
  const HERE = dirname(fileURLToPath(import.meta.url));
293
294
  const CHECK = join(HERE, "check-render.sh");
294
295
  // `detected` = the keys IEEEtran reported in the .blg as control entries it read.
@@ -380,7 +381,7 @@ import {
380
381
  /bibliography: BSTcontrol/,
381
382
  withGap.stdout,
382
383
  );
383
- }
384
+ });
384
385
 
385
386
  // ── THE LOG VERDICT: check-render.sh FAILS A PAPER WHOSE TEXT BLEEDS PAST THE COLUMN ─────────
386
387
  // The script reads the LaTeX log and exits 1 on a visible defect (an overfull box wider than the
@@ -388,30 +389,30 @@ import {
388
389
  // read. `NO_COMPILE=1` skips pdflatex, so the log parser runs anywhere; the last case compiles
389
390
  // for real, and only where a TeX toolchain exists. Both halves, always: a gate that fails a clean
390
391
  // log is bypassed on deadline day, and one that passes a defective log is decoration.
391
- {
392
- const CHECK = join(
393
- dirname(fileURLToPath(import.meta.url)),
394
- "check-render.sh",
395
- );
396
- const dirWith = (files) => {
397
- const dir = realpathSync(mkdtempSync(join(tmpdir(), "render-log-")));
398
- for (const [name, body] of Object.entries(files))
399
- writeFileSync(join(dir, name), body);
400
- return dir;
401
- };
402
- const verdict = (dir, { threshold = "5", compile = false } = {}) => {
403
- const env = { ...process.env };
404
- if (compile) delete env.NO_COMPILE;
405
- else env.NO_COMPILE = "1";
406
- const r = spawnSync("bash", [CHECK, dir, "paper", threshold], {
407
- encoding: "utf8",
408
- env,
409
- });
410
- return { status: r.status, stdout: r.stdout };
411
- };
412
- const overfull = (pt) =>
413
- `Overfull \\hbox (${pt}pt too wide) in paragraph at lines 4--5\n`;
392
+ const LOG_CHECK = join(
393
+ dirname(fileURLToPath(import.meta.url)),
394
+ "check-render.sh",
395
+ );
396
+ const dirWith = (files) => {
397
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "render-log-")));
398
+ for (const [name, body] of Object.entries(files))
399
+ writeFileSync(join(dir, name), body);
400
+ return dir;
401
+ };
402
+ const verdict = (dir, { threshold = "5", compile = false } = {}) => {
403
+ const env = { ...process.env };
404
+ if (compile) delete env.NO_COMPILE;
405
+ else env.NO_COMPILE = "1";
406
+ const r = spawnSync("bash", [LOG_CHECK, dir, "paper", threshold], {
407
+ encoding: "utf8",
408
+ env,
409
+ });
410
+ return { status: r.status, stdout: r.stdout };
411
+ };
412
+ const overfull = (pt) =>
413
+ `Overfull \\hbox (${pt}pt too wide) in paragraph at lines 4--5\n`;
414
414
 
415
+ it("the log verdict: a paper whose text bleeds past the column fails, a clean log passes", () => {
415
416
  const wide = verdict(dirWith({ "paper.log": overfull("12.34") }));
416
417
  assert.equal(
417
418
  wide.status,
@@ -491,11 +492,15 @@ import {
491
492
  /FAIL: no .*paper\.log/,
492
493
  `the missing log was not named:\n${noLog.stdout}`,
493
494
  );
495
+ });
494
496
 
495
- const haveLatex =
496
- spawnSync("bash", ["-c", "command -v pdflatex"], { encoding: "utf8" })
497
- .status === 0;
498
- if (haveLatex) {
497
+ const haveLatex =
498
+ spawnSync("bash", ["-c", "command -v pdflatex"], { encoding: "utf8" })
499
+ .status === 0;
500
+ // The real compile needs a TeX toolchain: without pdflatex vitest reports a skip, not a pass.
501
+ it.skipIf(!haveLatex)(
502
+ "the log verdict, compiled for real: an overfull word fails, a clean paragraph passes",
503
+ () => {
499
504
  const texPaper = (body, preamble = "") =>
500
505
  dirWith({
501
506
  "paper.tex": `\\documentclass[10pt]{article}\n${preamble}\\begin{document}\n${body}\n\\end{document}\n`,
@@ -528,9 +533,5 @@ import {
528
533
  0,
529
534
  `an ordinary paragraph must pass a real compile:\n${good.stdout}`,
530
535
  );
531
- } else {
532
- console.log(
533
- " real compile (overfull word, clean paragraph): NOT VERIFIED — pdflatex is not installed; only the log parser ran.",
534
- );
535
- }
536
- }
536
+ },
537
+ );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `fill.ts` — what is recovered from pdf.js's exports for each text item: whether it is upright, and
3
3
  * the fill it was drawn in (the operator-list walk). Operator lists here are written by hand; the
4
- * real-PDF half runs in `pdf-facts.harness.ts` and `test/e2e/tex/banal.e2e.ts`.
4
+ * real-PDF half runs in `pdf-facts-tables.test.ts` and `test/e2e/tex/banal.e2e.ts`.
5
5
  */
6
6
  import assert from "node:assert/strict";
7
7
  import { test } from "vitest";