fix(anatomy): R5.4 drawings projection charges each drawing's fixed parts

This commit is contained in:
bchanot committed 2026-10-23 16:38:06 +02:00
1 parent 411e1058c0
commit c4e717da86
5 files changed
+193 -8

No files matched your search

+7 -2
View File
@@ -202,7 +202,7 @@ fn view_ids(document: &Value) -> Vec<String> {
}
/// The review drawings' bytes, projected as an upper bound before any is rendered (the equine
/// draft projects 1.4 MB for 0.56 MB written): every drawing repeats the whole cleaned drawing,
/// draft projects 1.41 MB for 0.56 MB written): every drawing repeats the whole cleaned drawing,
/// two per view, and each annotation of a view adds its markup. Views added by a changeset
/// multiply the drawing (2,000 views asked for 547 MB, security gate R5.4 round 8); unnamed
/// triggers repeat the opened view's names in theirs (a 485 KB changeset wrote a 131 MB
@@ -247,6 +247,10 @@ fn longest_view_name(documents: [&Value; 2]) -> Result<usize, PipelineError> {
Ok(longest)
}
/// What a drawing writes besides the cleaned drawing and its annotations: the layer group, the
/// overlay's group and legend (under 1 KB each; a view without annotations carries them alone).
const DRAWING_FIXED_BYTES: usize = 4096;
/// The projected bytes of the review drawings: per view, the overlay (both documents' markers)
/// and the application's drawing (the curated layer), each over the cleaned drawing.
pub fn review_drawings_bytes(draft: &DraftResult) -> Result<usize, PipelineError> {
@@ -255,7 +259,8 @@ pub fn review_drawings_bytes(draft: &DraftResult) -> Result<usize, PipelineError
for view_id in view_ids(&draft.document) {
let after = layer_bytes(&draft.document, &view_id, names)?;
let before = layer_bytes(&draft.baseline, &view_id, names)?;
let view = draft.cleaned_svg.len().saturating_mul(2) + before + after.saturating_mul(2);
let drawings = draft.cleaned_svg.len() + DRAWING_FIXED_BYTES;
let view = drawings.saturating_mul(2) + before + after.saturating_mul(2);
total = total.saturating_add(view);
}
Ok(total)