Repository navigation
refactor(csharp): lift interface dispatch into a language-agnostic core - #4034
GAURAV-1313 wants to merge 1 commit into
Conversation
|
Thanks for the pull request, @GAURAV-1313. 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. |
Move the single-implementer dispatch mechanism from csharp_dispatch.py into interface_dispatch.py with the file-suffix gate as a keyword parameter. csharp_dispatch.py keeps its public names (resolve_csharp_interface_dispatch, _method_label, DISPATCH_RELATION) and becomes the `.cs` gate over the core. No behaviour change: the 15 C# dispatch tests pass untouched, and the extractor registration is not modified. Swift protocols have the same shape (Graphify-Labs#3673 resolves a call through an injected protocol to the requirement, and the conformer's method sits unreachable from it). With the core shared, that language can add a gate instead of a second copy of the algorithm. AI disclosure: Claude Code assisted with this change.
9dec303 to
6aade32
Compare
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.
Graphify review — findings
Refactors the single-implementer interface-dispatch resolver into a language-agnostic resolve_interface_dispatch, which takes a suffixes gate that both the interface and its implementer must be declared in. Another language (Swift protocols, say) can now add a thin wrapper instead of copying the algorithm. resolve_csharp_interface_dispatch becomes that wrapper with .cs and still re-exports DISPATCH_RELATION and _method_label for existing callers.
Worth a look
- Cross-language implementers suppress valid dispatch —
graphify/interface_dispatch.py:92· 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 — 14 functions depend on the 12 functions this change touches.
Health — grade A; no new coupling hotspots.
Verification — 14 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: 14 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
1 of 318 test file(s) selected (0%) via static blast radius.
tests/test_csharp_interface_dispatch.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.
|
Shipped in v0.9.75 (live on PyPI as Closing as shipped. |
What does this PR do?
Moves the single-implementer dispatch mechanism out of
graphify/csharp_dispatch.pyinto a newgraphify/interface_dispatch.py, with the file-suffix gate as a keyword parameter (resolve_interface_dispatch(..., suffixes=)).csharp_dispatch.pykeeps its public names (resolve_csharp_interface_dispatch,_method_label,DISPATCH_RELATION) and becomes the.csgate over the core. The registration inextract.pyis untouched.Why: Swift protocols have exactly the shape #3003 fixed for C# interfaces. Since #3673 a call through an injected protocol lands on the requirement node, and the conformer's method is unreachable from it. The follow-up PR adds a 46-line
.swiftgate over this core instead of a second copy of the algorithm, following the rule from the #3729 review: reuse the existing resolver rather than re-implement a subset of it.Type of change
Verification & Invariants
Invariant: for every corpus, the edges this pass emits are identical before and after. The body of
resolve_interface_dispatchis the old function verbatim; the only edit is the module constant_CSHARP_SUFFIXESbecoming thesuffixesparameter, which the C# gate passes as(".cs",). Which pairs qualify, the edge's fields, and the dedup are unchanged. No persisted or generated state is involved: the pass runs in memory after extraction.tests/test_csharp_interface_dispatch.pypass unmodified and are the boundary test (two implementers produce nothing, a Java corpus gains no edge, the dedup is scoped todispatches_to).How was this tested?
Diff: 2 files, +176 / −133. One commit, rebased on
v8at 0b60d47.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. No fragment changed.