feat(domain): R4.2d attachment probe, import_pdf and SheetHandle.import_pdf on the wasm facade

locate_attachment (shared 16 MiB budget, JS-path steps in the TypeScript order, OD-3 cap
hook off until measured), pdf::import, facade import_pdf with the PdfImportKind kinds
(ts-rs exported). cargo: O7 144 inputs (locate, read, archive rows) and O8 51 cases equal
to the R3 path, 3 OD-4 differences declared (lone surrogate in an overwritten duplicate
value). Node through the shipped module: the same O8 outcomes, every reference PDF.
Module 421.7 KB gzip (W1 budget 600 KB).
This commit is contained in:
bchanot committed 2026-10-18 15:55:46 +02:00
1 parent 9850a8341a
commit f8579bc19a
13 files changed
+813 -14

No files matched your search

+11 -8
View File
@@ -327,17 +327,20 @@ fn draft_restore(sheet: &LoadedSheet, input: &str) -> Outcome {
/// The input is the attachment's JSON as the byte scan read it (any shape).
fn archive_import(sheet: &LoadedSheet, input: &str) -> Outcome {
session::import_archive(sheet, input)
.map_err(|failure| match failure {
ImportFailure::IncompatibleVersion(found) => {
versioned("incompatible_version", Some(found))
}
ImportFailure::NoAttachment => Failure::new("no_attachment", ""),
ImportFailure::LoneSurrogate(detail) => Failure::new("lone_surrogate", detail),
ImportFailure::Invalid(detail) => Failure::new("invalid", detail),
})
.map_err(import_failure)
.and_then(|import| to_value(&import))
}
/// The closed kinds of a session import failure, shared with the PDF import.
pub(crate) fn import_failure(failure: ImportFailure) -> Failure {
match failure {
ImportFailure::IncompatibleVersion(found) => versioned("incompatible_version", Some(found)),
ImportFailure::NoAttachment => Failure::new("no_attachment", ""),
ImportFailure::LoneSurrogate(detail) => Failure::new("lone_surrogate", detail),
ImportFailure::Invalid(detail) => Failure::new("invalid", detail),
}
}
fn archive_snapshot(sheet: &LoadedSheet, input: &str) -> Outcome {
let input: SnapshotInput = parse_input(input)?;
to_value(&build_sheet_snapshot(sheet, &input.report))