From 3823586fa8643568e92abddb6320b4fa82343236 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Mon, 15 Jun 2026 18:11:41 +0000 Subject: [PATCH] test(lbug): cover the invalid-TO-label skip branch (#2215 review) Only an invalid-FROM label was exercised; the validTables skip is an OR over both endpoints, so the invalid-TO branch was untested (an inverted && would have slipped through). Add a valid-FROM/invalid-TO edge to the differential test and the router unit test, asserting it's skipped identically by router and oracle. Co-Authored-By: Claude Opus 4.8 (1M context) --- gitnexus/test/integration/csv-pipeline.test.ts | 4 +++- gitnexus/test/unit/rel-pair-routing.test.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gitnexus/test/integration/csv-pipeline.test.ts b/gitnexus/test/integration/csv-pipeline.test.ts index 0c7fd2db8..08c5d7ccb 100644 --- a/gitnexus/test/integration/csv-pipeline.test.ts +++ b/gitnexus/test/integration/csv-pipeline.test.ts @@ -382,6 +382,8 @@ describe('streamAllCSVsToDisk — direct per-pair emit matches the split oracle' { sourceId: 'proc_1', targetId: 'proc_2', type: 'CONTAINS' }, // Invalid FROM label ('Bogus' ∉ NODE_TABLES) — skipped by both paths. { sourceId: 'Bogus:x', targetId: 'File:a.ts', type: 'CONTAINS' }, + // Invalid TO label — exercises the OTHER branch of the skip condition. + { sourceId: 'File:a.ts', targetId: 'Bogus:y', type: 'CONTAINS' }, ], ); @@ -416,7 +418,7 @@ describe('streamAllCSVsToDisk — direct per-pair emit matches the split oracle' expect(direct.totalValidRels).toBe(split.totalValidRels); expect(direct.totalValidRels).toBe(5); expect(direct.skippedRels).toBe(split.skippedRels); - expect(direct.skippedRels).toBe(1); + expect(direct.skippedRels).toBe(2); // invalid-FROM + invalid-TO, both skipped expect(direct.relHeader).toBe(split.relHeader); // Identical pair set. diff --git a/gitnexus/test/unit/rel-pair-routing.test.ts b/gitnexus/test/unit/rel-pair-routing.test.ts index 0bf68d84e..8355014d7 100644 --- a/gitnexus/test/unit/rel-pair-routing.test.ts +++ b/gitnexus/test/unit/rel-pair-routing.test.ts @@ -110,9 +110,10 @@ describe('RelPairRouter', () => { await route('File:a', 'Function:a:g:2'); // same pair await route('Function:a:f:1', 'Function:a:g:2'); // different pair await route('Bogus:x', 'File:a'); // invalid FROM label → skipped + await route('File:a', 'Bogus:y'); // invalid TO label → skipped (other branch) await router.close(); - expect(router.skipped).toBe(1); + expect(router.skipped).toBe(2); expect(router.total).toBe(3); expect([...router.byPair.keys()].sort()).toEqual(['File|Function', 'Function|Function']); expect(router.byPair.get('File|Function')!.rows).toBe(2);