Files
reverse-engineering-anything/src/resources/StableArtifactObservation.ts
T
Matt Van Hornandgensokyo-dev 54e3918d1c feat(elf): report separate debug-file linkage and verify a candidate debug file
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>
2026-11-17 09:25:07 +00:00

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,
});
};