Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

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

Kaoru08221f692c83e2e6
diff --git a/src/artifacts/ArtifactProvider.ts b/src/artifacts/ArtifactProvider.ts
index fe5d24ef0..821455903 100644
--- a/src/artifacts/ArtifactProvider.ts
+++ b/src/artifacts/ArtifactProvider.ts
@@ -194,10 +194,8 @@ class ArtifactClient implements AnalysisClient {
this.target.sourcePath ?? this.target.path,
result.manifest,
),
- locations: result.artifacts.map(({ relative_path: path }) => ({
- kind: "artifact-path" as const,
- path,
- })),
+ // Each extracted file's path is already in artifacts.
+ locations: [],
}),
);
}
@@ -211,10 +209,8 @@ class ArtifactClient implements AnalysisClient {
this.target.sourcePath ?? this.target.path,
result.manifest,
),
- locations: result.occurrences.map(({ logical_path: path }) => ({
- kind: "artifact-path" as const,
- path,
- })),
+ // Each occurrence's logical path is already in the result.
+ locations: [],
}),
);
} catch (cause: unknown) {
@@ -323,17 +319,14 @@ class ArtifactClient implements AnalysisClient {
this.target.sourcePath ?? this.target.path,
inventory.manifest,
);
- const locations = inventory.occurrences.map(({ logical_path: path }) => ({
- kind: "artifact-path" as const,
- path,
- }));
const inventoryEvidence = createEvidence(subject, ARTIFACT_GRAPH_PROVIDER, {
operation: "inventory_artifact",
parameters: inventoryParameters,
result: inventory,
rawResult: null,
limitations: inventory.limitations,
- locations,
+ // The nested inventory already names every occurrence's logical path.
+ locations: [],
});
const result = createArtifactInspection(inventoryEvidence);
await options?.progress?.report({
@@ -347,7 +340,7 @@ class ArtifactClient implements AnalysisClient {
rawResult: null,
limitations: result.limitations,
subject,
- locations,
+ locations: [],
}),
);
}
diff --git a/tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts b/tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts
index 2da4a98f4..79765e711 100644
--- a/tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts
+++ b/tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts
@@ -66,6 +66,9 @@ describe("artifact archive inventory", () => {
inspection.substeps[0]?.evidence.normalized_result,
).occurrences,
).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([
"root-manifest",
]);
diff --git a/tests/boundary/providers/native/artifactProvider.extraction.test.ts b/tests/boundary/providers/native/artifactProvider.extraction.test.ts
index 9726e5560..9a538e2b1 100644
--- a/tests/boundary/providers/native/artifactProvider.extraction.test.ts
+++ b/tests/boundary/providers/native/artifactProvider.extraction.test.ts
@@ -65,6 +65,8 @@ describe("artifact extraction", () => {
]),
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(
"selected();\n",
);