Files
paperspec/registry/rules.json
T
alexmandClaude ea0a7efa78 feat: zipped packages, target set, checklists, audit fixes and a stress test
Features for the next six months (accessible HTML export, paperpack and
Lode on packages, the personal bundle):

- Zipped packages: the oracle writes and reads `.sct.zip` archives under
  the rules of spec/12 §12.2; validate.py and load.py accept them; a
  byte-identical zip of the tiny package joins the fixtures, and two
  broken archives (traversal, symbolic link) join fixtures/invalid.
- The target set of targeted F3 (spec/08 §8.10) is computed by the
  oracle and pinned by vectors/targets.jsonl under each digit rule; the
  rule now covers cells as well as sentences and the leaves of anchored
  containers, and defines a node's section.
- scienting-checklist/1 (provisional): a conformance check of an export,
  covered by a receipt as ["checklist", id, hash] (spec/08 §8.11), with a
  WCAG 2.1 AA fixture and its receipt.
- QA reports are signed like receipts (spec/08 §8.9).
- A `description` annotation body with role alt or long, so an
  accessible export can find a confirmed figure description; the layer
  fixture carries one, and the store's body-kind constraint allows it.
- scienting-spot-check/1, the seed payload, is registered with a schema.
- exercise, submission and grade are provisional until a course has
  used them.

Audit fixes, each with a vector or a broken package where one was
missing:

- Folder packages: symbolic links are refused on validate and load,
  manifest paths must not collide under case folding, listed files are
  matched by exact name, files are hashed in chunks under a size limit.
- Files are compared byte for byte, so CR LF, a byte order mark, NaN,
  a lone surrogate or invalid UTF-8 is refused instead of translated;
  integers beyond 2^53 are read as doubles, as canonical JSON writes them.
- Receipts: signature.key must equal by and the key must be valid when
  signed; a qa receipt's nodes must be the sample at the original's
  hashes, its scope must name qa.of, its errors must be sampled nodes;
  statuses are computed once, iteratively, so chains of spot-checks
  hundreds deep settle; Base64 and manifest shape errors become refusals
  instead of tracebacks; counts and the fidelity of roster-less packages
  are recomputed.
- The gate enforces rule 11 of spec/11 §11.4: changed nodes are
  validated against the node schema and the references between nodes
  are checked, so a set to a bad value, an insert with unknown
  properties or a delete of a referenced header cell is refused; a
  relabel to null drops the label; a reclassify drops foreign
  attributes; a split strips whitespace across runs; ids.jsonl order
  follows spec/04 §4.4 in every state; a move after itself is refused.
- Anchors: the relabel rule requires that nothing else changed below the
  node; an alias chain ending in a deletion no longer crashes resolve.
- Notation: a script after an empty group applies to the previous atom
  ({}^{14}C); letters are defined by Unicode block in spec/05 §5.4 and
  the oracle; \left) is complex.
- Page fingerprints delete whitespace before folding, so "10 -20" and
  "10-20" fold alike (spec/07 §7.1).
- Grades are summed with exact decimals; the reviewer error bound is
  computed with integer arithmetic.
- receipts and revocations are keyed by (doc_key, id) in SQL, since one
  revocation may be carried by several packages.

Checking:

- tools/stress.py: seeded randomized property tests over canonical JSON,
  normalization, notation, random correction walks, anchor resolution,
  Merkle roots, spot-check samples, error bounds, fingerprints, mutated
  archives and packages, rights and spot-check chains; CI runs it.
- check.py verifies every count and version the prose states against
  the repository, the zipped fixture and crafted archives, the checklist
  coverage, and nine more broken packages.
- CONTRIBUTING.md gains a release checklist.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-14 20:07:22 -04:00

473 lines
16 KiB
JSON

{
"registry": "rules",
"version": "0.1.0",
"note": "Rule IDs name each refusal, so tools report file, node and rule in the form path:line: rule: message.",
"rules": [
{
"id": "correction.digits",
"description": "A digit changes without crop evidence, or a leaf's digits change undeclared.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.evidence",
"description": "An insert has no crop evidence.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.find",
"description": "`find` is empty or does not occur exactly once.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.insert",
"description": "Text is inserted outside the runs of a node, or at a bad offset.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.merge",
"description": "The nodes differ in kind, are not mergeable, or are not adjacent siblings.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.move",
"description": "The destination is unknown or inside the moved node.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.op",
"description": "The operation is unknown.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.reclassify",
"description": "The new kind has another content shape.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.relabel",
"description": "The kind takes no label.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.replace",
"description": "Runs replace text outside a text run, or include an equation run.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.schema",
"description": "A proposed correction does not match the correction schema.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.set",
"description": "The attribute cannot be set on the kind.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.split",
"description": "The node is not a sentence, the offset is outside it or inside a run other than text, or a part is empty.",
"chapter": "spec/22-conformance.md"
},
{
"id": "correction.target",
"description": "A target, parent or sibling is not a live node, or the root is deleted, moved, merged or reclassified.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.correction.after",
"description": "The last correction of a leaf does not end at the leaf's current node_hash.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.correction.id",
"description": "A correction's id does not derive from its record.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.correction.index",
"description": "Correction indexes do not count from 1 without gaps.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.correction.rev",
"description": "document.json's rev is not the number of corrections.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.fidelity.report",
"description": "document.json's fidelity distribution does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.align-key",
"description": "An align_key does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.key",
"description": "The key supplied does not match the package's key_id.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.match-hash",
"description": "A match_hash does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.meta",
"description": "meta_hash does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.node-hash",
"description": "A node_hash does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.own-hash",
"description": "An own_hash does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.root",
"description": "document.json's root is not the root node's node_hash.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.hash.text-hash",
"description": "A text_hash does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.id.alias",
"description": "An alias does not name a live node.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.id.form",
"description": "An ID is not seven letter-first Crockford base32 characters.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.id.retired-live",
"description": "An ID is both live and in the ID table.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.id.retired-missing",
"description": "A correction retired an ID that ids.jsonl does not record.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.id.successor",
"description": "A successor names an ID that is neither live nor in the ID table.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.id.unique",
"description": "An ID occurs twice.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.location.node",
"description": "A location names an unknown node.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.location.page",
"description": "A location's page_fp is not a page of any witness.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.node.attrs",
"description": "A section has no level.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.node.content",
"description": "A node's content does not have the shape its kind requires.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.node.kind",
"description": "A node kind is not in the list.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.node.label",
"description": "A node of a kind that takes no label has one.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.node.schema",
"description": "A node a correction produced does not validate against the node schema (a property the kind does not take, or a bad shape).",
"chapter": "spec/11-corrections.md"
},
{
"id": "doc.counts",
"description": "document.json's counts are not the number of nodes and of leaves.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.order.ids",
"description": "ids.jsonl is not aliases by ID, then retirements by revision and ID.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.order.locations",
"description": "locations.jsonl is not sorted by node order, page and fingerprint.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.order.pages",
"description": "pages.jsonl is not sorted by witness and page.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.order.receipts",
"description": "receipts.jsonl is not sorted by time and ID.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.order.references",
"description": "references.jsonl does not follow document order.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.order.suspects",
"description": "suspects.jsonl is not sorted by ID.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.page.witness",
"description": "A page names an unknown witness.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.policy.keyed",
"description": "A checks-only package carries plain hashes.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.policy.withheld",
"description": "Text is present where the policy withholds it, or withheld where the policy is full, or a checks-only package carries corrections or suspects.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.qa.key",
"description": "A spot-check seed key is not a registered Ed25519 spot-check key, or was registered after the receipt.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.qa.of",
"description": "A spot-check names a receipt the package does not hold.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.qa.sample",
"description": "A spot-check sample does not follow from its seed.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.qa.seed",
"description": "A spot-check seed is not the checker's signature over the receipt.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.receipt.doc",
"description": "A receipt names another document.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.receipt.id",
"description": "A receipt's or revocation's id does not derive from its record.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.receipt.nodes",
"description": "A receipt's nodes are not sorted by ID, or one repeats.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.receipt.root",
"description": "A receipt's Merkle root does not recompute.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.receipt.signature",
"description": "A signature does not verify against the roster.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.reference.node",
"description": "A reference record names a node that is not a reference.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.canonical",
"description": "Runs are not canonical: an empty text run, or two adjacent text runs with the same styles.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.cite",
"description": "A cite run names a node that is not a reference.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.equation",
"description": "Equation runs do not name the sentence's equation children, once each, in order.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.fnmark",
"description": "An fnmark run names a node that is not a footnote.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.kind",
"description": "A run kind is not in the list.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.style",
"description": "A style is unknown, or a run is both a subscript and a superscript.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.run.xref",
"description": "A same-document xref names no node.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.table.header",
"description": "A column or row header path names a node that is not a cell.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.tree.child",
"description": "A node holds a child kind it may not hold, a heading is not first, or a once-only child repeats.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.tree.empty",
"description": "A kind that must have children has none.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.tree.ord",
"description": "A parent's children do not have ord 0 to n-1.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.tree.order",
"description": "nodes.jsonl is not in document order.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.tree.root",
"description": "The tree does not have exactly one root, of kind document.",
"chapter": "spec/22-conformance.md"
},
{
"id": "doc.witness.id",
"description": "A witness ID does not derive from its SHA-256.",
"chapter": "spec/22-conformance.md"
},
{
"id": "grade.key-stale",
"description": "An anchor in the exercise's key is stale, so nothing is graded with it.",
"chapter": "spec/22-conformance.md"
},
{
"id": "grade.kind",
"description": "The exercise kind is unknown.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.file.canonical",
"description": "A JSON or JSON Lines record is not in canonical JSON.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.file.empty",
"description": "An optional JSON Lines file is present with no records.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.file.newline",
"description": "A line of a JSON Lines file does not end with a newline.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.file.required",
"description": "document.json, nodes.jsonl, witnesses.json or provenance.json is missing.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.absent",
"description": "An entry listed without its bytes is not an asset, or its bytes are present.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.hash",
"description": "A file's SHA-256 or size differs from its manifest entry.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.key",
"description": "The manifest's key differs from document.json's.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.missing",
"description": "The package has no MANIFEST.json.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.missing-file",
"description": "A file the manifest lists is not in the package.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.order",
"description": "Manifest entries are not sorted by path, or a path repeats.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.schema",
"description": "MANIFEST.json does not validate against manifest.schema.json.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.manifest.unlisted",
"description": "The package holds a file the manifest does not list.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.path.unsafe",
"description": "A path is absolute, has an empty, `.` or `..` segment, a backslash or a NUL, is not normalized, or is or passes through a symbolic link.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.size",
"description": "The package's files exceed the consumer's size limit.",
"chapter": "spec/12-package.md"
},
{
"id": "package.schema",
"description": "A file or line does not validate against its schema.",
"chapter": "spec/22-conformance.md"
},
{
"id": "package.zip.entry",
"description": "A zipped package is not a zip archive, or an entry is encrypted, a symbolic link, neither stored nor deflated, not marked as UTF-8, duplicated, unsafe as a path, or not under one top-level folder named by the key.",
"chapter": "spec/12-package.md"
},
{
"id": "package.zip.size",
"description": "A zipped package expands past the consumer's limit, or an entry holds more than its header declares.",
"chapter": "spec/12-package.md"
}
]
}