Skip to content

Fix HttpRouter web handler context - #6665

Merged
tim-smart merged 2 commits into
mainfrom
agent/codex-engineer/25e7e942
Jul 27, 2026
Merged

Fix HttpRouter web handler context#6665
tim-smart merged 2 commits into
mainfrom
agent/codex-engineer/25e7e942

Conversation

@tim-smart

@tim-smart tim-smart commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • align HttpRouter.toWebHandler request-context inference with HttpEffect.toWebHandlerLayerWith
  • exclude services supplied by the application layer and HTTP adapter
  • cover identity middleware with an application-provided service in the type tests

Testing

  • pnpm test-types HttpRouter.tst.ts
  • pnpm lint-fix
  • pnpm check

Closes EFF-121

Summary by CodeRabbit

  • Bug Fixes

    • Improved HttpRouter.toWebHandler type inference so application-provided services and built-in request/scope services are no longer incorrectly reflected as required in the handler context.
    • Web handlers can now be typed/called with only a request when no extra context is needed.
  • Tests

    • Added type-level coverage to verify the handler context is optional/absent when services are supplied by the application layer.

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 27, 2026
@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a5eb54b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a23c33d0-3e09-426b-8415-c9c01c75baa0

📥 Commits

Reviewing files that changed from the base of the PR and between c9fd25c and a5eb54b.

📒 Files selected for processing (1)
  • .changeset/eff-121-http-router-web-handler.md

📝 Walkthrough

Walkthrough

toWebHandler now excludes application-provided, scope, and request services from inferred context requirements. A type test verifies that an application-provided service produces a handler callable with only a Request.

Changes

Web handler context typing

Layer / File(s) Summary
Refine handler context requirements
packages/effect/src/unstable/http/HttpRouter.ts, packages/effect/typetest/unstable/http/HttpRouter.tst.ts, .changeset/eff-121-http-router-web-handler.md
toWebHandler derives remaining context requirements with ReqR, making context optional when none remain. A type test verifies application-provided services are excluded, and the changeset records the patch release.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Effect-TS/effect#6526: Both changes refine toWebHandler context typing by excluding adapter- or application-provided services.

Suggested labels: bug

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.63 KB 6.63 KB 0.00 KB (0.00%)
batching.ts 9.37 KB 9.37 KB 0.00 KB (0.00%)
brand.ts 6.26 KB 6.26 KB 0.00 KB (0.00%)
cache.ts 10.12 KB 10.12 KB 0.00 KB (0.00%)
config.ts 19.21 KB 19.21 KB 0.00 KB (0.00%)
differ.ts 18.42 KB 18.42 KB 0.00 KB (0.00%)
http-client.ts 20.76 KB 20.76 KB 0.00 KB (0.00%)
logger.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
metric.ts 8.55 KB 8.55 KB 0.00 KB (0.00%)
optic.ts 7.41 KB 7.41 KB 0.00 KB (0.00%)
pubsub.ts 14.20 KB 14.20 KB 0.00 KB (0.00%)
queue.ts 11.08 KB 11.08 KB 0.00 KB (0.00%)
schedule.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
schema-class.ts 18.16 KB 18.16 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 28.02 KB 28.02 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 24.33 KB 24.33 KB 0.00 KB (0.00%)
schema-string-transformation.ts 12.69 KB 12.69 KB 0.00 KB (0.00%)
schema-string.ts 10.35 KB 10.35 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.49 KB 14.49 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 20.93 KB 20.93 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 23.38 KB 23.38 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.32 KB 18.32 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.00 KB 18.00 KB 0.00 KB (0.00%)
schema-toFormatter.ts 17.88 KB 17.88 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 21.51 KB 21.51 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 18.55 KB 18.55 KB 0.00 KB (0.00%)
schema.ts 17.43 KB 17.43 KB 0.00 KB (0.00%)
stm.ts 12.05 KB 12.05 KB 0.00 KB (0.00%)
stream.ts 9.36 KB 9.36 KB 0.00 KB (0.00%)

@coderabbitai coderabbitai Bot added the bug Something isn't working label Jul 27, 2026
@tim-smart
tim-smart merged commit a3fd084 into main Jul 27, 2026
15 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/25e7e942 branch July 27, 2026 08:37
@github-project-automation github-project-automation Bot moved this from Discussion Ongoing to Done in PR Backlog Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant