GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix snowflake id rounding in SQLite message storage by itisrmk · Pull Request #9485 · Effect-TS/effect

Conversation

@itisrmk

@itisrmk itisrmk commented Oct 18, 2026 •
edited by effect-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

SqlMessageStorage reads snowflake columns (id, request_id, reply_id, last_reply_id, and joined reply ids) under SqlClient.SafeIntegers, then turns them back into ids with String / Snowflake. That is exact only when the driver returns the full 64-bit integer.

@effect/sql-sqlite-do cannot do that. Durable Object sql.exec().raw() types every SQLite INTEGER as a JavaScript number (ArrayBuffer | string | number | null), so a value above 2^53 is rounded on read. The stored integer stays exact. Default snowflakes have been above 2^53 since early 2025, so on a Durable Object nearly every id read back is wrong: a reply is saved with the rounded request_id, UPDATE ... SET processed = TRUE WHERE request_id = ... matches nothing, and the message is delivered again on every poll. requestIdForPrimaryKey and duplicate-envelope originalId return the rounded id too.

SQLite selects in this storage now use CAST(column AS TEXT). Text comes back as the exact decimal digits on every SQLite driver, including drivers that already return bigints. PostgreSQL, MySQL, and SQL Server queries are unchanged.

The worker SQL API has no bigint read, so making @effect/sql-sqlite-do honor SafeIntegers cannot recover these values. Casting at the query keeps the ids exact. The separate request to stop Snowflake.layerGenerator from overriding an outer generator is left out of this change.

Design assessment

Worth accepting: this fixes request/reply identity loss without a public API change. SQLite-only casts at the projection boundary preserve exact decimal IDs while leaving stored INTEGER values, joins, predicates, and numeric ordering unchanged. Casting nullable joined IDs preserves NULL. Other dialect projections remain unchanged.

The first takeover pass only simplifies tests; implementation refactoring and independent review remain separate follow-ups. The repeated projection lists are a candidate for simplification. Generator injection redesign remains out of scope.

Validation

  • Replaced the 188-line standalone Durable Object fake test with one regression in the existing SqlMessageStorage.integration.test.ts, reusing message fixtures and a scoped real SQLite connection. A small connection adapter converts bigint results to numbers to model number-returning drivers without a cross-package Durable Object dependency.
  • The regression uses deterministic, non-representable IDs above 2^53 and checks request identity, claiming, completed-request exclusion, reply identity, duplicate identity, and primary-key lookup through public storage APIs.
  • Red/green verified: temporarily restoring the pre-fix implementation fails the request ID assertion (9007199254740992 instead of 9007199254740993); the unchanged PR implementation passes.
  • nix develop -c env EFFECT_INTEGRATION_TESTS=1 pnpm test --run packages/platform/node/test/cluster/SqlMessageStorage.integration.test.ts -t "sqlite|preserves ids above" — 23 passed (22 existing SQLite tests + 1 regression). PostgreSQL/MySQL were not run in this pass.
  • nix develop -c pnpm lint-fix — passed.
  • nix develop -c pnpm check — passed.

Closes EFF-2423
Closes #9483

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cursoragent @itisrmk
Fix snowflake id rounding in SQLite message storage
9a3de61
Read SQLite id columns as text so snowflakes above 2^53 stay exact when
the driver returns integers as JavaScript numbers, including Durable Objects.

Co-authored-by: Rahul Kashyap <[email protected]>
@changeset-bot

changeset-bot Bot commented Oct 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f388104

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@itisrmk
itisrmk had a problem deploying to fork October 18, 2026 03:40 — with GitHub Actions Error
@effect-janitor effect-janitor Bot added the 4.0 label Oct 18, 2026
effect-janitor[bot]
effect-janitor Bot previously approved these changes Oct 18, 2026
View reviewed changes
@github-actions

github-actions Bot commented Oct 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 39.09 KB 39.09 KB 0.00 KB (0.00%)
basic.ts 7.02 KB 7.02 KB 0.00 KB (0.00%)
batching.ts 10.82 KB 10.82 KB 0.00 KB (0.00%)
brand.ts 6.71 KB 6.71 KB 0.00 KB (0.00%)
cache.ts 11.33 KB 11.33 KB 0.00 KB (0.00%)
config.ts 22.51 KB 22.51 KB 0.00 KB (0.00%)
differ.ts 21.61 KB 21.61 KB 0.00 KB (0.00%)
http-client.ts 24.00 KB 24.00 KB 0.00 KB (0.00%)
http-router.ts 35.65 KB 35.65 KB 0.00 KB (0.00%)
logger.ts 11.68 KB 11.68 KB 0.00 KB (0.00%)
metric.ts 9.16 KB 9.16 KB 0.00 KB (0.00%)
optic.ts 6.93 KB 6.93 KB 0.00 KB (0.00%)
pubsub.ts 15.77 KB 15.77 KB 0.00 KB (0.00%)
queue.ts 12.59 KB 12.59 KB 0.00 KB (0.00%)
schedule.ts 11.77 KB 11.77 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 13.80 KB 13.80 KB 0.00 KB (0.00%)
schema-binary.ts 40.55 KB 40.55 KB 0.00 KB (0.00%)
schema-class.ts 21.30 KB 21.30 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 32.39 KB 32.39 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.56 KB 27.56 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.01 KB 15.01 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.28 KB 16.28 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.61 KB 38.61 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 25.66 KB 25.66 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.54 KB 20.54 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 20.73 KB 20.73 KB 0.00 KB (0.00%)
schema-toFormatter.ts 20.84 KB 20.84 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 25.46 KB 25.46 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 20.83 KB 20.83 KB 0.00 KB (0.00%)
schema.ts 20.48 KB 20.48 KB 0.00 KB (0.00%)
stm.ts 13.87 KB 13.87 KB 0.00 KB (0.00%)
stream.ts 10.11 KB 10.11 KB 0.00 KB (0.00%)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@effect-bot
test: focus SQLite message ID precision regression
0d65bcd
@effect-bot
effect-bot dismissed effect-janitor[bot]’s stale review via 0d65bcd October 18, 2026 04:36
@effect-bot
effect-bot had a problem deploying to fork October 18, 2026 04:36 — with GitHub Actions Error
@effect-janitor effect-janitor Bot added the bug Something isn't working label Oct 18, 2026
effect-janitor[bot]
effect-janitor Bot previously approved these changes Oct 18, 2026
View reviewed changes
@effect-bot
refactor: share SQLite id text projections in SqlMessageStorage
b1310af
@effect-bot
effect-bot dismissed effect-janitor[bot]’s stale review via b1310af October 18, 2026 04:48
@effect-bot
effect-bot had a problem deploying to fork October 18, 2026 04:48 — with GitHub Actions Error
@effect-bot
docs: clarify SQLite ID precision release note
f388104
@effect-bot
effect-bot had a problem deploying to fork October 18, 2026 04:50 — with GitHub Actions Failure
effect-janitor[bot]
effect-janitor Bot approved these changes Oct 18, 2026
View reviewed changes
@tim-smart
tim-smart merged commit 8a5507b into Effect-TS:main Oct 18, 2026
10 of 11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kommander kommander mentioned this pull request Oct 27, 2026
chore: upgrade effect to 4.0.6 anomalyco/opencode#59630
Merged
@github-actions github-actions Bot mentioned this pull request Oct 28, 2026
📊 AI CLI 工具社区动态日报 2026-10-28 fireKylinKing/agents-radar#53
Open

This branch had an error being deployed

1 failed deployment
fork — f3881041 Deployed Oct 18, 2026 by effect-bot via approval-gate #20868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@effect-janitor effect-janitor[bot] effect-janitor[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

4.0 bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

cluster: SqlMessageStorage corrupts request ids above 2^53 on @effect/sql-sqlite-do

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@itisrmk @tim-smart @effect-bot @cursoragent
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.