Repository navigation
fix(affected): walk the callers of the supertype member an overriding method overrides - #4331
rohit-jsfreaky wants to merge 2 commits into
Conversation
… method overrides Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B8gwEpjajiWHVW3c9smuKf
|
Thanks for the pull request, @rohit-jsfreaky. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 sampled, not proven).
Formal verification. PR-changed functions: 1/1 verified (0 proven, 1 may-equivalent, 0 distinguished) · 0 not verified.
Graphify review — findings
Makes affected_nodes follow method overrides, so changing a method also reports callers bound to the same-named member of any supertype its class transitively inherits, extends or implements (e.g. v.head() typed NodeVisitor when Printer.head changes). That supertype member is walked at the same depth as the override but reported only if a real edge also reaches it, so depth limits stay exact. The expansion needs edge direction, so undirected graphs get no override expansion and behave as before.
Worth a look
- Recursive overridden member is reported as an affected hit via its own self-loop —
graphify/affected.py:311· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 271 functions depend on the 35 functions this change touches.
Health — grade A; 5 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
main()— 103 callers, 3 callees (high)dispatch_command()— 2 callers, 130 callees (high)_run_cli()— 8 callers, 8 callees (high)resolve_seed()— 12 callers, 4 callees (high)test_poisoned_manifest_is_healed()— 0 callers, 6 callees (medium)
Verification — 271 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 85 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
12 of 368 test file(s) selected (3%) via static blast radius.
tests/test_affected_cli.py— impacttests/test_affected_defines.py— impacttests/test_affected_member_seed.py— impacttests/test_affected_overrides.py— impact, changed-testtests/test_corrupt_graph_json.py— impacttests/test_indirect_call_nested_closure_shadow.py— impacttests/test_indirect_dispatch.py— impacttests/test_indirect_dispatch_assign_return.py— impacttests/test_indirect_dispatch_getattr.py— impacttests/test_js_dynamic_import_affected.py— impacttests/test_js_dynamic_imports.py— impacttests/test_scala_self_type.py— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Formal verification
No difference found (not proven): No behavior difference found in affected\_nodes (not a proof).
The verifier ran both versions of affected\_nodes on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
… a caller Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B8gwEpjajiWHVW3c9smuKf
Intended. A self-loop on @Graphify-Labs please re-review. |
|
Landed in 0.9.86 (now on PyPI) via an authorship-preserving cherry-pick, so your commit authorship is retained. Thank you, @rohit-jsfreaky! |
What does this PR do?
Fixes #4330.
affected_nodesnow treats a method's overridden members as stepping stones. When the walk reaches a method node, it finds the method's class (incomingmethodedge), that class's supertypes (inherits/extends/implements, transitively), and their same-named members, and walks those members' callers at the same depth. The overridden member itself is not reported (it did not change), unless a real edge reaches it too (a base overload calling the abstract member shares its node). It runs at query time: no new edges, no graph or cache change, every language with those edges (Java, TypeScript, Python, Kotlin, C#, ...).This is class-hierarchy analysis: a caller bound to
Base.mis listed for every override ofm, since any of them can run there.Type of change
Verification & Invariants
Invariant: a caller bound to a member that a method overrides is affected by that method, at the depth of a direct caller.
Against javac (callers of each overriding method that reach it only through the member it overrides, by file), 0.9.85 vs this branch,
affected(method, depth=1):The rest are calls with no
callsedge at all (receiver types graphify does not resolve yet), not the walk. TypeScript, callers of overridden members on graphify's own edges: TypeORM 1737 missed -> 0, NestJS 98 -> 0.Cost, every method of the project as a seed, depth 2: jackson-core 0.01 -> 0.30 ms per query, jsoup 0.02 -> 0.12 ms, TypeORM 0.01 -> 0.14 ms; mean hits per seed 3.5 -> 6.3 / 4.2 -> 6.1 / 2.2 -> 3.7.
Python test suites, where a crash is inserted in a function and the failing test files are the truth (click 80 functions, flask 80, httpx 37): unchanged at depth 2; httpx at depth 50 33% -> 37% of failing test files found.
tests/test_affected_overrides.py, 11 tests; 9 fail on 0.9.85;test_unrelated_same_named_method_is_not_walkedandtest_undirected_graph_is_unchangedpass on both (guards).test_recursive_overridden_member_is_a_caller_of_the_overridepins that a self-recursive overridden member is reported. End-to-end on Java, TypeScript and Python extraction.Limitations: members are matched by label, so a same-named static method in a subclass (hiding, not overriding) and Java overloads sharing one node are walked too; an undirected graph has no supertype direction and is left as before.
How was this tested?
Graphify-specific checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01B8gwEpjajiWHVW3c9smuKf