perf(artifacts): share sealed inventory and report in inspect_artifact (#2690)
inspect_artifact parsed a fresh inventory and inspection report but left both mutable, so each later Evidence boundary cloned and re-digested the complete payload: createArtifactInspection re-authenticated the nested inventory Evidence, createAnalysisExecution re-parsed the report, and recordEvidence re-authenticated the outer Evidence. Seal both exclusively owned values with freezeJsonSnapshot so those boundaries take the existing immutable-snapshot path. Output is byte-identical. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e46bed73f1
commit
11268fe241
|
|
@ -40,6 +40,7 @@ import { ArtifactResourceScope } from "./ArtifactResourceScope.js";
|
|||
import { artifactCapabilities } from "./ArtifactProviderMetadata.js";
|
||||
import { ARTIFACT_GRAPH_PROVIDER } from "../application/InvestigationProviders.js";
|
||||
import { createEvidence } from "../domain/evidence.js";
|
||||
import { freezeJsonSnapshot } from "../domain/immutableJson.js";
|
||||
import { createArtifactInspection } from "../domain/artifactInspection.js";
|
||||
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
||||
|
||||
|
|
@ -341,7 +342,11 @@ class ArtifactClient implements AnalysisClient {
|
|||
total: 1,
|
||||
message: "inventory substep started",
|
||||
});
|
||||
const inventory = await this.inventory(inventoryParameters, options);
|
||||
// The freshly parsed inventory is exclusively owned here. Sealing it lets
|
||||
// the nested Evidence share it instead of cloning and re-digesting it.
|
||||
const inventory = freezeJsonSnapshot(
|
||||
await this.inventory(inventoryParameters, options),
|
||||
);
|
||||
const subject = subjectFor(
|
||||
this.target.sourcePath ?? this.target.path,
|
||||
inventory.manifest,
|
||||
|
|
@ -355,7 +360,10 @@ class ArtifactClient implements AnalysisClient {
|
|||
// The nested inventory already names every occurrence's logical path.
|
||||
locations: [],
|
||||
});
|
||||
const result = createArtifactInspection(inventoryEvidence);
|
||||
// The returned execution and its Evidence then reuse this owned report.
|
||||
const result = freezeJsonSnapshot(
|
||||
createArtifactInspection(inventoryEvidence),
|
||||
);
|
||||
await options?.progress?.report({
|
||||
phase: "inspect_artifact.inventory",
|
||||
completed: 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue