Skip to content

refactor: replace zod with Effect so the broker runs against an in-memory store - #13

Merged
gpu004 merged 1 commit into
mainfrom
effect-services
Nov 20, 2026
Merged

gpu004 merged 1 commit into
mainfrom
effect-services

Conversation

@gpu004

@gpu004 gpu004 commented Nov 20, 2026

Copy link
Copy Markdown
Owner

The broker's commit protocol could only be tested through a real Durable Object and R2, so batching and compare-and-set retries had no direct test. This moves the Worker and broker onto Effect. R2, the clock, id generation, and background work become services, and the new test/broker.test.ts runs the protocol against an in-memory store, including a lost race.

  • Effect Schema replaces zod for request bodies, config, and the stored queue file. storedStruct keeps fields a newer broker wrote, and the R2 format is unchanged.
  • A new Worker test checks that a corrupt stored queue gets a 500 that doesn't leak details.
  • The vendored anti-slop plugin moves to upstream 63dbb09, and its Effect lint rules are now on.

Proof: npm run check passes (oxlint, lint-rule tests, oxfmt, Wrangler dry run, tsc). npm test passes: 6 files, 33 tests. I didn't run TLC locally because there's no Java here. The spec change is a comment only, and CI's model-check job covers it. Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved. Three nits stay open as follow-ups:

  • A non-finite number like 1e400 in a field the server ignores now gets 400 invalid_json.
  • Instant no longer rejects impossible dates like 2026-02-30. Only toISOString writes stored instants, so a broker can't produce one.
  • The first enqueuer isn't guarded against interruption. Nothing in src interrupts broker fibers, so this can't happen today.

The Effect migration was already in the working tree when this session started. I reviewed, verified, and filed it with Claude Opus 5.5 in T3 Code.

🤖 Generated with Claude Code

…mory store

The broker's commit protocol could only be exercised through a real
Durable Object and R2. Moving the Worker and broker onto Effect makes R2,
the clock, id generation, and background work into services, so
test/broker.test.ts drives batching and compare-and-set retries,
including a lost race, against an in-memory store.

Effect Schema replaces zod for request bodies, config, and the stored
queue file. Stored objects keep unknown fields through storedStruct, and
the file format is unchanged. The vendored anti-slop plugin moves to
upstream 63dbb09 and its Effect rules are enabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedeffect@​4.1.4100100999680

View full report

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