paperlint 18.4.1 → 18.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CLAUDE.md +6 -2
  2. package/dist/adapters/hotcrp/portal.io.d.ts.map +1 -1
  3. package/dist/adapters/hotcrp/portal.io.js +1 -0
  4. package/dist/adapters/hotcrp/portal.io.js.map +1 -1
  5. package/dist/adapters/hotcrp/response.d.ts.map +1 -1
  6. package/dist/adapters/hotcrp/response.js +15 -0
  7. package/dist/adapters/hotcrp/response.js.map +1 -1
  8. package/dist/adapters/latex/abstract.d.ts +11 -0
  9. package/dist/adapters/latex/abstract.d.ts.map +1 -1
  10. package/dist/adapters/latex/abstract.js +1 -1
  11. package/dist/adapters/latex/abstract.js.map +1 -1
  12. package/dist/adapters/latex/index.d.ts.map +1 -1
  13. package/dist/adapters/latex/index.js +3 -0
  14. package/dist/adapters/latex/index.js.map +1 -1
  15. package/dist/adapters/latex/macros.d.ts +6 -0
  16. package/dist/adapters/latex/macros.d.ts.map +1 -0
  17. package/dist/adapters/latex/macros.js +27 -0
  18. package/dist/adapters/latex/macros.js.map +1 -0
  19. package/dist/adapters/osf/host.io.d.ts +12 -0
  20. package/dist/adapters/osf/host.io.d.ts.map +1 -0
  21. package/dist/adapters/osf/host.io.js +119 -0
  22. package/dist/adapters/osf/host.io.js.map +1 -0
  23. package/dist/adapters/osf/index.d.ts +10 -0
  24. package/dist/adapters/osf/index.d.ts.map +1 -0
  25. package/dist/adapters/osf/index.js +10 -0
  26. package/dist/adapters/osf/index.js.map +1 -0
  27. package/dist/adapters/osf/response.d.ts +11 -0
  28. package/dist/adapters/osf/response.d.ts.map +1 -0
  29. package/dist/adapters/osf/response.js +87 -0
  30. package/dist/adapters/osf/response.js.map +1 -0
  31. package/dist/artifact-upload-rule.d.ts +66 -0
  32. package/dist/artifact-upload-rule.d.ts.map +1 -0
  33. package/dist/artifact-upload-rule.js +151 -0
  34. package/dist/artifact-upload-rule.js.map +1 -0
  35. package/dist/artifact.d.ts +35 -0
  36. package/dist/artifact.d.ts.map +1 -0
  37. package/dist/artifact.js +251 -0
  38. package/dist/artifact.js.map +1 -0
  39. package/dist/cli.d.ts +7 -0
  40. package/dist/cli.d.ts.map +1 -1
  41. package/dist/cli.js +99 -7
  42. package/dist/cli.js.map +1 -1
  43. package/dist/domain/artifact-upload.d.ts +44 -0
  44. package/dist/domain/artifact-upload.d.ts.map +1 -0
  45. package/dist/domain/artifact-upload.js +80 -0
  46. package/dist/domain/artifact-upload.js.map +1 -0
  47. package/dist/domain/submission.d.ts +4 -0
  48. package/dist/domain/submission.d.ts.map +1 -1
  49. package/dist/domain/submission.js.map +1 -1
  50. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
  51. package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
  52. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
  53. package/dist/ports/artifact-host.d.ts +54 -0
  54. package/dist/ports/artifact-host.d.ts.map +1 -0
  55. package/dist/ports/artifact-host.js +2 -0
  56. package/dist/ports/artifact-host.js.map +1 -0
  57. package/dist/ports/latex.d.ts +9 -0
  58. package/dist/ports/latex.d.ts.map +1 -1
  59. package/dist/submission-confirm-hook.d.ts +11 -1
  60. package/dist/submission-confirm-hook.d.ts.map +1 -1
  61. package/dist/submission-confirm-hook.js +83 -21
  62. package/dist/submission-confirm-hook.js.map +1 -1
  63. package/dist/submission.d.ts +19 -2
  64. package/dist/submission.d.ts.map +1 -1
  65. package/dist/submission.js +121 -17
  66. package/dist/submission.js.map +1 -1
  67. package/dist/types.d.ts +6 -0
  68. package/dist/types.d.ts.map +1 -1
  69. package/docs/artifact-upload.md +124 -0
  70. package/docs/optional-rules.md +1 -0
  71. package/docs/osf-artifact.md +4 -1
  72. package/docs/rules/artifact/upload-current.md +85 -0
  73. package/docs/rules.md +1 -0
  74. package/docs/submission.md +19 -4
  75. package/eslint-rules/CLAUDE.md +5 -1
  76. package/eslint-rules/CLAUDE.md.spec.ts +3 -0
  77. package/package.json +1 -1
  78. package/src/adapters/hotcrp/portal.io.ts +1 -0
  79. package/src/adapters/hotcrp/portal.test.ts +43 -2
  80. package/src/adapters/hotcrp/response.ts +21 -0
  81. package/src/adapters/latex/abstract.ts +3 -1
  82. package/src/adapters/latex/index.ts +3 -0
  83. package/src/adapters/latex/macros.test.ts +31 -0
  84. package/src/adapters/latex/macros.ts +43 -0
  85. package/src/adapters/osf/cassette/README.md +20 -0
  86. package/src/adapters/osf/cassette/get-file.json +108 -0
  87. package/src/adapters/osf/cassette/get-listing.json +111 -0
  88. package/src/adapters/osf/cassette/get-missing.json +1 -0
  89. package/src/adapters/osf/cassette/put-new.json +31 -0
  90. package/src/adapters/osf/host.io.ts +156 -0
  91. package/src/adapters/osf/host.test.ts +274 -0
  92. package/src/adapters/osf/index.ts +14 -0
  93. package/src/adapters/osf/response.ts +105 -0
  94. package/src/artifact-upload-rule.test.ts +213 -0
  95. package/src/artifact-upload-rule.ts +213 -0
  96. package/src/artifact.test.ts +504 -0
  97. package/src/artifact.ts +402 -0
  98. package/src/cli.test.ts +149 -1
  99. package/src/cli.ts +121 -8
  100. package/src/domain/artifact-upload.test.ts +80 -0
  101. package/src/domain/artifact-upload.ts +111 -0
  102. package/src/domain/submission.ts +4 -0
  103. package/src/ports/artifact-host.ts +65 -0
  104. package/src/ports/latex.ts +10 -0
  105. package/src/rule-cases.test.ts +44 -0
  106. package/src/submission-confirm-hook.test.ts +113 -1
  107. package/src/submission-confirm-hook.ts +120 -27
  108. package/src/submission-fields-run.test.ts +1 -0
  109. package/src/submission-prior-reviews.test.ts +9 -1
  110. package/src/submission-show.test.ts +81 -0
  111. package/src/submission-update.test.ts +164 -6
  112. package/src/submission.ts +208 -24
  113. package/src/types.ts +6 -0
