feat: add cross-language edge contexts and context-aware queries#573
Open
TheFedaikin wants to merge 1 commit intosafishamsi:v5from
Open
feat: add cross-language edge contexts and context-aware queries#573TheFedaikin wants to merge 1 commit intosafishamsi:v5from
TheFedaikin wants to merge 1 commit intosafishamsi:v5from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make graph queries context-aware across languages
What we want
We want graphify queries to distinguish between edge kinds that are currently traversed together.
Examples:
A query like
who calls X?should prefer call-heavy results instead of mixing calls, imports, and declaration-style references.Why
This improves query precision in larger or noisier graphs and makes edge disambiguation a graph-level, cross-language capability.
Model boundary:
relation= semantic edge typecontext= syntactic disambiguation where neededProposal
Add a cross-language
contextlayer for edges where it improves query quality, and use it during query traversal.Initial contexts:
callimportfieldQueries should support:
Examples:
graphify query "extract" --context callwho calls extract-> infercallwhen no explicit filter is providedScope
contextwhere supportedgraphify queryquery_graphNon-goals
inherits/implementsintocontextrelationwithcontextexplain/pathdisambiguationReferences #569
This is related to #569, but narrower in scope.
#569is mainly about resolving the right node or candidate set in large, noisy graphsIn short:
#569= node resolution / disambiguationDone when
› can you now give me the updated PR description?
• # Add cross-language edge contexts and context-aware queries
Summary
This PR makes edge
contexta first-class cross-language query feature.It:
contextsupport across touched extractors--contextfiltering to CLIgraphify querycontext_filterto MCPquery_graphModel boundary:
relation= semantic meaningcontext= syntactic disambiguationWhy
Testing
uv run --with pytest pytest tests/test_extract.py tests/test_multilang.py tests/test_languages.py tests/test_serve.py tests/test_query_cli.py -q
Passed:
Also ran:
uv run graphify update .
Queries like
who calls X?should not traverse the same way aswhat imports X?orwhere is X used as a field?.This improves query precision and gives graphify a cleaner cross-language story for edge disambiguation.
References
Closes #572.
Related to #569.
This PR improves traversal precision via edge-context filtering, but does not address
explain/pathcandidate resolution or broader node-disambiguation behavior.Examples