Skip to content

Let HttpClient.withRateLimiter report limiter failures as HTTP errors - #10713

Merged
tim-smart merged 7 commits into
v4/next-minorfrom
agent/effect-bot/e79148e27dd4
Nov 18, 2026
Merged

tim-smart merged 7 commits into
v4/next-minorfrom
agent/effect-bot/e79148e27dd4

Conversation

@effect-bot

@effect-bot effect-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Add failsWith to HttpClient.withRateLimiter instead of introducing a second export. Both direct and piped calls retain the wrapped client's own errors and add the following error type:

Options Added error
Literal "RateLimiterError" RateLimiterError
Literal "HttpClientError" HttpClientError
Omitted, hidden, broadly typed, or union-valued mode RateLimiterError | HttpClientError

In HTTP mode a plain HTTP client remains assignable to HttpClient.HttpClient. A limiter failure becomes a TransportError reason carrying the request and the original limiter error as its cause. Errors from the wrapped client pass through unchanged. Both modes use the existing 429 retry and header-handling loop.

Compatibility: When failsWith is absent at runtime, limiter failures remain raw. At compile time, an object whose type omits the key can still carry it (for example through an Omit alias). Both overload sets therefore require an explicit literal mode to narrow the error type. To retain raw-only limiter errors in the inferred type, specify failsWith: "RateLimiterError". This type widening for existing calls warrants a minor changeset. Use satisfies WithRateLimiter.Options to validate an options literal while preserving its narrower mode.

Local validation: 114 HTTP client runtime tests and 74 type assertions across both compiler targets passed, as did repository type, lint/format, and JSDoc checks.

Closes #10697
Closes EFF-3894

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ba14c24

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

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

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

@effect-janitor effect-janitor Bot added the 4.0 label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.19 KB 40.19 KB 0.00 KB (0.00%)
basic.ts 7.35 KB 7.35 KB 0.00 KB (0.00%)
batching.ts 11.30 KB 11.30 KB 0.00 KB (0.00%)
brand.ts 7.00 KB 7.00 KB 0.00 KB (0.00%)
cache.ts 11.83 KB 11.83 KB 0.00 KB (0.00%)
config.ts 23.19 KB 23.19 KB 0.00 KB (0.00%)
differ.ts 22.30 KB 22.30 KB 0.00 KB (0.00%)
http-client.ts 27.70 KB 27.70 KB 0.00 KB (0.00%)
http-router.ts 37.70 KB 37.70 KB 0.00 KB (0.00%)
logger.ts 12.28 KB 12.28 KB 0.00 KB (0.00%)
metric.ts 9.74 KB 9.74 KB 0.00 KB (0.00%)
optic.ts 7.21 KB 7.21 KB 0.00 KB (0.00%)
pubsub.ts 16.34 KB 16.34 KB 0.00 KB (0.00%)
queue.ts 13.20 KB 13.20 KB 0.00 KB (0.00%)
schedule.ts 12.08 KB 12.08 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.33 KB 14.33 KB 0.00 KB (0.00%)
schema-binary.ts 42.58 KB 42.58 KB 0.00 KB (0.00%)
schema-class.ts 22.06 KB 22.06 KB 0.00 KB (0.00%)
schema-codegen.ts 30.80 KB 30.80 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.67 KB 30.67 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.36 KB 28.36 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.64 KB 15.64 KB 0.00 KB (0.00%)
schema-string.ts 12.53 KB 12.53 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.51 KB 16.51 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.75 KB 39.75 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.21 KB 21.21 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.38 KB 21.38 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.47 KB 21.47 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.51 KB 26.51 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.55 KB 21.55 KB 0.00 KB (0.00%)
schema.ts 21.14 KB 21.14 KB 0.00 KB (0.00%)
stm.ts 14.56 KB 14.56 KB 0.00 KB (0.00%)
stream.ts 10.66 KB 10.66 KB 0.00 KB (0.00%)
supervisor.ts 11.61 KB 11.61 KB 0.00 KB (0.00%)

@effect-bot effect-bot changed the title Add HttpClient.withRateLimiterTransportError Let HttpClient.withRateLimiter report limiter failures as HTTP errors Nov 18, 2026
@effect-bot
effect-bot changed the base branch from main to v4/next-minor November 18, 2026 03:27
@effect-janitor effect-janitor Bot removed the 4.0 label Nov 18, 2026
@tim-smart
tim-smart merged commit 8b9a211 into v4/next-minor Nov 18, 2026
15 checks passed
@tim-smart
tim-smart deleted the agent/effect-bot/e79148e27dd4 branch November 18, 2026 03:59
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.

HttpClient.withRateLimiter: let RateLimiterError be handled as an HttpClientError

2 participants