@@ -64,6 +64,7 @@ writing, not a number the venue states.
64
64
  | [`study/declare-sample`](rules/study/declare-sample.md) | experimental: a study's `prereg.json` declares its population, screens, coverage and the author's check of the drawn units | papers with a sampled study; no preset turns it on — [page](rules/study/declare-sample.md) |
65
65
  | [`cycle/changes-since-approved`](rules/cycle/changes-since-approved.md) | experimental: what the approved text had (numbers, cite keys) and the draft lacks is declared in `changes.yaml` | papers that keep an approved version; no preset turns it on — [page](rules/cycle/changes-since-approved.md) |
66
66
  | [`cycle/changes-since-approved-coverage`](rules/cycle/changes-since-approved-coverage.md) | experimental: each paragraph of the approved text that is gone is covered by a `changes.yaml` entry | the same; a warning — [page](rules/cycle/changes-since-approved-coverage.md) |
67
+ | [`artifact/upload-current`](rules/artifact/upload-current.md) | the paper prints the numbers its uploaded artifact was built for, as the upload record (`paperlint artifact record`) says | papers with an uploaded artifact and a file of number macros; turned on with `["warn", { "numbers": "numbersdef.tex" }]` — [page](rules/artifact/upload-current.md) |
67
68
 
68
69
  ## `pdf/last-page-balance`
69
70
 
@@ -4,11 +4,14 @@ For a double-blind venue without a supplementary upload, the reproduction artifa
4
4
  on an [OSF](https://osf.io) project behind an anonymized view-only link (creating the project and
5
5
  the link: `submit-paper`, step 2). This page replaces or adds a file on that project through the
6
6
  [OSF API](https://developer.osf.io/), when the web interface is inconvenient.
7
+ `paperlint artifact upload --to osf` does the same and writes the upload record
8
+ ([`artifact-upload.md`](artifact-upload.md)); this page is the manual way.
7
9
 
8
10
  ## The token
9
11
 
10
12
  Make a personal access token at `osf.io/settings/tokens` with the scope `osf.full_write` (a
11
- read-only token cannot write); it is shown once. Set it in your environment as `OSF_TOKEN`. Never
13
+ read-only token cannot write); it is shown once. Set it in your environment as `OSF_TOKEN` for the
14
+ lines below (`paperlint artifact upload` reads `OSF_TOKEN_OSF_IO` instead). Never
12
15
  commit it, print it or write it into a file, and delete it on the same page after the upload.
13
16
 
14
17
  ## Replace a file
@@ -0,0 +1,85 @@
1
+ # artifact/upload-current
2
+
3
+ **OPT-IN: off unless you turn it on with its options.** **Level:** whatever you give it; `warn` is
4
+ meant · **Reads:** the paper's upload record (`submission/artifact-upload.json`), its numbers file,
5
+ `paper.tex` and the body files of the last build · **Reported on:** the first line of the paper's
6
+ `PIPELINE-STATUS.md`
7
+
8
+ ## What it catches
9
+
10
+ The paper prints a number its uploaded artifact was not built for. The upload record
11
+ ([format](../../artifact-upload.md)) holds the paper's number macros as they were when the artifact
12
+ was uploaded; the rule compares them with the numbers file now and reports, once:
13
+
14
+ ```text
15
+ papers/my-paper/PIPELINE-STATUS.md
16
+ 1:1 warning the paper prints 4 numbers the upload of 2026-11-01 (https://osf.io/abcde/) was not
17
+ built for: 3 new (nA, nB, nC), 1 changed (nRepos) — rebuild and upload the artifact,
18
+ then record it again (`paperlint artifact record <zip> --url <url>`)
19
+ artifact/upload-current
20
+ ```
21
+
22
+ Only the macros the paper's source uses count: a macro defined in the numbers file and printed
23
+ nowhere never fires. A key is _new_ when the record lacks it, _changed_ when the record holds
24
+ another value.
25
+
26
+ Turned on and missing what it needs, it says so once and judges nothing else: no `numbers` option;
27
+ the numbers file missing, or defining no macro without arguments; no record (it names
28
+ `paperlint artifact record`); a record that is not one (it says which field and why).
29
+
30
+ ## Why
31
+
32
+ A reviewer runs the archive the paper links. When the paper's numbers move after the upload (a
33
+ rerun, a new study, a fixed bug), the archive reproduces numbers the paper no longer prints, and
34
+ nothing in the build says so. The record is the one fact that survives the upload: what the paper
35
+ printed when the archive was made.
36
+
37
+ ## Examples
38
+
39
+ Turning it on, in the paper's `paperlint.json`:
40
+
41
+ ```json
42
+ {
43
+ "rules": {
44
+ "artifact/upload-current": ["warn", { "numbers": "numbersdef.tex" }]
45
+ }
46
+ }
47
+ ```
48
+
49
+ Failing: `numbersdef.tex` says `\newcommand{\nRepos}{64}`, the body prints `\nRepos`, and the
50
+ record's `numbers` has `"nRepos": "63"`.
51
+
52
+ Passing: the record's `numbers` holds `"nRepos": "64"`; or the rule is not turned on.
53
+
54
+ ## Options
55
+
56
+ | option | required | what |
57
+ | --------- | -------- | ----------------------------------------------------------------------------------- |
58
+ | `numbers` | yes | the paper's file of number macros, relative to the paper |
59
+ | `record` | no | the upload record, relative to the paper; default `submission/artifact-upload.json` |
60
+
61
+ The numbers file holds `\newcommand{\key}{value}` lines (`\newcommand*`, `\renewcommand`,
62
+ `\providecommand` and `\def\key{value}` too); a macro with arguments is skipped. A value is compared
63
+ as written in its definition, so `41.2\%` and `41.2 \%` differ.
64
+
65
+ ## What it does not check
66
+
67
+ - **The host.** The rule never calls the network: it trusts the record. Whether the host still holds
68
+ the file the record names is `paperlint artifact show` (by hash, where the host gives one).
69
+ - **The archive's inside.** Whether the uploaded archive computes those numbers is not looked at;
70
+ the record says what the paper printed when it was uploaded, not what the archive produces.
71
+ - **Numbers typed into the prose.** A number not printed through a macro of the numbers file is
72
+ invisible here (opt-in `tex/claim-provenance` looks at those).
73
+ - **Uses outside the paper's files.** Uses are read in `paper.tex` and, when the last build's record
74
+ (`_build/sources.json`) is fresh, the body files it lists; with no record or a stale one,
75
+ `paper.tex` alone, and `paper/sources-fresh` says so.
76
+ - **Which definition TeX keeps.** A macro defined twice keeps its last definition here, whatever
77
+ the definer (`\providecommand` keeps the first in TeX).
78
+
79
+ ## How to fix
80
+
81
+ Rebuild the artifact, upload it, and record the upload: `paperlint artifact record <zip> --url <url>`
82
+ (any host), or `paperlint artifact upload --to osf <zip> --save`, which writes the same record. Do
83
+ not re-record without uploading: the record would then claim an archive that was never built. If the
84
+ archive deliberately stays as it is, turn the rule off for the paper, or silence the finding with a
85
+ disable comment and its reason at the top of `PIPELINE-STATUS.md`.
package/docs/rules.md CHANGED
@@ -22,6 +22,7 @@ reads and when it fails. Errors fail `paperlint lint`; warnings print and do not
22
22
  | [`paper/edition-over`](rules/paper/edition-over.md) | warn | `paperlint.json` → the venue preset, and the clock | every deadline the paper's edition preset records has passed: the edition is over; names the newer editions of the series paperlint ships — [page](rules/paper/edition-over.md) |
23
23
  | [`artifact/required-files`](rules/artifact/required-files.md) | error; silent without `artifact.required` | `paperlint.json` (`artifact`) → the artifact's folder or its committed list of paths | a name the paper requires at the artifact's top level (`README`, `LICENSE`; any extension) is not there, or the folder or list is missing — [page](rules/artifact/required-files.md) |
24
24
  | [`artifact/promised`](rules/artifact/promised.md) | error; silent without `artifact.promises` | `paperlint.json` (`artifact`) → the artifact's folder or its committed list of paths | a promise of the paper (a label and a glob) matches no path of the artifact, or the folder or list is missing — [page](rules/artifact/promised.md) |
25
+ | [`artifact/upload-current`](rules/artifact/upload-current.md) | opt-in; off unless turned on with its options | the upload record and the paper's numbers file | the paper prints number macros its uploaded artifact was not built for (new keys, changed values), by the record written at upload; never calls the network — [page](rules/artifact/upload-current.md) |
25
26
  | [`paper/allowed-files-only`](rules/paper/allowed-files-only.md) | error | the paper folder's root listing → `paperlint.json` | a file or folder at the paper's root is not part of the layout (`PLAN.md`, `archive/`, a stray PDF); reported on `PIPELINE-STATUS.md`, once per entry, with where it goes; `extra/` takes anything — [page](rules/paper/allowed-files-only.md) |
26
27
  | [`repro/allowed-files-only`](rules/repro/allowed-files-only.md) | error | the listing of the paper's `repro/` | an entry at the top of `repro/` is not `README.md`, `studies.json`, `.gitignore`, `tools/`, `data/` or a study folder named `<id>-<slug>` (or, in a paper without the registry, `<slug>-YYYY-MM-DD`), or a study folder has no `README.md`; reported on `PIPELINE-STATUS.md`, once per entry, with where it goes by kind (a script → `repro/tools/`, data → `repro/data/`, a note → its study or `research/`) — [page](rules/repro/allowed-files-only.md) |
27
28
  | [`repro/study-registered`](rules/repro/study-registered.md) | error | the listing of the paper's `repro/`, `repro/studies.json`, `repro/README.md`, each study's `plan.json` | a study folder with no row in `repro/studies.json`, a row whose folder is missing or not `<id>-<slug>`, a bad or repeated id, a title over 8 words, `done` without a result and an existing result file, `superseded` without an existing successor, a row naming a measurement the registry does not declare, a measurement with no study or an unknown requirement, a headline measurement not approved by the author, a plan that is missing, malformed or — once the study runs — unfilled, a headline study that has run without the author's check in its plan, or the index in `repro/README.md` out of sync with the registry; `paperlint studies new` and `paperlint studies index` write both — [page](rules/repro/study-registered.md) |
