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.
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +7 -0
- package/CLAUDE.md +2 -2
- package/CONTRIBUTING.md +2 -2
- package/{action.harness.mjs → action.test.mjs} +147 -138
- package/dist/eslint-rules/papers.js +1 -1
- package/dist/latex-log.d.ts +1 -1
- package/dist/latex-log.js +1 -1
- package/dist/latex-loop.d.ts +1 -1
- package/dist/latex-loop.js +1 -1
- package/dist/lib/paper-config.d.ts +3 -3
- package/dist/lib/paper-config.js +3 -3
- package/docs/e2e.md +9 -9
- package/docs/testing.md +3 -4
- package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
- package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
- package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
- package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
- package/eslint-rules/papers.ts +1 -1
- package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
- package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
- package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
- package/eslint.config.mjs +15 -2
- package/fixtures/pdf-facts/README.md +1 -1
- package/fixtures/render-paper/build-clean.sh +1 -1
- package/fixtures/toolchain-mirror/install-tl +1 -1
- package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
- package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
- package/lib/paper-config.ts +3 -3
- package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
- package/package.json +3 -3
- package/presets/acm-acmsmall.jsonc +1 -1
- package/scripts/check-workflow.test.ts +368 -0
- package/scripts/check.ts +2 -2
- package/scripts/eslint-file-length.mjs +9 -9
- package/scripts/eslint-report-guard.mjs +1 -1
- package/scripts/eslint-report-guard.test.mjs +1 -1
- package/scripts/harness-api.test.ts +7 -46
- package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
- package/scripts/rules-see-files.mjs +1 -1
- package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
- package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
- package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
- package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
- package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
- package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
- package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
- package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
- package/src/adapters/pdfjs/fill.test.ts +1 -1
- package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
- package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
- package/src/{cli.harness.mjs → cli-e2e.test.mjs} +108 -102
- package/src/cli.test.ts +1 -1
- package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
- package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
- package/src/facts-file.test.ts +1 -1
- package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
- package/src/latex-log.test.ts +395 -0
- package/src/latex-log.ts +1 -1
- package/src/latex-loop.test.ts +553 -0
- package/src/latex-loop.ts +1 -1
- package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
- package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
- package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
- package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
- package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
- package/src/{structure.harness.ts → structure.test.ts} +12 -10
- package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
- package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
- package/scripts/check.harness.ts +0 -343
- package/scripts/harness-api.frozen.json +0 -41
- package/src/latex-log.harness.ts +0 -382
- package/src/latex-loop.harness.ts +0 -515
package/.github/workflows/ci.yml
CHANGED
|
@@ -465,6 +465,13 @@ jobs:
|
|
|
465
465
|
: "DIVERGE — this is the platform this job exists for");
|
|
466
466
|
'
|
|
467
467
|
|
|
468
|
+
# Shard 1 runs the harnesses (scripts/test.ts), and since vigiles 49 `--min=1` counts only
|
|
469
|
+
# files that RAN: without the agent binary all four skip and the shard fails (run 45346444793).
|
|
470
|
+
- name: the agent binary the harnesses drive
|
|
471
|
+
if: matrix.shard == 1
|
|
472
|
+
run: npm i -g @anthropic-ai/claude-code
|
|
473
|
+
timeout-minutes: 3
|
|
474
|
+
|
|
468
475
|
# Issue #9: `npm test` was red ONLY on macOS.
|
|
469
476
|
- name: npm test (macOS), shard ${{ matrix.shard }} of 2
|
|
470
477
|
run: npm test -- --shard=${{ matrix.shard }}/2
|
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- vigiles:sha256:
|
|
1
|
+
<!-- vigiles:sha256:6d6e96066c9c2e2b compiled from CLAUDE.md.spec.ts -->
|
|
2
2
|
|
|
3
3
|
# CLAUDE.md
|
|
4
4
|
|
|
@@ -46,7 +46,7 @@ Claude Code loads `add-venue` from `.claude/skills/` and Codex loads it from `.a
|
|
|
46
46
|
|
|
47
47
|
## Before leaving draft and before merge
|
|
48
48
|
|
|
49
|
-
While drafting, run `npm run test:changed` and `npm run lint`, and push `wip:` commits to the draft. `npm run test:changed` runs only the tests that import what the branch changed (109 s, measured; a change to `package.json` or the vitest config runs them all, 159 s with the report), then prints the changed files that are not at 100% coverage, with their uncovered lines: read it before leaving draft. It is a report, not a gate, because some lines are reached only by the harnesses or e2e suites it does not run (`scripts/test.ts`). Leave draft once both pass and any review asked for on the draft (a Codex review, for one) has nothing left to fix: leaving draft starts CI, every later push to the ready PR runs it again, and every gate of `npm run check` has a CI job (`scripts/check.
|
|
49
|
+
While drafting, run `npm run test:changed` and `npm run lint`, and push `wip:` commits to the draft. `npm run test:changed` runs only the tests that import what the branch changed (109 s, measured; a change to `package.json` or the vitest config runs them all, 159 s with the report), then prints the changed files that are not at 100% coverage, with their uncovered lines: read it before leaving draft. It is a report, not a gate, because some lines are reached only by the harnesses or e2e suites it does not run (`scripts/test.ts`). Leave draft once both pass and any review asked for on the draft (a Codex review, for one) has nothing left to fix: leaving draft starts CI, every later push to the ready PR runs it again, and every gate of `npm run check` has a CI job (`scripts/check-workflow.test.ts`), so CI is the gate. On red CI, fix it on the branch and push; merge on green CI at the current head. Run `npm run check` locally to debug one gate, or when `scripts/check.ts` itself changes (2026-11-08: 11 full local runs, ~127 min, each followed by a CI run that repeated it). `npm run lint` caches (`node_modules/.cache/eslint/`, 45 s → 3 s warm): a cached file is not re-judged when only a file it reads or imports changed (a preset, the build facts, an imported type), so a result that looks stale is checked with `rm -rf node_modules/.cache/eslint`; CI starts without the cache. Red first · assert the whole value · no test touches the real network · 100% coverage, no `c8 ignore`. In a container without TeX Live, only the TeX e2e gate fails, and it says so; `npx paperlint toolchain` installs it.
|
|
50
50
|
|
|
51
51
|
## Commits
|
|
52
52
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -50,7 +50,7 @@ report and listed as skipped, never counted as passed. The e2e areas also run al
|
|
|
50
50
|
Each gate's command is listed in `scripts/check.ts`; run one of them directly while iterating on
|
|
51
51
|
one rule. They are not what you run before pushing.
|
|
52
52
|
|
|
53
|
-
**The list of gates cannot quietly fall behind CI.** `scripts/check.
|
|
53
|
+
**The list of gates cannot quietly fall behind CI.** `scripts/check-workflow.test.ts` pulls the job
|
|
54
54
|
names out of `.github/workflows/ci.yml` and requires each to be either reproduced by a gate or
|
|
55
55
|
named with a reason for why it cannot be. Add a job and it goes red the same day, naming the job
|
|
56
56
|
nobody covered — verified by adding a `windows` job and watching it fail.
|
|
@@ -199,7 +199,7 @@ A venue is a **preset**, a JSONC file in `presets/`, validated by
|
|
|
199
199
|
markers is written by `npm run build && npx eslint --fix presets/` (the config loads the rule from
|
|
200
200
|
`dist/`).
|
|
201
201
|
3. **A test.** A case in `src/presets.test.ts` that `paperlint:<series>-<year>` resolves over its family with
|
|
202
|
-
the kinds you declared; `src/tex-requirements.
|
|
202
|
+
the kinds you declared; `src/tex-requirements-tables.test.ts` already checks every shipped preset
|
|
203
203
|
against the schema.
|
|
204
204
|
|
|
205
205
|
`paperlint toolchain` picks the new preset's packages up by itself, and the README and
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Run: `npx vigiles test action.harness.mjs`
|
|
2
|
+
* Test over `action.yml` and the guard it calls.
|
|
4
3
|
*
|
|
5
|
-
* 🔴 WHAT IT REFUSES TO BE. A
|
|
4
|
+
* 🔴 WHAT IT REFUSES TO BE. A test that greps `action.yml` for `--no-config-lookup` would pass
|
|
6
5
|
* on a file where the flag sits inside a comment, and would say nothing about whether the action
|
|
7
6
|
* BEHAVES. So: the YAML is read with a PARSER (`js-yaml`) and addressed as nodes, and the
|
|
8
7
|
* green-zero guard is exercised by CALLING it on fixtures — the same entry point the action calls.
|
|
@@ -11,6 +10,7 @@
|
|
|
11
10
|
* A guard only ever observed silent is indistinguishable from a dead one.
|
|
12
11
|
*/
|
|
13
12
|
import assert from "node:assert/strict";
|
|
13
|
+
import { it } from "vitest";
|
|
14
14
|
import {
|
|
15
15
|
readFileSync,
|
|
16
16
|
writeFileSync,
|
|
@@ -28,85 +28,92 @@ const HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
28
28
|
const TMP = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-action-")));
|
|
29
29
|
const action = yaml.load(readFileSync(join(HERE, "action.yml"), "utf8"));
|
|
30
30
|
|
|
31
|
-
// ── I. SHAPE, read as nodes ───────────────────────────────────────────────────────────────────
|
|
32
|
-
assert.equal(action.runs.using, "composite", "the action must be composite");
|
|
33
31
|
const names = action.runs.steps.map((s) => s.name);
|
|
34
|
-
|
|
35
|
-
action.runs.steps.length,
|
|
36
|
-
4,
|
|
37
|
-
`expected 4 steps, got ${action.runs.steps.length}: ${names}`,
|
|
38
|
-
);
|
|
32
|
+
const eslintStep = action.runs.steps.find((s) => s.name === "paperlint lint");
|
|
39
33
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
assert.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
assert.ok(hooksStep, `no hooks step among: ${names}`);
|
|
50
|
-
assert.equal(
|
|
51
|
-
hooksStep.if,
|
|
52
|
-
"inputs.check-hooks == 'true'",
|
|
53
|
-
"the hooks step runs only when asked",
|
|
54
|
-
);
|
|
55
|
-
assert.match(
|
|
56
|
-
hooksStep.run,
|
|
57
|
-
/npx paperlint doctor/,
|
|
58
|
-
"the hooks step runs `paperlint doctor`",
|
|
59
|
-
);
|
|
60
|
-
assert.equal(
|
|
61
|
-
action.runs.steps.at(-1),
|
|
62
|
-
hooksStep,
|
|
63
|
-
"the hooks step comes after the lint step, so a failing doctor never hides the lint report",
|
|
64
|
-
);
|
|
34
|
+
// ── I. SHAPE, read as nodes ───────────────────────────────────────────────────────────────────
|
|
35
|
+
it("I. SHAPE, read as nodes", () => {
|
|
36
|
+
assert.equal(action.runs.using, "composite", "the action must be composite");
|
|
37
|
+
assert.equal(
|
|
38
|
+
action.runs.steps.length,
|
|
39
|
+
4,
|
|
40
|
+
`expected 4 steps, got ${action.runs.steps.length}: ${names}`,
|
|
41
|
+
);
|
|
65
42
|
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
// `check-hooks` is OFF unless asked for, and when on it runs `paperlint doctor` — the command whose
|
|
44
|
+
// exit code (2 for partly wired or doubled hooks, src/doctor.ts) is the verdict — and nothing else.
|
|
45
|
+
const hooksInput = action.inputs["check-hooks"];
|
|
46
|
+
assert.ok(hooksInput, "the action must take a `check-hooks` input");
|
|
47
|
+
assert.equal(
|
|
48
|
+
hooksInput.default,
|
|
49
|
+
"false",
|
|
50
|
+
"`check-hooks` must default to off",
|
|
51
|
+
);
|
|
52
|
+
assert.equal(hooksInput.required, false);
|
|
53
|
+
const hooksStep = action.runs.steps.find(
|
|
54
|
+
(s) => s.name === "paperlint doctor (hooks fully wired)",
|
|
55
|
+
);
|
|
56
|
+
assert.ok(hooksStep, `no hooks step among: ${names}`);
|
|
57
|
+
assert.equal(
|
|
58
|
+
hooksStep.if,
|
|
59
|
+
"inputs.check-hooks == 'true'",
|
|
60
|
+
"the hooks step runs only when asked",
|
|
61
|
+
);
|
|
62
|
+
assert.match(
|
|
63
|
+
hooksStep.run,
|
|
64
|
+
/npx paperlint doctor/,
|
|
65
|
+
"the hooks step runs `paperlint doctor`",
|
|
66
|
+
);
|
|
67
|
+
assert.equal(
|
|
68
|
+
action.runs.steps.at(-1),
|
|
69
|
+
hooksStep,
|
|
70
|
+
"the hooks step comes after the lint step, so a failing doctor never hides the lint report",
|
|
71
|
+
);
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
assert.ok(eslintStep, `no step named "paperlint lint" among: ${names}`);
|
|
74
|
+
|
|
75
|
+
// 🔴 THE ACTION MUST CALL THE PACKAGE'S OWN CLI, NOT ESLINT. This is not tidiness: while the step
|
|
76
|
+
// invoked `npx eslint` directly it was a SECOND implementation of the same job, and it had already
|
|
77
|
+
// drifted — the directory-structure check (a paper directory with no PIPELINE-STATUS.md gets zero
|
|
78
|
+
// rules and reports clean) lives in `bin/paperlint.mjs`, so in CI it did not run at all. Any future edit
|
|
79
|
+
// that reaches past the CLI reintroduces exactly that gap, silently and greenly.
|
|
80
|
+
assert.match(
|
|
81
|
+
eslintStep.run,
|
|
82
|
+
/npx paperlint lint/,
|
|
83
|
+
"the lint step must call this package's own CLI — invoking eslint directly bypasses the settings and the structure check",
|
|
84
|
+
);
|
|
85
|
+
assert.doesNotMatch(
|
|
86
|
+
eslintStep.run,
|
|
87
|
+
/npx eslint/,
|
|
88
|
+
"the lint step must not invoke eslint directly — that is the bypass this step was fixed to remove",
|
|
89
|
+
);
|
|
90
|
+
// `--no-config-lookup` is deliberately absent and is NOT missing: the CLI builds its config with
|
|
91
|
+
// `overrideConfigFile: true`, so a consumer's nested config cannot reach the run. The guarantee
|
|
92
|
+
// moved from a flag into the code — assert the code, not the flag.
|
|
93
|
+
//
|
|
94
|
+
// 🔴 AND ASSERT IT IN THE FILE THAT HOLDS IT. This read said `bin/paperlint.mjs` until the CLI moved to
|
|
95
|
+
// TypeScript; `bin/paperlint.mjs` is now a loader shim and contains no such call, so the assertion went
|
|
96
|
+
// red on a move that changed no behaviour. That redness is the point — the same assertion written
|
|
97
|
+
// as a grep over "the CLI" would have kept passing against whichever file still matched, which is
|
|
98
|
+
// how a check quietly stops watching its subject.
|
|
99
|
+
assert.match(
|
|
100
|
+
readFileSync(new URL("./src/cli.ts", import.meta.url), "utf8"),
|
|
101
|
+
/overrideConfigFile:\s*true/,
|
|
102
|
+
"the CLI must pin its own config, or a consumer's nested config silently changes the rule set",
|
|
103
|
+
);
|
|
104
|
+
// The redirect into a report file is only sound while `--json` keeps stdout clean.
|
|
105
|
+
assert.match(
|
|
106
|
+
eslintStep.run,
|
|
107
|
+
/--json > "\$RUNNER_TEMP\/paperlint-report\.json"/,
|
|
108
|
+
"the machine-readable report must be redirected whole — it is what the guard reads",
|
|
109
|
+
);
|
|
110
|
+
// The guard must be CALLED, and by file — an inline blob would be untestable.
|
|
111
|
+
assert.match(
|
|
112
|
+
eslintStep.run,
|
|
113
|
+
/eslint-report-guard\.mjs/,
|
|
114
|
+
"the lint step must hand its report to scripts/eslint-report-guard.mjs",
|
|
115
|
+
);
|
|
116
|
+
});
|
|
110
117
|
// ── I-b. THE STEP'S SHELL SEMANTICS, EXECUTED — not grepped ───────────────────────────────────
|
|
111
118
|
//
|
|
112
119
|
// 🔴 THE ASSERTION THAT STOOD HERE READ THE TEXT (`/RC=\$\?/`) AND WAS GREEN OVER A DEAD ERROR
|
|
@@ -153,7 +160,7 @@ const stubbedStepRun = (stubRc, paths = ".") => {
|
|
|
153
160
|
};
|
|
154
161
|
|
|
155
162
|
// FIRES-THROUGH: ESLint failed. This is the case the old text assertion could not see.
|
|
156
|
-
{
|
|
163
|
+
it("FIRES-THROUGH: ESLint failed, the guard still runs and the code comes through", () => {
|
|
157
164
|
const r = stubbedStepRun(2);
|
|
158
165
|
assert.match(
|
|
159
166
|
r.stdout,
|
|
@@ -165,9 +172,9 @@ const stubbedStepRun = (stubRc, paths = ".") => {
|
|
|
165
172
|
2,
|
|
166
173
|
"ESLint's failure code must come through the guard, not be masked to 1",
|
|
167
174
|
);
|
|
168
|
-
}
|
|
175
|
+
});
|
|
169
176
|
// QUIET HALF: ESLint succeeded — the guard runs and passes 0 through.
|
|
170
|
-
{
|
|
177
|
+
it("QUIET HALF: ESLint succeeded, the guard runs and passes 0 through", () => {
|
|
171
178
|
const r = stubbedStepRun(0);
|
|
172
179
|
assert.match(
|
|
173
180
|
r.stdout,
|
|
@@ -175,43 +182,47 @@ const stubbedStepRun = (stubRc, paths = ".") => {
|
|
|
175
182
|
"the guard must run on success too",
|
|
176
183
|
);
|
|
177
184
|
assert.equal(r.status, 0, "a clean run must stay green");
|
|
178
|
-
}
|
|
185
|
+
});
|
|
179
186
|
|
|
180
187
|
// texcount is checked for EXISTENCE, not by the installer's exit code: an installer can put nothing
|
|
181
188
|
// in place and report success (measured in this corpus, 2026-09-01).
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
assert.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
it("texcount is checked for existence, and the action takes its inputs", () => {
|
|
190
|
+
const pathStep = action.runs.steps.find((s) => /on PATH/i.test(s.name ?? ""));
|
|
191
|
+
assert.ok(pathStep, `no step verifying texcount is on PATH among: ${names}`);
|
|
192
|
+
assert.match(
|
|
193
|
+
pathStep.run,
|
|
194
|
+
/command -v texcount/,
|
|
195
|
+
"the PATH step must probe the binary itself",
|
|
196
|
+
);
|
|
189
197
|
|
|
190
|
-
for (const key of [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
])
|
|
197
|
-
|
|
198
|
+
for (const key of [
|
|
199
|
+
"config",
|
|
200
|
+
"paths",
|
|
201
|
+
"max-warnings",
|
|
202
|
+
"texcount",
|
|
203
|
+
"working-directory",
|
|
204
|
+
])
|
|
205
|
+
assert.ok(action.inputs[key], `input \`${key}\` is missing`);
|
|
206
|
+
});
|
|
198
207
|
|
|
199
208
|
// ── `paths` is OPTIONAL: with none, the CLI lints the papersDir its paperlint.json declares ──────
|
|
200
209
|
// `paperlint lint` with no path finds the root paperlint.json and lints its `papersDir`, so that is
|
|
201
210
|
// the normal call and the action must not refuse it. What is asserted is the behaviour: the real
|
|
202
211
|
// `run:` block, handed an empty `paths`, calls the CLI with no path argument at all, and the guard
|
|
203
212
|
// still runs over what the CLI reported.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
it("`paths` is OPTIONAL: declared, not required", () => {
|
|
214
|
+
assert.equal(
|
|
215
|
+
action.inputs.paths.required,
|
|
216
|
+
false,
|
|
217
|
+
"`paths` must be optional — the CLI finds papersDir itself",
|
|
218
|
+
);
|
|
219
|
+
assert.equal(
|
|
220
|
+
action.inputs.paths.default,
|
|
221
|
+
"",
|
|
222
|
+
"`paths` must default to empty, which means: the papersDir of paperlint.json",
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
|
+
it("an empty `paths` runs clean and the CLI gets no path argument", () => {
|
|
215
226
|
const r = stubbedStepRun(0, "");
|
|
216
227
|
assert.equal(r.status, 0, `an empty \`paths\` must run clean: ${r.stderr}`);
|
|
217
228
|
assert.deepEqual(
|
|
@@ -220,8 +231,8 @@ assert.equal(
|
|
|
220
231
|
"with no `paths` the CLI must get no path argument — not an empty string, not `.`",
|
|
221
232
|
);
|
|
222
233
|
assert.match(r.stdout, /linted 1 file\(s\)/, "the guard must still run");
|
|
223
|
-
}
|
|
224
|
-
{
|
|
234
|
+
});
|
|
235
|
+
it("named paths are handed to the CLI one argument each", () => {
|
|
225
236
|
stubbedStepRun(0, "papers/a papers/b");
|
|
226
237
|
assert.deepEqual(
|
|
227
238
|
readFileSync(join(TMP, "npx-args"), "utf8").trim().split("\n"),
|
|
@@ -235,7 +246,7 @@ assert.equal(
|
|
|
235
246
|
],
|
|
236
247
|
"named paths are handed to the CLI one argument each",
|
|
237
248
|
);
|
|
238
|
-
}
|
|
249
|
+
});
|
|
239
250
|
|
|
240
251
|
// ── II. BEHAVIOUR of the guard — both halves, on fixtures ─────────────────────────────────────
|
|
241
252
|
const fixture = (name, body) => {
|
|
@@ -245,7 +256,7 @@ const fixture = (name, body) => {
|
|
|
245
256
|
};
|
|
246
257
|
|
|
247
258
|
// FIRES: zero files linted. The whole reason the guard exists.
|
|
248
|
-
{
|
|
259
|
+
it("FIRES: zero files linted", () => {
|
|
249
260
|
const { code, lines } = guard(fixture("empty.json", "[]"), 0, {
|
|
250
261
|
paths: ".",
|
|
251
262
|
config: "c.mjs",
|
|
@@ -256,9 +267,9 @@ const fixture = (name, body) => {
|
|
|
256
267
|
"a report of zero linted files must FAIL, not pass as clean",
|
|
257
268
|
);
|
|
258
269
|
assert.match(lines.join("\n"), /linted ZERO files/);
|
|
259
|
-
}
|
|
270
|
+
});
|
|
260
271
|
// With no paths given, the guard names where the scope came from instead of printing `paths=`.
|
|
261
|
-
{
|
|
272
|
+
it("with no paths given, the guard names where the scope came from", () => {
|
|
262
273
|
const { lines } = guard(fixture("empty2.json", "[]"), 0, {
|
|
263
274
|
paths: "",
|
|
264
275
|
config: "paperlint.json",
|
|
@@ -268,26 +279,28 @@ const fixture = (name, body) => {
|
|
|
268
279
|
/paths=\(none: the papersDir of paperlint\.json\)/,
|
|
269
280
|
"an empty paths value must be named as the papersDir, not printed blank",
|
|
270
281
|
);
|
|
271
|
-
}
|
|
282
|
+
});
|
|
272
283
|
// FIRES: the report is absent or unparsable — nothing was measured either way.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
it("FIRES: the report is absent or unparsable", () => {
|
|
285
|
+
assert.equal(
|
|
286
|
+
guard(join(TMP, "absent.json"), 0).code,
|
|
287
|
+
1,
|
|
288
|
+
"an unreadable report must FAIL",
|
|
289
|
+
);
|
|
290
|
+
assert.equal(
|
|
291
|
+
guard(fixture("garbage.json", "{oops"), 0).code,
|
|
292
|
+
1,
|
|
293
|
+
"an unparsable report must FAIL",
|
|
294
|
+
);
|
|
295
|
+
assert.equal(
|
|
296
|
+
guard(fixture("object.json", '{"not":"an array"}'), 0).code,
|
|
297
|
+
1,
|
|
298
|
+
"a report that is not a result array must FAIL",
|
|
299
|
+
);
|
|
300
|
+
});
|
|
288
301
|
|
|
289
302
|
// QUIET: files were linted and ESLint was happy → ESLint's code passes through untouched.
|
|
290
|
-
{
|
|
303
|
+
it("QUIET: files were linted and ESLint was happy", () => {
|
|
291
304
|
const one = fixture(
|
|
292
305
|
"one.json",
|
|
293
306
|
JSON.stringify([
|
|
@@ -309,9 +322,9 @@ assert.equal(
|
|
|
309
322
|
2,
|
|
310
323
|
"a real run must pass ESLint's failure code through, not mask it",
|
|
311
324
|
);
|
|
312
|
-
}
|
|
325
|
+
});
|
|
313
326
|
// QUIET: a file linted with NO findings is a legitimate clean run — the guard must not fire on it.
|
|
314
|
-
{
|
|
327
|
+
it("QUIET: a file linted with no findings is a clean run", () => {
|
|
315
328
|
const clean = fixture(
|
|
316
329
|
"clean.json",
|
|
317
330
|
JSON.stringify([{ filePath: "/x/a.md", messages: [] }]),
|
|
@@ -324,8 +337,4 @@ assert.equal(
|
|
|
324
337
|
);
|
|
325
338
|
assert.doesNotMatch(lines.join("\n"), /linted ZERO files/);
|
|
326
339
|
assert.match(lines.join("\n"), /linted 1 file\(s\) · 0 finding\(s\)/);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
console.log(
|
|
330
|
-
"✓ action.yml shape (parsed, not grepped) + guard behaviour, both halves",
|
|
331
|
-
);
|
|
340
|
+
});
|
|
@@ -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.
|
|
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.
|
package/dist/latex-log.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface FailingWarning {
|
|
|
37
37
|
* nearly every paper has some, and the pdf/* rules check the margins), font shape substitution
|
|
38
38
|
* (usually harmless), "Rerun to get" (the loop already reruns). Those never fail a build.
|
|
39
39
|
*
|
|
40
|
-
* Adding one is one entry here, plus its row of cases in `latex-log.
|
|
40
|
+
* Adding one is one entry here, plus its row of cases in `latex-log.test.ts` (the harness does
|
|
41
41
|
* not type-check without it).
|
|
42
42
|
*
|
|
43
43
|
* `lost-character`: TeX prints "Missing character: There is no X in font F!" when
|
package/dist/latex-log.js
CHANGED
|
@@ -81,7 +81,7 @@ const startsPhysicalLine = (line, prefix) => range(0, Math.floor(line.length / M
|
|
|
81
81
|
* nearly every paper has some, and the pdf/* rules check the margins), font shape substitution
|
|
82
82
|
* (usually harmless), "Rerun to get" (the loop already reruns). Those never fail a build.
|
|
83
83
|
*
|
|
84
|
-
* Adding one is one entry here, plus its row of cases in `latex-log.
|
|
84
|
+
* Adding one is one entry here, plus its row of cases in `latex-log.test.ts` (the harness does
|
|
85
85
|
* not type-check without it).
|
|
86
86
|
*
|
|
87
87
|
* `lost-character`: TeX prints "Missing character: There is no X in font F!" when
|
package/dist/latex-loop.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* PURE. No disk, no process, no clock. The shell in `build.ts` runs a step, records what it saw
|
|
5
5
|
* as an `Observation`, appends it to the history and asks `nextStep(summarize(history))` again.
|
|
6
|
-
* Both halves are table tests (`latex-loop.
|
|
6
|
+
* Both halves are table tests (`latex-loop.test.ts`), not scenarios that need TeX.
|
|
7
7
|
*
|
|
8
8
|
* ── THE LOOP: `summarize` reduces the history to a `State`, and `nextStep` asks four questions ──
|
|
9
9
|
* 1. did the last program fail — a non-zero exit, or a
|
package/dist/latex-loop.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* PURE. No disk, no process, no clock. The shell in `build.ts` runs a step, records what it saw
|
|
5
5
|
* as an `Observation`, appends it to the history and asks `nextStep(summarize(history))` again.
|
|
6
|
-
* Both halves are table tests (`latex-loop.
|
|
6
|
+
* Both halves are table tests (`latex-loop.test.ts`), not scenarios that need TeX.
|
|
7
7
|
*
|
|
8
8
|
* ── THE LOOP: `summarize` reduces the history to a `State`, and `nextStep` asks four questions ──
|
|
9
9
|
* 1. did the last program fail — a non-zero exit, or a
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/**
|
|
18
18
|
* The tool's name. Its settings file is named after it (`CONFIG_FILE`), its messages start with it,
|
|
19
19
|
* and the hooks resolve their scripts through it. It equals the package name, and
|
|
20
|
-
* `lib/paper-config.
|
|
20
|
+
* `lib/paper-config.test.mjs` checks that.
|
|
21
21
|
*/
|
|
22
22
|
export declare const CONFIG_KEY: string;
|
|
23
23
|
/**
|
|
@@ -60,7 +60,7 @@ export declare const DEFAULT_PAPERS_ROOT: string;
|
|
|
60
60
|
* This is the one place the name is spelled. Code reads the field as
|
|
61
61
|
* `settings[PAPERS_DIR_FIELD]`, never by a literal, so renaming it again is a one-line change
|
|
62
62
|
* here. The three hooks cannot import this module, so they keep their own copy, and
|
|
63
|
-
* `lib/paper-config.
|
|
63
|
+
* `lib/paper-config.test.mjs` checks that every copy matches this one.
|
|
64
64
|
*/
|
|
65
65
|
export declare const PAPERS_DIR_FIELD: string;
|
|
66
66
|
/**
|
|
@@ -68,7 +68,7 @@ export declare const PAPERS_DIR_FIELD: string;
|
|
|
68
68
|
* A key not listed here is REFUSED with its name, because a typo in a key otherwise reads as "not
|
|
69
69
|
* set". The keys in `ROOT_ONLY_KEYS` describe the whole project and are refused in a paper's file.
|
|
70
70
|
*
|
|
71
|
-
* 🔴 ONE LIST, AND IT IS CHECKED AGAINST THE READERS, NOT TRUSTED. `lib/paper-config.
|
|
71
|
+
* 🔴 ONE LIST, AND IT IS CHECKED AGAINST THE READERS, NOT TRUSTED. `lib/paper-config.test.mjs`
|
|
72
72
|
* walks the package's source, finds every `settingsOf(…)?.<key>` read and every field of
|
|
73
73
|
* `PaperlintConfig`, and requires each to be here — so a new reader that forgets this list turns
|
|
74
74
|
* the harness red before a consumer's config does.
|
package/dist/lib/paper-config.js
CHANGED
|
@@ -19,7 +19,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
19
19
|
/**
|
|
20
20
|
* The tool's name. Its settings file is named after it (`CONFIG_FILE`), its messages start with it,
|
|
21
21
|
* and the hooks resolve their scripts through it. It equals the package name, and
|
|
22
|
-
* `lib/paper-config.
|
|
22
|
+
* `lib/paper-config.test.mjs` checks that.
|
|
23
23
|
*/
|
|
24
24
|
export const CONFIG_KEY = "paperlint";
|
|
25
25
|
/**
|
|
@@ -93,7 +93,7 @@ export const DEFAULT_PAPERS_ROOT = "papers";
|
|
|
93
93
|
* This is the one place the name is spelled. Code reads the field as
|
|
94
94
|
* `settings[PAPERS_DIR_FIELD]`, never by a literal, so renaming it again is a one-line change
|
|
95
95
|
* here. The three hooks cannot import this module, so they keep their own copy, and
|
|
96
|
-
* `lib/paper-config.
|
|
96
|
+
* `lib/paper-config.test.mjs` checks that every copy matches this one.
|
|
97
97
|
*/
|
|
98
98
|
export const PAPERS_DIR_FIELD = "papersDir";
|
|
99
99
|
/**
|
|
@@ -101,7 +101,7 @@ export const PAPERS_DIR_FIELD = "papersDir";
|
|
|
101
101
|
* A key not listed here is REFUSED with its name, because a typo in a key otherwise reads as "not
|
|
102
102
|
* set". The keys in `ROOT_ONLY_KEYS` describe the whole project and are refused in a paper's file.
|
|
103
103
|
*
|
|
104
|
-
* 🔴 ONE LIST, AND IT IS CHECKED AGAINST THE READERS, NOT TRUSTED. `lib/paper-config.
|
|
104
|
+
* 🔴 ONE LIST, AND IT IS CHECKED AGAINST THE READERS, NOT TRUSTED. `lib/paper-config.test.mjs`
|
|
105
105
|
* walks the package's source, finds every `settingsOf(…)?.<key>` read and every field of
|
|
106
106
|
* `PaperlintConfig`, and requires each to be here — so a new reader that forgets this list turns
|
|
107
107
|
* the harness red before a consumer's config does.
|
package/docs/e2e.md
CHANGED
|
@@ -32,14 +32,14 @@ import the modules directly. Every path resolves, every dependency is already in
|
|
|
32
32
|
file they read is the file in `git`. An end-to-end run exists because all three of those are
|
|
33
33
|
assumptions that stop holding the moment somebody else installs the package.
|
|
34
34
|
|
|
35
|
-
| question | answered by
|
|
36
|
-
| ------------------------------------------------------------------------------------ |
|
|
37
|
-
| does this rule find this defect, and stay quiet otherwise | unit, beside the rule
|
|
38
|
-
| does the rule run through ESLint, wired, on the file it is for | integration (`src/rule-cases.test.ts`)
|
|
39
|
-
| does the CLI pick the right script, with the right interpreter | integration (`src/build.
|
|
40
|
-
| does the tarball, installed into a tree that is not this one, contain what it claims | **e2e**
|
|
41
|
-
| do the paths written inside a skill resolve where the package actually lands | **e2e**
|
|
42
|
-
| did a PDF come out, and is it typeset in the fonts the venue requires | **e2e**
|
|
35
|
+
| question | answered by |
|
|
36
|
+
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
|
|
37
|
+
| does this rule find this defect, and stay quiet otherwise | unit, beside the rule |
|
|
38
|
+
| does the rule run through ESLint, wired, on the file it is for | integration (`src/rule-cases.test.ts`) |
|
|
39
|
+
| does the CLI pick the right script, with the right interpreter | integration (`src/build-fake-tex.test.mjs` substitutes `spawnSync`) |
|
|
40
|
+
| does the tarball, installed into a tree that is not this one, contain what it claims | **e2e** |
|
|
41
|
+
| do the paths written inside a skill resolve where the package actually lands | **e2e** |
|
|
42
|
+
| did a PDF come out, and is it typeset in the fonts the venue requires | **e2e** |
|
|
43
43
|
|
|
44
44
|
The last three rows are the ones no other test can reach even in principle: the defect only exists
|
|
45
45
|
once the code is somewhere else, or once a real TeX has typeset it.
|
|
@@ -153,7 +153,7 @@ within seconds; `--check` must exit 0; then the `acmart` fixture is built with P
|
|
|
153
153
|
only, so no other TeX Live and no PDF tool can stand in, and the PDF must carry Libertine and Biolinum
|
|
154
154
|
and no Computer Modern face. Without `PAPERLINT_TEXLIVE_DIR` its tests are skipped: installing ~270 MB
|
|
155
155
|
into a home directory as a side effect of `npm run check` is the unasked install the root `CLAUDE.md` forbids.
|
|
156
|
-
`src/toolchain.
|
|
156
|
+
`src/toolchain-mirror.test.mjs` covers the installer's logic (mirror fallback, archive check, time
|
|
157
157
|
limit, verification, idempotence) against a fake mirror on disk, without the network.
|
|
158
158
|
|
|
159
159
|
## Skips are reported, never passed
|
package/docs/testing.md
CHANGED
|
@@ -51,13 +51,12 @@ When in doubt between unit and integration: if the function takes a port (`Files
|
|
|
51
51
|
- **Answers:** what does an agent see or cause? A hook's allow or deny on a given input, what a
|
|
52
52
|
skill's contract promises.
|
|
53
53
|
- **Lives:** `<surface>.harness.mjs` beside what it tests; it imports `runHook`, `runHarnessTest`
|
|
54
|
-
or `runEval` from vigiles.
|
|
55
|
-
|
|
56
|
-
#77). A new test of anything else is a unit or integration test.
|
|
54
|
+
or `runEval` from vigiles (`scripts/harness-api.test.ts` fails on a `*.harness.*` file that does
|
|
55
|
+
not). A test of anything else is a unit or integration test.
|
|
57
56
|
- **Asserts through** `lib/check.mjs`: `const check = createChecker();` then
|
|
58
57
|
`check(label, cond, detail)`. A failure prints the label and the detail, every call is counted.
|
|
59
58
|
Do not define a local `check`.
|
|
60
|
-
- **Example:** `
|
|
59
|
+
- **Example:** `skills/label-agent-runs/label-agent-runs.harness.ts` (`runHarnessTest` over a scripted mock model).
|
|
61
60
|
- **Skills are tested through vigiles**, not a bespoke runner: a home-grown runner here once printed
|
|
62
61
|
byte-identical "clean" verdicts for three skills that had never loaded.
|
|
63
62
|
|