refactor(evidence): simplify artifact inspection coverage (#16530)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-04 09:57:03 +08:00
1 parent e32bb0e3ac
commit e25955686d
1 file changed
+16 -36
+16 -36
View File
@@ -185,18 +185,6 @@ export const createArtifactInspection = (
inventoryEvidence.evidence_id,
nextProbes,
);
const retained = {
observations,
hypotheses,
branches,
probes: nextProbes,
};
const omissions = {
observations: 0,
hypotheses: 0,
branches: 0,
probes: 0,
};
const semantic = {
subject: {
manifest_id: inventory.manifest.manifest_id,
@@ -219,22 +207,25 @@ export const createArtifactInspection = (
evidence: inventoryEvidence,
},
],
observations: retained.observations,
hypotheses: retained.hypotheses,
observations,
hypotheses,
contradictions: contradictions(inventory, inventoryEvidence.evidence_id),
unexplored_branches: retained.branches,
next_probes: retained.probes,
unexplored_branches: branches,
next_probes: nextProbes,
coverage: {
status: inspectionCoverage(inventory, omissions),
status:
inventory.coverage.status === "complete"
? "complete-within-substeps"
: "partial",
substeps_completed: 1 as const,
observations_retained: retained.observations.length,
observations_omitted: omissions.observations,
hypotheses_retained: retained.hypotheses.length,
hypotheses_omitted: omissions.hypotheses,
unexplored_branches_retained: retained.branches.length,
unexplored_branches_omitted: omissions.branches,
next_probes_retained: retained.probes.length,
next_probes_omitted: omissions.probes,
observations_retained: observations.length,
observations_omitted: 0,
hypotheses_retained: hypotheses.length,
hypotheses_omitted: 0,
unexplored_branches_retained: branches.length,
unexplored_branches_omitted: 0,
next_probes_retained: nextProbes.length,
next_probes_omitted: 0,
},
evidence_links: [inventoryEvidence.evidence_id],
limitations: uniqueSorted([
@@ -982,17 +973,6 @@ const branch = (
};
};
// A completed substep establishes only the coverage its producer examined, so
// unknown inventory traversal keeps the inspection partial, never complete.
const inspectionCoverage = (
inventory: ArtifactInventoryResult,
omissions: Readonly<Record<string, number>>,
): ArtifactInspectionResult["coverage"]["status"] => {
if (Object.values(omissions).some((count) => count > 0)) return "truncated";
if (inventory.coverage.status !== "complete") return "partial";
return "complete-within-substeps";
};
/** Select source records from a typed inspection, preserving sealed child ownership. */
export const artifactInspectionSources = (
inspection: ArtifactInspectionResult,