perf(evidence): authenticate and seal imported bundles in one pass

Reuse the immutable domain parser at the file boundary instead of rebuilding and revalidating an already authenticated bundle. Existing filesystem and integrity regressions pass (27 tests); a 4 MiB parsing probe preserves immutable output and reduces repeated validation work.
This commit is contained in:
morluto committed 2026-10-13 03:22:38 +08:00
1 parent a97b713f74
commit b123b2e51c
1 file changed
+2 -10
+2 -10
View File
@@ -1,9 +1,9 @@
import { resolve } from "node:path";
import {
createImmutableEvidenceBundle,
describeEvidenceBundleFailure,
describeValidationFailure,
parseImmutableEvidenceBundle,
parseEvidenceBundle,
type EvidenceBundle,
} from "../domain/evidenceBundle.js";
@@ -49,15 +49,7 @@ export const readImmutableEvidenceBundle = (
signal?: AbortSignal,
resources?: ArtifactResourceScope,
): Promise<Result<EvidenceBundle, EvidenceReadFailure>> =>
readBundle(
path,
(input) => {
const bundle = parseEvidenceBundle(input);
return createImmutableEvidenceBundle(bundle.records, bundle.unknowns);
},
signal,
resources,
);
readBundle(path, parseImmutableEvidenceBundle, signal, resources);
const readBundle = async (
path: string,