Skip to content

fix(DateTime): avoid top-level liftThrowable so AOT compilers prune Intl - #10906

Merged
tim-smart merged 2 commits into
mainfrom
agent/effect-bot/e0f8e3453bc4
Nov 25, 2026
Merged

tim-smart merged 2 commits into
mainfrom
agent/effect-bot/e0f8e3453bc4

Conversation

@effect-bot

Copy link
Copy Markdown
Contributor

Summary

Rewrites makeZoned and zoneMakeNamed in packages/effect/src/internal/dateTime.ts as plain functions with try/catch instead of top-level Option.liftThrowable(...) calls.

Root cause

Effect reaches internal/dateTime.ts via internal/schedule.ts -> Schedule.ts -> Cron.ts -> internal/dateTime.ts. AOT compilers such as scriptc treat any function passed to a call in a module's top-level initializer as reachable (even when annotated /*#__PURE__*/ and never called). Passing makeZonedUnsafe and zoneMakeNamedUnsafe to Option.liftThrowable at module scope caused new Intl.DateTimeFormat(...) to be treated as reachable whenever internal/dateTime.ts loaded, failing builds on runtimes without ICU.

Rewriting those two helpers as ordinary functions preserves the exact public API and runtime behavior while allowing per-function pruning to omit Intl when time zones / cron schedules are not used.

Verification

  • Existing test suites pass:
    • packages/effect/test/DateTime.test.ts (132 passed, 1 skipped)
    • packages/effect/test/Cron.test.ts (51 passed)
    • packages/effect/test/Schedule.test.ts (36 passed)
  • Typecheck (pnpm --filter effect check), oxlint, and dprint check pass.
  • Verified with [email protected] on linux-x64-gnu after removing the icu archive and icudt78l.dat from @scriptc/runtime-linux-x64-gnu/runtime-pack.json (so linking scr_intl.o fails with SC3004 undefined ICU symbols, exercising the same Intl-reachability condition as SC3002 on macOS):
Program Before After
import { runSync, succeed } from "effect/Effect" Fails (SC3004, links scr_intl.o) Builds (exit 0, no scr_intl.o)
import { Effect } from "effect" Fails (SC3004, links scr_intl.o) Builds (exit 0, no scr_intl.o)
Effect.retry(..., Schedule.recurs(2)) Fails (SC3004, links scr_intl.o) Builds (exit 0, no scr_intl.o)
Schedule.cron("* * * * *") Fails (SC3004, links scr_intl.o) Fails (SC3004, links scr_intl.o, expected)

Closes #10900
Closes EFF-4273

Co-authored-by: Quino Terrasa [email protected]

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2e402e9

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

This PR includes changesets to release 40 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-amazon-bedrock 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/chat-discord Patch
@effect/chat-slack Patch
@effect/chat-teams Patch
@effect/chat-telegram Patch
@effect/chat-whatsapp Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-cloudflare 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 Nov 25, 2026
@tim-smart
tim-smart enabled auto-merge (squash) November 25, 2026 00:50
@github-actions

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.17 KB 40.17 KB 0.00 KB (0.00%)
basic.ts 7.31 KB 7.31 KB 0.00 KB (0.00%)
batching.ts 11.29 KB 11.29 KB 0.00 KB (0.00%)
brand.ts 7.05 KB 7.05 KB 0.00 KB (0.00%)
cache.ts 11.75 KB 11.75 KB 0.00 KB (0.00%)
config.ts 23.18 KB 23.18 KB 0.00 KB (0.00%)
differ.ts 22.30 KB 22.30 KB 0.00 KB (0.00%)
http-client.ts 27.87 KB 27.87 KB 0.00 KB (0.00%)
http-router.ts 38.66 KB 38.66 KB 0.00 KB (0.00%)
logger.ts 12.19 KB 12.19 KB 0.00 KB (0.00%)
metric.ts 9.66 KB 9.66 KB 0.00 KB (0.00%)
optic.ts 7.28 KB 7.28 KB 0.00 KB (0.00%)
pubsub.ts 16.23 KB 16.23 KB 0.00 KB (0.00%)
queue.ts 13.13 KB 13.13 KB 0.00 KB (0.00%)
schedule.ts 11.99 KB 11.99 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.36 KB 14.36 KB 0.00 KB (0.00%)
schema-binary.ts 42.91 KB 42.92 KB -0.01 KB (-0.02%)
schema-class.ts 22.01 KB 22.01 KB 0.00 KB (0.00%)
schema-codegen.ts 30.78 KB 30.78 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.64 KB 30.64 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.33 KB 28.33 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.61 KB 15.61 KB 0.00 KB (0.00%)
schema-string.ts 12.56 KB 12.56 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.50 KB 16.50 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.72 KB 39.72 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.20 KB 21.20 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.36 KB 21.36 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.45 KB 21.45 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.50 KB 26.50 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.54 KB 21.54 KB 0.00 KB (0.00%)
schema.ts 21.14 KB 21.14 KB 0.00 KB (0.00%)
stm.ts 14.48 KB 14.48 KB 0.00 KB (0.00%)
stream.ts 10.61 KB 10.61 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit fa2e5af into main Nov 25, 2026
18 checks passed
@tim-smart
tim-smart deleted the agent/effect-bot/e0f8e3453bc4 branch November 25, 2026 00:54
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.

Schedule's eager Cron import makes effect/Effect's module graph require Intl/ICU, which breaks static (AOT) compilation

2 participants