fix(snapshot): export only target-bound observations

This commit is contained in:
morluto committed 2026-10-27 07:55:16 +08:00
1 parent 7fa54e2d62
commit 2ad599dace
5 files changed
+186 -9

No files matched your search

@@ -291,13 +291,19 @@ export class AnalysisSnapshotCache {
try {
const snapshotTargetIdentity = snapshotTarget(target);
const binding = snapshotBinding(profile);
const entries = [...this.#entries.values()].sort((left, right) =>
compareUnicodeCodePoints(left.query_id, right.query_id),
);
const workflows = [...this.#workflowEntries.values()].sort(
(left, right) =>
// In-memory replay can preserve unbound and child-artifact observations.
// A persisted target snapshot can authenticate only rows whose Evidence
// has that target subject; the record owner applies the same scope to its bundle.
const entries = [...this.#entries.values()]
.filter((entry) => entry.execution.subject?.sha256 === target.sha256)
.sort((left, right) =>
compareUnicodeCodePoints(left.query_id, right.query_id),
);
);
const workflows = [...this.#workflowEntries.values()]
.filter((entry) => entry.execution.subject?.sha256 === target.sha256)
.sort((left, right) =>
compareUnicodeCodePoints(left.query_id, right.query_id),
);
// Parsing owns the returned JSON and metadata; pre-cloning the same
// payloads here only adds another full materialization.
return ok(