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) <noreply@anthropic.com>
This commit is contained in:
Gergo Magyar 2026-06-15 18:11:41 +00:00
parent a797349358
commit 3823586fa8
2 changed files with 5 additions and 2 deletions

View file

@ -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.

View file

@ -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);