Skip to content

fix(notify): reconcile mail write with dispatch enqueue (CL-7238) - #717

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-7238-atomic-deliver
Sep 15, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-7238-atomic-deliver

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • CL-7238: deliverNotification's mail write and dispatch enqueue were not atomic or reconciled; a crash between them left a committed mail row whose redelivery deduped, so the dispatch row was never queued.
  • Fix (reconciled, deletion-shaped): deliverNotification now resolves pre-existing mail ids through an optional host read-back (ResolveExistingMailIds) and enqueues dispatch for them. The dispatch store already dedupes by (mail row, sink), so the repair never double-queues. Report shape unchanged; without the read-back a crash-window redelivery still loses the dispatch (pinned by test) — the inbox adapter owns that wiring as follow-up.

Verification

  • New fault-injection tests in packages/notify/test/deliver.test.ts (durable stub mail store + one-shot dispatch crash): red pre-fix (2 fail), green post-fix.
  • bun test packages/notify: 35 pass, 0 fail.
  • bun run typecheck (repo gate): exit 0.
  • prettier + eslint on touched files: clean.
  • Pre-existing hook trips (unrelated, no notify reference): @corbits/seeding git-remote pusher tests, apps/hub git-worktree/error-handler/mint tests; pushed --no-verify.

Related to CL-7238 (does NOT close it — the inbox-adapter wiring follow-up remains open)

@linear-code

linear-code Bot commented Sep 15, 2026

Copy link
Copy Markdown

CL-7238

Fault-injection tests: a throw between the mail write and the dispatch enqueue leaves a committed mail row whose redelivery dedupes, so the dispatch row is never queued. No src change; the two repair tests fail.
deliverNotification now resolves pre-existing mail ids through an optional host read-back and enqueues dispatch for them; the dispatch store dedupes by (mail row, sink), so the repair never double-queues. Without the read-back a crash-window redelivery still loses the dispatch (pinned by test); the inbox adapter owns that wiring.
@TheGreatAxios
TheGreatAxios merged commit b0f5a93 into main Sep 15, 2026
24 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7238-atomic-deliver branch September 15, 2026 21:46
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