fix(ai): preserve full RPC paths with the native client - #796
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR replaces the per-subrouter oRPC adapter with a native client constructed from the complete application router, preserving namespaced procedure paths for mutation auditing and tracking.
Confidence Score: 5/5The PR appears safe to merge, with no actionable correctness, security, or repository-rule issues identified. The native full-router client matches existing two-segment callers and router structure, restores the complete middleware path, and preserves the adapter’s authentication, cancellation, dry-run, validation, and error behavior. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
AI[AI tool call] --> Guard{Dry-run mutation?}
Guard -->|Yes| Receipt[Return blocked-mutation receipt]
Guard -->|No| Context[Create authenticated RPC context]
Context --> Client[Create native client from full appRouter]
Client --> Path[Resolve routerName.method]
Path --> Middleware[Audit and tracking middleware receive full path]
Middleware --> Procedure[Invoke procedure with input and AbortSignal]
Reviews (1): Last reviewed commit: "fix(ai): preserve full RPC paths with th..." | Re-trigger Greptile |
AI tool calls built a separate client for each subrouter, so middleware received
createinstead oflinks.create. That dropped the namespace from tracking and caused the existing mutation-audit gate to skip these calls.Use oRPC's native client for the full router. Delete the one-consumer client adapter, three type casts, and two forwarding helpers. Keep the lazy router import, authentication context, dry-run guard, cancellation, validation, and error mapping. Existing audit and tracking middleware now receive the complete procedure path.
Validation: reproduced the missing path with the installed SDK and a failing regression test before the fix. All six focused RPC checks now pass, including strict AbortSignal identity. Root lint, 33 type/build tasks, and 27 test tasks pass; independent diff review is clear. Runtime checks use synthetic procedures and mocks. One file deleted, no new files.
Scope: AI tool RPC invocation only. No dependency on or file overlap with #790 or #751; RPC context, billing implementation, and business-context handlers are unchanged.
Summary by cubic
Fixes AI tool RPC calls so middleware receives the full procedure path (
links.create) instead of justcreate. Previously, a separate client was built per subrouter, which dropped the namespace and caused the mutation-audit gate to skip these calls. Now we use oRPC's native client for the full router, preserving path, authentication context, dry-run guard, cancellation, validation, and error mapping. The old adapter, type casts, and forwarding helpers are removed. This change is limited to AI tool RPC invocation.Written for commit 235339a. Summary will update on new commits.