feat: comment categories; emend, relink and resolve corrections

scienting-layer/1: an optional, fixed category on comment, caveat and
question bodies (comment, context, critique, question, correction,
feedback, resource).

Corrections: emend fixes the authors' own slip and keeps what was printed
(a run's printed), never lowering fidelity or a witness match; relink sets
or removes what a citation names; resolve sets a reference's resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017R7sgDNvUGWY2zFPCq2JH6
This commit is contained in:
alexmandClaude committed 2026-10-17 06:17:10 -04:00
1 parent 4d59b29b63
commit 8b5ee87275
33 files changed
+726 -80

No files matched your search

+15
View File
@@ -46,3 +46,18 @@ Both are minor changes in the sense of [spec/00](spec/00-introduction.md): no va
`paperspec.align` gains `lcs_length` (bit-parallel, Hyyrö 2004) and `similarity`, and `alignment.jsonl` a second case, `substitutions`: a misread number, a misread word, a sentence too short to be paired this way and two sentences too unlike to be one.
- A suspect may name the witness its second reading came from (`witness`, a witness ID; [spec/05 §5.7](spec/05-hashes.md#57-suspects), `suspect.schema.json`), and a package whose suspect names a witness it does not have breaks `doc.suspect.witness`.
No broken package exercises the rule yet: adding one changes the count of broken packages that the 0.1.0 entry above states, so it waits for the release.
Four more, asked for by editors who correct and discuss papers rather than readings.
They are minor changes too: new operations, enumeration values and optional properties, with no valid file made invalid, no value of an existing file computed differently, and no existing vector case or package changed.
- Annotation categories ([spec/18 §18.4](spec/18-layers.md#184-bodies), `annotation.schema.json`, the `category` term of the JSON-LD context): a `comment`, `caveat` or `question` body may carry a `category` from the fixed list `comment`, `context`, `critique`, `question`, `correction`, `feedback` and `resource`, which a producer that supports categories SHOULD set on every such body.
The store's `annotations` table gains a nullable `category` column with its CHECK ([sql/store.sql](sql/store.sql)).
The example layer's comment, question and reply gain categories, which changes their record IDs, and it gains a caveat; no other fixture changes.
- `emend`, a correction of the authors' own typo, spelling, grammar, punctuation or wording, where the reading matches the page and the page is wrong ([spec/11 §11.6](spec/11-corrections.md#116-emendations)).
The emended text keeps what was printed in a new optional run property, `printed` ([spec/03 §3.5](spec/03-nodes.md#35-inline-runs), `runs.schema.json`), so a leaf as printed is recovered from the package alone ([3.6](spec/03-nodes.md#36-the-plain-projection), `paperspec.hashing.printed` and `as_printed`), and runs with `printed` are never joined.
The strict and lossy projections are of the runs as printed, so an emend changes the leaf's `text_hash`, `own_hash` and `node_hash` but not its `match_hash` or `align_key`, and alignment, corroboration and suspects never report an emendation ([spec/05 §5.1](spec/05-hashes.md#51-the-five-values)).
The gate refuses an emend in math, across runs, or that changes a digit or edits beside one, and refuses a `replace`, text `insert` or `split` inside an emended run (`correction.emend`).
- `relink` makes a run a citation of other references, a text run a cite run, or a cite run text, without changing its text, and `resolve` sets a reference's resolution in `references.jsonl`, keeping the one before in `from` ([spec/11 §11.7](spec/11-corrections.md#117-citations-and-references)); a package whose last resolve of a reference is not its resolution breaks `doc.correction.resolution`.
Like an emend, neither lowers a leaf's level, and a receipt keeps counting across all three ([spec/08 §8.1–8.2](spec/08-fidelity.md#82-levels), `receipts.carried_hashes`).
- The rules `correction.emend`, `correction.relink`, `correction.resolve` and `doc.correction.resolution` are registered, the `corrections` table's CHECK takes the three operations ([sql/doc.sql](sql/doc.sql)), `corrections.State` carries the reference records, and `paperspec stress` walks the three operations with their invariants.
`corrections.jsonl` gains thirteen cases and `projections.jsonl` and `projection-groups.jsonl` two each; no existing case changes.