Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(comparison): account for unpaired records after explicit bundle pairing (#603)
Rudy Mizrahi Celekli12a2e3793af6
diff --git a/src/domain/bundleComparison.test.ts b/src/domain/bundleComparison.test.tsindex de81c1a67..9743c3525 100644--- a/src/domain/bundleComparison.test.ts+++ b/src/domain/bundleComparison.test.ts@@ -24,6 +24,57 @@ const evidence = (label: string) =>authority: "analyst-inference",});+describe("bundle comparison explicit cross-pairs", () => {+ it("accounts for every unpaired occurrence after cross-pairing shared records", () => {+ const first = evidence("first-cross-pair");+ const second = evidence("second-cross-pair");+ const unchanged = evidence("unchanged-cross-pair");+ const bundle = createEvidenceBundle([first, second, unchanged]);+ const result = compareBundles(bundle, bundle, [+ {+ left_evidence_id: first.evidence_id,+ right_evidence_id: second.evidence_id,+ },+ ]);+ expect(result.summary).toMatchObject({+ records_unchanged: 1,+ records_changed: 1,+ records_added: 0,+ records_removed: 0,+ unresolved: 2,+ });+ expect(result.changes).toEqual(+ expect.arrayContaining([+ expect.objectContaining({+ classification: "unknown",+ conclusion_kind: "unresolved_branch",+ left_evidence_ids: [second.evidence_id],+ }),+ expect.objectContaining({+ classification: "unknown",+ conclusion_kind: "unresolved_branch",+ right_evidence_ids: [first.evidence_id],+ }),+ ]),+ );+ expect(result.status).toBe("unknown");+ expect(result.changes).toHaveLength(3);+ const changedOrUnknown = result.changes.filter(+ ({ entity }) => entity === "evidence",+ );+ expect(+ result.summary.records_unchanged ++ changedOrUnknown.flatMap(({ left_evidence_ids }) => left_evidence_ids)+ .length,+ ).toBe(bundle.records.length);+ expect(+ result.summary.records_unchanged ++ changedOrUnknown.flatMap(({ right_evidence_ids }) => right_evidence_ids)+ .length,+ ).toBe(bundle.records.length);+ });+});+describe("bundle comparison", () => {it("accepts long caller-selected bundle paths", () => {const path = `/${"deep/".repeat(1_000)}bundle.json`;diff --git a/src/domain/bundleComparison.ts b/src/domain/bundleComparison.tsindex 3ab517317..a0fc4b1c5 100644--- a/src/domain/bundleComparison.ts+++ b/src/domain/bundleComparison.ts@@ -166,10 +166,10 @@ const compareRecords = ((id) => rightIds.has(id) && !pairedLeft.has(id) && !pairedRight.has(id),);const removed = [...leftIds].filter(- (id) => !rightIds.has(id) && !pairedLeft.has(id),+ (id) => !pairedLeft.has(id) && (!rightIds.has(id) || pairedRight.has(id)),);const added = [...rightIds].filter(- (id) => !leftIds.has(id) && !pairedRight.has(id),+ (id) => !pairedRight.has(id) && (!leftIds.has(id) || pairedLeft.has(id)),);for (const [ids, side] of [[removed, "left"],