fix(anatomy): R5.4 aligned report tables bounded before they are built, declared case fully held, docs

This commit is contained in:
bchanot committed 2026-10-23 14:39:51 +02:00
1 parent aeb5050502
commit 777c8000b8
8 files changed
+215 -21

No files matched your search

+14
View File
@@ -77,6 +77,20 @@ fn tables_align_as_prettier_aligns_them() {
assert_eq!(refused, vec![5], "only the emoji table is refused");
}
/// One long cell pads every row of its column: the aligned table is bounded before any row is
/// built (security gate R5.4 round 6: an 80 KB rationale over 14,000 records asked for 1 GB).
#[test]
fn an_aligned_table_past_the_bound_is_refused_before_it_is_built() {
let mut raw = vec!["| a | b |".to_owned(), "| --- | --- |".to_owned()];
raw.push(format!("| {} | x |", "w".repeat(2_000)));
raw.extend((0..20_000).map(|_| "| a | b |".to_owned()));
let error = format_markdown(&raw.join("\n")).unwrap_err();
assert!(
matches!(&error, PipelineError::Guard(message) if message.contains("exceeds the")),
"{error}"
);
}
#[test]
fn slugs_and_uuids_match_the_typescript() {
let semantics = oracle("js-semantics.json");
+14 -11
View File
@@ -361,18 +361,21 @@ fn the_synthetic_review_cases_match_the_typescript_or_are_refused_as_declared()
),
"{name}"
);
continue;
} else {
assert_eq!(
rendered.changelog.unwrap(),
case["changelog"].as_str().unwrap(),
"{name}"
);
}
// The review report and the drawings of a declared case are held too: the same text
// or a declared refusal, never another text.
match rendered.review {
Ok(review) => assert_eq!(review, case["review"].as_str().unwrap(), "{name}"),
Err(PipelineError::UnsupportedWidth(_) | PipelineError::UnsupportedMarkdown(_))
if DECLARED_REFUSALS.contains(&name) => {}
Err(other) => panic!("{name}: {other}"),
}
assert_eq!(
rendered.changelog.unwrap(),
case["changelog"].as_str().unwrap(),
"{name}"
);
assert_eq!(
rendered.review.unwrap(),
case["review"].as_str().unwrap(),
"{name}"
);
let views = typed(&case_document(&frozen, case)).views.len();
assert_eq!(rendered.drawings.len(), 2 * views, "{name}");
let rule = TriggerNames::of(&typed(&case_document(&frozen, case)));