@@ -119,10 +119,25 @@ then `match`: `yes` means the portal holds exactly the PDF you built (compared b
119
119
  deadlines in force for the current attempt, each with when and where it was read
120
120
  ([Deadlines](configuration.md#deadlines)). Exit 0 whenever the portal answered.
121
121
 
122
+ It also compares what the portal holds with the paper, and adds a line only where they differ:
123
+
124
+ - `paper title`, `paper abstract` — the paper's own (read as `new` reads them) is not the portal's;
125
+ `update` sends it;
126
+ - `paper authors` — `"authors"` in `paperlint.json` is not what the portal records (an author's
127
+ email in any case, name, affiliation, and their order). `update` does not change the authors;
128
+ change them on the site.
129
+
130
+ Spacing is not a difference. What paperlint cannot read, or a side that names no authors, is not
131
+ compared.
132
+
122
133
  ## `update`
123
134
 
124
- Sends the PDF, the paper's `"fields"`, and, when asked, a new abstract (`--abstract <file>`) and
125
- "submitted" (`--submit`).
135
+ Sends the PDF, the paper's `"fields"`, the paper's title and abstract each when the portal holds
136
+ another, and "submitted" when asked (`--submit`). `--abstract <file>` sends that file's text instead
137
+ of the paper's abstract, whatever the portal holds. One `title` and one `abstract` line say what
138
+ happens to each: `sends … — the portal has …`, `unchanged`, or `not checked` with the reason when
139
+ paperlint cannot read it, and then it sends none. Texts that differ only in spacing are the same. The
140
+ portal is read once for both, before the change is sent; a failed read stops the update.
126
141
  Without `--save` it is a dry run. It prints the portal's verdict and its messages; exit 1 when the
127
142
  portal would not take the change. Before sending, it asks you to open that exact PDF and check it
128
143
  against the venue's call for papers.
@@ -223,6 +238,6 @@ every client.
223
238
 
224
239
  ## What it does not do
225
240
 
226
- - It does not set a field the venue preset does not record, change the authors after `new`, or
227
- upload supplementary files.
241
+ - It does not set a field the venue preset does not record, change the authors after `new` (`show`
242
+ says when they differ), or upload supplementary files.
228
243
  - It does not run the rest of `paperlint lint`: only the venue rules, on the PDF.
@@ -1,4 +1,4 @@
1
- <!-- vigiles:sha256:75393007efd6bb96 compiled from eslint-rules/CLAUDE.md.spec.ts -->
1
+ <!-- vigiles:sha256:a24e4a23a4caaf86 compiled from eslint-rules/CLAUDE.md.spec.ts -->
2
2
 
3
3
  # CLAUDE.md
4
4
 
@@ -43,3 +43,7 @@ the checks push every paper toward a blog post.
43
43
  ### Lint Rule Over Script
44
44
 
45
45
  **Guidance only** — A check over a syntax tree is a lint rule, not a script. It fires in the editor on save, gets the AST for free, and has a suppression syntax people already know. A script is for corpus-wide questions — index connectivity, ratios across many files. When the work has to run a program, a script may do the work and write facts to a JSON file, and a rule judges that file: the verdict still lands in the engine.
46
+
47
+ ### A Rule Is Configured The Eslint Way
48
+
49
+ **Guidance only** — Provisional, pending #599 (the author is not sure it is right). A rule's own switches (what to require, a threshold, a file to compare) come from its options where it is turned on: `["warn", { … }]`. A new rule is not on by default and silent until some key of `paperlint.json` is declared: that hides a check behind a setting nobody sees in the rule list. A fact several rules share about a paper (its venue, cycles, artifact, talk) reaches them through ESLint's `settings`, filled once by `buildConfig` from `paperlint.json`; a rule does not open `paperlint.json` itself. A rule whose subject IS `paperlint.json` (it validates the config) is exempt. Where an outside service varies (an artifact host, a portal), the rule reads a file of facts a command wrote and never the service; the services are adapters behind a port, as `src/ports/submission-portal.ts` and `src/adapters/hotcrp/` are, and eslint-plugin-import's `settings["import/resolver"]` is the ESLint precedent. About 25 existing rules predate this; #599 decides whether to move them, narrow this rule, or drop it and allow a rule to read `paperlint.json`. The author proposed this on 2026-11-21.
@@ -40,5 +40,8 @@ the checks push every paper toward a blog post.
40
40
  "lint-rule-over-script": guidance(
41
41
  "A check over a syntax tree is a lint rule, not a script. It fires in the editor on save, gets the AST for free, and has a suppression syntax people already know. A script is for corpus-wide questions — index connectivity, ratios across many files. When the work has to run a program, a script may do the work and write facts to a JSON file, and a rule judges that file: the verdict still lands in the engine.",
42
42
  ),
43
+ "a-rule-is-configured-the-eslint-way": guidance(
44
+ 'Provisional, pending #599 (the author is not sure it is right). A rule\'s own switches (what to require, a threshold, a file to compare) come from its options where it is turned on: `["warn", { … }]`. A new rule is not on by default and silent until some key of `paperlint.json` is declared: that hides a check behind a setting nobody sees in the rule list. A fact several rules share about a paper (its venue, cycles, artifact, talk) reaches them through ESLint\'s `settings`, filled once by `buildConfig` from `paperlint.json`; a rule does not open `paperlint.json` itself. A rule whose subject IS `paperlint.json` (it validates the config) is exempt. Where an outside service varies (an artifact host, a portal), the rule reads a file of facts a command wrote and never the service; the services are adapters behind a port, as `src/ports/submission-portal.ts` and `src/adapters/hotcrp/` are, and eslint-plugin-import\'s `settings["import/resolver"]` is the ESLint precedent. About 25 existing rules predate this; #599 decides whether to move them, narrow this rule, or drop it and allow a rule to read `paperlint.json`. The author proposed this on 2026-11-21.',
45
+ ),
43
46
  },
44
47
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "18.4.1",
3
+ "version": "18.6.0",
4
4
  "description": "A linter for scientific papers written in LaTeX: catches mistakes before you submit to a conference or journal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -102,6 +102,7 @@ export function changeObject(
102
102
  object: "paper",
103
103
  pid: id,
104
104
  ...(c.pdf === null ? {} : { submission: { content_file: CONTENT_FIELD } }),
105
+ ...(c.title === null ? {} : { title: c.title }),
105
106
  ...(c.abstract === null ? {} : { abstract: c.abstract }),
106
107
  ...(c.submit ? { status: "submitted" } : {}),
107
108
  ...c.fields,
@@ -203,6 +203,13 @@ test("show: GET /api/paper?p=<id>&word_limit=hard with the bearer token, parsed
203
203
  paperType: "Example paper type",
204
204
  topics: ["Example topic one", "Example topic two"],
205
205
  abstract: "An example abstract of exactly ten words for the test.",
206
+ authors: [
207
+ {
208
+ name: "A. Author",
209
+ email: "author@example.org",
210
+ affiliation: "Example University",
211
+ },
212
+ ],
206
213
  pdf: {
207
214
  sha256: CASSETTE_HEX,
208
215
  hash: `sha2-${CASSETTE_HEX}`,
@@ -237,6 +244,7 @@ test("show: a submission without a PDF, fields absent, a paper type that is not
237
244
  paperType: "2",
238
245
  topics: [],
239
246
  abstract: null,
247
+ authors: null,
240
248
  pdf: {
241
249
  sha256: null,
242
250
  hash: "sha2-short",
@@ -260,6 +268,25 @@ test("show: a null paper type and a null submission read as none", async () => {
260
268
  assert.deepEqual(r.ok && [r.value.paperType, r.value.pdf], [null, null]);
261
269
  });
262
270
 
271
+ test("show: an author HotCRP names by one part, or without an email, reads with what it has", async () => {
272
+ answer(200, {
273
+ ok: true,
274
+ paper: {
275
+ pid: 7,
276
+ status: "draft",
277
+ authors: [
278
+ { email: "ada@example.org", family_name: "Lovelace" },
279
+ { given_name: "Bob" },
280
+ ],
281
+ },
282
+ });
283
+ const r = await portal().show(7);
284
+ assert.deepEqual(r.ok && r.value.authors, [
285
+ { name: "Lovelace", email: "ada@example.org", affiliation: null },
286
+ { name: "Bob", email: "", affiliation: null },
287
+ ]);
288
+ });
289
+
263
290
  test("🔴 show: 401 surfaces HotCRP's own message, and the token is in no part of it", async () => {
264
291
  seen.length = 0;
265
292
  reply = { status: 401, body: cassette("get-noauth") };
@@ -278,6 +305,7 @@ test("🔴 show: 401 surfaces HotCRP's own message, and the token is in no part
278
305
 
279
306
  const CHANGE: SubmissionChange = {
280
307
  pdf: { name: "paper.pdf", bytes: PDF },
308
+ title: "A New Title",
281
309
  abstract: "new abstract",
282
310
  submit: true,
283
311
  fields: {},
@@ -301,6 +329,7 @@ test("update: a dry run by default — dry_run=1, the json field, the PDF under
301
329
  object: "paper",
302
330
  pid: 7,
303
331
  submission: { content_file: CONTENT_FIELD },
332
+ title: "A New Title",
304
333
  abstract: "new abstract",
305
334
  status: "submitted",
306
335
  });
@@ -573,7 +602,13 @@ test("a portal that does not answer is unreachable, with the network's words", a
573
602
 
574
603
  test("changeObject: only what changes is sent", () => {
575
604
  assert.deepEqual(
576
- changeObject(7, { pdf: null, abstract: null, submit: false, fields: {} }),
605
+ changeObject(7, {
606
+ pdf: null,
607
+ title: null,
608
+ abstract: null,
609
+ submit: false,
610
+ fields: {},
611
+ }),
577
612
  { object: "paper", pid: 7 },
578
613
  );
579
614
  });
@@ -585,7 +620,13 @@ test("changeObject and createObject: the venue's fields go in as submission-obje
585
620
  ACMCorAut: "ada@example.org",
586
621
  };
587
622
  assert.deepEqual(
588
- changeObject(7, { pdf: null, abstract: null, submit: false, fields }),
623
+ changeObject(7, {
624
+ pdf: null,
625
+ title: null,
626
+ abstract: null,
627
+ submit: false,
628
+ fields,
629
+ }),
589
630
  { object: "paper", pid: 7, ...fields },
590
631
  );
591
632
  const created = createObject({ ...NEW, fields });
@@ -12,6 +12,7 @@ import { z } from "zod";
12
12
  import { err, ok, type Result } from "../../domain/result.ts";
13
13
  import { parseSha256, type Sha256 } from "../../domain/sha256.ts";
14
14
  import type {
15
+ Author,
15
16
  CreateOutcome,
16
17
  PortalDocument,
17
18
  PortalFailure,
@@ -42,6 +43,16 @@ const Paper = z.object({
42
43
  abstract: z.string().optional(),
43
44
  paper_type: z.unknown().optional(),
44
45
  topics: z.array(z.string()).optional(),
46
+ authors: z
47
+ .array(
48
+ z.object({
49
+ email: z.string().optional(),
50
+ given_name: z.string().optional(),
51
+ family_name: z.string().optional(),
52
+ affiliation: z.string().optional(),
53
+ }),
54
+ )
55
+ .optional(),
45
56
  submission: Document.nullable().optional(),
46
57
  submitted_at: z.number().optional(),
47
58
  modified_at: z.number().optional(),
@@ -115,6 +126,15 @@ const typeText = (v: unknown): string | null =>
115
126
  ? v
116
127
  : JSON.stringify(v);
117
128
 
129
+ /** An author as HotCRP sends one — the name in two parts — in the paper's terms. */
130
+ const authorOf = (
131
+ a: Readonly<NonNullable<z.infer<typeof Paper>["authors"]>[number]>,
132
+ ): Author => ({
133
+ name: `${a.given_name ?? ""} ${a.family_name ?? ""}`.trim(),
134
+ email: a.email ?? "",
135
+ affiliation: a.affiliation ?? null,
136
+ });
137
+
118
138
  function viewOf(b: Readonly<z.infer<typeof ShowBody>>): SubmissionView {
119
139
  const p = b.paper;
120
140
  return {
@@ -124,6 +144,7 @@ function viewOf(b: Readonly<z.infer<typeof ShowBody>>): SubmissionView {
124
144
  paperType: typeText(p.paper_type),
125
145
  topics: p.topics ?? [],
126
146
  abstract: p.abstract ?? null,
147
+ authors: p.authors === undefined ? null : p.authors.map(authorOf),
127
148
  pdf: documentOf(p.submission),
128
149
  submittedAt: p.submitted_at ?? null,
129
150
  modifiedAt: p.modified_at ?? null,
@@ -77,7 +77,9 @@ function defDefinition(m: Macro): readonly [string, Definition["body"]][] {
77
77
  }
78
78
 
79
79
  /** `\newcommand` and its kin, read by util-macros. */
80
- function definitionOf(m: Macro): readonly [string, Definition["body"]][] {
80
+ export function definitionOf(
81
+ m: Macro,
82
+ ): readonly [string, Definition["body"]][] {
81
83
  if (DEF_MACROS.has(m.content)) return defDefinition(m);
82
84
  // A \newcommand the parser gave no name has none here either: util-macros answers "".
83
85
  const name = newcommandMatcher(m) ? newcommandMacroToName(m) : "";
@@ -33,6 +33,7 @@ import {
33
33
  import { citeKeysOf, macroTextsOf, registeredNumbersOf } from "./facts.ts";
34
34
  import { captionProse } from "./captions.ts";
35
35
  import { headingsOf } from "./headings.ts";
36
+ import { macroValuesOf, macrosUsedOf } from "./macros.ts";
36
37
  import { documentBodyOf, includesOf } from "./includes.ts";
37
38
  import { outlineOf } from "./outline.ts";
38
39
  import { parseLatex } from "./parse.ts";
@@ -93,4 +94,6 @@ export const latexReader: LatexReader = {
93
94
  citeKeys: (src) => citeKeysOf(parseLatex(src)),
94
95
  registeredNumbers: registeredNumbersOf,
95
96
  macroTexts: macroTextsOf,
97
+ macroValues: macroValuesOf,
98
+ macrosUsed: macrosUsedOf,
96
99
  };
@@ -0,0 +1,31 @@
1
+ import { expect, test } from "vitest";
2
+ import { latexReader } from "./index.ts";
3
+
4
+ const NUMBERS = [
5
+ "\\newcommand{\\nRepos}{63}",
6
+ "\\newcommand*{\\pctPass}{ 41.2\\% }",
7
+ "\\def\\nRuns{7}",
8
+ "\\renewcommand\\nRepos{64}",
9
+ "\\newcommand{\\twice}[1]{#1#1}",
10
+ "% \\newcommand{\\commented}{1}",
11
+ ].join("\n");
12
+
13
+ test("macroValues: each argument-less definition with its body as written, in source order", () => {
14
+ // Guards: \newcommand, \newcommand*, \def and \renewcommand read; one with arguments and one in a comment not.
15
+ expect(latexReader.macroValues(NUMBERS)).toEqual([
16
+ { name: "nRepos", value: "63" },
17
+ { name: "pctPass", value: "41.2\\%" },
18
+ { name: "nRuns", value: "7" },
19
+ { name: "nRepos", value: "64" },
20
+ ]);
21
+ });
22
+
23
+ test("macrosUsed: a name counts where it is used, not where it is defined", () => {
24
+ const src =
25
+ "\\newcommand{\\local}{x}\\newcommand{\\pct}{\\nRuns\\%}\n\\begin{document}\nWe saw \\nRepos{} repos, \\pct.\n% \\pctPass\n\\end{document}\n";
26
+ // Guards: \local is only defined; \nRuns counts through \pct's body; a comment holds no use;
27
+ // the definers and \% are macros too, which no numbers file defines.
28
+ expect([...latexReader.macrosUsed(src)].sort()).toEqual(
29
+ ["%", "nRepos", "nRuns", "newcommand", "pct"].sort(),
30
+ );
31
+ });
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The author's own macros, read off the parse tree for `artifact/upload-current`: the value each
3
+ * argument-less one is defined to (`\newcommand`, `\newcommand*`, `\renewcommand`, `\providecommand`,
4
+ * `\def` and its kin), and the names a source uses. Pure.
5
+ *
6
+ * A value is the definition's body as written (`41.2\%`), not what TeX prints: two definitions that
7
+ * print alike but are written differently are two values. A name defined twice keeps its last value.
8
+ * A use is any occurrence of the name that is not its own definition, wherever it stands (a
9
+ * definition's body included): the name in `\newcommand{\x}` is not a use of `\x`.
10
+ */
11
+ import { printRaw } from "@unified-latex/unified-latex-util-print-raw";
12
+ import { countBy } from "remeda";
13
+ import type { MacroValue } from "../../ports/latex.ts";
14
+ import { definitionOf } from "./abstract.ts";
15
+ import { isNode, visited, type Macro } from "./nodes.ts";
16
+ import { parseLatex } from "./parse.ts";
17
+
18
+ /** Every macro node of the source, in document order. */
19
+ const macrosIn = (src: string): readonly Macro[] =>
20
+ visited(parseLatex(src).root, () => false).flatMap((v) =>
21
+ isNode(v) && v.type === "macro" ? [v] : [],
22
+ );
23
+
24
+ /** Each name `src` defines without arguments, and its body as written, in source order. */
25
+ export const macroValuesOf = (src: string): readonly MacroValue[] =>
26
+ macrosIn(src).flatMap((m) =>
27
+ definitionOf(m).flatMap(([name, body]) =>
28
+ body === null ? [] : [{ name, value: printRaw([...body]).trim() }],
29
+ ),
30
+ );
31
+
32
+ /** The names `src` uses: occurring more often than it defines them. */
33
+ export const macrosUsedOf = (src: string): readonly string[] => {
34
+ const macros = macrosIn(src);
35
+ const seen = countBy(macros, (m) => m.content);
36
+ const defined = countBy(
37
+ macros.flatMap((m) => definitionOf(m).map(([name]) => name)),
38
+ (n) => n,
39
+ );
40
+ return Object.entries(seen).flatMap(([n, c]) =>
41
+ c > (defined[n] ?? 0) ? [n] : [],
42
+ );
43
+ };
@@ -0,0 +1,20 @@
1
+ # OSF cassette
2
+
3
+ Answers to the requests `paperlint artifact upload|show` sends, replayed by `host.test.ts` from a
4
+ local server on 127.0.0.1 and parsed by the adapter's real schemas: no test reaches OSF.
5
+
6
+ Recorded from the live API on 2026-11-21 without a token, from a public project (`curl`, read-only).
7
+ Identifying values are replaced with fakes of the same type — the project's guid (`abcde`), the
8
+ file's id, guid, name, size, dates and hashes (the hashes are those of the 15 bytes
9
+ `artifact bytes\n`, which the tests upload); OSF's keys, value types and statuses are verbatim.
10
+
11
+ | file | request | HTTP | how |
12
+ | ------------------ | ------------------------------------------------------------------------------------------ | ---: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
13
+ | `get-file.json` | `GET https://api.osf.io/v2/files/<id>/` | 200 | recorded |
14
+ | `get-listing.json` | `GET https://api.osf.io/v2/nodes/<guid>/files/osfstorage/?filter[name]=<name>` | 200 | recorded; the file's `guid` is `null`, as OSF answered for it |
15
+ | `get-missing.json` | `GET https://api.osf.io/v2/files/000000000000000000000000/` | 404 | recorded verbatim |
16
+ | `put-new.json` | `PUT https://files.osf.io/v1/resources/<guid>/providers/osfstorage/?kind=file&name=<name>` | 201 | **not recorded** (it needs a token and writes): written from WaterButler's source — `{"data": <entity>}`, `id` = provider + path, `path` = `/<id>`, `extra.hashes` |
17
+
18
+ To re-record the three reads: `curl -sS -g -o <file> '<url>'` against a public project, then fake
19
+ every identifying value. Recording `put-new.json` needs a project of your own and a token with
20
+ `osf.full_write`; replace its values the same way.
@@ -0,0 +1,108 @@
1
+ {
2
+ "data": {
3
+ "id": "0123456789abcdef01234567",
4
+ "type": "files",
5
+ "attributes": {
6
+ "guid": "fgh12",
7
+ "checkout": null,
8
+ "name": "artifact.zip",
9
+ "kind": "file",
10
+ "path": "/0123456789abcdef01234567",
11
+ "size": 15,
12
+ "provider": "osfstorage",
13
+ "materialized_path": "/artifact.zip",
14
+ "last_touched": null,
15
+ "date_modified": "2026-11-01T10:00:00.000000",
16
+ "date_created": "2026-11-01T10:00:00.000000Z",
17
+ "extra": {
18
+ "hashes": {
19
+ "md5": "3f395fbbb68716f38f5ff7fa9d740e3b",
20
+ "sha256": "59bd16dfc39e768f82bb8ec74467e571e80ed284683b586f077dbf1aa2483ecd"
21
+ },
22
+ "downloads": 1
23
+ },
24
+ "tags": [],
25
+ "current_user_can_comment": false,
26
+ "current_version": 1,
27
+ "show_as_unviewed": false
28
+ },
29
+ "relationships": {
30
+ "parent_folder": {
31
+ "links": {
32
+ "related": {
33
+ "href": "https://api.osf.io/v2/files/0123456789abcdef00000000/",
34
+ "meta": {}
35
+ }
36
+ },
37
+ "data": {
38
+ "id": "0123456789abcdef00000000",
39
+ "type": "files"
40
+ }
41
+ },
42
+ "versions": {
43
+ "links": {
44
+ "related": {
45
+ "href": "https://api.osf.io/v2/files/0123456789abcdef01234567/versions/",
46
+ "meta": {}
47
+ }
48
+ }
49
+ },
50
+ "comments": {
51
+ "links": {
52
+ "related": {
53
+ "href": "https://api.osf.io/v2/nodes/abcde/comments/?filter%5Btarget%5D=fgh12",
54
+ "meta": {}
55
+ }
56
+ }
57
+ },
58
+ "node": {
59
+ "links": {
60
+ "related": {
61
+ "href": "https://api.osf.io/v2/nodes/abcde/",
62
+ "meta": {}
63
+ }
64
+ },
65
+ "data": {
66
+ "id": "abcde",
67
+ "type": "nodes"
68
+ }
69
+ },
70
+ "target": {
71
+ "links": {
72
+ "related": {
73
+ "href": "https://api.osf.io/v2/nodes/abcde/",
74
+ "meta": {
75
+ "type": "nodes"
76
+ }
77
+ }
78
+ },
79
+ "data": {
80
+ "type": "nodes",
81
+ "id": "abcde"
82
+ }
83
+ },
84
+ "cedar_metadata_records": {
85
+ "links": {
86
+ "related": {
87
+ "href": "https://api.osf.io/v2/files/0123456789abcdef01234567/cedar_metadata_records/",
88
+ "meta": {}
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "links": {
94
+ "info": "https://api.osf.io/v2/files/0123456789abcdef01234567/",
95
+ "move": "https://files.osf.io/v1/resources/abcde/providers/osfstorage/0123456789abcdef01234567",
96
+ "upload": "https://files.osf.io/v1/resources/abcde/providers/osfstorage/0123456789abcdef01234567",
97
+ "delete": "https://files.osf.io/v1/resources/abcde/providers/osfstorage/0123456789abcdef01234567",
98
+ "download": "https://osf.io/download/fgh12/",
99
+ "render": "https://mfr.osf.io/render?url=https%3A%2F%2Fosf.io%2Fdownload%2Ffgh12%2F%3Fdirect%26mode%3Drender",
100
+ "html": "https://osf.io/abcde/files/osfstorage/0123456789abcdef01234567",
101
+ "self": "https://api.osf.io/v2/files/0123456789abcdef01234567/",
102
+ "iri": "https://osf.io/fgh12"
103
+ }
104
+ },
105
+ "meta": {
106
+ "version": "2.0"
107
+ }
108
+ }