Skip to content

Fix request registration before synchronous batch delays - #9439

Open
tim-smart wants to merge 4 commits into
mainfrom
agent/bob/acafb57f3ae5
Open

tim-smart wants to merge 4 commits into
mainfrom
agent/bob/acafb57f3ae5

Conversation

@tim-smart

@tim-smart tim-smart commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Register the first request in a batch before starting its delay, so a synchronously completing delay (for example RequestResolver.setDelay(0) under TestClock) no longer executes and recycles an empty batch. The delay fiber is published from inside the delay effect so reentrant callbacks that fill the batch can interrupt it, and the caller checks that the batch is still pending before touching it. The execution fiber is no longer written back into a batch that may already have been recycled.

Tests

Four cases added to packages/effect/test/Request.test.ts: the TestClock regression with its live-clock control, reentrant delay callbacks filling a batchN(2) batch, and delay, collection and interruption ordering across pooled batch reuse.

Validation

  • pnpm vitest run packages/effect/test/Request.test.ts: 38 passed
  • pnpm lint-fix, pnpm check and git diff --check pass

Closes EFF-2352

Related historical report: #7589 and closed, unmerged PR #7597. Separate from #9401.

@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f7c9dc1

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

This PR includes changesets to release 33 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node 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/doctest Patch
@effect/graphql-generator 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

@effect-janitor effect-janitor Bot added the 4.0 label Oct 16, 2026
effect-janitor[bot]
effect-janitor Bot previously approved these changes Oct 16, 2026

@effect-janitor effect-janitor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the request registration, synchronous-delay reentrancy, pooled-batch reuse, and regression tests. No confirmed merge-blocking issues found. git diff --check passed. Runtime tests were not rerun because dependencies and the repository’s package manager are not installed in the sandbox.

Reviewed at 6fbfaf1: no new findings.

@github-actions

github-actions Bot commented Oct 16, 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 39.02 KB 39.02 KB 0.00 KB (0.00%)
basic.ts 7.02 KB 7.02 KB 0.00 KB (0.00%)
batching.ts 10.77 KB 10.73 KB +0.03 KB (+0.31%)
brand.ts 6.71 KB 6.71 KB 0.00 KB (0.00%)
cache.ts 11.26 KB 11.26 KB 0.00 KB (0.00%)
config.ts 22.44 KB 22.44 KB 0.00 KB (0.00%)
differ.ts 21.54 KB 21.54 KB 0.00 KB (0.00%)
http-client.ts 23.93 KB 23.93 KB 0.00 KB (0.00%)
http-router.ts 35.48 KB 35.48 KB 0.00 KB (0.00%)
logger.ts 11.60 KB 11.60 KB 0.00 KB (0.00%)
metric.ts 9.08 KB 9.08 KB 0.00 KB (0.00%)
optic.ts 6.93 KB 6.93 KB 0.00 KB (0.00%)
pubsub.ts 15.68 KB 15.68 KB 0.00 KB (0.00%)
queue.ts 12.52 KB 12.52 KB 0.00 KB (0.00%)
schedule.ts 11.73 KB 11.73 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 13.80 KB 13.80 KB 0.00 KB (0.00%)
schema-binary.ts 40.48 KB 40.48 KB 0.00 KB (0.00%)
schema-class.ts 21.22 KB 21.22 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 32.31 KB 32.31 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.50 KB 27.50 KB 0.00 KB (0.00%)
schema-string-transformation.ts 14.95 KB 14.95 KB 0.00 KB (0.00%)
schema-string.ts 12.05 KB 12.05 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.21 KB 16.21 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.54 KB 38.54 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 25.60 KB 25.60 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.47 KB 20.47 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 20.67 KB 20.67 KB 0.00 KB (0.00%)
schema-toFormatter.ts 20.77 KB 20.77 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 25.40 KB 25.40 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 20.76 KB 20.76 KB 0.00 KB (0.00%)
schema.ts 20.41 KB 20.41 KB 0.00 KB (0.00%)
stm.ts 13.79 KB 13.79 KB 0.00 KB (0.00%)
stream.ts 10.05 KB 10.05 KB 0.00 KB (0.00%)

@effect-janitor effect-janitor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the source changes and regression coverage; no confirmed issues found. git diff --check passed. Runtime tests and type checks could not be run: frozen-lockfile dependency installation failed with a registry 403 for @​jsr/db__redis and a supply-chain policy check failure.

Reviewed at f7c9dc1: no new findings.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant