paperlint 18.2.2 → 18.3.1
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/dist/readability.d.ts +12 -9
- package/dist/readability.d.ts.map +1 -1
- package/dist/readability.js +3 -3
- package/dist/readability.js.map +1 -1
- package/dist/skills/pc-panel-review/scripts/prior-reviews-core.d.ts +19 -0
- package/dist/skills/pc-panel-review/scripts/prior-reviews.d.ts +2 -0
- package/docs/optional-rules.md +2 -2
- package/docs/rules/tex/max-paragraph-numbers.md +13 -7
- package/docs/rules/tex/max-paragraph-words.md +17 -28
- package/docs/rules.md +2 -2
- package/package.json +1 -1
- package/scripts/grow-real-papers/archive.test.ts +294 -0
- package/scripts/grow-real-papers/archive.ts +287 -0
- package/scripts/grow-real-papers/collect.test.ts +329 -0
- package/scripts/grow-real-papers/collect.ts +316 -0
- package/scripts/grow-real-papers/http.test.ts +95 -0
- package/scripts/grow-real-papers/http.ts +76 -0
- package/scripts/grow-real-papers/main.test.ts +295 -0
- package/scripts/grow-real-papers/main.ts +221 -0
- package/scripts/grow-real-papers/paper.test.ts +305 -0
- package/scripts/grow-real-papers/paper.ts +241 -0
- package/scripts/grow-real-papers/rules.test.ts +222 -0
- package/scripts/grow-real-papers/rules.ts +250 -0
- package/scripts/grow-real-papers/sources.test.ts +275 -0
- package/scripts/grow-real-papers/sources.ts +239 -0
- package/scripts/grow-real-papers/testkit.ts +79 -0
- package/skills/pc-panel-review/SKILL.md +18 -11
- package/skills/pc-panel-review/SKILL.md.spec.ts +17 -10
- package/skills/pc-panel-review/scripts/prior-reviews-core.js +44 -0
- package/skills/pc-panel-review/scripts/prior-reviews-core.ts +66 -0
- package/skills/pc-panel-review/scripts/prior-reviews.js +14 -0
- package/skills/pc-panel-review/scripts/prior-reviews.test.ts +206 -0
- package/skills/pc-panel-review/scripts/prior-reviews.ts +19 -0
- package/src/readability.test.ts +44 -41
- package/src/readability.ts +12 -9
- package/src/rule-cases.test.ts +6 -6
|
@@ -12,7 +12,7 @@ import tightenPaper from "../tighten-paper/SKILL.md.spec.ts";
|
|
|
12
12
|
export default experimental_skill({
|
|
13
13
|
name: "pc-panel-review",
|
|
14
14
|
description:
|
|
15
|
-
'Use when asking "what would the program committee decide?" / "simulate the reviewers" / "what\'s this paper\'s accept probability?" / "red-team this paper" / "what would Reviewer 2 attack?" on a drafted paper + artifact. Spawns N independent reviewers with DISTINCT lenses (one actually RUNS the artifact, one is a skimming genre/register reviewer, one is the hostile Reviewer 2), then synthesizes a PC-chair meta-review into an accept/reject prediction reported as min/median/max, a calibrated probability, and consensus must-fixes (or none). Takes tighten-paper\'s structural verdict and cold-read-diff\'s whole-paper report as inputs — the panel cannot feel reader fatigue on its own. The third and last step of the final review. Before the final review, a red-team request runs the hostile seat (Reviewer 2) alone, without the readability inputs. Also runs the VENUE-FIT seat alone for a CFP-fit spot-check. NOT the submit checklist (harden-paper).',
|
|
15
|
+
'Use when asking "what would the program committee decide?" / "simulate the reviewers" / "what\'s this paper\'s accept probability?" / "red-team this paper" / "what would Reviewer 2 attack?" on a drafted paper + artifact. Spawns N independent reviewers with DISTINCT lenses (one actually RUNS the artifact, one is a skimming genre/register reviewer, one is the hostile Reviewer 2), then synthesizes a PC-chair meta-review into an accept/reject prediction reported as min/median/max, a calibrated probability, and consensus must-fixes (or none). Takes tighten-paper\'s structural verdict and cold-read-diff\'s whole-paper report as inputs — the panel cannot feel reader fatigue on its own. The third and last step of the final review. Before the final review, a red-team request runs the hostile seat (Reviewer 2) alone, without the readability inputs. Also runs the VENUE-FIT seat alone for a CFP-fit spot-check, and the PRIOR-REVIEWS seat alone while drafting ("did we really answer the last reviewers?"). NOT the submit checklist (harden-paper).',
|
|
16
16
|
tools: [
|
|
17
17
|
"Read",
|
|
18
18
|
"Write",
|
|
@@ -28,10 +28,10 @@ export default experimental_skill({
|
|
|
28
28
|
# pc-panel-review — model the whole PC, not one reviewer
|
|
29
29
|
|
|
30
30
|
> The whole PC (N independent lenses incl. an artifact-runner) + a chair meta-review, run once as the
|
|
31
|
-
> last step of the final review (\`paper-pipeline\`, "The final review").
|
|
32
|
-
> the hostile seat, before the final review only (**Hostile-seat mode**, below),
|
|
33
|
-
> (below),
|
|
34
|
-
> recorded as the panel.
|
|
31
|
+
> last step of the final review (\`paper-pipeline\`, "The final review"). Three seats also run alone:
|
|
32
|
+
> the hostile seat, before the final review only (**Hostile-seat mode**, below), the prior-reviews seat
|
|
33
|
+
> while drafting (**Prior-reviews mode**, below), and **Venue-fit mode** (below), a spot-check against a
|
|
34
|
+
> named venue's CFP rubric, recorded as \`venue-fit\`. None is recorded as the panel.
|
|
35
35
|
|
|
36
36
|
A real decision is made by **2–4 reviewers with different priorities + a meta-review** that weighs
|
|
37
37
|
consensus over any single voice. This skill runs that. The payoff over a single review: a **must-fix
|
|
@@ -96,11 +96,12 @@ prose-only read can.
|
|
|
96
96
|
code for
|
|
97
97
|
circularity (echoing stored fields vs recomputing); grep all files (incl. data + compiled
|
|
98
98
|
caches) for anonymization leaks; scope the badge (Available / Functional / Reproduced).
|
|
99
|
-
- **Prior-reviews reviewer (MANDATORY when
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
- **Prior-reviews reviewer (MANDATORY when
|
|
100
|
+
\`node \${CLAUDE_SKILL_DIR}/scripts/prior-reviews.js <paper-dir>\` prints \`required\`)** — the
|
|
101
|
+
script reads the same function as \`cycle/prior-reviews-answered\`, so the seat sits exactly when
|
|
102
|
+
that rule fires, and it prints the points file. Do not decide from \`paperlint.json\` by eye. The rule
|
|
103
|
+
already decides that every point has an answer and that each \`where\` is a \`\\section\` of the
|
|
104
|
+
paper; do not re-count that. Give this reviewer the points file beside the paper, and it judges what no rule can: whether the section an
|
|
104
105
|
answer names really answers the quoted point, and whether a \`declined\` reason would satisfy the
|
|
105
106
|
reviewer who raised it. Each answer that does not is a must-fix, named by its point id.
|
|
106
107
|
- **Security/ethics reviewer** (security venues) — threat model soundness, responsible disclosure,
|
|
@@ -202,6 +203,12 @@ consensus must-fixes. Its report goes under \`reviews/\`, and the author decides
|
|
|
202
203
|
(\`fixed\`, or \`wontfix\` with a \`note\` giving his reason; \`review/frontmatter\`). Once the final review
|
|
203
204
|
starts, the hostile seat runs only inside the panel.
|
|
204
205
|
|
|
206
|
+
## Prior-reviews mode (one seat, while drafting)
|
|
207
|
+
While the paper is being revised for the next attempt, the prior-reviews seat of step 3 runs alone, on
|
|
208
|
+
the current text and the points file \`scripts/prior-reviews.js\` prints; it runs only when that script
|
|
209
|
+
says \`required\`. It gets no readability inputs and predicts no decision. Its report goes under
|
|
210
|
+
\`reviews/\`, decided per finding like Hostile-seat mode. In the final review it sits inside the panel.
|
|
211
|
+
|
|
205
212
|
## Venue-fit mode (single-lens spot-check — the merged \`venue-review-sim\`)
|
|
206
213
|
When a full panel is overkill and you just want to predict **"given THIS venue's criteria, bar, and
|
|
207
214
|
culture, would a real reviewer accept it, and what scores?"**, run **one** venue-fit reviewer scoring
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prior-reviews-core — whether the panel's prior-reviews seat must sit, and which points file it
|
|
3
|
+
* reads. The answer comes from `priorReviewsOf`, the function `cycle/prior-reviews-answered` uses,
|
|
4
|
+
* so the seat and the rule fire on the same papers: the last rejection with reviews before the open
|
|
5
|
+
* attempt, walking back over attempts that brought no reviews (a withdrawal, a desk rejection).
|
|
6
|
+
* No model, no network.
|
|
7
|
+
*/
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { callerPath } from "#src/caller-path";
|
|
10
|
+
import { readPaperSettings } from "#src/paper-settings";
|
|
11
|
+
import { priorReviewsOf } from "#src/prior-reviews-rule";
|
|
12
|
+
/** The seat's verdict for the paper in `dir`. */
|
|
13
|
+
export function seatVerdict(dir, deps) {
|
|
14
|
+
// readPaperSettings, as the lint run reads the file: a file that does not parse, or cycles it cannot
|
|
15
|
+
// hold, is an error here, never a "not required" (readCycles alone reads broken JSON as no cycles).
|
|
16
|
+
const settings = readPaperSettings(deps.files, dir);
|
|
17
|
+
if (!settings.ok)
|
|
18
|
+
return { code: 2, line: `prior-reviews: ${settings.error.why}` };
|
|
19
|
+
const cycles = settings.value?.cycles ?? null;
|
|
20
|
+
const prior = cycles === null ? null : priorReviewsOf(cycles);
|
|
21
|
+
if (prior === null)
|
|
22
|
+
return {
|
|
23
|
+
code: 0,
|
|
24
|
+
line: "not required: no rejection with reviews before the open attempt",
|
|
25
|
+
};
|
|
26
|
+
const from = `reviews from ${prior.rejected.id}, answered by ${prior.open.id}`;
|
|
27
|
+
return deps.files.isFile(callerPath(join(dir, prior.file)))
|
|
28
|
+
? { code: 0, line: `required: ${prior.file} (${from})` }
|
|
29
|
+
: {
|
|
30
|
+
code: 1,
|
|
31
|
+
line: `required, and ${prior.file} is missing (${from}): write it first; cycle/prior-reviews-answered fails until it exists`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Run the command on `argv`; the exit code. */
|
|
35
|
+
export function main(argv, deps, { out, err }) {
|
|
36
|
+
const [arg] = argv;
|
|
37
|
+
if (arg === undefined) {
|
|
38
|
+
err("usage: node prior-reviews.js <paper-dir>\n");
|
|
39
|
+
return 2;
|
|
40
|
+
}
|
|
41
|
+
const verdict = seatVerdict(callerPath(arg), deps);
|
|
42
|
+
(verdict.code === 0 ? out : err)(`${verdict.line}\n`);
|
|
43
|
+
return verdict.code;
|
|
44
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prior-reviews-core — whether the panel's prior-reviews seat must sit, and which points file it
|
|
3
|
+
* reads. The answer comes from `priorReviewsOf`, the function `cycle/prior-reviews-answered` uses,
|
|
4
|
+
* so the seat and the rule fire on the same papers: the last rejection with reviews before the open
|
|
5
|
+
* attempt, walking back over attempts that brought no reviews (a withdrawal, a desk rejection).
|
|
6
|
+
* No model, no network.
|
|
7
|
+
*/
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { callerPath } from "#src/caller-path";
|
|
10
|
+
import type { Files } from "#src/ports/files";
|
|
11
|
+
import { readPaperSettings } from "#src/paper-settings";
|
|
12
|
+
import { priorReviewsOf } from "#src/prior-reviews-rule";
|
|
13
|
+
|
|
14
|
+
/** What the command prints, and its exit code. */
|
|
15
|
+
export interface SeatVerdict {
|
|
16
|
+
readonly code: number;
|
|
17
|
+
readonly line: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The seat's verdict for the paper in `dir`. */
|
|
21
|
+
export function seatVerdict(
|
|
22
|
+
dir: string,
|
|
23
|
+
deps: { readonly files: Files },
|
|
24
|
+
): SeatVerdict {
|
|
25
|
+
// readPaperSettings, as the lint run reads the file: a file that does not parse, or cycles it cannot
|
|
26
|
+
// hold, is an error here, never a "not required" (readCycles alone reads broken JSON as no cycles).
|
|
27
|
+
const settings = readPaperSettings(deps.files, dir);
|
|
28
|
+
if (!settings.ok)
|
|
29
|
+
return { code: 2, line: `prior-reviews: ${settings.error.why}` };
|
|
30
|
+
const cycles = settings.value?.cycles ?? null;
|
|
31
|
+
const prior = cycles === null ? null : priorReviewsOf(cycles);
|
|
32
|
+
if (prior === null)
|
|
33
|
+
return {
|
|
34
|
+
code: 0,
|
|
35
|
+
line: "not required: no rejection with reviews before the open attempt",
|
|
36
|
+
};
|
|
37
|
+
const from = `reviews from ${prior.rejected.id}, answered by ${prior.open.id}`;
|
|
38
|
+
return deps.files.isFile(callerPath(join(dir, prior.file)))
|
|
39
|
+
? { code: 0, line: `required: ${prior.file} (${from})` }
|
|
40
|
+
: {
|
|
41
|
+
code: 1,
|
|
42
|
+
line: `required, and ${prior.file} is missing (${from}): write it first; cycle/prior-reviews-answered fails until it exists`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Where the command writes. */
|
|
47
|
+
export interface Output {
|
|
48
|
+
readonly out: (s: string) => void;
|
|
49
|
+
readonly err: (s: string) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Run the command on `argv`; the exit code. */
|
|
53
|
+
export function main(
|
|
54
|
+
argv: readonly string[],
|
|
55
|
+
deps: { readonly files: Files },
|
|
56
|
+
{ out, err }: Output,
|
|
57
|
+
): number {
|
|
58
|
+
const [arg] = argv;
|
|
59
|
+
if (arg === undefined) {
|
|
60
|
+
err("usage: node prior-reviews.js <paper-dir>\n");
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
const verdict = seatVerdict(callerPath(arg), deps);
|
|
64
|
+
(verdict.code === 0 ? out : err)(`${verdict.line}\n`);
|
|
65
|
+
return verdict.code;
|
|
66
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* prior-reviews — whether the panel's prior-reviews seat must sit, and its points file
|
|
4
|
+
* (`prior-reviews-core.ts`); this file only runs it. A consumer runs the compiled `prior-reviews.js`
|
|
5
|
+
* (Node strips no types under node_modules).
|
|
6
|
+
*
|
|
7
|
+
* Usage: node prior-reviews.js <paper-dir>
|
|
8
|
+
*/
|
|
9
|
+
import { nodeFiles } from "#src/adapters/node/index";
|
|
10
|
+
import { main } from "./prior-reviews-core.js";
|
|
11
|
+
process.exitCode = main(process.argv.slice(2), { files: nodeFiles }, {
|
|
12
|
+
out: (s) => process.stdout.write(s),
|
|
13
|
+
err: (s) => process.stderr.write(s),
|
|
14
|
+
});
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prior-reviews-core.ts: the prior-reviews seat sits exactly when `cycle/prior-reviews-answered`
|
|
3
|
+
* fires, past attempts that brought no reviews, and names the points file it reads.
|
|
4
|
+
*/
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { describe, expect, it } from "vitest";
|
|
8
|
+
import { memoryFiles } from "#src/adapters/memory/index";
|
|
9
|
+
import { runNode, useTempDir, writeTree } from "../../../test/support.ts";
|
|
10
|
+
import { readPaperSettings } from "#src/paper-settings";
|
|
11
|
+
import { main, seatVerdict } from "./prior-reviews-core.ts";
|
|
12
|
+
|
|
13
|
+
const SCRIPT = join(
|
|
14
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
15
|
+
"prior-reviews.ts",
|
|
16
|
+
);
|
|
17
|
+
const PAPER = "/work/papers/p";
|
|
18
|
+
const POINTS = "reviews/alpha-response.yaml";
|
|
19
|
+
|
|
20
|
+
const venue = (name: string) => ({
|
|
21
|
+
kind: "named",
|
|
22
|
+
name,
|
|
23
|
+
url: `https://${name.toLowerCase()}.example`,
|
|
24
|
+
});
|
|
25
|
+
const REVIEWED = {
|
|
26
|
+
id: "alpha-2026",
|
|
27
|
+
venue: venue("Alpha"),
|
|
28
|
+
opened: "2026-06-01",
|
|
29
|
+
deadlines: [],
|
|
30
|
+
outcome: {
|
|
31
|
+
kind: "rejected",
|
|
32
|
+
date: "2026-09-08",
|
|
33
|
+
evidence: "reviews/alpha.eml",
|
|
34
|
+
desk: false,
|
|
35
|
+
points: POINTS,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const between = (outcome: object) => ({
|
|
39
|
+
id: "gamma-2026",
|
|
40
|
+
venue: venue("Gamma"),
|
|
41
|
+
opened: "2026-09-09",
|
|
42
|
+
deadlines: [],
|
|
43
|
+
outcome: { date: "2026-10-01", evidence: "reviews/gamma.eml", ...outcome },
|
|
44
|
+
});
|
|
45
|
+
const OPEN = {
|
|
46
|
+
id: "beta-2027",
|
|
47
|
+
venue: venue("Beta"),
|
|
48
|
+
opened: "2026-10-02",
|
|
49
|
+
deadlines: [],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** The paper folder with `cycles` as its record, and the points file when `points` is true. */
|
|
53
|
+
const paper = (cycles: readonly object[] | undefined, points = true) =>
|
|
54
|
+
memoryFiles({
|
|
55
|
+
[`${PAPER}/paperlint.json`]: JSON.stringify(
|
|
56
|
+
cycles === undefined ? {} : { cycles },
|
|
57
|
+
),
|
|
58
|
+
...(points ? { [`${PAPER}/${POINTS}`]: "points: []\n" } : {}),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const verdict = (cycles: readonly object[] | undefined, points = true) =>
|
|
62
|
+
seatVerdict(PAPER, { files: paper(cycles, points) });
|
|
63
|
+
|
|
64
|
+
/** A record whose one cycle has no id, venue or dates: the settings reader refuses it. */
|
|
65
|
+
const BROKEN = JSON.stringify({ cycles: [{}] });
|
|
66
|
+
|
|
67
|
+
const REQUIRED = {
|
|
68
|
+
code: 0,
|
|
69
|
+
line: `required: ${POINTS} (reviews from alpha-2026, answered by beta-2027)`,
|
|
70
|
+
};
|
|
71
|
+
const NOT_REQUIRED = {
|
|
72
|
+
code: 0,
|
|
73
|
+
line: "not required: no rejection with reviews before the open attempt",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
describe("seatVerdict — the seat sits when the rule fires", () => {
|
|
77
|
+
it("🔴 rejected with reviews → withdrawn → open: required, with the rejection's points file", () => {
|
|
78
|
+
expect(verdict([REVIEWED, between({ kind: "withdrawn" }), OPEN])).toEqual(
|
|
79
|
+
REQUIRED,
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("🔴 rejected with reviews → desk-rejected → open: required", () => {
|
|
84
|
+
expect(
|
|
85
|
+
verdict([REVIEWED, between({ kind: "rejected", desk: true }), OPEN]),
|
|
86
|
+
).toEqual(REQUIRED);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("🔴 rejected with reviews, then open directly: required", () => {
|
|
90
|
+
expect(verdict([REVIEWED, { ...OPEN, opened: "2026-09-09" }])).toEqual(
|
|
91
|
+
REQUIRED,
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("🔴 required, and the points file is missing: exit 1, says to write it", () => {
|
|
96
|
+
expect(verdict([REVIEWED, OPEN], false)).toEqual({
|
|
97
|
+
code: 1,
|
|
98
|
+
line: `required, and ${POINTS} is missing (reviews from alpha-2026, answered by beta-2027): write it first; cycle/prior-reviews-answered fails until it exists`,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("no cycles recorded: not required", () => {
|
|
103
|
+
expect(verdict(undefined)).toEqual(NOT_REQUIRED);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("only a desk rejection before the open attempt: not required", () => {
|
|
107
|
+
expect(verdict([between({ kind: "rejected", desk: true }), OPEN])).toEqual(
|
|
108
|
+
NOT_REQUIRED,
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("the reviewed rejection is the last attempt, nothing open: not required", () => {
|
|
113
|
+
expect(verdict([REVIEWED])).toEqual(NOT_REQUIRED);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('🔴 a paperlint.json that does not parse: exit 2 with readPaperSettings\' reason, never "not required"', () => {
|
|
117
|
+
const files = memoryFiles({
|
|
118
|
+
[`${PAPER}/paperlint.json`]: '{ "cycles": [], }',
|
|
119
|
+
});
|
|
120
|
+
const read = readPaperSettings(files, PAPER);
|
|
121
|
+
expect({ read: read.ok, verdict: seatVerdict(PAPER, { files }) }).toEqual({
|
|
122
|
+
read: false,
|
|
123
|
+
verdict: {
|
|
124
|
+
code: 2,
|
|
125
|
+
line: `prior-reviews: ${read.ok ? "" : read.error.why}`,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("🔴 cycles the record cannot hold: exit 2 with the settings' reason", () => {
|
|
131
|
+
const files = memoryFiles({ [`${PAPER}/paperlint.json`]: BROKEN });
|
|
132
|
+
const read = readPaperSettings(files, PAPER);
|
|
133
|
+
expect({ read: read.ok, verdict: seatVerdict(PAPER, { files }) }).toEqual({
|
|
134
|
+
read: false,
|
|
135
|
+
verdict: {
|
|
136
|
+
code: 2,
|
|
137
|
+
line: `prior-reviews: ${read.ok ? "" : read.error.why}`,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe("main — the command", () => {
|
|
144
|
+
const run = (argv: readonly string[], cycles?: readonly object[]) => {
|
|
145
|
+
const out: string[] = [];
|
|
146
|
+
const err: string[] = [];
|
|
147
|
+
const code = main(
|
|
148
|
+
argv,
|
|
149
|
+
{ files: paper(cycles) },
|
|
150
|
+
{
|
|
151
|
+
out: (s) => out.push(s),
|
|
152
|
+
err: (s) => err.push(s),
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
return { code, out: out.join(""), err: err.join("") };
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
it("🔴 prints the verdict on stdout", () => {
|
|
159
|
+
expect(run([PAPER], [REVIEWED, OPEN])).toEqual({
|
|
160
|
+
code: 0,
|
|
161
|
+
out: `${REQUIRED.line}\n`,
|
|
162
|
+
err: "",
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("no argument: the usage on stderr, exit 2", () => {
|
|
167
|
+
expect(run([])).toEqual({
|
|
168
|
+
code: 2,
|
|
169
|
+
out: "",
|
|
170
|
+
err: "usage: node prior-reviews.js <paper-dir>\n",
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("an unreadable record goes to stderr", () => {
|
|
175
|
+
const err: string[] = [];
|
|
176
|
+
const files = memoryFiles({ [`${PAPER}/paperlint.json`]: BROKEN });
|
|
177
|
+
const code = main(
|
|
178
|
+
[PAPER],
|
|
179
|
+
{ files },
|
|
180
|
+
{ out: () => {}, err: (s) => err.push(s) },
|
|
181
|
+
);
|
|
182
|
+
expect({ code, toStderr: err.length }).toEqual({ code: 2, toStderr: 1 });
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
describe("prior-reviews.ts — the runner on a real folder", () => {
|
|
187
|
+
const dir = useTempDir();
|
|
188
|
+
|
|
189
|
+
it("🔴 required for a reviewed rejection behind a withdrawal, from any cwd", () => {
|
|
190
|
+
writeTree(dir, {
|
|
191
|
+
"paperlint.json": JSON.stringify({
|
|
192
|
+
cycles: [REVIEWED, between({ kind: "withdrawn" }), OPEN],
|
|
193
|
+
}),
|
|
194
|
+
[POINTS]: "points: []\n",
|
|
195
|
+
});
|
|
196
|
+
const r = runNode(SCRIPT, [dir], { cwd: "/" });
|
|
197
|
+
expect(r).toEqual({ status: 0, stdout: `${REQUIRED.line}\n`, stderr: "" });
|
|
198
|
+
});
|
|
199
|
+
it("no argument: the usage on stderr, exit 2", () => {
|
|
200
|
+
expect(runNode(SCRIPT, [], { cwd: "/" })).toEqual({
|
|
201
|
+
status: 2,
|
|
202
|
+
stdout: "",
|
|
203
|
+
stderr: "usage: node prior-reviews.js <paper-dir>\n",
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* prior-reviews — whether the panel's prior-reviews seat must sit, and its points file
|
|
4
|
+
* (`prior-reviews-core.ts`); this file only runs it. A consumer runs the compiled `prior-reviews.js`
|
|
5
|
+
* (Node strips no types under node_modules).
|
|
6
|
+
*
|
|
7
|
+
* Usage: node prior-reviews.js <paper-dir>
|
|
8
|
+
*/
|
|
9
|
+
import { nodeFiles } from "#src/adapters/node/index";
|
|
10
|
+
import { main } from "./prior-reviews-core.ts";
|
|
11
|
+
|
|
12
|
+
process.exitCode = main(
|
|
13
|
+
process.argv.slice(2),
|
|
14
|
+
{ files: nodeFiles },
|
|
15
|
+
{
|
|
16
|
+
out: (s) => process.stdout.write(s),
|
|
17
|
+
err: (s) => process.stderr.write(s),
|
|
18
|
+
},
|
|
19
|
+
);
|
package/src/readability.test.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { latexReader } from "./adapters/latex/index.ts";
|
|
|
7
7
|
import { memoryFiles } from "./adapters/memory/index.ts";
|
|
8
8
|
import { sourcesCodec } from "./adapters/sources-record/index.ts";
|
|
9
9
|
import {
|
|
10
|
+
DEFAULT_MAX_PARAGRAPH_NUMBERS,
|
|
10
11
|
DEFAULT_MAX_PARAGRAPH_WORDS,
|
|
11
12
|
judgeCaptionWords,
|
|
12
13
|
judgeParagraphNumbers,
|
|
@@ -44,21 +45,21 @@ const found = (body: string) =>
|
|
|
44
45
|
).map((f) => f.data);
|
|
45
46
|
|
|
46
47
|
describe("tex/max-paragraph-words — a paragraph over the ceiling, and only that", () => {
|
|
47
|
-
it("🔴
|
|
48
|
+
it("🔴 251 words: fires, with the count, the ceiling and the paragraph's first words", () => {
|
|
48
49
|
// Guards: the case that was a false green once — a long single sentence tripped a sentence
|
|
49
50
|
// ceiling and never the paragraph one. Here every sentence is at most ten words.
|
|
50
|
-
expect(found(paragraph(
|
|
51
|
+
expect(found(paragraph(251))).toEqual([
|
|
51
52
|
{
|
|
52
|
-
words:
|
|
53
|
-
max:
|
|
53
|
+
words: 251,
|
|
54
|
+
max: 250,
|
|
54
55
|
head: "The rule reads the body and counts what…",
|
|
55
56
|
},
|
|
56
57
|
]);
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
it("
|
|
60
|
-
// Guards: the ceiling is inclusive —
|
|
61
|
-
expect(found(paragraph(
|
|
60
|
+
it("250 words and a short paragraph: silent", () => {
|
|
61
|
+
// Guards: the ceiling is inclusive — 250 is allowed.
|
|
62
|
+
expect(found(paragraph(250))).toEqual([]);
|
|
62
63
|
expect(found(paragraph(30))).toEqual([]);
|
|
63
64
|
});
|
|
64
65
|
|
|
@@ -89,9 +90,9 @@ describe("maxOf — the ceiling a config sets", () => {
|
|
|
89
90
|
it("the option when it is set, the default otherwise", () => {
|
|
90
91
|
// Guards: ESLint has validated the option; anything else falls back to the default.
|
|
91
92
|
expect(maxOf([{ max: 120 }])).toBe(120);
|
|
92
|
-
expect(maxOf([])).toBe(
|
|
93
|
-
expect(maxOf(undefined)).toBe(
|
|
94
|
-
expect(maxOf(["warn"])).toBe(
|
|
93
|
+
expect(maxOf([])).toBe(250);
|
|
94
|
+
expect(maxOf(undefined)).toBe(250);
|
|
95
|
+
expect(maxOf(["warn"])).toBe(250);
|
|
95
96
|
});
|
|
96
97
|
});
|
|
97
98
|
|
|
@@ -128,13 +129,13 @@ describe("the rule, through its create()", () => {
|
|
|
128
129
|
};
|
|
129
130
|
|
|
130
131
|
it("reports at the paragraph's first line, with its message id", () => {
|
|
131
|
-
expect(reported(paragraph(
|
|
132
|
+
expect(reported(paragraph(260))).toEqual([
|
|
132
133
|
{
|
|
133
134
|
loc: { start: { line: 3, column: 0 }, end: { line: 3, column: 0 } },
|
|
134
135
|
messageId: "paragraph",
|
|
135
136
|
data: {
|
|
136
|
-
words:
|
|
137
|
-
max:
|
|
137
|
+
words: 260,
|
|
138
|
+
max: 250,
|
|
138
139
|
head: "The rule reads the body and counts what…",
|
|
139
140
|
},
|
|
140
141
|
},
|
|
@@ -143,65 +144,67 @@ describe("the rule, through its create()", () => {
|
|
|
143
144
|
|
|
144
145
|
it("a source without a raw text is read from its text", () => {
|
|
145
146
|
// Guards: ESLint's source code may carry no `raw`; the rule falls back to `text`.
|
|
146
|
-
expect(reported(paragraph(
|
|
147
|
+
expect(reported(paragraph(260), [], false)).toHaveLength(1);
|
|
147
148
|
});
|
|
148
149
|
|
|
149
|
-
it("an option moves the ceiling:
|
|
150
|
-
expect(reported(paragraph(
|
|
151
|
-
expect(reported(paragraph(
|
|
150
|
+
it("an option moves the ceiling: 240 words fire under max 120, not under the default", () => {
|
|
151
|
+
expect(reported(paragraph(240), [{ max: 120 }])).toHaveLength(1);
|
|
152
|
+
expect(reported(paragraph(240))).toHaveLength(0);
|
|
152
153
|
});
|
|
153
154
|
});
|
|
154
155
|
|
|
155
156
|
/** What the numbers judge finds in `body` at the default ceiling. */
|
|
156
157
|
const numbersFound = (body: string) => {
|
|
157
158
|
const src = doc(body);
|
|
158
|
-
return judgeParagraphNumbers(
|
|
159
|
-
(
|
|
160
|
-
|
|
159
|
+
return judgeParagraphNumbers(
|
|
160
|
+
latexReader.bodyProse(src),
|
|
161
|
+
DEFAULT_MAX_PARAGRAPH_NUMBERS,
|
|
162
|
+
).map((f) => f.data);
|
|
161
163
|
};
|
|
162
164
|
|
|
163
165
|
describe("tex/max-paragraph-numbers", () => {
|
|
164
|
-
it("🔴
|
|
165
|
-
const
|
|
166
|
-
"We ran 1 and 2.5 and 30\\% and 4,000 and \\numA{} and \\numTotal and 7 and 8.";
|
|
167
|
-
expect(numbersFound(
|
|
168
|
-
expect(numbersFound(`${
|
|
169
|
-
{ numbers:
|
|
166
|
+
it("🔴 eleven numbers fire, ten stay quiet; citations and references are not numbers, a hand-typed place is", () => {
|
|
167
|
+
const ten =
|
|
168
|
+
"We ran 1 and 2.5 and 30\\% and 4,000 and \\numA{} and \\numTotal and 7 and 8 and 9 and 10.";
|
|
169
|
+
expect(numbersFound(ten)).toEqual([]);
|
|
170
|
+
expect(numbersFound(`${ten} Then 11.`)).toEqual([
|
|
171
|
+
{ numbers: 11, max: 10, head: "We ran 1 and 2.5 and 30% and…" },
|
|
170
172
|
]);
|
|
171
173
|
// Guards: a citation key and a reference are not quantities.
|
|
172
|
-
expect(
|
|
173
|
-
|
|
174
|
-
)
|
|
174
|
+
expect(numbersFound(`${ten} See \\cite{k2024} and \\ref{sec:1}.`)).toEqual(
|
|
175
|
+
[],
|
|
176
|
+
);
|
|
175
177
|
// A place typed by hand is a number like any other; written with \\ref it is not.
|
|
176
|
-
expect(numbersFound(`${
|
|
177
|
-
{ numbers:
|
|
178
|
+
expect(numbersFound(`${ten} See Section 3.2.`)).toEqual([
|
|
179
|
+
{ numbers: 11, max: 10, head: "We ran 1 and 2.5 and 30% and…" },
|
|
178
180
|
]);
|
|
179
|
-
expect(numbersFound(`${
|
|
181
|
+
expect(numbersFound(`${ten} See Section \\ref{sec:x}.`)).toEqual([]);
|
|
180
182
|
});
|
|
181
183
|
|
|
182
|
-
/**
|
|
183
|
-
const
|
|
184
|
+
/** Ten numbers a reader sees, none of them a `\num…` macro. */
|
|
185
|
+
const TEN =
|
|
186
|
+
"We ran 1 and 2 and 3 and 4 and 5 and 6 and 7 and 8 and 9 and 10 times.";
|
|
184
187
|
|
|
185
|
-
it("🔴 a `\\num…` macro in the paragraph's prose counts: the
|
|
186
|
-
expect(numbersFound(`${
|
|
187
|
-
{ numbers:
|
|
188
|
+
it("🔴 a `\\num…` macro in the paragraph's prose counts: the eleventh fires", () => {
|
|
189
|
+
expect(numbersFound(`${TEN} Then \\numFoo{} more.`)).toEqual([
|
|
190
|
+
{ numbers: 11, max: 10, head: "We ran 1 and 2 and 3 and…" },
|
|
188
191
|
]);
|
|
189
192
|
});
|
|
190
193
|
|
|
191
194
|
it("🔴 a `\\num…` macro inside inline math is math, not prose: not counted", () => {
|
|
192
195
|
// Guards: the source between the paragraph's first and last piece holds the macro.
|
|
193
|
-
expect(numbersFound(`${
|
|
196
|
+
expect(numbersFound(`${TEN} Then $\\num{9}$ more.`)).toEqual([]);
|
|
194
197
|
});
|
|
195
198
|
|
|
196
199
|
it("🔴 a `\\num…` macro on a commented-out line is not counted", () => {
|
|
197
200
|
// Guards: a comment changes nothing on the page, so it cannot add a number.
|
|
198
|
-
expect(numbersFound(`${
|
|
201
|
+
expect(numbersFound(`${TEN}\n% \\numFoo\nThen more.`)).toEqual([]);
|
|
199
202
|
});
|
|
200
203
|
|
|
201
204
|
it("🔴 a `\\num…` macro in a footnote counts for the footnote, not for the paragraph it hangs from", () => {
|
|
202
205
|
// Guards: a footnote is a passage of its own; its numbers are its own.
|
|
203
206
|
expect(
|
|
204
|
-
numbersFound(`${
|
|
207
|
+
numbersFound(`${TEN}\\footnote{See \\numFoo{}.} Then more.`),
|
|
205
208
|
).toEqual([]);
|
|
206
209
|
});
|
|
207
210
|
});
|
|
@@ -291,7 +294,7 @@ describe("the new rules, through create()", () => {
|
|
|
291
294
|
const long = Array.from({ length: 60 }, () => "word").join(" ");
|
|
292
295
|
expect(run(maxSentenceWordsRule(deps), `${long}.`)).toHaveLength(1);
|
|
293
296
|
expect(
|
|
294
|
-
run(maxParagraphNumbersRule(deps), "1 2 3 4 5 6 7 8 9."),
|
|
297
|
+
run(maxParagraphNumbersRule(deps), "1 2 3 4 5 6 7 8 9 10 11."),
|
|
295
298
|
).toHaveLength(1);
|
|
296
299
|
expect(run(maxParagraphWordsRule(deps), "Short.")).toHaveLength(0);
|
|
297
300
|
});
|
package/src/readability.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THE PARAGRAPH CEILING — `tex/max-paragraph-words`, a rule of the `tex` plugin over the body's
|
|
3
|
-
* prose: a paragraph runs past `max` words (default
|
|
3
|
+
* prose: a paragraph runs past `max` words (default 250).
|
|
4
4
|
*
|
|
5
5
|
* ── OFF BY DEFAULT ───────────────────────────────────────────────────────────────
|
|
6
6
|
* No call for papers states a paragraph limit, so no venue is a source for the number. The rule is
|
|
7
7
|
* registered and silent until a project turns it on in its `rules`, as `tex/heading-case` is. The
|
|
8
8
|
* name and the `max` option follow ESLint's own `max-lines`, `max-len`, `max-statements`.
|
|
9
9
|
*
|
|
10
|
-
* ── WHERE
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* ── WHERE 250 COMES FROM ─────────────────────────────────────────────────────────
|
|
11
|
+
* The 99th percentile of paragraph length over the accepted real papers in
|
|
12
|
+
* `fixtures/real-papers/accepted/` (96 papers with at least 2,500 body words, 7,994 paragraphs,
|
|
13
|
+
* measured with this rule's counter): p99 is 252, so 250 leaves about 1% of accepted paragraphs
|
|
14
|
+
* over it. The author chose it on 2026-11-20. It rests on what 99% of accepted paragraphs pass, not
|
|
15
|
+
* on reviewer evidence: a pilot on ICLR 2025 presentation scores found no link between long
|
|
16
|
+
* paragraphs and the score (inconclusive). The measurement is on the rule's page. A paragraph is
|
|
17
|
+
* at most `max` words; 250 is allowed.
|
|
15
18
|
*
|
|
16
19
|
* ── WHAT IT READS ────────────────────────────────────────────────────────────────
|
|
17
20
|
* The body's prose through the `LatexReader` port (`bodyProse`): paragraphs, list items and
|
|
@@ -40,10 +43,10 @@ import {
|
|
|
40
43
|
} from "./tex-venue-rules.ts";
|
|
41
44
|
|
|
42
45
|
/** The ceiling when the config sets none: the largest paragraph that does not fire. */
|
|
43
|
-
export const DEFAULT_MAX_PARAGRAPH_WORDS =
|
|
46
|
+
export const DEFAULT_MAX_PARAGRAPH_WORDS = 250;
|
|
44
47
|
|
|
45
|
-
/** The numbers ceiling when the config sets none:
|
|
46
|
-
export const DEFAULT_MAX_PARAGRAPH_NUMBERS =
|
|
48
|
+
/** The numbers ceiling when the config sets none: an eleventh number fires. */
|
|
49
|
+
export const DEFAULT_MAX_PARAGRAPH_NUMBERS = 10;
|
|
47
50
|
|
|
48
51
|
/** The sentence ceiling when the config sets none: a 56th word fires. */
|
|
49
52
|
export const DEFAULT_MAX_SENTENCE_WORDS = 55;
|