Skip to content

Skip optional stack capture when stackTraceLimit is zero - #8114

Merged
tim-smart merged 6 commits into
mainfrom
agent/bob/f9c1c0f82b71
Sep 7, 2026
Merged

tim-smart merged 6 commits into
mainfrom
agent/bob/f9c1c0f82b71

Conversation

@tim-smart

@tim-smart tim-smart commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Effect.fn overrides Error.stackTraceLimit = 0 and constructs errors to capture definition and invocation sites. These captures can be expensive during Cloudflare Workers startup even with a zero-length stack.

Skip optional error construction when the limit is zero in functions, spans, layer and middleware service definitions, atom labels, and the internal stack probe. Leave a zero limit unchanged when formatting causes. Named spans, function frames, and enabled stack locations are preserved. Explicit captureStackTrace: true still opts into span capture at limit zero, and supplied stack callbacks remain supported.

Service definitions expose an undefined stack at limit zero and retain their definition location at positive limits. Includes an Effect patch changeset documenting these behaviors.

Adds four focused regressions for zero-limit function definition/invocation capture, default span capture, and explicit span opt-in. Existing tests cover the surrounding tracing behavior.

Validation:

  • All 783 tests in 21 related files pass under Node, including the four focused regressions.
  • nix develop -c bun run --bun vitest run packages/effect/test/StackCapture.test.ts: all four pass.
  • nix develop -c pnpm lint-fix: passed.
  • nix develop -c pnpm check: passed.

Closes EFF-1312
Closes #8038

@changeset-bot

changeset-bot Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49abf0a

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

This PR includes changesets to release 30 packages
Name Type
effect Patch
@effect/opentelemetry 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/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/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 Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 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 33.90 KB 33.88 KB +0.01 KB (+0.04%)
basic.ts 6.87 KB 6.87 KB 0.00 KB (0.00%)
batching.ts 10.15 KB 10.14 KB +0.01 KB (+0.12%)
brand.ts 6.45 KB 6.45 KB 0.00 KB (0.00%)
cache.ts 10.77 KB 10.76 KB +0.01 KB (+0.12%)
config.ts 21.50 KB 21.50 KB +0.01 KB (+0.03%)
differ.ts 20.29 KB 20.27 KB +0.01 KB (+0.06%)
http-client.ts 22.11 KB 22.10 KB +0.01 KB (+0.05%)
http-router.ts 33.57 KB 33.56 KB +0.01 KB (+0.03%)
logger.ts 10.88 KB 10.87 KB +0.01 KB (+0.13%)
metric.ts 9.02 KB 9.00 KB +0.01 KB (+0.13%)
optic.ts 6.70 KB 6.70 KB 0.00 KB (0.00%)
pubsub.ts 15.27 KB 15.26 KB +0.01 KB (+0.08%)
queue.ts 11.85 KB 11.84 KB +0.01 KB (+0.12%)
schedule.ts 10.96 KB 10.95 KB +0.01 KB (+0.11%)
schema-binary.ts 39.48 KB 39.47 KB +0.01 KB (+0.03%)
schema-class.ts 20.03 KB 20.04 KB -0.01 KB (-0.03%)
schema-fromJsonSchemaDocument.ts 30.42 KB 30.40 KB +0.01 KB (+0.05%)
schema-representation-roundtrip.ts 26.24 KB 26.24 KB -0.00 KB (-0.00%)
schema-string-transformation.ts 13.64 KB 13.63 KB +0.01 KB (+0.04%)
schema-string.ts 11.12 KB 11.11 KB +0.01 KB (+0.10%)
schema-template-literal.ts 15.44 KB 15.44 KB +0.00 KB (+0.03%)
schema-toArbitrary.ts 33.44 KB 33.43 KB +0.01 KB (+0.04%)
schema-toCodeDocument.ts 24.48 KB 24.47 KB +0.01 KB (+0.04%)
schema-toCodecJson.ts 19.24 KB 19.23 KB +0.01 KB (+0.07%)
schema-toEquivalence.ts 19.39 KB 19.38 KB +0.01 KB (+0.06%)
schema-toFormatter.ts 19.49 KB 19.48 KB +0.01 KB (+0.06%)
schema-toJsonSchemaDocument.ts 23.58 KB 23.57 KB +0.01 KB (+0.06%)
schema-toRepresentation.ts 19.55 KB 19.53 KB +0.01 KB (+0.06%)
schema.ts 19.26 KB 19.25 KB +0.01 KB (+0.05%)
stm.ts 12.80 KB 12.78 KB +0.02 KB (+0.16%)
stream.ts 9.83 KB 9.81 KB +0.01 KB (+0.15%)

@tim-smart
tim-smart enabled auto-merge (squash) September 7, 2026 03:51
@tim-smart
tim-smart merged commit 4907e9b into main Sep 7, 2026
13 checks passed
@tim-smart
tim-smart deleted the agent/bob/f9c1c0f82b71 branch September 7, 2026 03:56
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.

Effect.fn constructs an Error at every definition site, which costs most of a Cloudflare Workers startup budget

1 participant