mirror of
https://github.com/morluto/rea.git
synced 2026-11-23 15:05:51 +00:00
Add offline ELF separate-debug linkage inspection with explicit candidate verification, bounded streaming, canonical parser limits and preserved complete/partial Evidence provenance. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning) Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import {
|
|
fileSnapshotPartialObservationSchema,
|
|
type FileSnapshotPartialObservation,
|
|
} from "../domain/fileSnapshotObservation.js";
|
|
import {
|
|
type StableArtifactSnapshot,
|
|
completedStableArtifactIdentity,
|
|
} from "./readStableArtifact.js";
|
|
|
|
/**
|
|
* Completed file identity survives finalization and later decoding failures;
|
|
* `completed` is the snapshot a provider already holds when its parser fails.
|
|
*/
|
|
export const completedStableArtifactObservation = (
|
|
cause: unknown,
|
|
path: string,
|
|
completedSnapshot?: StableArtifactSnapshot,
|
|
): FileSnapshotPartialObservation | undefined => {
|
|
const identity =
|
|
completedSnapshot === undefined
|
|
? completedStableArtifactIdentity(cause)
|
|
: {
|
|
sha256: completedSnapshot.sha256,
|
|
bytes: completedSnapshot.bytes.length,
|
|
};
|
|
return identity === undefined
|
|
? undefined
|
|
: fileSnapshotPartialObservationSchema.parse({
|
|
kind: "file-snapshot-hash",
|
|
path,
|
|
sha256: identity.sha256,
|
|
bytes: identity.bytes,
|
|
});
|
|
};
|