diff --git a/src/domain/apple/interfaceBuilderGraph.test.ts b/src/domain/apple/interfaceBuilderGraph.test.ts index 13d6f79fb..fb1c0b9ad 100644 --- a/src/domain/apple/interfaceBuilderGraph.test.ts +++ b/src/domain/apple/interfaceBuilderGraph.test.ts @@ -509,3 +509,46 @@ describe("AppKit keyed archive connectors", () => { expect(to).toEqual(expect.arrayContaining(["objc_selector", "unknown"])); }); }); + +it("names the archive once per evidence record", () => { + const relativePath = "Views/Main.storyboardc/scene.nib/objects.nib"; + const result = buildInterfaceBuilderAnalysis({ + targetSha256: hash, + toolVersion: "test", + documents: [ + { + relativePath, + archiveSha256: hash, + documentKind: "storyboard_scene", + raw: { + "com.apple.ibtool.document.objects": { + controller: { customClass: "StoreViewController" }, + next: { customClass: "BuildViewController" }, + }, + "com.apple.ibtool.document.connections": { + controller: [ + { type: "segue", identifier: "showBuild", destinationId: "next" }, + ], + }, + }, + }, + ], + limits: interfaceBuilderLimitsSchema.parse({}), + }); + const evidence = [...result.graph.nodes, ...result.graph.edges].flatMap( + (item) => item.evidence, + ); + expect(new Set(evidence.map(({ artifact_path }) => artifact_path))).toEqual( + new Set([relativePath]), + ); + expect(evidence.map(({ description }) => description)).toEqual( + expect.arrayContaining([ + "compiled document", + "object controller", + "segue showBuild", + ]), + ); + expect( + evidence.filter(({ description }) => description.includes(relativePath)), + ).toEqual([]); +}); diff --git a/src/domain/apple/interfaceBuilderGraph.ts b/src/domain/apple/interfaceBuilderGraph.ts index 17e94d584..bd35130a8 100644 --- a/src/domain/apple/interfaceBuilderGraph.ts +++ b/src/domain/apple/interfaceBuilderGraph.ts @@ -72,7 +72,9 @@ export const buildInterfaceBuilderAnalysis = (input: { const evidenceFor = (description: string) => [ { kind: "interface_builder_resource" as const, - description: `${document.relativePath}: ${description}`, + // artifact_path names the archive; repeating it here cost a path per + // node and edge. + description, location: { address: null, file_offset: null }, artifact_path: document.relativePath, artifact_sha256: document.archiveSha256,