feat(domain): R4.2e OD-3 value cap (400,000), rescue-copy guard, 1 GiB linear ceiling, budget measurements

json_js::MAX_JSON_VALUES from the R4.2e measurements (CAP envelope 39,652 values, 612-leaf
export 23,803; ~100 B of tree per value, a 16 MiB dense document 784 MiB with the cap off,
16 MiB with it); draft.restore refuses an over-budget copy as invalid; --max-memory 1 GiB
proven to trap on the proofs build; cargo pdf_budget prints the value table, the Node
budget suite prints the per-class cost (fresh instance, W4 asserted).
This commit is contained in:
bchanot committed 2026-10-18 16:06:36 +02:00
1 parent f8579bc19a
commit 6ee04c96c5
13 files changed
+599 -14

No files matched your search

+13 -1
View File
@@ -268,6 +268,16 @@ fn o8_import_matches_the_r3_path_outside_the_declared_differences() {
assert_eq!(declared, 3);
}
/// O8 cases the application's caps refuse (OD-3, `MAX_JSON_VALUES`): a token-dense
/// document is skipped like one nested too deep, so the kind follows the stamp, as the
/// depth cap's does today (`depth-65` is `attachment_stripped` in O8).
fn declared_od3(id: &str) -> Option<Value> {
match id {
"values-1m" => Some(json!({ "ok": false, "kind": "attachment_stripped" })),
_ => None,
}
}
#[test]
fn the_facade_envelope_carries_the_closed_kinds() {
let sheet = draft_sheet();
@@ -276,7 +286,9 @@ fn the_facade_envelope_carries_the_closed_kinds() {
let id = case["id"].as_str().unwrap();
let pdf = std::fs::read(repo_root().join(case["pdf"].as_str().unwrap())).unwrap();
let envelope: Value = serde_json::from_str(&facade::import_pdf(&sheet, &pdf)).unwrap();
let expected = declared_o8(id).unwrap_or_else(|| case["outcome"].clone());
let expected = declared_od3(id)
.or_else(|| declared_o8(id))
.unwrap_or_else(|| case["outcome"].clone());
assert_eq!(envelope["ok"], expected["ok"], "{id}");
if expected["ok"] == false {
assert_eq!(envelope["kind"], expected["kind"], "{id}");