Fix ambiguous symbol navigation and real-repo call graphs - #726
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9790be81d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var cursor = after_name; | ||
| while (cursor < line.len and (line[cursor] == ' ' or line[cursor] == '\t')) cursor += 1; | ||
| if (cursor < line.len and line[cursor] == '(') return true; |
There was a problem hiding this comment.
Accept language-specific calls before filtering
This predicate only accepts an identifier followed directly by (, apart from the Swift and shell exceptions below. Consequently, valid calls such as Ruby's render user and generic invocations such as C++ foo<int>() are discarded by handleCallers, potentially reporting zero callers even though the content search found real call sites. Add the supported languages' non-parenthesized and generic-call forms before using this as a mandatory filter.
Useful? React with 👍 / 👎.
| outline.language == .go_lang or outline.language == .php or | ||
| outline.language == .dart or outline.language == .java or | ||
| outline.language == .kotlin or outline.language == .svelte or | ||
| outline.language == .kotlin or outline.language == .swift or |
There was a problem hiding this comment.
Recognize Swift multiline strings when balancing bodies
Adding Swift to the generic brace scanner corrupts function ranges for valid multiline literals: findBraceEnd only recognizes Dart triple quotes, so Swift's opening """ is treated as three alternating ordinary quotes. An ordinary " inside that literal can therefore end the scanner's string state, after which a literal } is counted as code and may truncate the function body; later calls then disappear from symbol bodies and the call graph. Teach the scanner Swift multiline/raw-string rules before enabling brace balancing for Swift.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
|
Follow-up review caught and fixed a Windows-specific stale-daemon handoff bug in 7ba719e: the named-pipe listener now honors the same retire/yield result as POSIX. Re-review found no remaining blocker. Native tests remain green (261/265, 4 skipped), and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ba719e7dd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| std.process.exit(1); | ||
| }; | ||
| defer allocator.free(snapshot_path); | ||
| snapshot_mod.writeSnapshotDual(io, &explorer, abs_root, snapshot_path, allocator) catch |err| { |
There was a problem hiding this comment.
Keep reindex usable on read-only project roots
When the indexed project is readable but not writable, such as a read-only checkout or mounted dependency tree, this unconditional root snapshot write fails and exits 1. The paired bootstrap.zig change now skips writeProjectCacheSnapshot for reindex, so the command no longer leaves the fresh central snapshot that previously made this workflow succeed; retain the cache write or make the root copy best-effort.
Useful? React with 👍 / 👎.
| } | ||
| return; | ||
| } | ||
| if (from_candidates.len > 1 or to_candidates.len > 1) { |
There was a problem hiding this comment.
Support disambiguation within a single file
When a selected file contains multiple call-graph nodes with the same name—such as overloaded Java/C++ methods or identically named methods in multiple classes—from_path/to_path still leaves multiple candidates and this branch refuses the search. Because paths are the only disambiguators exposed by the MCP schema and CLI, the user cannot proceed even after following the diagnostic; add a line/symbol selector or allow the same-file candidates to participate as an endpoint set.
Useful? React with 👍 / 👎.
|
Final validation on f8d0cfa:
The ranking path keeps the established fast approximate graph; user-visible callpaths upgrade it to strict scoped/import-aware resolution. This preserves retrieval latency while fixing #725 correctness. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8d0cfa311
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| defer allocator.free(snap_path); | ||
| if (std.Io.Dir.cwd().statFile(io, snap_path, .{})) |st| { | ||
| snap_stat = st; | ||
| if (!found or st.mtime.nanoseconds > snap_stat.mtime.nanoseconds) snap_stat = st; |
There was a problem hiding this comment.
Check freshness against the snapshot that actually loads
When the newer snapshot is corrupt, truncated, or has a mismatched Git HEAD, this uses that rejected file's mtime as the freshness baseline, while loadBestSnapshot subsequently falls back to the older valid copy. A worktree edit made after the older snapshot but before the rejected newer file will therefore not mark the index stale, so queries silently serve the older snapshot and miss the edit; select the baseline only after validating the snapshot, or propagate the mtime of the copy that was actually loaded.
Useful? React with 👍 / 👎.
Summary
reindexatomically persist root and central snapshots so the next no-daemon query loads instead of rescanningcodedb_contexton production definitions before imports/tests/generated collisionsFixes #725.
Validation
zig build test --summary all— 31/31 build steps; 1,454 passed, 4 skippedpython3 scripts/e2e_mcp_test.py --binary zig-out/bin/codedb --project /Users/blackfloofie/tmp/codedb-fix-name-resolution-725— 76/76python3 scripts/fd_regression_test.py --binary zig-out/bin/codedb— 45 descriptors at both 128 and 2,048 files (bounded, corpus-size independent)mainresolves exactly tozigrep/src/exec/search_engine.zig:run; warm snapshot load verifiedtoggleDictationresolves directly tobeginDictation; Swift bodies restored;startcaller false positives reducedsrc/main.zig:mainranks first; scoped MCP/watcher callpaths resolve correctly;.env*and*.pemreturn no matchesNo version bump, tag, or release is included in this PR.