From 2a511ebd88fe8ece9cc46a774439d7ae05aae9c1 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Thu, 18 Jun 2026 16:15:04 +0000 Subject: [PATCH] test(impact): integration cover line-seeded slice over callee-less blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A real-DB downstream line seed reaches a dependent block via the CDG edge, so calleesOfBlocks runs over real seed+reachable blocks whose `callees` carry no data (created without the property — the no-calls / pre-v2 reality). Assert the call completes without surfacing a query failure, the slice resolves, and the statement-precise inter-procedural precision is null (empty reach) rather than a partial value. The column-absent variant is unit-covered (forced-throw test); the harness builds the full schema so it cannot create a column-less table. Addresses PR #2227 tri-review finding (testing). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../impact-pdg-degradation.test.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gitnexus/test/integration/impact-pdg-degradation.test.ts b/gitnexus/test/integration/impact-pdg-degradation.test.ts index a3e211855..ee4e41cbb 100644 --- a/gitnexus/test/integration/impact-pdg-degradation.test.ts +++ b/gitnexus/test/integration/impact-pdg-degradation.test.ts @@ -170,6 +170,32 @@ withTestLbugDB( // Distinct from KTD6 "no PDG body": this symbol HAS a body. expect(result.epistemic).not.toBe('no-pdg-body'); }); + + it('a line-seeded slice over callee-less blocks degrades gracefully (real-DB calleesOfBlocks)', async () => { + // The seeded BasicBlocks carry no `callees` data (created without the + // property — the pre-v2 / no-calls reality). A downstream line seed at + // B0 reaches B1 via the CDG edge, so calleesOfBlocks runs over real + // seed+reachable blocks; with no callee data it must yield an empty set + // and degrade to callgraph-equal — no throw, no partial precision. + vi.mocked(loadMeta).mockResolvedValueOnce( + META({ maxCdgEdgesPerFunction: 0, maxReachingDefEdgesPerFunction: 0 } as any), + ); + const result = await backend.callTool('impact', { + target: 'hot', + direction: 'downstream', + mode: 'pdg', + line: 2, + }); + // The slice resolved (B1 is downstream-dependent on the line-2 seed) and + // the call completed without surfacing a callees-query failure. + expect(result.error).toBeUndefined(); + expect(result.epistemic).toBe('pdg-intra-procedural'); + expect(result.affectedStatementCount).toBeGreaterThanOrEqual(1); + // No CALLS edge in the fixture and no callee data on the blocks, so the + // statement-precise inter-procedural reach is empty — precision is null + // (no reach), never a partial value, and nothing threw. + expect(result.pdgInterprocedural.statementPrecision).toBeNull(); + }); }); describe('unknown (meta unreadable)', () => {