Skip to content

Keep maxDepth in Context.pick and slim Context.makeUnsafe - #9837

Merged
tim-smart merged 2 commits into
v4/next-minorfrom
agent/bob/558f8dd9ad65
Oct 23, 2026
Merged

tim-smart merged 2 commits into
v4/next-minorfrom
agent/bob/558f8dd9ad65

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

#8969 added maxDepth to Context.makeUnsafe and made the basic.ts bundle fixture larger. It also left a gap in Context.pick: with zero or one key it reset the result to the default depth of 8 instead of keeping the source context's maxDepth.

Changes

  • makeUnsafe checks maxDepth inline instead of calling normalizeMaxDepth, whose default parameter kept it in the bundle. When no options are passed, Rollup can now reduce the argument to 8. Behaviour is unchanged: NaN, Infinity, negative and non-integer values still fall back to 8.
  • The pick fast path for zero or one key now carries over the source context's maxDepth, which matches the JSDoc.
  • Adds a regression test for pick with zero and one key.

Bundle size

basic.ts against v4/next-minor (fcb9610134): 7194 B → 7165 B gzip (−0.03 KB).

Closes EFF-2859

@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12b8ed0

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

@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 39.27 KB 39.30 KB -0.02 KB (-0.06%)
basic.ts 7.17 KB 7.20 KB -0.03 KB (-0.38%)
batching.ts 11.04 KB 11.07 KB -0.03 KB (-0.23%)
brand.ts 6.83 KB 6.83 KB 0.00 KB (0.00%)
cache.ts 11.47 KB 11.49 KB -0.02 KB (-0.17%)
config.ts 22.70 KB 22.73 KB -0.02 KB (-0.11%)
differ.ts 21.83 KB 21.86 KB -0.03 KB (-0.13%)
http-client.ts 26.64 KB 26.66 KB -0.02 KB (-0.06%)
http-router.ts 36.31 KB 36.33 KB -0.02 KB (-0.06%)
logger.ts 11.86 KB 11.88 KB -0.02 KB (-0.17%)
metric.ts 9.40 KB 9.43 KB -0.03 KB (-0.29%)
optic.ts 7.04 KB 7.04 KB 0.00 KB (0.00%)
pubsub.ts 15.95 KB 15.97 KB -0.02 KB (-0.11%)
queue.ts 12.75 KB 12.77 KB -0.02 KB (-0.16%)
schedule.ts 11.72 KB 11.74 KB -0.02 KB (-0.17%)
schema-bigdecimal.ts 13.98 KB 14.01 KB -0.03 KB (-0.18%)
schema-binary.ts 40.99 KB 41.01 KB -0.02 KB (-0.05%)
schema-class.ts 21.49 KB 21.52 KB -0.03 KB (-0.13%)
schema-fromJsonSchemaDocument.ts 32.54 KB 32.56 KB -0.02 KB (-0.06%)
schema-representation-roundtrip.ts 27.73 KB 27.76 KB -0.03 KB (-0.10%)
schema-string-transformation.ts 15.24 KB 15.26 KB -0.02 KB (-0.14%)
schema-string.ts 12.22 KB 12.25 KB -0.03 KB (-0.21%)
schema-template-literal.ts 16.16 KB 16.18 KB -0.03 KB (-0.16%)
schema-toArbitrary.ts 38.80 KB 38.83 KB -0.02 KB (-0.06%)
schema-toCodeDocument.ts 25.89 KB 25.92 KB -0.03 KB (-0.10%)
schema-toCodecJson.ts 20.77 KB 20.80 KB -0.03 KB (-0.13%)
schema-toEquivalence.ts 20.91 KB 20.94 KB -0.03 KB (-0.13%)
schema-toFormatter.ts 21.02 KB 21.05 KB -0.03 KB (-0.13%)
schema-toJsonSchemaDocument.ts 25.65 KB 25.68 KB -0.03 KB (-0.11%)
schema-toRepresentation.ts 21.01 KB 21.04 KB -0.03 KB (-0.13%)
schema.ts 20.69 KB 20.72 KB -0.03 KB (-0.13%)
stm.ts 14.06 KB 14.08 KB -0.02 KB (-0.15%)
stream.ts 10.31 KB 10.34 KB -0.03 KB (-0.25%)

@tim-smart
tim-smart merged commit 703836b into v4/next-minor Oct 23, 2026
10 checks passed
@tim-smart
tim-smart deleted the agent/bob/558f8dd9ad65 branch October 23, 2026 06:58
@effect-bot effect-bot mentioned this pull request Oct 23, 2026
effect-bot pushed a commit to jayhemnani9910/effect that referenced this pull request Oct 24, 2026
effect-bot pushed a commit to FredAmartey/effect that referenced this pull request Oct 25, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant