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
package/eslint.config.mjs CHANGED
@@ -209,6 +209,19 @@ const RATCHET = {
209
209
  "max-depth": 4,
210
210
  },
211
211
  "src/toolchain.ts": { "max-lines-per-function": 50 },
212
+ "scripts/check-workflow.test.ts": { complexity: 16 },
213
+ "skills/render-paper/extract-pdf-facts.test.ts": {
214
+ complexity: 20,
215
+ "max-lines-per-function": 99,
216
+ },
217
+ "src/hooks-settings.test.ts": { "max-lines-per-function": 255 },
218
+ "src/latex-log.test.ts": { "max-lines-per-function": 122 },
219
+ "src/latex-loop.test.ts": { "max-lines-per-function": 127 },
220
+ "src/link-skills-fs.test.ts": { "max-lines-per-function": 119 },
221
+ "src/structure.test.ts": {
222
+ complexity: 17,
223
+ "max-lines-per-function": 112,
224
+ },
212
225
  };
213
226
 
214
227
  // ── Hexagonal layers (src/CLAUDE.md, issue #76) ─────────────────────────────────────────
@@ -585,8 +598,8 @@ const TYPESCRIPT_ONLY = [
585
598
  export default [
586
599
  ...fileLength,
587
600
  // 🔴 TRANSIENT DIRECTORIES ARE NOT THE CORPUS, and leaving them in is a RACE, not sloppiness.
588
- // `paper-stages.harness.mjs` creates a temp tree under fixtures and removes it when done,
589
- // while `latex-language.harness.mjs` lints the whole repository to prove its glob matches
601
+ // `paper-stages-rule.test.mjs` creates a temp tree under fixtures and removes it when done,
602
+ // while `latex-language-rules.test.mjs` lints the whole repository to prove its glob matches
590
603
  // real files. Run in parallel, ESLint enumerates a path and then reads it, and the file can
591
604
  // be gone in between: ENOENT, in a harness that has nothing to do with either.
592
605
  //
@@ -1,6 +1,6 @@
1
1
  # PDF fixtures for the pdf.js reader
2
2
 
3
- Real PDFs that `src/pdf-facts.harness.ts` and `skills/render-paper/extract-pdf-facts.harness.ts`
3
+ Real PDFs that `src/pdf-facts-tables.test.ts` and `skills/render-paper/extract-pdf-facts.test.ts`
4
4
  read. They were measured with poppler and with pdf.js on 2026-09-24 (issue #61); the harnesses pin
5
5
  poppler's numbers, so a pass means agreement with the tool pdf.js replaced.
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # FIXTURE — the CLEAN half of the `build.sh` ladder assertion in
3
- # `skills/render-paper/render-paper.harness.mjs`.
3
+ # `skills/render-paper/render-paper.test.mjs`.
4
4
  #
5
5
  # A paper's own build script must not hard-code a path into the agent's skills directory:
6
6
  # once the skills move into a package that address points at nothing, and LaTeX's reaction to
@@ -1,5 +1,5 @@
1
1
  #!/bin/sh
2
- # STANDS IN FOR install-tl in src/toolchain.harness.mjs. It reads TEXDIR from the profile paperlint
2
+ # STANDS IN FOR install-tl in src/toolchain-mirror.test.mjs. It reads TEXDIR from the profile paperlint
3
3
  # wrote and lays out a tree whose kpsewhich and tlmgr are the stubs shipped beside it, so the
4
4
  # harness drives paperlint's real download, unpack, install and verify logic without the network.
5
5
  set -eu
@@ -3,13 +3,16 @@
3
3
  *
4
4
  * The case that matters most is 4: a probe that discards its output. It cannot be staged at
5
5
  * all against a real `spawnSync`, because there is no way to ask the installed binary to print
6
- * nothing — which is precisely why the observation had to leave the harness that spawns it
6
+ * nothing — which is precisely why the observation had to leave the code that spawns it
7
7
  * before it could be tested (issue #7).
8
8
  */
9
9
  import assert from "node:assert/strict";
10
- import { recordCheck } from "vigiles";
10
+ import { it, vi } from "vitest";
11
11
  import { observeAgentCli, CHARACTERIZED_CLI } from "./agent-cli-version.ts";
12
12
 
13
+ // Several tests here run real ESLint, spawn processes or walk the repository.
14
+ vi.setConfig({ testTimeout: 120_000 });
15
+
13
16
  /** A spawner that records how it was called, so the CALL SHAPE is assertable, not just the result. */
14
17
  const spawner = (result) => {
15
18
  const seen = [];
@@ -24,7 +27,7 @@ const spawner = (result) => {
24
27
  const cases = [];
25
28
 
26
29
  // ── 1. BINARY ABSENT: no throw, and `present` says so — the skip path of the caller.
27
- {
30
+ it("1. BINARY ABSENT: no throw, and `present` says so — the skip path of the caller", () => {
28
31
  const spawnSync = spawner({ status: 127, stdout: "", stderr: "not found" });
29
32
  const o = observeAgentCli({ spawnSync });
30
33
  assert.equal(
@@ -39,11 +42,11 @@ const cases = [];
39
42
  "the note must say WHY there is nothing to observe",
40
43
  );
41
44
  cases.push("CLI absent → present:false, no throw, note explains");
42
- }
45
+ });
43
46
 
44
47
  // ── 2. 🔴 DRIFT IS NAMED, NOT INFERRED. The measured case from issue #7: the machine carries
45
48
  // 2.1.273 while the assertions were written against 2.1.227.
46
- {
49
+ it("2. DRIFT IS NAMED, NOT INFERRED: the machine carries 2.1.273 while the assertions were written against 2.1.227", () => {
47
50
  const spawnSync = spawner({
48
51
  status: 0,
49
52
  stdout: "2.1.273 (Claude Code)\n",
@@ -78,11 +81,11 @@ const cases = [];
78
81
  cases.push(
79
82
  "drifted CLI → version parsed, drifted:true, note names BOTH numbers",
80
83
  );
81
- }
84
+ });
82
85
 
83
86
  // ── 3. NO DRIFT: the same machinery must stay quiet when the numbers agree, or `drifted`
84
87
  // would be a constant rather than a comparison.
85
- {
88
+ it("3. NO DRIFT: the same machinery must stay quiet when the numbers agree", () => {
86
89
  const spawnSync = spawner({
87
90
  status: 0,
88
91
  stdout: `${CHARACTERIZED_CLI} (Claude Code)\n`,
@@ -92,12 +95,12 @@ const cases = [];
92
95
  assert.equal(o.drifted, false, "matching versions are not drift");
93
96
  assert.equal(o.version, CHARACTERIZED_CLI);
94
97
  cases.push("CLI at the characterized version → drifted:false");
95
- }
98
+ });
96
99
 
97
100
  // ── 4. 🔴 THE DEFECT ITSELF: exit 0, nothing on stdout — what `stdio: "ignore"` produced.
98
101
  // Reporting `characterized against ""` would be issue #7 wearing new clothes, so this
99
102
  // must THROW rather than return an empty observation.
100
- {
103
+ it("4. THE DEFECT ITSELF: exit 0, nothing on stdout", () => {
101
104
  const spawnSync = spawner({ status: 0, stdout: null, stderr: "" });
102
105
  assert.throws(
103
106
  () => observeAgentCli({ spawnSync }),
@@ -114,12 +117,12 @@ const cases = [];
114
117
  /\(got "", stderr "warming up"\)/,
115
118
  );
116
119
  cases.push("…and the stderr it printed instead is quoted in the refusal");
117
- }
120
+ });
118
121
 
119
122
  // ── 5. THE CALL SHAPE, asserted directly. Case 4 catches a discarding probe only because the
120
123
  // double returns nothing; a real `stdio: "ignore"` would ALSO have to be caught if some
121
124
  // other path happened to fill stdout. So the options handed to the spawner are checked.
122
- {
125
+ it("5. THE CALL SHAPE, asserted directly", () => {
123
126
  const spawnSync = spawner({
124
127
  status: 0,
125
128
  stdout: "2.1.273 (Claude Code)\n",
@@ -143,12 +146,12 @@ const cases = [];
143
146
  '`stdio: "ignore"` is the discarded-output defect itself',
144
147
  );
145
148
  cases.push("the probe is spawned with encoding:utf8 and never stdio:ignore");
146
- }
149
+ });
147
150
 
148
151
  // ── 6. AND THE REAL BINARY, when this machine has one. Cases 1-5 are about the module; this
149
152
  // one is about reality — an observer that only ever meets a double proves nothing about
150
153
  // the output format of the tool it exists to read.
151
- {
154
+ it("6. AND THE REAL BINARY, when this machine has one", async () => {
152
155
  const { spawnSync } = await import("node:child_process");
153
156
  const o = observeAgentCli({ spawnSync });
154
157
  if (o.present) {
@@ -165,8 +168,4 @@ const cases = [];
165
168
  "real `claude` binary absent on this machine → absent path exercised for real",
166
169
  );
167
170
  }
168
- }
169
-
170
- recordCheck(cases.length);
171
- console.log(`observeAgentCli: ${cases.length} cases:`);
172
- for (const c of cases) console.log(` ok ${c}`);
171
+ });
@@ -21,18 +21,23 @@
21
21
  * and requires every file it finds to be on the list. Its subject is different — "is there a
22
22
  * file I don't know about" — and a text search is legitimate for that: it looks for CANDIDATES,
23
23
  * while the value itself is still taken by import.
24
- *
25
- * Run: npx vigiles test lib/paper-config.harness.mjs
26
24
  */
27
25
  import { readFileSync, readdirSync } from "node:fs";
28
26
  import { dirname, join, relative, resolve } from "node:path";
29
27
  import { fileURLToPath, pathToFileURL } from "node:url";
30
- import { createChecker } from "./check.ts";
28
+ import { expect, it, vi } from "vitest";
29
+
30
+ // Several tests here run real ESLint, spawn processes or walk the repository.
31
+ vi.setConfig({ testTimeout: 120_000 });
31
32
 
32
33
  const HERE = dirname(fileURLToPath(import.meta.url));
33
34
  const ROOT = resolve(HERE, "..");
34
35
 
35
- const check = createChecker();
36
+ /** One soft assertion: a failed check does not stop the checks after it in the same test. */
37
+ const check = (label, cond, detail) =>
38
+ expect
39
+ .soft(cond, detail === undefined ? label : `${label}\n${detail}`)
40
+ .toBe(true);
36
41
 
37
42
  /**
38
43
  * Every place that publishes at least one of the two constants. Each re-exports from
@@ -59,7 +64,7 @@ const loaded = await Promise.all(
59
64
  );
60
65
 
61
66
  // ── I. THE SOURCE SAYS WHAT IT SHOULD ───────────────────────────────────────────────────────
62
- {
67
+ it("I. THE SOURCE SAYS WHAT IT SHOULD", () => {
63
68
  // 🔴 THERE IS NO KEY LITERAL HERE, AND THAT IS DELIBERATE. The first version compared
64
69
  // `src.key` against "research-paper-pipeline" right here — and by doing so made the check
65
70
  // below, that the key equals the package name, UNKILLABLE: any corruption of the value would
@@ -74,10 +79,10 @@ const loaded = await Promise.all(
74
79
  src.def.length > 0,
75
80
  );
76
81
  check("the default papers directory is `papers`", src.def === "papers");
77
- }
82
+ });
78
83
 
79
84
  // ── II. ALL CARRIERS AGREE WITH THE SOURCE ──────────────────────────────────────────────────
80
- {
85
+ it("II. ALL CARRIERS AGREE WITH THE SOURCE", () => {
81
86
  const keys = new Set(loaded.map((c) => c.key).filter((v) => v !== undefined));
82
87
  const defs = new Set(loaded.map((c) => c.def).filter((v) => v !== undefined));
83
88
  check(
@@ -129,14 +134,14 @@ const loaded = await Promise.all(
129
134
  loaded[0].key ===
130
135
  JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).name,
131
136
  );
132
- }
137
+ });
133
138
 
134
139
  // ── III. THE HOOKS DUPLICATE, AND THAT IS CHECKED SEPARATELY ───────────────────────────────
135
140
  // A hook that started importing the constants would compile, run, and pass the value
136
141
  // cross-check — but it would violate the `checkHookImports` contract, i.e. stop being a hook
137
142
  // with a proven capability surface. The values have nothing to do with that, so it gets its own
138
143
  // check.
139
- {
144
+ it("III. THE HOOKS DUPLICATE, AND THAT IS CHECKED SEPARATELY", async () => {
140
145
  const { checkHookImports } = await import("vigiles/hook");
141
146
  for (const rel of CARRIERS.filter((c) => c.endsWith(".hook.mjs"))) {
142
147
  const offending = checkHookImports(
@@ -148,12 +153,12 @@ const loaded = await Promise.all(
148
153
  offending.length === 0,
149
154
  );
150
155
  }
151
- }
156
+ });
152
157
 
153
158
  // ── IV. COMPLETENESS OF THE LIST: IS THERE A SIXTH CARRIER ─────────────────────────────────
154
159
  // The subject of this check is not the value but the EXISTENCE of a file the list doesn't know
155
160
  // about.
156
- {
161
+ it("IV. COMPLETENESS OF THE LIST: IS THERE A SIXTH CARRIER", () => {
157
162
  const skip = new Set([
158
163
  "node_modules",
159
164
  ".git",
@@ -189,7 +194,7 @@ const loaded = await Promise.all(
189
194
  "and the search itself is not empty — otherwise it is searching the wrong place, and its zero reads as all-clear",
190
195
  found.length > 0,
191
196
  );
192
- }
197
+ });
193
198
 
194
199
  // ── SETTINGS_KEYS against every reader of the settings ─────────────────────────────────────
195
200
  // The settings object has readers all over the package, each reading its own keys, and the CLI
@@ -197,7 +202,7 @@ const loaded = await Promise.all(
197
202
  // consumer's valid key is refused — and nothing no one reads. The readers are FOUND, by the AST:
198
203
  // every `settingsOf(root)?.<key>` (and the older `[CONFIG_KEY]?.<key>` shape), plus every field of
199
204
  // `PaperlintConfig` and `PaperSettings`, the typed views of the root's and a paper's object.
200
- {
205
+ it("SETTINGS_KEYS against every reader of the settings", async () => {
201
206
  const { SETTINGS_KEYS } = await import(join(HERE, "paper-config.ts"));
202
207
  const ts = (await import("typescript")).default;
203
208
  const readKeys = new Set();
@@ -256,10 +261,10 @@ const loaded = await Promise.all(
256
261
  readKeys.has(k),
257
262
  ),
258
263
  );
259
- }
264
+ });
260
265
 
261
266
  // ── the two readers' fallbacks: no marker anywhere up the tree, and JSON that is not an object ──
262
- {
267
+ it("the two readers' fallbacks: no marker anywhere up the tree, and JSON that is not an object", async () => {
263
268
  const { findProjectRoot, settingsOf } = await import(
264
269
  join(HERE, "paper-config.ts")
265
270
  );
@@ -280,8 +285,4 @@ const loaded = await Promise.all(
280
285
  } finally {
281
286
  rmSync(dir, { recursive: true, force: true });
282
287
  }
283
- }
284
-
285
- console.log(
286
- `✓ ${check.count} assertions passed — one source for the consumer's config key`,
287
- );
288
+ });
@@ -21,7 +21,7 @@ import { dirname, join, resolve } from "node:path";
21
21
  /**
22
22
  * The tool's name. Its settings file is named after it (`CONFIG_FILE`), its messages start with it,
23
23
  * and the hooks resolve their scripts through it. It equals the package name, and
24
- * `lib/paper-config.harness.mjs` checks that.
24
+ * `lib/paper-config.test.mjs` checks that.
25
25
  */
26
26
  export const CONFIG_KEY: string = "paperlint";
27
27
 
@@ -108,7 +108,7 @@ export const DEFAULT_PAPERS_ROOT: string = "papers";
108
108
  * This is the one place the name is spelled. Code reads the field as
109
109
  * `settings[PAPERS_DIR_FIELD]`, never by a literal, so renaming it again is a one-line change
110
110
  * here. The three hooks cannot import this module, so they keep their own copy, and
111
- * `lib/paper-config.harness.mjs` checks that every copy matches this one.
111
+ * `lib/paper-config.test.mjs` checks that every copy matches this one.
112
112
  */
113
113
  export const PAPERS_DIR_FIELD: string = "papersDir";
114
114
 
@@ -117,7 +117,7 @@ export const PAPERS_DIR_FIELD: string = "papersDir";
117
117
  * A key not listed here is REFUSED with its name, because a typo in a key otherwise reads as "not
118
118
  * set". The keys in `ROOT_ONLY_KEYS` describe the whole project and are refused in a paper's file.
119
119
  *
120
- * 🔴 ONE LIST, AND IT IS CHECKED AGAINST THE READERS, NOT TRUSTED. `lib/paper-config.harness.mjs`
120
+ * 🔴 ONE LIST, AND IT IS CHECKED AGAINST THE READERS, NOT TRUSTED. `lib/paper-config.test.mjs`
121
121
  * walks the package's source, finds every `settingsOf(…)?.<key>` read and every field of
122
122
  * `PaperlintConfig`, and requires each to be here — so a new reader that forgets this list turns
123
123
  * the harness red before a consumer's config does.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * skill-trigger-cases.harness.mjs — the carrier that lets a consumer add its OWN trigger cases
2
+ * skill-trigger-cases-carrier.test.mjs — the carrier that lets a consumer add its OWN trigger cases
3
3
  * without either side forking the table.
4
4
  *
5
5
  * WHY THIS FILE EXISTS. The case table used to be one list in the consumer's `.claude/lib/`,
@@ -12,8 +12,6 @@
12
12
  * precision silently becomes recall, with a number that still prints and still looks plausible.
13
13
  * So "the consumer's cases must come back" is asserted here, and so is "and the package must not
14
14
  * be holding them itself".
15
- *
16
- * Run: `npx vigiles test lib/skill-trigger-cases.harness.mjs`
17
15
  */
18
16
  import assert from "node:assert/strict";
19
17
  import { execFileSync } from "node:child_process";
@@ -21,18 +19,11 @@ import { mkdtempSync, writeFileSync, mkdirSync, realpathSync } from "node:fs";
21
19
  import { tmpdir } from "node:os";
22
20
  import { dirname, join } from "node:path";
23
21
  import { fileURLToPath } from "node:url";
24
- import { assertPromptDiversity, recordCheck } from "vigiles";
22
+ import { assertPromptDiversity } from "vigiles";
23
+ import { it } from "vitest";
25
24
  import { CASES, BY_SKILL, irrelevantFor } from "./skill-trigger-cases.mjs";
26
25
 
27
26
  const HERE = dirname(fileURLToPath(import.meta.url));
28
- const failures = [];
29
- const soft = (label, fn) => {
30
- try {
31
- fn();
32
- } catch (e) {
33
- failures.push(`${label}: ${e.message}`);
34
- }
35
- };
36
27
 
37
28
  /**
38
29
  * Load the module in a child process whose CONSUMER ROOT is `root`, and report what happened.
@@ -77,13 +68,13 @@ const LOCAL_ONE = `export const CASES = [{
77
68
 
78
69
  // ── I. The package's own table ───────────────────────────────────────────────
79
70
  // ⚠️ «THE TABLE CARRIES NO PRIVATE TOKEN» IS NOT ASSERTED HERE, AND THAT IS DELIBERATE.
80
- // `eslint-rules/papers.harness.mjs` part IV already walks every source file in this package for
71
+ // `eslint-rules/papers.test.mjs` part IV already walks every source file in this package for
81
72
  // them, and it is the ONLY file allowed to spell them — a second copy of the denylist would be a
82
73
  // second truth, and it would have to spell the words to check for them, which is precisely what
83
74
  // the guard forbids. Measured 2026-09-12: an earlier draft of this file did carry its own copy,
84
75
  // and part IV failed it. The guard caught its own duplicate, which is the behaviour wanted.
85
76
 
86
- soft("I. every case is shaped and every collider resolves", () => {
77
+ it("I. every case is shaped and every collider resolves", () => {
87
78
  for (const c of CASES) {
88
79
  assert.equal(typeof c.skill, "string", `a case has no skill name`);
89
80
  assert.ok(
@@ -101,7 +92,7 @@ soft("I. every case is shaped and every collider resolves", () => {
101
92
  // 🔴 THE ASSERTION THE SPLIT EXISTS FOR. Not "the table is non-empty" — that survives losing every
102
93
  // collider. This one fails the moment a collider goes missing, because the false-positive set it
103
94
  // builds from goes empty, which is the silent turn from precision into recall.
104
- soft("I. irrelevantFor still yields a full set for a one-collider case", () => {
95
+ it("I. irrelevantFor still yields a full set for a one-collider case", () => {
105
96
  const one = CASES.find((c) => c.collides.length === 1);
106
97
  assert.ok(one, "no one-collider case left to check the slicing against");
107
98
  assert.equal(
@@ -115,41 +106,35 @@ soft("I. irrelevantFor still yields a full set for a one-collider case", () => {
115
106
  // measured: the case reads as "must not take X's requests" and no request of X's is ever sent.
116
107
  // `irrelevantFor` used to cut the set at four, so a case with more than four colliders silently
117
108
  // lost the rest — grade-paper-writing, which names seven, lost three (2026-10-13).
118
- soft(
119
- "I. every collider of every case contributes to its irrelevant set",
120
- () => {
121
- for (const c of CASES) {
122
- const got = new Set(irrelevantFor(c.skill));
123
- const silent = c.collides.filter(
124
- (sib) => !BY_SKILL.get(sib).prompts.some((p) => got.has(p)),
125
- );
126
- assert.deepEqual(silent, [], `${c.skill}: colliders never measured`);
127
- }
128
- },
129
- );
109
+ it("I. every collider of every case contributes to its irrelevant set", () => {
110
+ for (const c of CASES) {
111
+ const got = new Set(irrelevantFor(c.skill));
112
+ const silent = c.collides.filter(
113
+ (sib) => !BY_SKILL.get(sib).prompts.some((p) => got.has(p)),
114
+ );
115
+ assert.deepEqual(silent, [], `${c.skill}: colliders never measured`);
116
+ }
117
+ });
130
118
 
131
119
  // The paid tier refuses a set that is too small or near-duplicate (vigiles' diversity pre-flight,
132
120
  // run by `measureTriggerRate` on both sides) — but only when someone pays to run it. The same gate,
133
121
  // with the same options `lib/skill-eval-kit.mjs` passes, decided here for free on every push.
134
- soft(
135
- "I. every case would pass the paid tier's prompt-diversity pre-flight",
136
- () => {
137
- for (const c of CASES) {
138
- assertPromptDiversity(c.prompts, {
139
- minPrompts: 4,
140
- label: `${c.skill} prompts`,
141
- });
142
- assertPromptDiversity(irrelevantFor(c.skill), {
143
- minPrompts: 4,
144
- label: `${c.skill} irrelevantPrompts`,
145
- });
146
- }
147
- },
148
- );
122
+ it("I. every case would pass the paid tier's prompt-diversity pre-flight", () => {
123
+ for (const c of CASES) {
124
+ assertPromptDiversity(c.prompts, {
125
+ minPrompts: 4,
126
+ label: `${c.skill} prompts`,
127
+ });
128
+ assertPromptDiversity(irrelevantFor(c.skill), {
129
+ minPrompts: 4,
130
+ label: `${c.skill} irrelevantPrompts`,
131
+ });
132
+ }
133
+ });
149
134
 
150
135
  // A prompt listed under two skills says it must fire both, and each case's precision run then
151
136
  // counts the other's correct answer as a false positive.
152
- soft("I. no prompt is claimed by two cases", () => {
137
+ it("I. no prompt is claimed by two cases", () => {
153
138
  const owners = new Map();
154
139
  for (const c of CASES)
155
140
  for (const p of c.prompts)
@@ -159,20 +144,17 @@ soft("I. no prompt is claimed by two cases", () => {
159
144
  });
160
145
 
161
146
  // ── II. The carrier, all four states ─────────────────────────────────────────
162
- soft(
163
- "II. undeclared and absent is SILENT — a consumer with no skills of its own",
164
- () => {
165
- const out = loadAt(fixture(null, null));
166
- assert.match(out, /^OK \d+$/, `expected a clean load, got: ${out}`);
167
- assert.equal(
168
- Number(out.slice(3)),
169
- CASES.length,
170
- "the package table changed size with no input",
171
- );
172
- },
173
- );
147
+ it("II. undeclared and absent is SILENT — a consumer with no skills of its own", () => {
148
+ const out = loadAt(fixture(null, null));
149
+ assert.match(out, /^OK \d+$/, `expected a clean load, got: ${out}`);
150
+ assert.equal(
151
+ Number(out.slice(3)),
152
+ CASES.length,
153
+ "the package table changed size with no input",
154
+ );
155
+ });
174
156
 
175
- soft("II. the DEFAULT path is picked up without any declaration", () => {
157
+ it("II. the DEFAULT path is picked up without any declaration", () => {
176
158
  const out = loadAt(fixture(null, LOCAL_ONE));
177
159
  assert.equal(
178
160
  out,
@@ -184,7 +166,7 @@ soft("II. the DEFAULT path is picked up without any declaration", () => {
184
166
  // ⚠️ DECLARED-AND-MISSING vs UNDECLARED-AND-MISSING is the whole point of the distinction, and it
185
167
  // is the same one `scriptsRoot()` draws: a path someone typed is a keystroke away from being wrong,
186
168
  // and substituting silence for it hides the typo behind a working run.
187
- soft("II. declared and missing THROWS, naming the declaration", () => {
169
+ it("II. declared and missing THROWS, naming the declaration", () => {
188
170
  const out = loadAt(fixture({ triggerCases: "nope.mjs" }, null));
189
171
  assert.match(out, /^THROW /, `a typoed declaration loaded quietly: ${out}`);
190
172
  assert.match(
@@ -194,7 +176,7 @@ soft("II. declared and missing THROWS, naming the declaration", () => {
194
176
  );
195
177
  });
196
178
 
197
- soft("II. a consumer may not redefine a case this package owns", () => {
179
+ it("II. a consumer may not redefine a case this package owns", () => {
198
180
  const clash = `export const CASES = [{ skill: "${CASES[0].skill}", why: "x", prompts: ["a","b","c","d"], collides: [] }];\n`;
199
181
  const out = loadAt(fixture(null, clash));
200
182
  assert.match(out, /^THROW /, `a shadowing case was accepted: ${out}`);
@@ -205,66 +187,47 @@ soft("II. a consumer may not redefine a case this package owns", () => {
205
187
  );
206
188
  });
207
189
 
208
- soft(
209
- "II. a declaration that is not a non-empty string THROWS, naming what it got",
210
- () => {
211
- for (const [declared, shown] of [
212
- ["", '""'],
213
- [7, "7"],
214
- ]) {
215
- const out = loadAt(fixture({ triggerCases: declared }, null));
216
- assert.equal(
217
- out,
218
- `THROW paperlint: "triggerCases" must be a non-empty string, got ${shown}`,
219
- );
220
- }
221
- },
222
- );
190
+ it("II. a declaration that is not a non-empty string THROWS, naming what it got", () => {
191
+ for (const [declared, shown] of [
192
+ ["", '""'],
193
+ [7, "7"],
194
+ ]) {
195
+ const out = loadAt(fixture({ triggerCases: declared }, null));
196
+ assert.equal(
197
+ out,
198
+ `THROW paperlint: "triggerCases" must be a non-empty string, got ${shown}`,
199
+ );
200
+ }
201
+ });
223
202
 
224
- soft(
225
- "II. a default-location file that does not load THROWS, saying it is the default",
226
- () => {
227
- for (const broken of [
228
- "export const CASES = [\n",
229
- 'throw "not an Error";\n',
230
- ]) {
231
- const out = loadAt(fixture(null, broken));
232
- assert.match(out, /^THROW .*could not load the consumer's trigger cases/);
233
- assert.match(
234
- out,
235
- /\(the default location; declare another in paperlint\.json/,
236
- );
237
- }
238
- },
239
- );
203
+ it("II. a default-location file that does not load THROWS, saying it is the default", () => {
204
+ for (const broken of [
205
+ "export const CASES = [\n",
206
+ 'throw "not an Error";\n',
207
+ ]) {
208
+ const out = loadAt(fixture(null, broken));
209
+ assert.match(out, /^THROW .*could not load the consumer's trigger cases/);
210
+ assert.match(
211
+ out,
212
+ /\(the default location; declare another in paperlint\.json/,
213
+ );
214
+ }
215
+ });
240
216
 
241
- soft("II. a cases file whose CASES is not an array THROWS", () => {
217
+ it("II. a cases file whose CASES is not an array THROWS", () => {
242
218
  const out = loadAt(fixture(null, "export const CASES = {};\n"));
243
219
  assert.match(out, /^THROW .* must export an array named CASES$/);
244
220
  });
245
221
 
246
- soft(
247
- "II. irrelevantFor refuses an unknown skill, and a collider that names one",
248
- () => {
249
- assert.throws(
250
- () => irrelevantFor("no-such-skill"),
251
- /^Error: unknown skill: no-such-skill$/,
252
- );
253
- const ghost = `export const CASES = [{ skill: "local-x", why: "x", prompts: ["a","b","c","d"], collides: ["ghost"] }];\n`;
254
- const out = loadAt(
255
- fixture(null, ghost),
256
- `m.irrelevantFor("local-x"); console.log("OK")`,
257
- );
258
- assert.equal(out, 'THROW local-x collides with unknown skill "ghost"');
259
- },
260
- );
261
-
262
- if (failures.length) {
263
- console.error(`${failures.length} assertion(s) failed:`);
264
- for (const f of failures) console.error(` ✗ ${f}`);
265
- process.exit(1);
266
- }
267
- console.log(
268
- `trigger-case carrier: ${CASES.length} package case(s), consumer merge in every state ✓`,
269
- );
270
- recordCheck();
222
+ it("II. irrelevantFor refuses an unknown skill, and a collider that names one", () => {
223
+ assert.throws(
224
+ () => irrelevantFor("no-such-skill"),
225
+ /^Error: unknown skill: no-such-skill$/,
226
+ );
227
+ const ghost = `export const CASES = [{ skill: "local-x", why: "x", prompts: ["a","b","c","d"], collides: ["ghost"] }];\n`;
228
+ const out = loadAt(
229
+ fixture(null, ghost),
230
+ `m.irrelevantFor("local-x"); console.log("OK")`,
231
+ );
232
+ assert.equal(out, 'THROW local-x collides with unknown skill "ghost"');
233
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "20.1.1",
3
+ "version": "20.1.2",
4
4
  "description": "A linter for scientific papers written in LaTeX: catches mistakes before you submit to a conference or journal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "ts-essentials": "^10.2.1",
48
48
  "typescript": "^6.0.3",
49
49
  "unpdf": "^1.8.1",
50
- "vigiles": "^42.2.0",
50
+ "vigiles": "^49.1.0",
51
51
  "zod": "^4.6.5"
52
52
  },
53
53
  "devDependencies": {
@@ -120,7 +120,7 @@
120
120
  ".github",
121
121
  "CLAUDE.md",
122
122
  "CONTRIBUTING.md",
123
- "action.harness.mjs",
123
+ "action.test.mjs",
124
124
  "action.yml",
125
125
  "bin",
126
126
  "dist",
@@ -50,7 +50,7 @@
50
50
  // acm-sigconf.jsonc, so acm-sigconf's list, for the same reasons (see the comments there: acmart
51
51
  // falls back to Computer Modern in silence when libertine, inconsolata or newtx is missing).
52
52
  // pbalance, filehook and zref are kept although acmsmall's one column never loads them:
53
- // src/tex-requirements.harness.ts holds every preset on one template to ONE list, so two lists
53
+ // src/tex-requirements-tables.test.ts holds every preset on one template to ONE list, so two lists
54
54
  // for acmart cannot drift apart, and the toolchain installs acm-sigconf's anyway. Measured
55
55
  // 2026-11-19: every file the two acmsmall builds above
56
56
  // read (247, from pdflatex's -recorder list) belongs to a package of TeX Live's scheme-basic, of