Phase 3 Workstream A: cross-file edge resolution#3
Open
gavdevs wants to merge 12 commits into
Open
Conversation
Locks the post-Workstream-A behavior: copies the TS fixtures into a
tempdir, runs the indexer pipeline (extract -> resolve_refs -> graph
upsert) per file with deferred edge batching, then asserts
`query_callers("simple_function.ts::add")` returns the cross-file
caller from `imports_and_exports.ts`.
Gated on MYCEL_TEST_LSP=1 to keep multilspy / tsserver / FalkorDB out of
the default `cargo test --workspace` path. Re-uses the existing
`imports_and_exports.ts` fixture (already imports `add` from
`./simple_function` and calls it) rather than adding a redundant
`cross_file_caller.ts`.
Adds async-trait + tempfile as dev-dependencies on mycel-index for the
StubEmbedder and tempdir setup.
…(and edges_for_file)
Two bugs were preventing Workstream A's cross-file CALLS / USES_TYPE / IMPLEMENTS edges from reaching the graph: 1. Bridge closed files between requests. tsserver only resolves through imports when the target file is open simultaneously with the source. The `with server.open_file(path):` form closed each file before the next request, so request_definition stopped at the import binding in the requesting file. Fix: maintain an ExitStack of open files per (repo, language), and prewarm with every same-language source file in the repo when the LS first spins up. 2. Pipeline always sent col=0 to LSP. tsserver's request_definition returns nothing when the cursor lands on whitespace, so col=0 for indented call sites resolved to empty. Fix: locate the bare callee token on the source line and seed its 0-indexed column. Also skip edges whose target already contains `::` (same-file resolutions produced earlier in the pipeline). The smoke tests under crates/mycel-lsp were anchored on `current_dir()` but `cargo test` runs from the package manifest dir, so `scripts/multilspy_bridge.py` and the TS fixtures were never findable. Fix: anchor on `CARGO_MANIFEST_DIR` and walk up to the workspace root, matching the pattern already used in cross_file_calls.rs. After these fixes the cross-file integration test passes against a live multilspy + tsserver, and all 85 workspace tests pass with MYCEL_TEST_LSP=1.
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.
Summary
Cross-file CALLS / USES_TYPE / IMPLEMENTS edges now land in the graph, unblocking
mycel callers,mycel uses, andmycel implements. Implements the Workstream A plan (docs/superpowers/plans/2026-05-11-phase-3-workstream-a-cross-file-edges.md) end-to-end.What changed
Edgegains optionalfrom_lineso tree-sitter can hand the LSP refinement layer a call-site coordinate.GraphClient::symbol_containing(file_path, line) -> Option<String>maps a resolved location back to a Symbol qname.resolve_refs_for_fileop callsrequest_definitionper site and returns(from_path, from_line, to_path, to_line, kind)tuples. The bridge now keeps files persistently open across requests and prewarms the LS with every same-language source file — tsserver only resolves through imports when the target file is open simultaneously.resolve_refs, maps responses to Symbol qnames viasymbol_containing, and appends resolved edges withEdgeSource::Lsp.Test coverage
crates/mycel-index/tests/cross_file_calls.rs) — indexes a TS project with a cross-file call into a fresh FalkorDB and asserts the CALLS edge lands andquery_callersreturns the cross-file caller. Passes.current_dir()butcargo testruns from the package manifest dir. Now anchored onCARGO_MANIFEST_DIR.Test plan
cargo build --workspacecleancargo clippy --workspace --all-targets -- -D warningscleancargo test --workspace— 82/82 pass (no LSP)MYCEL_TEST_LSP=1 cargo test --workspace— 85/85 pass (incl. live multilspy + tsserver)mycel callers content_hashagainst this repo (skipped locally — Ollama not running here; the integration test covers the same contract)Out of scope (deferred)
MultilspyResolver::refine— still marked#[deprecated]; delete after a sweep confirms no callers.🤖 Generated with Claude Code