codedb_remote: add 'wiki' backend (wiki.codes) alongside codegraff#312
codedb_remote: add 'wiki' backend (wiki.codes) alongside codegraff#312justrach merged 1 commit intorelease/0.2.579from
Conversation
codedb_remote today only hits codedb.codegraff.com (WASM-on-Workers indexer). Its sibling project codedb-cloud / wiki.codes is a Zig-native parquet router with a superset of actions and more repos indexed, but agents using codedb have no path to it. Adds an optional `backend` field to codedb_remote. Default stays "codegraff" — every existing caller is unchanged on the wire. Backends + supported actions: codegraff (default): tree, outline, search, meta wiki: tree, outline, search, symbol, policy `symbol` (exact-identifier definition lookup across an indexed repo) and `policy` (hot-pin size class) are new capabilities from wiki that codegraff doesn't expose; `meta` stays codegraff-only. Wiki requests go through the Vercel `/api/query` proxy at https://www.wiki.codes which server-side-auths to the Hetzner router. No client secrets, no API key. Slug is derived from the repo arg by replacing '/' with '-' (matches wiki's canonical naming: rust-lang/rust → rust-lang-rust). Per-backend action allowlists reject cross-backend mismatches with a clear error: action 'meta' not supported on backend 'wiki' (wiki supports: tree, outline, search, symbol, policy) Verified live against wiki.codes: codedb_remote repo=rust-lang/rust backend=wiki action=symbol query=HashMap → 25 hits in 686ms including library/std/src/collections/hash/map.rs:247 struct_def and impl_blocks, plus clippy + rust-analyzer test files Closes #311. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Benchmark Regression ReportThreshold: 10.00%
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bbe4447d1
ℹ️ 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".
| } | ||
| @memcpy(slug_buf[0..repo.len], repo); | ||
| for (slug_buf[0..repo.len]) |*c| { | ||
| if (c.* == '/') c.* = '-'; |
There was a problem hiding this comment.
Preserve unambiguous repo identity in wiki slug mapping
The wiki path derivation flattens owner/repo by replacing only / with -, which makes distinct valid repos collide (for example, foo/bar-baz and foo-bar/baz both map to foo-bar-baz). When both are indexed upstream, codedb_remote can return results for the wrong repository with no error, which can silently corrupt analysis. Use an unambiguous encoding (e.g., separate owner/repo params or escaping component dashes) before building slug.
Useful? React with 👍 / 👎.
Resolves #311.
Summary
`codedb_remote` today hits `codedb.codegraff.com` only. Its sibling project codedb-cloud / wiki.codes is a Zig-native parquet router on Hetzner with more repos indexed, the exact-identifier-lookup `symbol` action, and hot-pin `policy` — but agents using codedb have no path to it.
This PR adds an optional `backend` field. Default stays `"codegraff"` — every existing caller is unchanged on the wire. Opt in with `backend="wiki"` to reach the new capabilities.
Surface
Cross-backend mismatches get a clear error:
```
action 'meta' not supported on backend 'wiki'
(wiki supports: tree, outline, search, symbol, policy)
```
Wire details
Verified live
```
$ echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"codedb_remote",
"arguments":{"repo":"rust-lang/rust","action":"symbol","query":"HashMap",
"backend":"wiki"}},"id":2}' | codedb mcp
→ 25 hits in 686ms, including:
library/std/src/collections/hash/map.rs:247 struct_def "pub struct HashMap<"
library/std/src/collections/hash/map.rs:256 impl_block
src/tools/clippy/tests/ui-toml/toml_disallowed_types/.../conf_disallowed_types.rs:12
src/tools/rust-analyzer/crates/ide-assists/src/handlers/auto_import.rs:408
...
```
Also verified negative paths:
Out of scope
Test plan
🤖 Generated with Claude Code