diff --git a/gitnexus/test/integration/cfg/pipeline-pdg.test.ts b/gitnexus/test/integration/cfg/pipeline-pdg.test.ts index cf3fd522b..272e66097 100644 --- a/gitnexus/test/integration/cfg/pipeline-pdg.test.ts +++ b/gitnexus/test/integration/cfg/pipeline-pdg.test.ts @@ -196,9 +196,14 @@ describe('U7 — end-to-end --pdg pipeline', () => { // repo (one hazard fixture with real branching AND a non-terminating // loop/`select`) and we assert, under `--pdg`: // - BasicBlock + CFG > 0 (the worker built a per-function CFG and emit wired it) -// - REACHING_DEF + CDG > 0 (the def/use harvest + the post-dom/CDG passes -// populate — CDG > 0 proves EXIT stays reverse-reachable end-to-end through -// the worker even with the non-terminating loop, not just in unit probes) +// - REACHING_DEF > 0 (the def/use harvest populates the data-dependence layer) +// - CDG > 0 AND ≥1 CDG edge is sourced INSIDE the non-terminating-loop +// function itself (`hazard`, below) — not merely an aggregate satisfied by +// any branching function in the fixture. This is the load-bearing claim: +// the post-dom/CDG pass was NOT skipped for the function whose loop traps +// EXIT, i.e. EXIT stays reverse-reachable end-to-end through the worker even +// with the non-terminating loop/`select`. (#2197 U3 — the prior whole- +// fixture `cdg > 0` aggregate did not isolate the hazard function.) // and without `--pdg` (both the default run and an explicit `pdg:false` run): // - BasicBlock + CFG + REACHING_DEF + CDG == 0 // - the non-PDG graph is byte-identical between the two flag-off runs and @@ -211,12 +216,18 @@ describe('U7 — end-to-end --pdg pipeline', () => { const C_FAMILY_FIXTURES = path.join(__dirname, 'fixtures'); -const C_FAMILY: ReadonlyArray<{ lang: string; fixture: string }> = [ - { lang: 'C', fixture: 'c-hazards.c' }, - { lang: 'C++', fixture: 'cpp-hazards.cpp' }, - { lang: 'C#', fixture: 'csharp-hazards.cs' }, - { lang: 'Java', fixture: 'java-hazards.java' }, - { lang: 'Go', fixture: 'go-hazards.go' }, +// `hazard`: a substring of a BasicBlock's `text` that appears ONLY inside the +// fixture's non-terminating-loop function (`for(;;)` / `while(true)` / `for{}`). +// It locates that function's block anchor so the CDG assertion can prove the +// function specifically is CDG-bearing (see `cdgSourcedInHazardFunction`). C# +// has no such loop (its `Retry` goto-cycle is conditional and terminates), so +// it has no `hazard` and keeps the whole-fixture aggregate only. +const C_FAMILY: ReadonlyArray<{ lang: string; fixture: string; hazard?: string }> = [ + { lang: 'C', fixture: 'c-hazards.c', hazard: 'handle_request' }, // server_forever: for(;;) + { lang: 'C++', fixture: 'cpp-hazards.cpp', hazard: 'poll(' }, // run_forever: while(true) + { lang: 'C#', fixture: 'csharp-hazards.cs' }, // no non-terminating loop in the fixture + { lang: 'Java', fixture: 'java-hazards.java', hazard: 'ready(' }, // serve: while(true) + { lang: 'Go', fixture: 'go-hazards.go', hazard: 'handle(v)' }, // forInfinite: for{} ]; // ── Remaining-language worker-mode PDG (#2195 capstone) ───────────────────── @@ -227,23 +238,25 @@ const C_FAMILY: ReadonlyArray<{ lang: string; fixture: string }> = [ // Kotlin, Dart), AND Vue (whose provider reuses the TypeScript CfgVisitor — the // .vue file routes through the worker's Vue→TypeScript grammar mapping and the // SFC