* fix(hopper): normalize string-backed addresses and update verification * feat(native): add inspection primitives, dispatch traces and approved UI observation * test: prioritize real artifact E2E and captured golden regressions * fix(process): queue observed output before reactive rendering actions * test: prune redundant cases and strengthen boundary assertions * fix(cli): route native value tracing through shared workflows * test: replace synthetic success with real workflows and captured data * fix(catalog): separate portable metadata from native host availability
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { artifactInventoryResultSchema } from "../../src/domain/artifactGraph.js";
|
|
import { createEvidence, type Evidence } from "../../src/domain/evidence.js";
|
|
import { jsonValueSchema } from "../../src/domain/jsonValue.js";
|
|
|
|
/** Partition a real scan into authenticated partial observations for merge tests. */
|
|
export const fragmentInventoryEvidence = (
|
|
evidence: Evidence,
|
|
count: number,
|
|
): readonly Evidence[] => {
|
|
const inventory = artifactInventoryResultSchema.parse(
|
|
evidence.normalized_result,
|
|
);
|
|
const subject = evidence.subject;
|
|
if (subject === null)
|
|
throw new TypeError("Inventory has no artifact subject");
|
|
return Array.from({ length: count }, (_, index) =>
|
|
createEvidence(
|
|
{
|
|
path: subject.local_path,
|
|
sha256: subject.digest.sha256,
|
|
format: subject.format,
|
|
},
|
|
evidence.provider,
|
|
{
|
|
operation: "inventory_artifact",
|
|
parameters: evidence.parameters,
|
|
confidence: "derived",
|
|
authority: evidence.authority,
|
|
result: jsonValueSchema.parse({
|
|
...inventory,
|
|
nodes: inventory.nodes.filter(
|
|
(_, ordinal) => ordinal % count === index,
|
|
),
|
|
occurrences: inventory.occurrences.filter(
|
|
(_, ordinal) => ordinal % count === index,
|
|
),
|
|
edges: inventory.edges.filter(
|
|
(_, ordinal) => ordinal % count === index,
|
|
),
|
|
}),
|
|
},
|
|
),
|
|
);
|
|
};
|