docs(docs): R5.4 second gate round declared, contract clarification (markdown-sweep oracle), audits

This commit is contained in:
bchanot committed 2026-10-23 12:10:36 +02:00
1 parent df82424107
commit 077d91bdff
4 files changed
+235 -12

No files matched your search

+22 -12
View File
@@ -3116,7 +3116,7 @@ LOWs only, §11.12). Contract `.claude/tasks/contracts/2026-10-23-rust-r5-review
| `pipeline.rs` | `render_draft_artifacts` complete, in the TypeScript order: document, assets, sheet-ref, migration map, the overlays and the application's drawings per view, CHANGELOG, REVIEW-REPORT, seed SQL |
| `bin/import_equine.rs` | `--check` compares the 6 + 12 files with explicit criteria (byte identity; the application's drawings may fall back on parsed trees under the declared rule, printed as `declared:`); a file missing, not produced or different fails; the pending list and its `shortcut:` are gone; `--out` writes the 18 files |
Parity, every expectation written by the TypeScript (`tests/curation_review.rs`, 6 tests):
Parity, every expectation written by the TypeScript (`tests/curation_review.rs`, 8 tests):
- `CHANGELOG.md` (1,114,533 bytes) and `REVIEW-REPORT.md` of the committed draft byte for byte;
their raw texts equal the ledger's pre-Prettier digests, the aligned texts its digests;
@@ -3141,8 +3141,8 @@ Parity, every expectation written by the TypeScript (`tests/curation_review.rs`,
without the rule.
`pnpm r5:import-equine --check`: `legacy-import: 6 files, 0 differences`; `draft: declared:
review/app-main.svg (trees equal under the R3 trigger-name rule)`; `draft: 12 files, 0
differences`. `--out` then `diff -r`: legacy identical; draft identical but `app-main.svg`.
review/app-main.svg (byte-identical once the R3 trigger-name rule is applied)`; `draft: 12
files, 0 differences`. `--out` then `diff -r`: legacy identical; draft identical but `app-main.svg`.
R5.3 carry-over (final gate LOWs, not applied to the verified state): an existing destination
folder is itself identity-checked against the seed's folders; a failed seed walk reads `the seed
@@ -3159,20 +3159,27 @@ would rewrite, never writing a report that differs silently. The rules come from
by the TypeScript (`oracles/r5/markdown-sweep.json`, generator
`packages/anatomy/tests/r5.markdown-sweep-oracles.test.ts`: 31 characters in six positions,
whitespace patterns and Markdown constructs, each placed in a title, a rationale, a question, a
citation and a changed label; 220 probes): outside code spans, `*` outside a well-formed
`**strong**` span, an underscore not between two letters or digits, a backslash before a space or
citation and a changed label; 247 probes): a carriage return or a tab anywhere, code spans
included; outside code spans, an inline link, image or
reference (`](`, `][`), a `[[ … ]]` with inner spaces, an autolink (`<scheme:…>`, `<…@…>`), a
character reference (`&name;`, `&#n;`, `&#xh;`; the last three refused whole although Prettier
keeps some of them), `*` outside a well-formed
`**strong**` span, an underscore not between two ASCII letters or digits (Prettier escapes one
next to an accented letter or a CJK, kana or Hangul character), a backslash before a space or
at the end or an authored one before the cell escape `\|`, two spaces in a row, a tab, a carriage
return, an odd number of backticks, an empty code span or one with an outer space; a table row
whose cell count differs from its header; a control character (a line break included) in a
title, rationale, question, citation, URL, DOI or vet-flag value written in a list item. Result
(test `every_probe_is_formatted_as_the_typescript_or_refused`): 187 probes byte for byte with the
TypeScript, 33 refused, 0 silent difference; a probe made only of what the equine reports use is
never refused. The equine reports and the R5.2 import report pass the guard unchanged.
TypeScript, 60 refused, 0 silent difference; a probe made only of what the equine reports use,
outside the constructs, is never refused (a polygon's `[[10,10],…]` and the DOI's
`<0697:toih>` pass). The equine reports and the R5.2 import report pass the guard unchanged.
| Input | TypeScript | Rust |
|---|---|---|
| authored text with Markdown Prettier rewrites (`*x*`, `_x`, `a b`, a tab, a line break in a list item, `` `` ``, `a\|b`…) | written, then rewritten by Prettier (escapes, `_emphasis_`, collapsed spaces, indented continuation lines; a row with an extra cell) | refused (`UnsupportedMarkdown`) |
| authored text with Markdown Prettier rewrites (`*x*`, `_x`, `a b`, a tab, a line break in a list item, `` `` ``, `a\|b`, `[a](<b>)`, `[a](b "t")`, `[[ a ]]`, `&#42;`…) or one of the constructs refused whole (links, autolinks, character references) | written, then rewritten by Prettier (escapes, `_emphasis_`, collapsed spaces, indented continuation lines; a row with an extra cell) | refused (`UnsupportedMarkdown`) |
| a pictograph in a table cell (an emoji, and ©, ®, ™, ✓, ★, ⚠ and the other characters `text::is_emoji_candidate` lists) | measured with Prettier's tables | refused (`UnsupportedWidth`, R5.2): the set is wider than the emoji, the refusal stays loud |
| an id an `add` writes (the item's, and those nested in its `children` or `categories`) or a `rename` id that is not a stable id (a region code for a region), or a field segment holding a control character or a backtick | accepted when a later op removed or renamed the item: the raw id stayed in the records and reached the reports' code spans (a line break there forged a section, security gate R5.4 round 2) | refused at the op, the check the final document applies anyway (test `ids_and_field_segments_that_could_forge_report_structure_are_refused`) |
| a label, id or path holding a code point XML 1.0 refuses, or a carriage return, in a review drawing | written (a non-well-formed file; a raw CR read back as a line feed) | refused: the drawing is not written |
The drawing comparison hides nothing (security gate, MEDIUM): the rule fallback of `--check`
@@ -3181,8 +3188,10 @@ instruction, encoding or entity form can escape the comparison), the rule to cha
and the rebuilt text after the rule to equal the produced one byte for byte; `declared:` is
printed only then (test `the_rule_fallback_refuses_what_the_tree_does_not_carry`: a stylesheet
processing instruction, comments, a trailing comment and another declared encoding refused).
The renderers are indexed (citation counts in one walk, previous markers and kept ids hashed,
subjects grouped per change).
The committed drawing is read by the core's reader before any other parse, so its depth cap
holds (a 100,000-level file is refused, never a stack overflow). The overlay prints a coordinate
that overflowed as `Infinity`, as `String(number)` did. The renderers are indexed (citation
counts in one walk, previous markers and kept ids hashed, subjects grouped per change).
Tests: `cargo test -p faunosteo-core --features curation` (review 8, Markdown 1, draft 16,
importer 5, binary 3, formatting 6, plus the crate's suites); anatomy 144 (two generators added).
@@ -3196,8 +3205,9 @@ at R3 and identical to the editor canvas.
Residual risks: the reports refuse what Prettier would rewrite (emphasis, escapes, whitespace
runs, line breaks in list items) and the pictographs the width table does not reproduce: a
future changeset using them stops the pipeline, visibly, until the port grows a Markdown printer
or the text changes; raw HTML and links in authored text are kept as the TypeScript kept them
(GFM renders them; Gitea strips raw HTML); the comparison of the application's drawings accepts
or the text changes; inline links, autolinks and character references are refused as well, even
where Prettier would keep them; raw HTML in authored text (`<b>…</b>`) is kept as the TypeScript
kept it, byte for byte (GFM renders it; Gitea strips it); the comparison of the application's drawings accepts
exactly the trigger-name rule, byte for byte; the frozen
`horse.svg` is read, never regenerated, so a future change of the drawing needs its own
decision; the residual risks of §11.13 stand.