paperlint 20.1.1 → 20.2.0

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 (126) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +7 -0
  3. package/CLAUDE.md +6 -2
  4. package/CONTRIBUTING.md +2 -2
  5. package/{action.harness.mjs → action.test.mjs} +147 -138
  6. package/dist/adapters/venue-corpus/index.d.ts +345 -0
  7. package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
  8. package/dist/adapters/venue-corpus/index.js +205 -0
  9. package/dist/adapters/venue-corpus/index.js.map +1 -0
  10. package/dist/domain/licence.d.ts +51 -0
  11. package/dist/domain/licence.d.ts.map +1 -0
  12. package/dist/domain/licence.js +61 -0
  13. package/dist/domain/licence.js.map +1 -0
  14. package/dist/domain/venue-corpus.d.ts +120 -0
  15. package/dist/domain/venue-corpus.d.ts.map +1 -0
  16. package/dist/domain/venue-corpus.js +13 -0
  17. package/dist/domain/venue-corpus.js.map +1 -0
  18. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
  19. package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
  20. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
  21. package/dist/eslint-rules/papers.js +1 -1
  22. package/dist/latex-log.d.ts +1 -1
  23. package/dist/latex-log.js +1 -1
  24. package/dist/latex-loop.d.ts +1 -1
  25. package/dist/latex-loop.js +1 -1
  26. package/dist/lib/paper-config.d.ts +3 -3
  27. package/dist/lib/paper-config.js +3 -3
  28. package/dist/ports/venue-corpus-codec.d.ts +11 -0
  29. package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
  30. package/dist/ports/venue-corpus-codec.js +2 -0
  31. package/dist/ports/venue-corpus-codec.js.map +1 -0
  32. package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
  33. package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
  34. package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
  35. package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
  36. package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
  37. package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
  38. package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
  39. package/docs/design/venue-corpus.md +250 -0
  40. package/docs/e2e.md +9 -9
  41. package/docs/testing.md +3 -4
  42. package/docs/venues.md +144 -21
  43. package/eslint-rules/CLAUDE.md +5 -1
  44. package/eslint-rules/CLAUDE.md.spec.ts +3 -0
  45. package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
  46. package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
  47. package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
  48. package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
  49. package/eslint-rules/papers.ts +1 -1
  50. package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
  51. package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
  52. package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
  53. package/eslint.config.mjs +15 -2
  54. package/fixtures/pdf-facts/README.md +1 -1
  55. package/fixtures/render-paper/build-clean.sh +1 -1
  56. package/fixtures/toolchain-mirror/install-tl +1 -1
  57. package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
  58. package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
  59. package/lib/paper-config.ts +3 -3
  60. package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
  61. package/package.json +4 -3
  62. package/presets/acm-acmsmall.jsonc +1 -1
  63. package/scripts/bundle-skills.ts +1 -0
  64. package/scripts/check-workflow.test.ts +368 -0
  65. package/scripts/check.ts +2 -2
  66. package/scripts/eslint-file-length.mjs +9 -9
  67. package/scripts/eslint-report-guard.mjs +1 -1
  68. package/scripts/eslint-report-guard.test.mjs +1 -1
  69. package/scripts/harness-api.test.ts +7 -46
  70. package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
  71. package/scripts/rules-see-files.mjs +1 -1
  72. package/scripts/venue-corpus-schema.test.ts +39 -0
  73. package/scripts/venue-corpus-schema.ts +17 -0
  74. package/skills/argument-arc/scripts/headings.js +6 -4
  75. package/skills/cold-read-diff/scripts/cold-read.js +6 -4
  76. package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
  77. package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
  78. package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
  79. package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
  80. package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
  81. package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
  82. package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
  83. package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
  84. package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
  85. package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
  86. package/skills/study-accepted-papers/SKILL.md +28 -2
  87. package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -1
  88. package/skills/study-accepted-papers/papers.schema.json +427 -0
  89. package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
  90. package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +302 -0
  91. package/skills/study-accepted-papers/scripts/corpus-licences.js +383 -0
  92. package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +485 -0
  93. package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
  94. package/skills/verify-citations/scripts/bib-authors.js +6 -5
  95. package/skills/verify-citations/scripts/verify-cites.js +6 -5
  96. package/src/adapters/pdfjs/fill.test.ts +1 -1
  97. package/src/adapters/venue-corpus/index.test.ts +279 -0
  98. package/src/adapters/venue-corpus/index.ts +286 -0
  99. package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
  100. package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
  101. package/src/{cli.harness.mjs → cli-e2e.test.mjs} +108 -102
  102. package/src/cli.test.ts +1 -1
  103. package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
  104. package/src/domain/licence.test.ts +122 -0
  105. package/src/domain/licence.ts +95 -0
  106. package/src/domain/venue-corpus.ts +130 -0
  107. package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
  108. package/src/facts-file.test.ts +1 -1
  109. package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
  110. package/src/latex-log.test.ts +395 -0
  111. package/src/latex-log.ts +1 -1
  112. package/src/latex-loop.test.ts +553 -0
  113. package/src/latex-loop.ts +1 -1
  114. package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
  115. package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
  116. package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
  117. package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
  118. package/src/ports/venue-corpus-codec.ts +11 -0
  119. package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
  120. package/src/{structure.harness.ts → structure.test.ts} +12 -10
  121. package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
  122. package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
  123. package/scripts/check.harness.ts +0 -343
  124. package/scripts/harness-api.frozen.json +0 -41
  125. package/src/latex-log.harness.ts +0 -382
  126. package/src/latex-loop.harness.ts +0 -515
