perf(artifacts): stop repeating every artifact path as Evidence locations (#1492)

inventory_artifact, inspect_artifact, and extract_artifact copied each
occurrence or extracted file path into Evidence locations, although the
result already names every one. inspect_artifact did so twice, in its own
Evidence and in the nested inventory Evidence. Like other whole-target
Evidence, these now report no locations.

Visual Studio Code.app: inspect_artifact 15.37 MB to 13.07 MB,
extract_artifact 1.40 MB to 1.06 MB.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-10 00:47:51 -07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 782e0147cd
commit 1f692c83e2
3 changed files with 12 additions and 14 deletions
+7 -14
View File
@@ -194,10 +194,8 @@ class ArtifactClient implements AnalysisClient {
this.target.sourcePath ?? this.target.path, this.target.sourcePath ?? this.target.path,
result.manifest, result.manifest,
), ),
locations: result.artifacts.map(({ relative_path: path }) => ({ // Each extracted file's path is already in artifacts.
kind: "artifact-path" as const, locations: [],
path,
})),
}), }),
); );
} }
@@ -211,10 +209,8 @@ class ArtifactClient implements AnalysisClient {
this.target.sourcePath ?? this.target.path, this.target.sourcePath ?? this.target.path,
result.manifest, result.manifest,
), ),
locations: result.occurrences.map(({ logical_path: path }) => ({ // Each occurrence's logical path is already in the result.
kind: "artifact-path" as const, locations: [],
path,
})),
}), }),
); );
} catch (cause: unknown) { } catch (cause: unknown) {
@@ -323,17 +319,14 @@ class ArtifactClient implements AnalysisClient {
this.target.sourcePath ?? this.target.path, this.target.sourcePath ?? this.target.path,
inventory.manifest, inventory.manifest,
); );
const locations = inventory.occurrences.map(({ logical_path: path }) => ({
kind: "artifact-path" as const,
path,
}));
const inventoryEvidence = createEvidence(subject, ARTIFACT_GRAPH_PROVIDER, { const inventoryEvidence = createEvidence(subject, ARTIFACT_GRAPH_PROVIDER, {
operation: "inventory_artifact", operation: "inventory_artifact",
parameters: inventoryParameters, parameters: inventoryParameters,
result: inventory, result: inventory,
rawResult: null, rawResult: null,
limitations: inventory.limitations, limitations: inventory.limitations,
locations, // The nested inventory already names every occurrence's logical path.
locations: [],
}); });
const result = createArtifactInspection(inventoryEvidence); const result = createArtifactInspection(inventoryEvidence);
await options?.progress?.report({ await options?.progress?.report({
@@ -347,7 +340,7 @@ class ArtifactClient implements AnalysisClient {
rawResult: null, rawResult: null,
limitations: result.limitations, limitations: result.limitations,
subject, subject,
locations, locations: [],
}), }),
); );
} }
@@ -66,6 +66,9 @@ describe("artifact archive inventory", () => {
inspection.substeps[0]?.evidence.normalized_result, inspection.substeps[0]?.evidence.normalized_result,
).occurrences, ).occurrences,
).toHaveLength(3); ).toHaveLength(3);
// Occurrences name every logical path; neither Evidence repeats them.
expect(inspectionEvidence.locations).toEqual([]);
expect(inspection.substeps[0]?.evidence.locations).toEqual([]);
expect(inspection.observations.map(({ kind }) => kind)).toEqual([ expect(inspection.observations.map(({ kind }) => kind)).toEqual([
"root-manifest", "root-manifest",
]); ]);
@@ -65,6 +65,8 @@ describe("artifact extraction", () => {
]), ]),
extraction_manifest: { output_root_alias: "$OUTPUT_ROOT" }, extraction_manifest: { output_root_alias: "$OUTPUT_ROOT" },
}); });
// artifacts names every extracted path; the Evidence does not repeat them.
expect(result.value.locations).toEqual([]);
expect(await readFile(join(output, "assets", "selected.js"), "utf8")).toBe( expect(await readFile(join(output, "assets", "selected.js"), "utf8")).toBe(
"selected();\n", "selected();\n",
); );