refactor(artifacts): test inventory changes at materialization boundary

This commit is contained in:
morluto
2026-10-10 02:49:46 +08:00
parent e36afa112f
commit 750fb65650
2 changed files with 46 additions and 72 deletions
@@ -26,6 +26,7 @@ import {
} from "../../domain/artifactGraph.js";
import { AnalysisUnsupportedTargetError } from "../../domain/analysisErrorCore.js";
import type { BinaryTarget } from "../../domain/binaryTargetTypes.js";
import type { ArtifactInventorySnapshot } from "../../domain/artifactInventorySnapshot.js";
import { scanArtifactInventory } from "../inventory/ArtifactInventory.js";
/** Local extraction input with the output root chosen by the adapter. */
@@ -49,6 +50,17 @@ export const extractArtifact = async (
signal,
environment: input.environment,
});
return materializeArtifactInventory(input, sourcePath, snapshot, signal);
};
/** Materialize a scanned inventory, verifying every current occurrence against it. */
export const materializeArtifactInventory = async (
input: ArtifactExtractionInput,
sourcePath: string,
snapshot: ArtifactInventorySnapshot,
signal?: AbortSignal,
): Promise<ArtifactExtractionResult> => {
abortIfNeeded(signal);
const selectedOccurrences = snapshot.occurrences.filter(
(occurrence) =>
(occurrence.entry_kind === "file" || occurrence.entry_kind === "slice") &&