test(impact): integration cover line-seeded slice over callee-less blocks

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) <noreply@anthropic.com>
This commit is contained in:
Gergo Magyar 2026-06-18 16:15:04 +00:00
parent 2bb1b0ac6a
commit 2a511ebd88

View file

@ -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)', () => {