Skip to main content

make_archive_self_contained

Function make_archive_self_contained 

Source
pub fn make_archive_self_contained(
    bytes: &[u8],
) -> Result<SelfContainedArchive, ValidationError>
Expand description

Make an archive self-contained: drop every ## Relationships row whose target lives in another mem, re-pack canonically, and prove the result with the strict validator (the same pass install runs).

WHY: export --format mem admits cross-mem edges (it warns DANGLING_CROSS_MEM_EDGE_IN_EXPORT and still produces the archive), while install refuses them, so a mem that references its sibling mems could be exported but never installed anywhere, not even back into the workspace it came from. The dogfood workspace’s retired features mem carried fifty such rows, every one an alias row synthesised from a body wiki-link, so dropping the rows loses nothing the body does not still say. Rows that are NOT backed by a body link are dropped too; the caller reports every dropped edge so the author can see what the package no longer carries as a typed edge. Section text (body wiki-links included) is never touched.