@@ -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
+ });
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Colocated test for `eslint-rules/papers.mjs`.
3
- * Run: `npx vigiles test eslint-rules/papers.harness.mjs`
4
3
  *
5
4
  * FOUR PARTS:
6
5
  * I. THE DEFAULT AND THE DECLARATION — the two ways a root is chosen.
@@ -13,10 +12,10 @@
13
12
  * in this package. This is the assertion that makes the package reusable, and it is the
14
13
  * one that will fail first when someone "just hard-codes it for now".
15
14
  *
16
- * 🔴 Assertions live at MODULE TOP LEVEL: `vigiles test` imports the file and treats "it did
17
- * not throw" as success; an exported `tests` object is run by nothing.
15
+ * Each part is one vitest `it`; an assertion that throws fails it.
18
16
  */
19
17
  import assert from "node:assert/strict";
18
+ import { afterAll, it, vi } from "vitest";
20
19
  import { PAPERS_DIR_FIELD } from "../lib/paper-config.ts";
21
20
  import {
22
21
  mkdirSync,
@@ -33,13 +32,16 @@ import { fileURLToPath } from "node:url";
33
32
 
34
33
  import { DEFAULT_PAPERS_ROOT, paperFiles, papersRoot } from "./papers.ts";
35
34
 
35
+ // Several tests here run real ESLint, spawn processes or walk the repository.
36
+ vi.setConfig({ testTimeout: 120_000 });
37
+
36
38
  const HERE = dirname(fileURLToPath(import.meta.url));
37
39
  const ROOT = join(HERE, "..");
38
40
 
39
41
  const TMP = realpathSync(mkdtempSync(join(tmpdir(), "papers-root-")));
40
42
  // Registered immediately, not at the end: assertions throw, and cleanup at the bottom of a
41
43
  // file never runs in exactly the runs that are red.
42
- process.on("exit", () => rmSync(TMP, { recursive: true, force: true }));
44
+ afterAll(() => rmSync(TMP, { recursive: true, force: true }));
43
45
 
44
46
  /** A throwaway repository with the given directories already on disk. */
45
47
  const repoWith = (...dirs) => {
@@ -53,7 +55,7 @@ const declaring = (papers) => ({ [PAPERS_DIR_FIELD]: papers });
53
55
  // ═════════════════════════════════════════════════════════════════════════════
54
56
  // I. THE DEFAULT AND THE DECLARATION
55
57
  // ═════════════════════════════════════════════════════════════════════════════
56
- {
58
+ it("I. THE DEFAULT AND THE DECLARATION: a consumer that declares nothing gets the default", () => {
57
59
  const repo = repoWith(DEFAULT_PAPERS_ROOT);
58
60
  for (const [label, pkg] of [
59
61
  ["no paperlint.json at all", undefined],
@@ -65,18 +67,25 @@ const declaring = (papers) => ({ [PAPERS_DIR_FIELD]: papers });
65
67
  DEFAULT_PAPERS_ROOT,
66
68
  `${label}: a consumer that declares nothing must get the default "${DEFAULT_PAPERS_ROOT}"`,
67
69
  );
68
- }
70
+ });
69
71
 
70
72
  // A declared root wins, including a nested one — the first consumer's is two levels deep, and
71
73
  // a helper that only handled a single path segment would work on every fixture and fail there.
72
- for (const declared of ["papers", "docs/papers", "writing/drafts", "a/b/c/d"]) {
73
- const repo = repoWith(declared);
74
- assert.equal(
75
- papersRoot(declaring(declared), repo),
76
- declared,
77
- `a declared root must be returned as declared: ${declared}`,
78
- );
79
- }
74
+ it("I. THE DEFAULT AND THE DECLARATION: a declared root wins, including a nested one", () => {
75
+ for (const declared of [
76
+ "papers",
77
+ "docs/papers",
78
+ "writing/drafts",
79
+ "a/b/c/d",
80
+ ]) {
81
+ const repo = repoWith(declared);
82
+ assert.equal(
83
+ papersRoot(declaring(declared), repo),
84
+ declared,
85
+ `a declared root must be returned as declared: ${declared}`,
86
+ );
87
+ }
88
+ });
80
89
 
81
90
  // ═════════════════════════════════════════════════════════════════════════════
82
91
  // II. THE REFUSALS — and the message each one carries
@@ -84,7 +93,7 @@ for (const declared of ["papers", "docs/papers", "writing/drafts", "a/b/c/d"]) {
84
93
  // 🔴 THE CENTRAL ONE. A root that is not on disk must STOP the config from loading, because
85
94
  // the alternative is not "wrong findings" but NO findings — and a run with no findings is
86
95
  // byte-identical to a run that checked everything and passed.
87
- {
96
+ it("II. THE REFUSALS: a root that is not on disk stops the config from loading", () => {
88
97
  const repo = repoWith("somewhere-else");
89
98
  assert.throws(
90
99
  () => papersRoot(declaring("writing/drafts"), repo),
@@ -114,16 +123,18 @@ for (const declared of ["papers", "docs/papers", "writing/drafts", "a/b/c/d"]) {
114
123
  e.message.includes(`{ "${PAPERS_DIR_FIELD}": "path/to/papers" }`),
115
124
  "a missing root reached by DEFAULTING must say so and show the declaration to add",
116
125
  );
117
- }
126
+ });
118
127
 
119
128
  // Shapes that are present but unusable. Left unchecked, `""` is the worst of them: it makes
120
129
  // every glob `"/*/paper.tex"` — rooted at the filesystem, matching nothing, silently.
121
- for (const bad of ["", null, 0, false, [], {}, 42])
122
- assert.throws(
123
- () => papersRoot(declaring(bad), TMP),
124
- (e) => e instanceof TypeError && /non-empty string/.test(e.message),
125
- `a "papers" of ${JSON.stringify(bad)} must be refused as a type error, not coerced`,
126
- );
130
+ it("II. THE REFUSALS: shapes that are present but unusable", () => {
131
+ for (const bad of ["", null, 0, false, [], {}, 42])
132
+ assert.throws(
133
+ () => papersRoot(declaring(bad), TMP),
134
+ (e) => e instanceof TypeError && /non-empty string/.test(e.message),
135
+ `a "papers" of ${JSON.stringify(bad)} must be refused as a type error, not coerced`,
136
+ );
137
+ });
127
138
 
128
139
  // ═════════════════════════════════════════════════════════════════════════════
129
140
  // III. PROPERTIES NOBODY SEES
@@ -131,7 +142,7 @@ for (const bad of ["", null, 0, false, [], {}, 42])
131
142
  // 🔴 THE RETURNED ROOT MUST STAY RELATIVE. ESLint resolves `files:` globs against the config's
132
143
  // directory; an absolute path there is a different pattern with different behaviour, and the
133
144
  // breakage would show up as "the rule stopped matching", i.e. as silence.
134
- {
145
+ it("III. PROPERTIES NOBODY SEES: the returned root stays relative", () => {
135
146
  const repo = repoWith("writing/drafts");
136
147
  const got = papersRoot(declaring("writing/drafts"), repo);
137
148
  assert.equal(
@@ -144,14 +155,14 @@ for (const bad of ["", null, 0, false, [], {}, 42])
144
155
  false,
145
156
  "the root must not carry the base directory",
146
157
  );
147
- }
158
+ });
148
159
 
149
160
  // 🔴 `baseDir` DECIDES, NOT `process.cwd()`. This is the assertion that pins the reason the
150
161
  // parameter exists: cwd is wherever the editor, the CI step or the hook runtime happened to
151
162
  // start, and in a git worktree it can be an entirely different checkout. A helper that quietly
152
163
  // used cwd would pass every test run from the repository root and fail in exactly the setups
153
164
  // nobody runs tests in.
154
- {
165
+ it("III. PROPERTIES NOBODY SEES: baseDir decides, not process.cwd()", () => {
155
166
  const real = repoWith("writing/drafts");
156
167
  const empty = repoWith("unrelated");
157
168
  assert.equal(papersRoot(declaring("writing/drafts"), real), "writing/drafts");
@@ -161,11 +172,11 @@ for (const bad of ["", null, 0, false, [], {}, 42])
161
172
  "baseDir must be what is consulted — the same declaration must fail against a base that " +
162
173
  "does not contain the root",
163
174
  );
164
- }
175
+ });
165
176
 
166
177
  // Every glob set is derived from the root, and NONE of them is spelled out independently: a
167
178
  // set that forgot to interpolate would keep matching the previous consumer's layout.
168
- {
179
+ it("III. PROPERTIES NOBODY SEES: every glob set is derived from the root", () => {
169
180
  const sets = paperFiles("R");
170
181
  const names = Object.keys(sets).sort();
171
182
  assert.deepEqual(
@@ -194,7 +205,7 @@ for (const bad of ["", null, 0, false, [], {}, 42])
194
205
  other[name].map((g) => g.replace(/^Q\//, "")),
195
206
  `${name}: the two roots did not produce the same shapes — something is hard-coded`,
196
207
  );
197
- }
208
+ });
198
209
 
199
210
  // ═════════════════════════════════════════════════════════════════════════════
200
211
  // IV. THE ACCEPTANCE CRITERION OF THE EXTRACTION
@@ -204,7 +215,7 @@ for (const bad of ["", null, 0, false, [], {}, 42])
204
215
  // read once, a test runs every time. The forbidden word is the first consumer's own directory
205
216
  // name; it may appear ONLY in this file (as the value under test) and in prose that documents
206
217
  // the decision.
207
- {
218
+ it("IV. THE ACCEPTANCE CRITERION OF THE EXTRACTION: no consumer-specific path anywhere in this package", () => {
208
219
  // ⚠️ THE ONLY LEGITIMATE OCCURRENCE OF THIS WORD IN THE PACKAGE, and it is here out of
209
220
  // necessity: it is the SUBJECT of the assert. The fixtures above deliberately use neutral
210
221
  // paths (`writing/drafts`) — until 2026-09-12 they carried the consumer's real directory name,
@@ -252,4 +263,4 @@ for (const bad of ["", null, 0, false, [], {}, 42])
252
263
  `one possible user, which is the thing the extraction exists to undo. The root belongs ` +
253
264
  `in the consumer's package.json — see eslint-rules/papers.mjs`,
254
265
  );
255
- }
266
+ });
@@ -66,7 +66,7 @@
66
66
  * running that script has one net, not two.
67
67
  *
68
68
  * ⚠️ THE EXAMPLES IN THIS FILE ARE DELIBERATELY GENERIC (`docs/papers`), and that is ENFORCED
69
- * rather than a style preference: `papers.harness.mjs` part IV fails if the first consumer's own
69
+ * rather than a style preference: `papers.test.mjs` part IV fails if the first consumer's own
70
70
  * directory name appears anywhere in this package outside the test itself. It caught this very
71
71
  * docblock on 2026-09-11, where the example used the real value. An exemption list is what turns
72
72
  * such a check into decoration, so there is exactly one exemption: the file asserting it.
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Colocated test for `eslint-rules/pdf-last-page-balance.mjs` (`pdf/last-page-balance`).
3
- * Run: `npx vigiles test eslint-rules/pdf-last-page-balance.harness.mjs`
4
3
  *
5
4
  * The rule is driven the way a consumer drives it: through paperlint's own `buildConfig`, with the
6
5
  * rule turned on by a `rules` block in the settings — not through a config invented here. Each
@@ -24,7 +23,10 @@ import { dirname, join } from "node:path";
24
23
  import { fileURLToPath } from "node:url";
25
24
  import { ESLint } from "eslint";
26
25
  import { texLanguage } from "./latex-language.ts";
27
- import { createChecker } from "../lib/check.ts";
26
+ import { afterAll, expect, it, vi } from "vitest";
27
+
28
+ // Several tests here run real ESLint, spawn processes or walk the repository.
29
+ vi.setConfig({ testTimeout: 120_000 });
28
30
 
29
31
  const HERE = dirname(fileURLToPath(import.meta.url));
30
32
  const { parseFacts, judgeColumns, DEFAULT_TOLERANCE_PT } = await import(
@@ -32,7 +34,11 @@ const { parseFacts, judgeColumns, DEFAULT_TOLERANCE_PT } = await import(
32
34
  );
33
35
  const { buildConfig } = await import(join(HERE, "..", "src", "cli.ts"));
34
36
 
35
- const check = createChecker();
37
+ /** One soft assertion: a failed check does not stop the checks after it in the same test. */
38
+ const check = (label, cond, detail) =>
39
+ expect
40
+ .soft(cond, detail === undefined ? label : `${label}\n${detail}`)
41
+ .toBe(true);
36
42
 
37
43
  const TEX =
38
44
  "% a paper\n\\documentclass[sigconf]{acmart}\n\\begin{document}x\\end{document}\n";
@@ -93,8 +99,11 @@ async function lint(
93
99
  }
94
100
  const only = (msgs) => msgs.filter((m) => m.ruleId === "pdf/last-page-balance");
95
101
 
96
- try {
97
- // ── pure: parsing the facts and judging the columns ──────────────────────────────────
102
+ // Set by the "fires" test, read by the "quiet" one: the tests run in order.
103
+ let unb;
104
+
105
+ // ── pure: parsing the facts and judging the columns ──────────────────────────────────
106
+ it("pure: parsing the facts and judging the columns", () => {
98
107
  check(
99
108
  "parseFacts: a schema-1 file is refused by name",
100
109
  parseFacts(JSON.stringify({ schema: 1 })).messageId === "schema",
@@ -115,9 +124,11 @@ try {
115
124
  ?.messageId === "unbalanced",
116
125
  );
117
126
  check("the default tolerance is 120 pt", DEFAULT_TOLERANCE_PT === 120);
127
+ });
118
128
 
119
- // ── fires ───────────────────────────────────────────────────────────────────────────
120
- const unb = paper("unbalanced", facts(MEASURED(621.5, 264.8)));
129
+ // ── fires ───────────────────────────────────────────────────────────────────────────
130
+ it("fires", async () => {
131
+ unb = paper("unbalanced", facts(MEASURED(621.5, 264.8)));
121
132
  const u = only(await lint([join(unb, "paper.tex")]));
122
133
  check(
123
134
  "🔴 an unbalanced last page is a finding, with both heights and the difference",
@@ -179,8 +190,10 @@ try {
179
190
  "schema-1 facts are refused, not read with new meanings",
180
191
  only(await lint([join(old, "paper.tex")]))[0]?.messageId === "schema",
181
192
  );
193
+ });
182
194
 
183
- // ── the facts' optional spellings, and a paper.tex the rule cannot place the finding in ──
195
+ // ── the facts' optional spellings, and a paper.tex the rule cannot place the finding in ──
196
+ it("the facts' optional spellings, and a paper.tex the rule cannot place the finding in", async () => {
184
197
  check(
185
198
  "parseFacts: no schema at all, or JSON null, is schema `null` — named, not crashed on",
186
199
  parseFacts("{}").data?.got === "null" &&
@@ -239,8 +252,10 @@ try {
239
252
  mem.length === 1 && mem[0].line === 1 && mem[0].messageId === "unbalanced",
240
253
  JSON.stringify(fromMemory.messages),
241
254
  );
255
+ });
242
256
 
243
- // ── quiet ───────────────────────────────────────────────────────────────────────────
257
+ // ── quiet ───────────────────────────────────────────────────────────────────────────
258
+ it("quiet", async () => {
244
259
  const bal = paper("balanced", facts(MEASURED(464.2, 461.5)));
245
260
  const stub = paper("stub", facts({ kind: "stub", words: 12 }));
246
261
  const review = paper("review", facts({ kind: "review", line_numbers: 60 }));
@@ -260,10 +275,7 @@ try {
260
275
  "🔴 OFF BY DEFAULT: with no `rules` block, an unbalanced paper gets no finding",
261
276
  only(await lint([join(unb, "paper.tex")], [])).length === 0,
262
277
  );
263
- } finally {
278
+ });
279
+ afterAll(() => {
264
280
  rmSync(root, { recursive: true, force: true });
265
- }
266
-
267
- console.log(
268
- `✓ ${String(check.count)} assertions passed — pdf/last-page-balance: fires on unbalanced and unjudgeable, quiet on balanced/stub/review/off`,
269
- );
281
+ });
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * `local/temp-root-realpath` — both halves on real ESLint, plus the corpus itself.
3
3
  *
4
- * 🔴 WHY THIS HARNESS EXISTS AT ALL, rather than stopping at the twenty-four fixes. The
4
+ * 🔴 WHY THIS TEST EXISTS AT ALL, rather than stopping at the twenty-four fixes. The
5
5
  * defect (issue #9) ONLY REPRODUCES ON macOS: there `/var` is a symlink to `/private/var`,
6
6
  * and one directory gets two spellings. On Linux `realpathSync` is the identity, so no
7
7
  * behavioral test can tell a fixed root apart from a broken one: removing the wrapper leaves
8
8
  * the run GREEN. The only check that can even go red on Linux is structural: ask the AST
9
9
  * whether the root is resolved at the point it's created. That is exactly why it is written
10
- * as a linter rule and not an assert inside someone's harness.
10
+ * as a linter rule and not an assert inside someone's test.
11
11
  *
12
- * ⚠️ And a boundary, so the harness isn't mistaken for more: it asserts that the IDIOM is in
12
+ * ⚠️ And a boundary, so this test isn't mistaken for more: it asserts that the IDIOM is in
13
13
  * place, not that macOS is now green. The latter is only checked on macOS, and CI here is one
14
14
  * `ubuntu-latest` — recorded as a known limit, not papered over.
15
15
  *
@@ -19,9 +19,13 @@
19
19
  */
20
20
  import assert from "node:assert/strict";
21
21
  import { ESLint } from "eslint";
22
- import { recordCheck } from "vigiles";
22
+ import { it, vi } from "vitest";
23
23
  import localRules from "./temp-root-realpath.ts";
24
24
 
25
+ // A test here lints the whole repository: ~72 s alone, up to 224 s beside the rest of the suite
26
+ // under coverage on 4 cores (measured 2026-11-24), so the limit only catches a hang.
27
+ vi.setConfig({ testTimeout: 600_000 });
28
+
25
29
  const eslint = new ESLint({
26
30
  overrideConfigFile: true,
27
31
  overrideConfig: [
@@ -45,7 +49,7 @@ const HEAD =
45
49
  const cases = [];
46
50
 
47
51
  // ── 1. FIRES: a root from `tmpdir()` with no resolve — exactly the shape from issue #9.
48
- {
52
+ it("1. FIRES: a root from `tmpdir()` with no resolve — exactly the shape from issue #9", async () => {
49
53
  const m = await on(
50
54
  `${HEAD}const TMP = mkdtempSync(join(tmpdir(), "probe-"));\n`,
51
55
  );
@@ -68,11 +72,11 @@ const cases = [];
68
72
  cases.push(
69
73
  "mkdtempSync(join(tmpdir(), …)) with no resolve → a finding, the fix is in the message",
70
74
  );
71
- }
75
+ });
72
76
 
73
77
  // ── 2. STAYS SILENT on the fixed form. Without this half the rule is indistinguishable
74
78
  // from one that screams at every `mkdtempSync`.
75
- {
79
+ it("2. STAYS SILENT on the fixed form", async () => {
76
80
  const m = await on(
77
81
  `${HEAD}const TMP = realpathSync(mkdtempSync(join(tmpdir(), "probe-")));\n`,
78
82
  );
@@ -82,14 +86,14 @@ const cases = [];
82
86
  `the rule must stay silent on a resolved root, got: ${JSON.stringify(m)}`,
83
87
  );
84
88
  cases.push("realpathSync(mkdtempSync(join(tmpdir(), …))) → silence");
85
- }
89
+ });
86
90
 
87
91
  // ── 3. 🔴 STAYS SILENT ON A NESTED ROOT, and this is load-bearing, not a concession. The
88
92
  // corpus has five of these (`mkdtempSync(join(TMP, "repo-"))`); they inherit their
89
93
  // spelling from `TMP`, which is caught at ITS OWN spot. A rule that screamed here too
90
94
  // would demand a double resolve — and for an `error`-level rule a false positive is
91
95
  // worse than a miss: it gets turned off.
92
- {
96
+ it("3. STAYS SILENT ON A NESTED ROOT", async () => {
93
97
  const m = await on(
94
98
  `${HEAD}const TMP = realpathSync(mkdtempSync(join(tmpdir(), "probe-")));\n` +
95
99
  `const sub = mkdtempSync(join(TMP, "repo-"));\nvoid sub;\n`,
@@ -102,12 +106,12 @@ const cases = [];
102
106
  cases.push(
103
107
  "a nested mkdtempSync(join(TMP, …)) → silence (the parent is already resolved)",
104
108
  );
105
- }
109
+ });
106
110
 
107
111
  // ── 4. A COMMENT AND A STRING ARE NOT A CALL. This is exactly why the rule parses the AST: a
108
112
  // text-based guard looking for "mkdtempSync(join(tmpdir()" would find this very file and
109
113
  // would have to exclude itself — the class of check string-based checks are banned for here.
110
- {
114
+ it("4. A COMMENT AND A STRING ARE NOT A CALL", async () => {
111
115
  const m = await on(
112
116
  `${HEAD}// mkdtempSync(join(tmpdir(), "in-a-comment-"))\n` +
113
117
  `const doc = 'mkdtempSync(join(tmpdir(), "in-a-string-"))';\nvoid doc;\n`,
@@ -118,11 +122,11 @@ const cases = [];
118
122
  `text ABOUT a call is not a call; got: ${JSON.stringify(m)}`,
119
123
  );
120
124
  cases.push("the same sequence in a comment and a string → silence");
121
- }
125
+ });
122
126
 
123
127
  // ── 5. `fs.mkdtempSync` / `os.tmpdir()` through a namespace — the same thing under a
124
128
  // different spelling.
125
- {
129
+ it("5. `fs.mkdtempSync` / `os.tmpdir()` through a namespace", async () => {
126
130
  const ns =
127
131
  'import * as fs from "node:fs";\nimport * as os from "node:os";\nimport { join } from "node:path";\n';
128
132
  const bad = await on(
@@ -144,12 +148,12 @@ const cases = [];
144
148
  cases.push(
145
149
  "fs.mkdtempSync(join(os.tmpdir(), …)) is caught, fs.realpathSync(…) exempts it",
146
150
  );
147
- }
151
+ });
148
152
 
149
153
  // ── 5b. `realpathSync.native(…)` resolves too — as a bare import and through a namespace. A
150
154
  // `.native(…)` on anything else is NOT a resolve: another object, a computed member, a call
151
155
  // result, a bare `native` function. Each of those still gets its finding.
152
- {
156
+ it("5b. `realpathSync.native(…)` resolves too — as a bare import and through a namespace", async () => {
153
157
  const root = 'mkdtempSync(join(tmpdir(), "probe-"))';
154
158
  const silent = await on(
155
159
  `${HEAD}import * as fs from "node:fs";\n` +
@@ -177,11 +181,11 @@ const cases = [];
177
181
  cases.push(
178
182
  "realpathSync.native / fs.realpathSync.native exempt; keep, other.native, fs[name].native, pick().native, native do not",
179
183
  );
180
- }
184
+ });
181
185
 
182
186
  // ── 5c. The walk over the arguments survives the shapes that are not plain nodes: an array hole
183
187
  // (null) and a regex literal's `regex` object (no `type`). Neither is a `tmpdir()` call.
184
- {
188
+ it("5c. The walk over the arguments survives the shapes that are not plain nodes", async () => {
185
189
  const m = await on(
186
190
  `${HEAD}const a = mkdtempSync([, /tmp/g]);\nconst b = mkdtempSync([, /x/, tmpdir()]);\n`,
187
191
  );
@@ -193,13 +197,13 @@ const cases = [];
193
197
  cases.push(
194
198
  "an array hole and a regex literal in the arguments are walked, not mistaken",
195
199
  );
196
- }
200
+ });
197
201
 
198
202
  // ── 6. 🔴 THE CORPUS ITSELF IS CLEAN. The "silent" half on a made-up string says nothing
199
203
  // about the repository: the rule could also be silent because it was never handed a
200
204
  // single file (the recorded class — `scripts/rules-see-files.mjs`). So this check runs
201
205
  // THE RULE OVER THE REAL TREE and requires many files, zero findings.
202
- {
206
+ it("6. THE CORPUS ITSELF IS CLEAN", async () => {
203
207
  const corpus = new ESLint({ cwd: new URL("..", import.meta.url).pathname });
204
208
  const results = await corpus.lintFiles(["."]);
205
209
  const hits = results.flatMap((r) =>
@@ -218,8 +222,4 @@ const cases = [];
218
222
  `the rule was only handed ${linted} .mjs files — zero findings on an empty input is NOT cleanliness`,
219
223
  );
220
224
  cases.push(`corpus: ${linted} .mjs files, zero unresolved roots`);
221
- }
222
-
223
- recordCheck(cases.length);
224
- console.log(`local/temp-root-realpath: ${cases.length} cases:`);
225
- for (const c of cases) console.log(` ok ${c}`);
225
+ });