Skip to content

bug(build): incremental divergence warning compares per-batch edges vs total — false positive #289

@carlos-alm

Description

@carlos-alm

Found during dogfooding v2.6.32-dev.4f08082

Severity: Low
Command: codegraph build . --verbose (incremental rebuild after file change)

Reproduction

codegraph build . --no-incremental  # Full build: 1936 edges
echo "// test" >> src/logger.js
codegraph build .                   # Incremental: parses 24 files

Expected behavior

The divergence warning should compare the total edge count in the DB before and after the incremental build.

Actual behavior

Warning: "edges: 1936→792 [59.1%], threshold: 20%"

The 792 is only the edges generated from the 24 re-parsed files, not the total in the DB (which is still ~3034). The warning incorrectly compares the previous full build's reported number (1936) with only the current batch's number (792), triggering a false positive divergence warning on every incremental rebuild.

Root cause

The divergence check in builder.js compares previousEdges (from the last build's reported total) with currentEdges (only the edges produced in this incremental batch), not the actual total in the DB.

Suggested fix

After the incremental build, query the actual total edge count from the DB and compare that against the previous total for the divergence check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdogfoodFound during dogfooding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions