/improve_plan @thoughts/shared/plans/2026-04-06-route-handlers-to-internal-trpc.md
- User
/improve_plan @thoughts/shared/plans/2026-04-06-route-handlers-to-internal-trpc.md
- User
improve_plan /improve_plan @thoughts/shared/plans/2026-04-06-route-handlers-to-internal-trpc.md
Assistant· claude-opus-4-6
I've read the plan. Let me spawn parallel research agents to understand the codebase context before reviewing.
Assistant· claude-opus-4-6
All three agents are done. Let me synthesize findings and verify a few claims directly before presenting the review.
Assistant· claude-opus-4-6
Assistant· claude-opus-4-6
Good — all 4, and fix the ternary inline. Let me edit the plan now.
Assistant· claude-opus-4-6
Now fix the router pattern inconsistency — change
createTRPCRoutertosatisfies TRPCRouterRecordin both sub-router files.Assistant· claude-opus-4-6
Now change the router export pattern from
createTRPCRoutertosatisfies TRPCRouterRecord:Assistant· claude-opus-4-6
Now do the same for the OAuth sub-router:
Assistant· claude-opus-4-6
Now add the
parseErrorfix step and observability caveat to Phase 2. Let me also update theprocessCallbackprocedure to useparseError:Assistant· claude-opus-4-6
Now add the
parseErrorfix step. Let me find where to insert it — after the OAuth router creation and route handler changes:Assistant· claude-opus-4-6
Now update the
internal.tscode block to usecreateTRPCRouterfor the top-level composition but import the sub-routers as plain objects:Assistant· claude-opus-4-6
Good — the
internal.tscode already usescreateTRPCRouter()at the top level (same asroot.ts), and the sub-routers are plain objects. This matches the existing pattern perfectly.Now let me add the Improvement Log at the end of the plan:
Assistant· claude-opus-4-6
Plan updated. Here's a summary of the 5 changes:
# Severity Change 1 Critical Fixed false claim that tRPC middleware eliminates callback.ts:351ternary — it's insideprocessOAuthCallback, not the route handler. Added explicitparseErrorfix step in Phase 2.2 Critical Removed contradictory "NOT adding Zod input schemas" bullet — every procedure uses Zod. 3 High Changed both sub-routers from createTRPCRouter()tosatisfies TRPCRouterRecordto match the convention used by all 3 existing sub-routers.4 Improvement Added observability caveat — processCallbackalways shows "ok" because errors are caught internally as{ kind: "error" }.5 Improvement Documented that OAuth handlers are already thin; migration rationale is consistency, not code reduction. No spike was needed — all issues were verifiable directly from the code.