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.
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +7 -0
- package/CLAUDE.md +6 -2
- package/CONTRIBUTING.md +2 -2
- package/{action.harness.mjs → action.test.mjs} +147 -138
- package/dist/adapters/venue-corpus/index.d.ts +345 -0
- package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
- package/dist/adapters/venue-corpus/index.js +205 -0
- package/dist/adapters/venue-corpus/index.js.map +1 -0
- package/dist/domain/licence.d.ts +51 -0
- package/dist/domain/licence.d.ts.map +1 -0
- package/dist/domain/licence.js +61 -0
- package/dist/domain/licence.js.map +1 -0
- package/dist/domain/venue-corpus.d.ts +120 -0
- package/dist/domain/venue-corpus.d.ts.map +1 -0
- package/dist/domain/venue-corpus.js +13 -0
- package/dist/domain/venue-corpus.js.map +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
- 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/dist/ports/venue-corpus-codec.d.ts +11 -0
- package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
- package/dist/ports/venue-corpus-codec.js +2 -0
- package/dist/ports/venue-corpus-codec.js.map +1 -0
- package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
- package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
- package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
- package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
- package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
- package/docs/design/venue-corpus.md +250 -0
- package/docs/e2e.md +9 -9
- package/docs/testing.md +3 -4
- package/docs/venues.md +144 -21
- package/eslint-rules/CLAUDE.md +5 -1
- package/eslint-rules/CLAUDE.md.spec.ts +3 -0
- 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 +4 -3
- package/presets/acm-acmsmall.jsonc +1 -1
- package/scripts/bundle-skills.ts +1 -0
- 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/scripts/venue-corpus-schema.test.ts +39 -0
- package/scripts/venue-corpus-schema.ts +17 -0
- package/skills/argument-arc/scripts/headings.js +6 -4
- package/skills/cold-read-diff/scripts/cold-read.js +6 -4
- 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/extract-ref-facts.js +6 -5
- 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/pc-panel-review/scripts/prior-reviews.js +7 -5
- 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/skills/study-accepted-papers/SKILL.md +28 -2
- package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -1
- package/skills/study-accepted-papers/papers.schema.json +427 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +302 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.js +383 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +485 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
- package/skills/verify-citations/scripts/bib-authors.js +6 -5
- package/skills/verify-citations/scripts/verify-cites.js +6 -5
- package/src/adapters/pdfjs/fill.test.ts +1 -1
- package/src/adapters/venue-corpus/index.test.ts +279 -0
- package/src/adapters/venue-corpus/index.ts +286 -0
- 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/domain/licence.test.ts +122 -0
- package/src/domain/licence.ts +95 -0
- package/src/domain/venue-corpus.ts +130 -0
- 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/ports/venue-corpus-codec.ts +11 -0
- 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
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `latex-log.ts` — reading pdflatex logs, bibtex output and `.aux` files, both halves.
|
|
3
|
+
*
|
|
4
|
+
* The log excerpts below are copied from real TeX Live 2023 runs (2026-09-24), not typed from
|
|
5
|
+
* memory: the two error spellings `-file-line-error` produces, the missing-package form, and a
|
|
6
|
+
* marker that TeX broke at column 79.
|
|
7
|
+
*/
|
|
8
|
+
import { failureMessage } from "../lib/check.ts";
|
|
9
|
+
import { expect, it } from "vitest";
|
|
10
|
+
import type { FailingWarningId, LogMarker } from "./latex-log.ts";
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
unwrapLog,
|
|
14
|
+
logMarkers,
|
|
15
|
+
errorExcerpt,
|
|
16
|
+
isErrorLine,
|
|
17
|
+
bibtexExcerpt,
|
|
18
|
+
auxBib,
|
|
19
|
+
MAX_PRINT_LINE,
|
|
20
|
+
FAILING_WARNINGS,
|
|
21
|
+
failingWarnings,
|
|
22
|
+
} = await import("./latex-log.ts");
|
|
23
|
+
|
|
24
|
+
// A failed check is recorded and the rest of the test keeps running.
|
|
25
|
+
const check = (label: string, cond: unknown, detail?: unknown): void => {
|
|
26
|
+
expect.soft(cond, failureMessage(label, detail)).toBeTruthy();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// ── the 79-column wrap ──────────────────────────────────────────────────────────────────
|
|
30
|
+
it("the 79-column wrap", () => {
|
|
31
|
+
// A package warning long enough that "Rerun to get" crosses column 79. A real acmart log shows the
|
|
32
|
+
// same break: "Document Class: acmart 2024/02/04 v2.03 Typesetting articles for the Associatio"
|
|
33
|
+
// is a 79-byte line continued on the next one.
|
|
34
|
+
const warning =
|
|
35
|
+
"Package natbib Warning: Citation(s) may have changed in the bibliography. Rerun to get citations correct.";
|
|
36
|
+
const at79 = warning.slice(0, MAX_PRINT_LINE);
|
|
37
|
+
const rest = warning.slice(MAX_PRINT_LINE);
|
|
38
|
+
check(
|
|
39
|
+
"the fixture really is split at 79 (the marker straddles the break)",
|
|
40
|
+
at79.length === 79 && !at79.includes("Rerun to get") && rest.length > 0,
|
|
41
|
+
);
|
|
42
|
+
const wrappedLog = ["(./paper.aux)", "", at79, rest, ""].join("\n");
|
|
43
|
+
// Guards: rejoining the lines TeX broke — a 'Rerun to get' split across the break is on no line at
|
|
44
|
+
// all, and the loop would stop one pass early.
|
|
45
|
+
check(
|
|
46
|
+
"🔴 a marker broken at column 79 is rejoined and found",
|
|
47
|
+
logMarkers(unwrapLog(wrappedLog)).includes("rerun-requested"),
|
|
48
|
+
);
|
|
49
|
+
check(
|
|
50
|
+
"without the unwrap, the split marker is NOT on any one line — the wrap is real",
|
|
51
|
+
!wrappedLog.split("\n").some((l) => l.includes("Rerun to get")),
|
|
52
|
+
);
|
|
53
|
+
// LaTeX core's line is 78 bytes; one trailing space makes it a line TeX would NOT have broken but
|
|
54
|
+
// that is 79 bytes anyway — the ambiguous case `unwrapLog` documents.
|
|
55
|
+
const exact79 =
|
|
56
|
+
"LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ";
|
|
57
|
+
check(
|
|
58
|
+
"a marker line that is exactly 79 bytes by itself is still found after the (harmless) join",
|
|
59
|
+
exact79.length === 79 &&
|
|
60
|
+
logMarkers(unwrapLog([exact79, "", "next"].join("\n"))).includes(
|
|
61
|
+
"labels-changed",
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
check(
|
|
65
|
+
"a short line is not joined to the next one",
|
|
66
|
+
JSON.stringify(unwrapLog("a\nb")) === JSON.stringify(["a", "b"]),
|
|
67
|
+
);
|
|
68
|
+
check(
|
|
69
|
+
"two consecutive 79-byte lines join with the third",
|
|
70
|
+
unwrapLog(["x".repeat(79), "y".repeat(79), "z"].join("\n"))[0] ===
|
|
71
|
+
"x".repeat(79) + "y".repeat(79) + "z",
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// ── markers ─────────────────────────────────────────────────────────────────────────────
|
|
76
|
+
it("markers", () => {
|
|
77
|
+
const firstPass = [
|
|
78
|
+
"LaTeX Warning: Reference `sec:intro' on page 1 undefined on input line 4.",
|
|
79
|
+
"LaTeX Warning: There were undefined references.",
|
|
80
|
+
"LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.",
|
|
81
|
+
"Package rerunfilecheck Warning: File `paper.out' has changed.",
|
|
82
|
+
"(rerunfilecheck) Rerun to get outlines right",
|
|
83
|
+
"Package natbib Warning: There were undefined citations.",
|
|
84
|
+
];
|
|
85
|
+
const m = logMarkers(firstPass);
|
|
86
|
+
check(
|
|
87
|
+
"every documented marker is recognised, and the end-of-run summaries are not markers (they fail the build: FAILING_WARNINGS)",
|
|
88
|
+
JSON.stringify(m) ===
|
|
89
|
+
JSON.stringify([
|
|
90
|
+
"rerun-requested",
|
|
91
|
+
"labels-changed",
|
|
92
|
+
"rerunfilecheck",
|
|
93
|
+
] satisfies LogMarker[]),
|
|
94
|
+
m,
|
|
95
|
+
);
|
|
96
|
+
check(
|
|
97
|
+
"a clean log carries no markers",
|
|
98
|
+
logMarkers([
|
|
99
|
+
"This is pdfTeX",
|
|
100
|
+
"Output written on paper.pdf (1 page, 1234 bytes).",
|
|
101
|
+
]).length === 0,
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// ── error excerpt ───────────────────────────────────────────────────────────────────────
|
|
106
|
+
it("error excerpt", () => {
|
|
107
|
+
const undefinedCs = [
|
|
108
|
+
"(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)",
|
|
109
|
+
"./paper.tex:4: Undefined control sequence.",
|
|
110
|
+
"l.4 \\foo",
|
|
111
|
+
" bar baz ",
|
|
112
|
+
"Here is how much of TeX's memory you used:",
|
|
113
|
+
];
|
|
114
|
+
const ex = errorExcerpt(undefinedCs);
|
|
115
|
+
// Guards: the spelling paperlint's own flags produce for most errors — with only the `!` form recognised,
|
|
116
|
+
// an undefined control sequence fails with no error line quoted.
|
|
117
|
+
check(
|
|
118
|
+
"-file-line-error form: the error line, the l.NNN line and the rest of the source line",
|
|
119
|
+
ex[0] === "./paper.tex:4: Undefined control sequence." &&
|
|
120
|
+
ex[1] === "l.4 \\foo" &&
|
|
121
|
+
(ex[2] ?? "").includes("bar baz"),
|
|
122
|
+
);
|
|
123
|
+
// Guards: the end of the excerpt — without it the excerpt runs into TeX's memory statistics and
|
|
124
|
+
// buries the line the author needs.
|
|
125
|
+
check(
|
|
126
|
+
"the excerpt stops at the context — the memory statistics are not quoted",
|
|
127
|
+
!ex.some((l) => l.startsWith("Here is how much")),
|
|
128
|
+
);
|
|
129
|
+
const missingPkg = [
|
|
130
|
+
")",
|
|
131
|
+
"",
|
|
132
|
+
"! LaTeX Error: File `nopepkg.sty' not found.",
|
|
133
|
+
"",
|
|
134
|
+
"Type X to quit or <RETURN> to proceed,",
|
|
135
|
+
"or enter new name. (Default extension: sty)",
|
|
136
|
+
"",
|
|
137
|
+
"Enter file name: ",
|
|
138
|
+
"./paper.tex:3: Emergency stop.",
|
|
139
|
+
"<read *> ",
|
|
140
|
+
" ",
|
|
141
|
+
"l.3 \\begin",
|
|
142
|
+
" {document}^^M ",
|
|
143
|
+
"Here is how much of TeX's memory you used:",
|
|
144
|
+
];
|
|
145
|
+
const ex2 = errorExcerpt(missingPkg);
|
|
146
|
+
check(
|
|
147
|
+
"the classic `!` form: the FIRST error is quoted, not the emergency stop after it",
|
|
148
|
+
ex2[0] === "! LaTeX Error: File `nopepkg.sty' not found.",
|
|
149
|
+
);
|
|
150
|
+
check(
|
|
151
|
+
"…and the excerpt runs to its l.NNN context, dropping blank lines",
|
|
152
|
+
ex2.includes("l.3 \\begin") && !ex2.some((l) => l.trim() === ""),
|
|
153
|
+
);
|
|
154
|
+
check(
|
|
155
|
+
"no error line — an empty excerpt",
|
|
156
|
+
errorExcerpt(["all fine"]).length === 0,
|
|
157
|
+
);
|
|
158
|
+
check(
|
|
159
|
+
"a warning that ends in `line 4.` is not an error line",
|
|
160
|
+
!isErrorLine(
|
|
161
|
+
"LaTeX Warning: Citation `k' on page 1 undefined on input line 4.",
|
|
162
|
+
),
|
|
163
|
+
);
|
|
164
|
+
// Guards: the requirement that the prefix look like a path — without it, the first such line in a
|
|
165
|
+
// package's info output is quoted as 'the error'.
|
|
166
|
+
check(
|
|
167
|
+
"a path-less `word:12: ` is not an error line either",
|
|
168
|
+
!isErrorLine("Chapter:12: something"),
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// ── bibtex ──────────────────────────────────────────────────────────────────────────────
|
|
173
|
+
it("bibtex", () => {
|
|
174
|
+
const bibOut = [
|
|
175
|
+
"This is BibTeX, Version 0.99d (TeX Live 2023/Debian)",
|
|
176
|
+
"The top-level auxiliary file: paper.aux",
|
|
177
|
+
"The style file: plain.bst",
|
|
178
|
+
"I couldn't open database file nope.bib",
|
|
179
|
+
"---line 5 of file paper.aux",
|
|
180
|
+
" : \\bibdata{nope",
|
|
181
|
+
"(There were 2 error messages)",
|
|
182
|
+
].join("\n");
|
|
183
|
+
const bx = bibtexExcerpt(bibOut);
|
|
184
|
+
// Guards: filtering bibtex's fixed preamble — a failure would open with 'This is BibTeX, Version
|
|
185
|
+
// 0.99d' and push the real reason down.
|
|
186
|
+
check(
|
|
187
|
+
"bibtex: the banner is dropped, the explanation kept",
|
|
188
|
+
bx[0] === "I couldn't open database file nope.bib" &&
|
|
189
|
+
!bx.some((l) => l.startsWith("This is BibTeX")),
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// ── aux ─────────────────────────────────────────────────────────────────────────────────
|
|
194
|
+
it("aux", () => {
|
|
195
|
+
const aux = [
|
|
196
|
+
"\\relax ",
|
|
197
|
+
"\\citation{knuth84}",
|
|
198
|
+
"\\citation{b,a}",
|
|
199
|
+
"\\bibstyle{plain}",
|
|
200
|
+
"\\bibdata{refs,more}",
|
|
201
|
+
"\\@input{chap1.aux}",
|
|
202
|
+
"\\newlabel{sec:intro}{{1}{1}{}{}{}}",
|
|
203
|
+
].join("\n");
|
|
204
|
+
const sub = "\\citation{c}\n\\citation{a}\n";
|
|
205
|
+
const parsed = auxBib(aux, (name) => (name === "chap1.aux" ? sub : null));
|
|
206
|
+
// Guards: citations from \include'd chapters — a \cite added in a chapter would not change the
|
|
207
|
+
// citation set, and bibtex would not rerun for it.
|
|
208
|
+
check(
|
|
209
|
+
"citations: sorted, unique, including the ones in an \\@input aux",
|
|
210
|
+
JSON.stringify(parsed.citations) ===
|
|
211
|
+
JSON.stringify(["a", "b", "c", "knuth84"]),
|
|
212
|
+
);
|
|
213
|
+
check(
|
|
214
|
+
"databases and style are read",
|
|
215
|
+
JSON.stringify(parsed.databases) === JSON.stringify(["refs", "more"]) &&
|
|
216
|
+
parsed.style === "plain",
|
|
217
|
+
);
|
|
218
|
+
check(
|
|
219
|
+
"an aux with no \\bibdata names no databases",
|
|
220
|
+
auxBib("\\relax\n\\citation{x}\n").databases.length === 0,
|
|
221
|
+
);
|
|
222
|
+
check(
|
|
223
|
+
"a self-including aux does not loop forever",
|
|
224
|
+
auxBib("\\@input{paper.aux}\n\\citation{x}", () => "\\@input{paper.aux}")
|
|
225
|
+
.citations.length === 1,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
check(
|
|
229
|
+
"an \\@input aux that is not there (the default reader finds nothing) is skipped",
|
|
230
|
+
JSON.stringify(auxBib("\\@input{gone.aux}\n\\citation{x}\n").citations) ===
|
|
231
|
+
JSON.stringify(["x"]),
|
|
232
|
+
);
|
|
233
|
+
check(
|
|
234
|
+
"a log whose LAST line is exactly 79 bytes keeps it (nothing follows to join it to)",
|
|
235
|
+
JSON.stringify(unwrapLog(`a\n${"x".repeat(79)}`)) ===
|
|
236
|
+
JSON.stringify(["a", "x".repeat(79)]),
|
|
237
|
+
);
|
|
238
|
+
check(
|
|
239
|
+
"an error path must hold a dot or a slash; a bare word before the line number is not one",
|
|
240
|
+
isErrorLine("paper.tex:4: Undefined control sequence.") &&
|
|
241
|
+
isErrorLine("chapters/intro:9: x") &&
|
|
242
|
+
!isErrorLine("paper:4: x") &&
|
|
243
|
+
!isErrorLine("two words.tex:4: x"),
|
|
244
|
+
);
|
|
245
|
+
{
|
|
246
|
+
const flood = [
|
|
247
|
+
"./paper.tex:1: Undefined control sequence.",
|
|
248
|
+
...Array.from({ length: 20 }, (_, i) => `noise ${String(i)}`),
|
|
249
|
+
"l.1 \\foo",
|
|
250
|
+
];
|
|
251
|
+
check(
|
|
252
|
+
"an excerpt stops at MAX_EXCERPT lines even before the l.NNN line arrives",
|
|
253
|
+
errorExcerpt(flood).length === 12 &&
|
|
254
|
+
errorExcerpt(flood)[11] === "noise 10",
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// ── warnings that fail the build ────────────────────────────────────────────────────────
|
|
260
|
+
it("warnings that fail the build", () => {
|
|
261
|
+
// Every entry of FAILING_WARNINGS has its two halves here — log lines it must find, and lines it
|
|
262
|
+
// must not — and `satisfies Record<FailingWarningId, …>` makes a table entry without a row here a
|
|
263
|
+
// type error; the first check below makes it a red run as well.
|
|
264
|
+
// The lost-character line is copied from a real TeX Live 2026 run (2026-10-26): `\char"FF` in
|
|
265
|
+
// cmr10 under `\documentclass{article}`, which sets `\tracinglostchars=2`; pdflatex exited 0.
|
|
266
|
+
// The log is read as latin1, so the byte 0xFF is the one character "\xff".
|
|
267
|
+
const LOST = "Missing character: There is no \xff in font cmr10!";
|
|
268
|
+
const FAILING_CASES = {
|
|
269
|
+
"lost-character": {
|
|
270
|
+
fires: [
|
|
271
|
+
LOST,
|
|
272
|
+
"Missing character: There is no \xe2 in font LinLibertineT-tlf-ot1!",
|
|
273
|
+
],
|
|
274
|
+
quiet: [
|
|
275
|
+
"Overfull \\hbox (1.2pt too wide) in paragraph at lines 4--5",
|
|
276
|
+
"LaTeX Font Warning: Font shape `OT1/cmr/bx/sc' undefined",
|
|
277
|
+
"LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.",
|
|
278
|
+
"LaTeX Warning: There were undefined references.",
|
|
279
|
+
// The words inside an unrelated longer line — an overfull box quoting the text it set.
|
|
280
|
+
"[]\\OT1/cmr/m/n/10 Missing character: There is no x in font cmr10!",
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
// The three end-of-run summaries, worded as latex.ltx and natbib.sty print them (TeX Live 2026);
|
|
284
|
+
// LaTeX core has no "undefined citations" summary — an undefined \cite counts as a reference. Guards: matching the
|
|
285
|
+
// summary, not the word "undefined" — one reference warning per \ref is printed on EVERY pass
|
|
286
|
+
// before the rerun, and is not the summary.
|
|
287
|
+
"undefined-references": {
|
|
288
|
+
fires: ["LaTeX Warning: There were undefined references."],
|
|
289
|
+
quiet: [
|
|
290
|
+
"LaTeX Warning: Reference `sec:intro' on page 1 undefined on input line 4.",
|
|
291
|
+
"Package natbib Warning: There were undefined citations.",
|
|
292
|
+
"LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.",
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
"undefined-citations": {
|
|
296
|
+
fires: ["Package natbib Warning: There were undefined citations."],
|
|
297
|
+
quiet: [
|
|
298
|
+
"LaTeX Warning: Citation `knuth84' on page 1 undefined on input line 7.",
|
|
299
|
+
"Package natbib Warning: Citation `knuth84' on page 1 undefined on input line 7.",
|
|
300
|
+
"LaTeX Warning: There were undefined references.",
|
|
301
|
+
],
|
|
302
|
+
},
|
|
303
|
+
"multiply-defined-labels": {
|
|
304
|
+
fires: ["LaTeX Warning: There were multiply-defined labels."],
|
|
305
|
+
quiet: [
|
|
306
|
+
"LaTeX Warning: Label `sec:intro' multiply defined.",
|
|
307
|
+
"LaTeX Warning: There were undefined references.",
|
|
308
|
+
],
|
|
309
|
+
},
|
|
310
|
+
} satisfies Record<
|
|
311
|
+
FailingWarningId,
|
|
312
|
+
{ readonly fires: readonly string[]; readonly quiet: readonly string[] }
|
|
313
|
+
>;
|
|
314
|
+
check(
|
|
315
|
+
"every failing warning in the table has a row of cases, and every row is in the table",
|
|
316
|
+
JSON.stringify(FAILING_WARNINGS.map((w) => w.id).sort()) ===
|
|
317
|
+
JSON.stringify(Object.keys(FAILING_CASES).sort()),
|
|
318
|
+
);
|
|
319
|
+
for (const [id, c] of Object.entries(FAILING_CASES)) {
|
|
320
|
+
for (const line of c.fires)
|
|
321
|
+
check(
|
|
322
|
+
`${id}: fires on ${JSON.stringify(line)}`,
|
|
323
|
+
failingWarnings(["(./paper.aux)", line, ""]).some((h) => h.id === id),
|
|
324
|
+
() => failingWarnings(["(./paper.aux)", line, ""]),
|
|
325
|
+
);
|
|
326
|
+
for (const line of c.quiet)
|
|
327
|
+
check(
|
|
328
|
+
`${id}: quiet on ${JSON.stringify(line)}`,
|
|
329
|
+
!failingWarnings(["(./paper.aux)", line, ""]).some((h) => h.id === id),
|
|
330
|
+
() => failingWarnings(["(./paper.aux)", line, ""]),
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
check(
|
|
334
|
+
"a clean log carries no failing warning",
|
|
335
|
+
failingWarnings([
|
|
336
|
+
"This is pdfTeX",
|
|
337
|
+
"Output written on paper.pdf (1 page, 1234 bytes).",
|
|
338
|
+
]).length === 0,
|
|
339
|
+
);
|
|
340
|
+
{
|
|
341
|
+
const log = [
|
|
342
|
+
LOST,
|
|
343
|
+
"(./paper.aux)",
|
|
344
|
+
LOST,
|
|
345
|
+
"Missing character: There is no \xfe in font cmtt10!",
|
|
346
|
+
LOST,
|
|
347
|
+
];
|
|
348
|
+
const hits = failingWarnings(log);
|
|
349
|
+
check(
|
|
350
|
+
"a lost character quotes each distinct line once, in order, with how many times TeX printed it",
|
|
351
|
+
JSON.stringify(hits) ===
|
|
352
|
+
JSON.stringify([
|
|
353
|
+
{
|
|
354
|
+
id: "lost-character",
|
|
355
|
+
reason: FAILING_WARNINGS[0].reason,
|
|
356
|
+
quotes: [
|
|
357
|
+
{ text: LOST, times: 3 },
|
|
358
|
+
{
|
|
359
|
+
text: "Missing character: There is no \xfe in font cmtt10!",
|
|
360
|
+
times: 1,
|
|
361
|
+
},
|
|
362
|
+
],
|
|
363
|
+
},
|
|
364
|
+
]),
|
|
365
|
+
hits,
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
{
|
|
369
|
+
// A long font name pushes the line past column 79: TeX breaks it, and unwrapLog rejoins it.
|
|
370
|
+
const long =
|
|
371
|
+
"Missing character: There is no \xff in font LinLibertineT-tlf-ts1-scaled-1000-extended!";
|
|
372
|
+
const split = [long.slice(0, MAX_PRINT_LINE), long.slice(MAX_PRINT_LINE)];
|
|
373
|
+
check(
|
|
374
|
+
"a lost-character line TeX split at column 79 is rejoined and found, quoted whole",
|
|
375
|
+
split[0]?.length === 79 &&
|
|
376
|
+
JSON.stringify(
|
|
377
|
+
failingWarnings(unwrapLog(split.join("\n")))[0]?.quotes,
|
|
378
|
+
) === JSON.stringify([{ text: long, times: 1 }]),
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
{
|
|
382
|
+
// A line of exactly 79 bytes by itself is joined to the next one (unwrapLog's documented false
|
|
383
|
+
// join): the marker then starts at byte 79 of the joined line, where the physical line began.
|
|
384
|
+
const before = "x".repeat(MAX_PRINT_LINE);
|
|
385
|
+
const joined = unwrapLog([before, LOST, ""].join("\n"));
|
|
386
|
+
check(
|
|
387
|
+
"a lost-character line glued by a false join to a 79-byte line before it is still found",
|
|
388
|
+
joined[0] === before + LOST && failingWarnings(joined).length === 1,
|
|
389
|
+
);
|
|
390
|
+
check(
|
|
391
|
+
"the marker words NOT at a physical line start (byte 78) are not read as one",
|
|
392
|
+
failingWarnings(["y".repeat(MAX_PRINT_LINE - 1) + LOST]).length === 0,
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
});
|
package/src/latex-log.ts
CHANGED
|
@@ -105,7 +105,7 @@ const startsPhysicalLine = (line: string, prefix: string): boolean =>
|
|
|
105
105
|
* nearly every paper has some, and the pdf/* rules check the margins), font shape substitution
|
|
106
106
|
* (usually harmless), "Rerun to get" (the loop already reruns). Those never fail a build.
|
|
107
107
|
*
|
|
108
|
-
* Adding one is one entry here, plus its row of cases in `latex-log.
|
|
108
|
+
* Adding one is one entry here, plus its row of cases in `latex-log.test.ts` (the harness does
|
|
109
109
|
* not type-check without it).
|
|
110
110
|
*
|
|
111
111
|
* `lost-character`: TeX prints "Missing character: There is no X in font F!" when
|