codedb_remote: forward pagination/read params + add 'read' action#340
codedb_remote: forward pagination/read params + add 'read' action#340justrach merged 2 commits intorelease/0.2.579from
Conversation
Add an explicit `read` action on the codegraff backend (server-side support tracked in #333) plus per-action optional URL params so big responses can be sliced server-side as the cloud catches up: - tree: forward limit/offset/prefix/expand - commits, dep-history: forward limit/since - read: forward path (required) and lines Refactor handleRemote so a single fetchRemote helper builds the curl argv (with one --data-urlencode per param). Cuts the duplicated codegraff-vs-wiki branches from ~210 lines to one shared path while preserving every existing error message verbatim. Schema now advertises read + the new params + scope/backend so callers can discover the matrix without reading source. Refs #332 #333 #335 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bb5fd076a
ℹ️ 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".
| if (getBool(args, "expand")) { | ||
| params.append(alloc, .{ .name = "expand", .value = "true" }) catch {}; |
There was a problem hiding this comment.
Forward explicit
expand=false for tree requests
The new expand option is documented as a boolean where false requests a compact directory summary, but this branch only appends the query parameter when getBool(args, "expand") is true. Because missing and explicit false are treated the same, callers cannot actually send expand=false, so codedb_remote action=tree cannot request the compact mode and may still return large full-tree payloads.
Useful? React with 👍 / 👎.
Drop -sf in favor of -s + curl -w '%{http_code}' so non-2xx responses
come through with their body and the actual status. fetchRemote now
parses a [CODEDB-STATUS] sentinel from the trailing curl output and
returns {captured, status, body_len}.
handleRemote treats 200-299 as success; anything else formats as
"error: <host> HTTP <code> for <slug>/<action> — <body>". Body text is
truncated to 200 chars; falls back to stderr if body is empty.
Closes #334. Also self-diagnoses #338: previously opaque "outline
returned error" now reads "HTTP 404 — {\"error\":\"No outline
section\"}", making it obvious the snapshot just lacks outline data.
Refs #334 #338
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
Summary
readand 7 new params), pluspath/linesfor the newreadaction andlimit/offset/prefix/expand/sincefor paginated actions.handleRemotecollapsed from two ~100-line branches into a single shared path that builds acurl --data-urlencodearg list via a smallfetchRemotehelper. Every existing error message is preserved verbatim.Addresses #335 (schema underadvertising), partially addresses #332 (forwarding side; server-side pagination still needed) and #333 (
readplumbing; server-side endpoint still needed).Test plan
zig build— cleanzig build test— 407/408 pass (the one failing test,mcp.test.issue-258, fails identically on base; unrelated cache path-validation issue)codedb_remote action=read path=src/foo.zigagainst a slug and confirm clear 404 error from the codegraff worker (until codedb_remote: add 'read' action — locate-but-can't-view gap #333 lands)codedb_remote action=tree limit=50 prefix=src/and confirm the URL we issue includes bothlimit=50andprefix=src/query params (server may ignore for now)🤖 Generated with Claude Code