Repository navigation
fix(5320): run graph commands without anyio installed - #5422
Deepjyoti-Sarmah wants to merge 2 commits into
Conversation
explain, query, path, affected and benchmark only read a graph, so they must work on a core install. Run each with anyio, mcp and starlette unimportable.
e6d37d5 moved the import to the top of serve.py. anyio ships only with the mcp and all extras, but explain, query, path, affected and benchmark import helpers from serve.py, so they failed with ModuleNotFoundError on a core install of 0.9.118.
|
Thanks for the pull request, @Deepjyoti-Sarmah. 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.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify review 
4 possible issues to check · High impact
The server now imports anyio only when its asynchronous graph-loading helper runs, so importing the module for CLI graph commands no longer requires that optional dependency.
4 possible issues we couldn't confirm
- Warm-up of a project's graph still requires anyio, so it fails when anyio is not installed ·
graphify/serve.py:2997 - The test comment says it blocks every package the mcp extra installs, but only anyio, mcp and starlette are blocked, so regressions through ·
tests/test_cli_without_mcp_extra.py:10 - The benchmark case checks only the exit code, so its output could be wrong without the test failing. ·
tests/test_cli_without_mcp_extra.py:62 - +1 more in Graphify
They don't change the score.
Code graph · 883 functions depend on this change
- 31 of 621 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Reviewed d2e6a61 · Full report in the Graphify check
…batch Fold the Python-lambda (#5417), Go-import-shadow (#5411) and COBOL GO-TO (#5423) AST-output changes into one combined _AST_CACHE_SCHEMA bump 53 -> 54, so cached Python/Go/COBOL extractions re-run. Fix the #5422 regression test's cwd-fragile `query` assertion to check the queried node (returncode==0 is the real invariant). 0.9.119 changelog and version bump. The headline is the #5320 anyio regression fix (graph commands broke on core installs in 0.9.118). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Landed in v0.9.119 via an authorship-preserving cherry-pick, so your commit keeps its credit. Thank you for catching and fixing this — the 0.9.118 anyio hoist broke query/path/explain/affected/benchmark on core installs without the mcp extra, and moving the import back inside the MCP server path restores them. (I fixed the query test's cwd-fragile assertion on merge.) Verified end-to-end on a core install. Thanks @Deepjyoti-Sarmah! |
What does this PR do?
Part of #5320. On 0.9.118,
explain,query,path,affectedandbenchmarkcrash on an install without themcpextra:anyiocomes only with themcpandallextras. These five commands importhelpers from
serve.py, so a module-level import there has to work on a coreinstall. #5374 imported
anyioinside the MCP function that uses it; e6d37d5moved it to the top of the file. This PR moves it back, with a comment saying
why it is there.
Until this is released,
pip install anyioworks around it.Type of change
Verification & Invariants
The invariant: commands that only read a graph work on a core install. Only the
MCP server may need the
mcpextra.The dev environment has
anyio, so the other tests can't see this. The new testruns the CLI in a subprocess where
anyio,mcpandstarlettecan't beimported.
Merge Danger
Door: two-way. No persisted state, graph output or cache schema changes.
Blast radius: when
anyiogets imported. The MCP server still uses it inthe same place.
Limitations
benchmarkgets an exit-code check only, because it prints statistics.How was this tested?
With
PYTHONPATHset to the worktree:The one failure is a file-watcher test,
test_watch_relative_roots_receive_config_events_without_rebasing_source_paths[src],where
graph.jsondid not exist yet when it was read. Run alone it passes 5/5on this branch and 5/5 on v8, so it looks like timing; I did not find the cause.
Clean Python 3.12 environments without
anyio(graphifyy[vbnet]):Not tested: Windows.
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A: no skill fragments touched.)