Repository navigation
Conversation
|
Thanks for the pull request, @sunhouy. 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. |
…Graphify-Labs#5178) `context_filter` only matched `edge["context"]`, and the C#, Java and Python extractors emit `inherits`/`implements` with no context at all (only the TypeScript one tags them `type`). So no filter value could select inheritance in those languages: `["type"]` worked for TS alone, `["inherits"]` matched nothing anywhere, and the traversal came back with the seeds and zero edges. - map the heritage words (inherit(s)/inheritance/subclass/superclass, implements/interface(s), extends) onto the edge relations they name, and let a heritage filter match the edge's `relation` as well as its `context`; - `type` keeps meaning exactly `context == "type"` -- widening it would drop `implements` edges from a TypeScript graph; - an explicit filter that selects no edge is now reported in the header as `Context: <f> (explicit, matched 0 edges)`, so an empty answer is not read as "these symbols are unrelated". Verified on a four-language corpus (same Square : Base, IShape hierarchy in C#, TS, Java, Python): `--context inherits` now reaches the C#/Java/Python edges, and `--context implements` the interface ones, while `type` still returns only what TS tagged.
84c9ed5 to
17fc2a6
Compare
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; no formal proof of the changed code.
No blocking issues. I didn't find anything I'd hold the merge for.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 0 functions depend on the 0 functions this change touches.
Health — grade A; no new coupling hotspots.
Verification — 0 functions in the blast radius were not formally verified this run (proofs are advisory here).
Diff could not be reliably attributed to this PR: the base/head merge-base was unreachable in the shallow clone, so detailed findings were skipped (rather than emit a two-dot diff, which would misattribute base-branch changes).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Test selection
Test selection
0 of 559 test file(s) selected (0%) via static blast radius.
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.
What does this PR do?
context_filteronly ever looked atedge["context"], and the C#, Java and Python extractors emitinherits/implementswith no context at all — only the TypeScript one tags themtype. So no filter value could select inheritance in those languages:["type"]reached TypeScript alone, and["inherits"]matched nothing anywhere. On the reporter's C# graph a base class with ~550 subclasses came back as1 nodes found, with nothing in the output to suggest the filter had matched zero edges.Two changes in
graphify/serve.py:inherits/inherit/inheritance/subclass*/superclassmap toinherits;implements/interface*toimplements;extendstoextends._filter_graph_by_contextkeeps an edge whoserelationis one of the heritage relations the filter names, as well as one whosecontextmatches.Context: return_type (explicit, matched 0 edges). The old header readContext: return_type (explicit)next to1 nodes found, which is indistinguishable from "these symbols really are unrelated".typedeliberately keeps meaning exactlycontext == "type". It is what the TypeScript extractor writes, and folding the heritage relations into it would silently change what a TS user's existing--context typereturns.Fixes #5178
Type of change
Verification & Invariants
The invariant is that a
context_filterselects edges, and a filter that silently selects none is a bug of its own — the traversal answer is the same shape either way, so the header has to carry the difference. Nothing here changes the graph on disk, the stored edge shape, or extraction; the filter is a read-only view built per query. No persisted or generated state is affected, so there is no cache or manifest migration.Limitations, stated plainly:
references,contains) still needcontexton the edge; I did not widen those, because areferencesedge under an explicitinheritsfilter would be wrong and I have no report of it being needed.mixes_in/embedsare left alone: they are heritage-adjacent but the issue only coversinherits/implements/extends, and I would rather add them once someone has a graph that needs them.contexton its C#/Java/Python heritage edges; it just becomes reachable through the relation match.How was this tested?
The 150 failures are all in
test_terraform_modules.py,test_hook_*,test_skillgen.pyandtest_ext_tagged_id_clash.py, and fail identically on06aa51bwithout this patch (86 of them in the four files I re-ran on the base). They are unrelated toserve.py.End-to-end, on a corpus holding the same
Square : Base, IShapehierarchy in four languages (graphify extract . --code-only --no-viz, thengraphify query):Java and Python behave the same, and the TS edges still show
context=typewhen they are reached throughinherits.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. — not applicable, no skill fragment or CLI help text changed.