You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python entrypoint flag is lost when only the target's file is rebuilt #2433
Found while implementing #2428. This is a defect in #2411's feature as it currently stands, not a pre-existing bug — filing it separately because its trigger is different from the watch-mode gap #2428 describes, and it affects the ordinary codegraph build --incremental path.
Repro (both engines)
lib.py: def shared_main(): return 1
run.py: from lib import shared_main
if __name__ == "__main__":
shared_main()
Edit only lib.py (the target — the guard is untouched).
codegraph build --incremental → shared_main is now entrypoint = 0, entrypoint_source_file = NULL, role = core.
Verified on wasm and on native built from source at fix/python-entrypoint-roles. The run.py (file node) → shared_maincalls edge is still present in the graph after step 3 — only the flag is gone.
Root cause
nodes.entrypoint is cross-file derived state whose two ends have different lifecycles:
the evidence (the guarded call) belongs to the guard's file;
the flag sits on the target's node row, which is deleted and re-inserted with a fresh id whenever the target's file is rebuilt.
markEntrypointTargets / mark_entrypoint_targets write the flag straight from fileSymbols — the files reparsed in this build. When only the target is reparsed, the guard's file is not in that set, so nothing re-marks the freshly re-inserted row, and the flag is silently dropped.
This is the same root cause as #2428's watch-mode gap; the watcher symptom is one trigger, this is another. Both are fixed together by persisting the evidence per file and projecting it onto nodes at the end of every build path.
Why it matters
This is the path .claude/hooks/update-graph.sh runs after every edit, so in practice the flag survives only until the next edit to any file that declares an entrypoint target — after which codegraph roles --role entry under-reports and the target's call tree loses its reachability root again.
Fix
Being fixed alongside #2428 in the same PR (they are one defect), via a new entrypoint_calls(file, name) evidence table plus a projectEntrypointAttribution step — the same shape invoked_property_names (#2087) and return_types (#2138) already use for cross-file evidence that a partial rebuild must be able to see.
Activity
fix(roles): persist Python entrypoint evidence so attribution survive…