Skip to content

fix(ddg): drop dependence edges whose endpoint is not a body node - #229

Merged
rahlk merged 1 commit into
mainfrom
fix/issue-228-dangling-ddg-endpoints
Sep 7, 2026
Merged

fix(ddg): drop dependence edges whose endpoint is not a body node#229
rahlk merged 1 commit into
mainfrom
fix/issue-228-dangling-ddg-endpoints

Conversation

@rahlk

@rahlk rahlk commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #228

Cause

InstructionToNode.map returns the sentinel "<line>:0" when it cannot uniquely identify the source statement covering a WALA instruction. It is a well-formed localId but names no body node, and both PDG producers emitted edges on it.

Fix

DdgEdges.dropDangling drops any edge whose src or dst is not a key of the callable's own body{}, applied at both attach points — L3WalaOverlays (the wala engine's ddg) and L4WalaOverlays.merge (the points-to half) — so no producer can reintroduce the shape.

Dropping rather than emitting a <line>:0 vertex: the sentinel marks an over-approximation, so the edge is a may-dependence whose exact endpoint was never established, and a synthetic vertex would need a body-node kind the schema vocabulary does not have.

Verified

daytrader8 at -a 4:

ddg edges dangling
before 5,475 90 (39 distinct keys, all <line>:0, all prov:["points-to"])
after 5,385 0

The Neo4j snapshot of the same build now reports 5,385 J_DDG edges — exactly the JSON count, so the one measured disagreement between the two artefacts is gone.

./gradlew test: 511/512 pass, 4 skipped. The single failure is CodeAnalyzerIntegrationTest ("Could not find a valid Docker environment"), which fails identically on main here.

A WALA instruction whose covering source statement cannot be identified maps
to the sentinel "<line>:0" — a well-formed localId that names no body node.
Both PDG producers emitted edges on it, so 90 of 5,475 ddg edges on daytrader8
at -a 4 dangled, every one carrying prov:["points-to"].

Such an edge is unfollowable. The Neo4j emitter materialises body nodes from
body{}, so it silently could not write them, which made ddg the only place a
consumer reading both artefacts saw them disagree. Dropping is sound in the
direction that matters: the sentinel marks an over-approximation, so the edge
is a may-dependence whose exact endpoint was never established. Emitting a
synthetic vertex instead would need a body-node kind the schema has no
vocabulary for.

DdgEdges.dropDangling is applied by both attach points — L3WalaOverlays for
the wala engine's own ddg and L4WalaOverlays.merge for the points-to half —
so no producer can reintroduce the shape. The L3 log line now reports what it
dropped.

On daytrader8 at -a 4: 90 dangling edges before, 0 after, and the JSON and the
Neo4j snapshot now report the same 5,385 ddg edges.

Closes #228
@rahlk
rahlk merged commit 40d8e59 into main Sep 7, 2026
@rahlk
rahlk deleted the fix/issue-228-dangling-ddg-endpoints branch September 7, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ddg edges reference endpoints that are not body nodes of their own callable

1 participant