fix(anatomy): R5.4 records weigh every cloned string with its header

This commit is contained in:
bchanot committed 2026-10-23 15:34:38 +02:00
1 parent 8bdb079f70
commit 29eb499539
5 files changed
+133 -15

No files matched your search

+14 -1
View File
@@ -833,11 +833,24 @@ fn the_records_bound_holds_inside_one_op_and_the_marking() {
("B", "r".repeat(8_192), json!([add])),
("A", "Essai".to_owned(), json!([add, subtree])),
];
// A run of one-character reference ids weighs its headers too (security gate R5.4 round 9:
// 200,000 ids cloned into each record reached 948 MB at one unit per byte).
let mut cases = cases.to_vec();
let sets: Vec<Value> = (0..100)
.map(|i| json!({ "op": "set", "target": MOBILITY, "field": "name.en", "value": format!("v{i}") }))
.collect();
cases.push(("ids", "Essai".to_owned(), Value::from(sets)));
for (level, rationale, ops) in cases {
let ids = if level == "ids" {
vec!["atlas"; 200_000]
} else {
Vec::new()
};
let level = if level == "ids" { "A" } else { level };
let file = json!({ "changes": [{
"id": "CHG-001", "level": level, "kind": "technical",
"title": { "fr": "Essai", "en": "Test" }, "rationale": rationale,
"reference_ids": [], "ops": ops,
"reference_ids": ids, "ops": ops,
}]});
let changeset = parse_changeset(&to_js_compact(&file).unwrap()).unwrap();
let error = apply_changeset(&frozen["baseline"], &references, &changeset.changes)