fix(anatomy): R5.4 field segments and code spans on the generator alphabet, wiki and liquid brackets refused in list items, linear guard

This commit is contained in:
bchanot committed 2026-10-23 13:58:14 +02:00
1 parent 1b12d90325
commit aeb5050502
10 files changed
+325 -48

No files matched your search

+19 -11
View File
@@ -3101,7 +3101,7 @@ Owner go « Validation R5.3 et autorisation conditionnelle R5.4 » (2026-10-23),
fresh verification of the final R5.3 state: met on c6e0d85 (CONFORME 13/13, security PASS with
LOWs only, §11.12). Contract `.claude/tasks/contracts/2026-10-23-rust-r5-review.md`.
`crates/core/src/curation/draft` gains 1,458 lines (4,366 in all), plus `curation/report_guard.rs` (140):
`crates/core/src/curation/draft` gains 1,477 lines (4,385 in all), plus `curation/report_guard.rs` (258):
| Module | Ports |
|---|---|
@@ -3165,28 +3165,35 @@ backslash before `"` or `|` (a JSON quote, the cell escape), `**word**` with one
between spaces or line edges (the import report's form), and no inline construct (an inline link,
image or reference `](`, `][`; an image reference `![`; a `[[` before a space with a `]]` after
it, or a `]]` after a space with a `[[` before it; `<` before a letter, `/`, `!` or `?`: an HTML
tag or an autolink; a character reference `&name;`, `&#n;`); no plain underscore followed later on
tag or an autolink; a character reference `&name;`, `&#n;`; a liquid bracket `{%` or `%}`); no plain underscore followed later on
its line by one that can close an emphasis (inside a later code span, before anything but an ASCII
letter or digit: Prettier's parser paired `to_do … \`ref_\`` across the span); an authored text
holds no backtick (titles, rationales, questions, citations, URLs, DOIs, values), so code spans are
the generator's alone (ids, targets, field names); inside them, anything but a carriage return or
a tab, never empty, no outer space; a table row with
another cell count than its header and a control character in a list-item field (title,
rationale, question, citation, URL, DOI, vet-flag value) are refused too. Everything else is
written by the generator from ids, targets, field names and file paths; a code span admits only
that alphabet, `[A-Za-z0-9_:/. -]`, never empty, no outer space (the template's
`pnpm import:equine` holds the one inner space), and a field segment an op names is limited to
`[A-Za-z0-9_-]` (refused at the op otherwise: a `]` there closed an author's `[` across the span);
a table row with another cell count than its header is refused; a list-item field (title,
rationale, question, citation, URL, DOI, vet-flag value) shares its line with the change's other
fields and code spans, so it refuses a control character and any wiki-link or liquid bracket
(`[[`, `]]`, `{%`, `%}`) whole, wherever its partner sits on the line (a table cell is parsed on
its own and keeps the per-cell rule). Everything else is
refused with `UnsupportedMarkdown`: a character outside the set is refused by default; the forms
built from admitted characters are ruled one by one, so a form no rule names and no probe covers
could still pass.
The guarantee is empirical, not a proof of Prettier's behaviour: the TypeScript sweep
(`oracles/r5/markdown-sweep.json`, generator `packages/anatomy/tests/r5.markdown-sweep-oracles.test.ts`,
digests of the raw and formatted reports) holds 790 probes: 48 characters in six positions,
digests of the raw and formatted reports) holds 798 probes: 48 characters in six positions,
whitespace patterns, Markdown constructs, the families each gate round found (strong pairs, URLs,
non-terminated references, image references, nested padded wiki links, authored code spans and
underscores paired across them, with the cited reference named `probe_ref` and, for three probes,
`probe_ref_`), and 400 strings from a
`probe_ref_`; eight construct pairs opened in the title, the rationale and the other fields and
closed in the question: `[[`/`]]`, padded and unpadded, `{%`/`%}`, `[x`/`](y)`, `*`, `_`, `<b`/`>`),
and 400 strings from a
seeded generator over an alphabet that includes `&#`, `&amp`, `&lt`, `![`, `[[` and `]]`, each placed in a title, a rationale, a question, a citation, a label after a
word and a label alone (a cell start). Result (test `every_probe_is_formatted_as_the_typescript_or_refused`):
279 probes byte for byte with the TypeScript, 511 refused, 0 silent difference; a probe made only
268 probes byte for byte with the TypeScript, 530 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],…]`, the DOI's `<0697:toih>` and the URLs' inner underscores pass). The equine reports
pass the guard unchanged.
@@ -3195,7 +3202,7 @@ pass the guard unchanged.
|---|---|---|
| authored text outside the allowlist: Markdown Prettier rewrites (`*x*`, `_x`, `x_**a**`, `**a****b**`, `Voir_https://…`, `a b`, a non-ASCII space, a tab, a line break in a list item, `` `` ``, `a\|b`, `[a](<b>)`, `[[ a ]]`, `&#42;`…), the constructs refused whole (links, HTML tags, autolinks, character references) and any character outside the admitted set (combining marks, pictographs, symbols) | written, then rewritten by Prettier (escapes, `_emphasis_`, collapsed spaces, indented continuation lines, normalised links; a row with an extra cell), or kept | refused (`UnsupportedMarkdown`), even where Prettier would have kept the text |
| 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 (NUL included) 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`) |
| 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 outside `[A-Za-z0-9_-]` (a control character, NUL included, a backtick, a `]`, a space, a non-ASCII letter) | 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`
@@ -3225,7 +3232,8 @@ pipeline, visibly, until the allowlist is widened from new TypeScript probes or
Markdown printer; the allowlist is proven by probes, not by a model of Prettier: each gate round
of R5.4 found a family the previous rules missed (Markdown syntax, constructs, strong pairs and
URLs, then non-terminated references, image references and nested padded wiki links, then
authored code spans and underscores paired across code spans), each now
authored code spans and underscores paired across code spans, then wiki links opened in one field
and closed in another and field segments closing an author's bracket from a code span), each now
ruled and frozen in the sweep, so a combination of admitted characters no probe covers could still
differ; the comparison of the application's drawings accepts
exactly the trigger-name rule, byte for byte; the frozen