GeezerVison is showing github.com — id(currency): currency registry schema + ledger-u32 allocator (from #2062) · Issue #2317 · developing-today/code
id(currency): currency registry schema + ledger-u32 allocator (from #2062) #2317DescriptionFollow-up from the currency control plane design (#2062), §2 and §6 of
doc/2026-10-29T12-42-21Z_design_currency_control_plane/.
Scope
The control-plane registry that owns the meaning of a TigerBeetle ledger u32.
- Schema + migrations for
ledger_allocation, currency, currency_issuer, account (design §2.1–§2.2).
- The ledger-u32 allocator: monotonic, never recycled, documented range split (tenancy/system vs currency) (design §6).
currency_id minting; symbol unique per issuer, not globally.
currency.graph_object_id linkage to the signed graph object that is the canonical record (§2.4).
Acceptance
- A migration creates the four tables with the uniqueness constraints the design names.
- An allocator API hands out non-zero u32s monotonically and refuses to recycle.
- A test proves two issuers may both register symbol
ABC but a duplicate currency_id is rejected.
Depends on
Nothing. Blocks F2, F4.
Refs #2062 Activitydeveloping-today commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 Intake review
- Related: Design: id: design: currency control plane — registry, account factory, gateway #2062 (currency control plane, §2 and §6). Blocks F2 (id(currency): deterministic account factory + per-currency system accounts (from #2062) #2318) and F4. Depends on nothing — this is the foundation slice.
- Live check: No merged PR creates the
ledger_allocation / currency / currency_issuer / account tables or the ledger-u32 allocator; live. The body's ## Acceptance section already states the criteria (including the two-issuers-same-symbol test), so no section was appended.
- Notes: The never-recycled, monotonic ledger allocator and its documented range split are the load-bearing decisions; symbol uniqueness is per-issuer, not global.
- Risks: Medium — allocator semantics are one-way; get the range split documented in the migration itself.
- Suggested approach: Land this first in the id: design: currency control plane — registry, account factory, gateway #2062 slice order; the duplicate-
currency_id rejection test from the body is the key regression pin.
- Labels: already normalized by the filer (kind/feature, source/queue-worker, priority/normal, effort/m, app/id); added meta/enriched only.
developing-today commented on Nov 3, 2026 agent-note:v1
state: triaged (coverage pass)
Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
Found via: coverage pass 2026-11-03 dezren39 commented on Nov 16, 2026
Agent note — task 17444 released intact: this task IS the #2317 implementation slot (lane any-c)
- state: released to queued (no work started; resume state below)
- task: 17444 (carries the fix dedupe key repo-health:v1:fix:developing-today/code:issue:2317)
- issue: id(currency): currency registry schema + ledger-u32 allocator (from #2062) #2317
- Verified fresh this shift (2026-11-16): issue id(currency): currency registry schema + ledger-u32 allocator (from #2062) #2317 is OPEN. Triage already happened — lane code-d, task 15189, note 6912140267: all four design decisions ANSWERED 2026-11-16T02:00:33-06:00 (ledger currency-registry-decisions-2317): (1) registry store Postgres; (2) ledger u32 as bigint + 0..4294967295 check constraint, design §6 range split ratified; (3) currency_id globally unique, symbol unique per issuer; (4) missing currency_issuer/account columns are fleet-drafted from design §2.1–2.2 + §2.4 in a design PR for ratification.
- No implementation exists yet: no currency-registry / ledger-allocator symbols in pkgs/id crates (checked this shift). The implementation (Postgres schema + migrations for ledger_allocation/currency/currency_issuer/account, monotonic never-recycled ledger-u32 allocator API, currency_id minting, the two-issuers-same-symbol test) is a full implementation session's work.
- Why released: lane any-c claimed this at the tail of its shift (~35 min of budget left); starting a schema+allocator implementation now would leave it half-done. Released intact so the next owner starts from this note and code-d's decision record. It unblocks F2/F4 and issue id(currency): deterministic account factory + per-currency system accounts (from #2062) #2318 when done.
dezren39 commented on Nov 16, 2026
agent-note:v1
state: done (fixed_merged)
Implemented slice F1 of the #2062 design: PR #10658 MERGED (merge commit 454547f), closing this issue.
- New crate pkgs/id/crates/id-currency-registry: Postgres migration 0001 creates ledger_allocation, currency, currency_issuer, account with the design's constraints — ledger_id bigint + 0..4294967295 check, ratified range split as a per-kind check (1..=0xFFFFF tenancy/system, 0x100000.. currencies), currency_id globally UNIQUE, (issuer_id, symbol) UNIQUE, graph_object_id linkage (design s.2.4). currency_issuer / account columns fleet-drafted from s.4.2 / s.3 per decision 4, marked for ratification.
- Allocator: allocate_ledger() over monotonic sequences + a delete-refusing trigger in SQL; the Rust Allocator states the same semantics (non-zero, monotonic, never recycled — no release API, spent ids refused).
- Verification: cargo test -p id-currency-registry 11/11 pass (incl. two issuers both registering symbol ABC; duplicate currency_id rejected); clippy + fmt clean; scripts/test-migration.sh PASS against a real Postgres (allocator values, recycle refusal, both uniqueness rejections, range enforcement, down migration).
- Reviewers: Codex review failed on its usage limit and CodeRabbit was rate-limited — no findings existed to disposition; disposition recorded on PR feat(id): currency registry schema + ledger-u32 allocator (#2317) #10658.
This unblocks F2 (account factory) and F4 (reconciliation + supply audit), and issue #2318 per the triage note.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|