Skip to content

docs(id): Stage B decision record — multi-Turso sharding by currency (#5826) - #10769

Merged
dezren39 merged 1 commit into
mainfrom
queue/17435-5826-stage-b
Nov 16, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/17435-5826-stage-b

Conversation

@dezren39

@dezren39 dezren39 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Design decision record for #5826 — Stage B: multi-Turso sharding by currency, the Stage B item of the #5676 staged currency scaling path. Docs only; no implementation.

Closes the "what this design must settle" list on #5826: sharding shape, cross-DB transfers composed with the #2063 conversion engine, and rebalancing migrations.

Decisions recorded

  • Shard key = currency. One currency lives wholly in exactly one Turso DB; a DB hosts one or more whole currencies. Account-range sharding rejected (it splits a currency's ledger and makes common transfers cross-shard).
  • Cross-DB conversions adopt id: design: conversion & RateAuthorisation across stages (from #5676) #5828 §3.2 unchanged: durable coordinator intent, pending destination leg fenced by saga epoch, one durable COMMIT, compensation only before commit, forward-only recovery, declared saga outcomes. No cross-DB atomicity is claimed.
  • Currency→DB directory: versioned, audited metadata table (epoch, state, schema version) is the sole routing authority; front-end config may cache but never override.
  • Rebalancing: per-currency freeze → saga drain (bounded by saga timeout) → write fence → copy/replay → pre/post invariant + per-account census → epoch flip → retire. Rollback only before the flip accepts writes. Bounded maintenance window, stated honestly rather than claimed as zero-downtime.
  • Schema versioning: one release version, rolling expand/deploy/backfill/contract per DB, typed maintenance error for a DB mid-upgrade.
  • Invariants: I1–I8 from id: design: currency backend port + invariant test suite contract (from #5676) #5823 plus Stage B additions (no split currency, directory sole authority, no cross-DB balance reads in posting decisions, census equality at rebalancing flip, saga-epoch fencing).
  • Parent decisions: none changed. Answers only what id: design: Currency scaling — autoscaling service, Redis → multi-Turso → TigerBeetle path #5676 delegated to Stage B.

Test plan

Docs-only change: reviewed against #5676 principle 3 and the closed #5823 (port + I1–I8), #5824 (Stage A), #5825 (autoscaling), #5828 (conversion saga) records. No code, no test suite change.

Issue


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 16, 2026 13:54
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T13:55:00.711810Z
We couldn’t complete this review. Comment @codex review to try again.
fed0328 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c580f64e-54e7-46a1-8720-b87693000697
Commits

Reviewing files that changed from the base of the PR and between 41d765a and fed0328.

Files selected for processing: 1

  • doc/2026-11-16_design_id5826.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@dezren39
dezren39 merged commit 94becb8 into main Nov 16, 2026
1 check passed
@dezren39
dezren39 deleted the queue/17435-5826-stage-b branch November 16, 2026 13:56
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.

id: design: currency backend port + invariant test suite contract (from #5676)

1 participant