Skip to content

Conversation

@salzhrani
Copy link

@salzhrani salzhrani commented Oct 24, 2025

Pass the server context handler

Summary by CodeRabbit

  • Refactor
    • Updated server context propagation mechanism through route handling middleware to ensure consistent context availability throughout the request processing chain.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Walkthrough

Context parameter propagation through server route handling: handleServerRoutes now accepts and forwards a context: any argument through the middleware chain to executeRouter and executeMiddleware, replacing the previous empty object default.

Changes

Cohort / File(s) Summary
Context propagation in server route handling
packages/start-server-core/src/createStartHandler.ts
Add context: any parameter to handleServerRoutes function; propagate context through middleware chain and executeRouter instead of passing empty object; update call sites to pass context when invoking handleServerRoutes

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • fix: handle synchronous handler/middleware #5270: Both PRs modify packages/start-server-core/src/createStartHandler.ts in the handleServerRoutes and middleware execution areas, with overlapping changes to context and middleware result merging.

Poem

🐰 Through channels of routing, I hop and I bound,
Passing context along without a sound,
Middleware threads now catch every frame,
Context flows freely—no more empty shame! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "fix: pass server context to handler" directly and accurately describes the primary change in the changeset. The raw_summary confirms that the main objective is to propagate a context parameter through server route handling by updating handleServerRoutes to accept and forward this context through the middleware chain. The title is concise, specific, and uses appropriate conventional prefixing (fix:). It clearly communicates the core change without vagueness or unnecessary details, making it easy for teammates to understand the primary purpose of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c5f579 and 5a8eae6.

📒 Files selected for processing (1)
  • packages/start-server-core/src/createStartHandler.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/start-server-core/src/createStartHandler.ts
packages/{*-start,start-*}/**

📄 CodeRabbit inference engine (AGENTS.md)

Name and place Start framework packages under packages/-start/ or packages/start-/

Files:

  • packages/start-server-core/src/createStartHandler.ts
🔇 Additional comments (2)
packages/start-server-core/src/createStartHandler.ts (2)

243-248: LGTM: Context propagation to server routes.

The context is correctly threaded from the outer middleware chain to the server route handler, enabling server routes to access the context established by global middlewares.


414-419: LGTM: Context properly threaded through inner middleware.

The context is correctly passed to the inner executeMiddleware call, which ensures it flows through route-specific middlewares and handlers, ultimately reaching the router execution.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant