Repository navigation
Description
Summary
pkgs/id/src/currency_poc/ledger.rs — InMemoryLedger never remembers failed transfer IDs, so it can never return TransferError::IdAlreadyFailed — while real TigerBeetle remembers a failed transfer's ID permanently and refuses every resubmission of it. A transfer (or linked chain) that fails in the in-memory backend can be resubmitted later — after the blocker clears, e.g. the debit account is funded — and it posts. On a real cluster the same recovery resubmission is refused id_already_failed and the conversion can never post with those IDs.
- The variant exists and is documented for exactly this:
TransferError::IdAlreadyFailed(ledger.rs:97–103) — "TigerBeetle remembers failed transfer IDs and refuses their resubmission (id_already_failed). A recovery resubmission meeting this is a rejected resubmission, not a posting." - The real backend maps it:
tb_ledger.rs:223—Status::IdAlreadyFailed => Err(TransferError::IdAlreadyFailed). - The in-memory backend never produces it: an exhaustive grep of
pkgs/id/src/currency_poc/findsIdAlreadyFailedonly at its definition (ledger.rs:101–103) and the TB mapper (tb_ledger.rs:223) — the only other mention of the concept is the snake_case status name in the live-test comment (tests.rs:1491).InMemoryLedgerrecords only posted transfers (transfers/transfer_order, ledger.rs:152–156); a chain that fails increate_transfers(ledger.rs:270ff) stages nothing and records nothing about the failed IDs, so a later resubmission is validated from scratch as if the first attempt never happened. - The pinned behaviour exists only as a live-cluster test:
live_failed_conversion_recovery_reports_resubmission_rejected(tests.rs:1478ff,#[cfg(feature = "currency-poc-tb")],#[ignore]— requires the pinned TigerBeetle binary) asserts that after a failed conversion, recovery resubmission is refused (id_already_failed, comment at tests.rs:1491) and surfaces asResubmissionRejected. There is no in-memory counterpart — and with the current backend there cannot be one that passes: in-memory, once liquidity is restored,recovery::reconcile(recovery.rs:110–125) resubmits the legs, they post, and the record is markedPostedinstead ofResubmissionRejected.
Evidence (verified this run, laptop probe against the real id crate)
Probe: ~/git/fleet/probe-failed-id on the laptop (path dependency on the real pkgs/id crate), at laptop primary HEAD 266875e1e02f8312d63baec10cdf03f917687578 (line citations re-verified at this HEAD):
PROBE create_accounts: [Ok(()), Ok(()), Ok(())]
PROBE t42 first submit (unfunded): [Err(DebitsMustNotExceedCredits)]
PROBE t42 identical resubmit (still unfunded): [Err(DebitsMustNotExceedCredits)]
PROBE fund USER id=1: [Ok(())]
PROBE USER balance after funding: Some(AccountBalance { debits_posted: 0, credits_posted: 1000 })
PROBE t42 resubmit after funding: [Ok(())]
PROBE lookup_transfer(42): Some((42, 500))
PROBE LP balance: Some(AccountBalance { debits_posted: 0, credits_posted: 500 })
PROBE t43 amount=0 submit: [Err(AmountMustNotBeZero)]
PROBE t43 fixed-amount resubmit (different fields): [Ok(())]
PROBE chain 50/51 first submit: [Err(DebitsMustNotExceedCredits), Err(LinkedEventFailed)]
PROBE fund USER id=2: [Ok(())]
PROBE chain 50/51 identical resubmit after funding: [Ok(()), Ok(())]
PROBE lookup_transfer(50): Some((50, 600))
PROBE USER balance final: Some(AccountBalance { debits_posted: 1100, credits_posted: 2600 })
No resubmission ever returns IdAlreadyFailed: the failed transfer 42 posts once funded, the validation-failed ID 43 posts with corrected fields, and the failed linked chain 50/51 posts byte-identical after funding.
Controls in the same run: account creation and the funding transfers post normally; the first submission of each failing shape returns the expected original error (the failure itself is modelled — only the memory of the failure is missing).
On the real backend each resubmission above returns IdAlreadyFailed (tb_ledger.rs:223) and nothing ever posts with those IDs — the exact behaviour the live test at tests.rs:1478 pins for the recovery path.
Why it matters
InMemoryLedger is the executor's test oracle (see #6135 / #6108 for the sibling divergences): every non-live scenario test, including the whole recovery suite, runs against it. The recovery scanner's central promise is "absent from the ledger ⇒ the submission never landed, so the same IDs may be safely resubmitted" (recovery.rs module docs; intent.rs:9) — but on TigerBeetle "absent" has two different meanings: never submitted (resubmittable) and submitted and failed (poisoned forever). The in-memory backend collapses them into one, so the in-memory recovery tests certify a resubmission path that, against a real cluster, strands the intent as ResubmissionRejected — and, worse, a scenario in which a failed conversion later posts after re-funding passes in-memory while being impossible in production. The one test that pins the real behaviour is #[ignore]d and needs a live cluster, so CI never runs it.
Acceptance criteria
-
InMemoryLedgerrecords the IDs of transfers that failed for their own reason (validation / balance-invariant failures, including the failing leg of a linked chain), and any later submission of a recorded ID returnsErr(TransferError::IdAlreadyFailed)— regardless of whether the resubmitted fields match or differ, and regardless of whether the original blocker has cleared - The treatment of
LinkedEventFailedlegs (siblings of the failing leg) is decided explicitly and pinned by a test, consistent with what the TB binding observes on resubmission of a failed chain (the live test at tests.rs:1478 is the reference: the record surfacesResubmissionRejected) - An in-memory counterpart of
live_failed_conversion_recovery_reports_resubmission_rejectedpasses: failed conversion → fund the account →reconcilewithRecoveryPolicy::ResubmityieldsResubmissionRejected, the record staysSubmitted/unresolved, and no leg posts - Controls unchanged: resubmitting a posted transfer still returns
Exists/ExistsWithDifferentFields; resubmitting a chain rejected as unterminated (LinkedEventChainOpen— the trait docs at ledger.rs:136 promise those transfers "may be resubmitted (properly terminated) in a later batch") still works; a failed ID's failure does not block unrelated new transfers -
cargo test -p id --lib currency_pocpasses
Related
- id(currency_poc): InMemoryLedger accepts and posts zero / int-max account and transfer IDs real TigerBeetle refuses — the reference backend is a broken oracle for ID validity #6135 — sibling oracle divergence in the same backend (zero / int-max IDs accepted and posted in-memory, refused by real TigerBeetle).
- id(currency_poc/tb_ledger): status mappers panic on unmodelled-but-ordinary TigerBeetle statuses (zero/int-max IDs, closed accounts) the in-memory backend accepts #6108 — the real-backend side: unmodelled TB statuses (including the shapes that produce
id_already_failedverdicts) panic in thetb_ledger.rsmappers. - id(conversion): build_conversion_batch accepts ledger 0 — builds a batch that can never post, with no typed pre-ledger rejection #6102 — sibling builder gap in
build_conversion_batch. - tests.rs:1478
live_failed_conversion_recovery_reports_resubmission_rejected— the live-only pin this issue asks to make reproducible in-memory.
Activity
developing-today commentedon Nov 5, 2026
CODE-1778
dezren39 commentedon Nov 5, 2026
🤖 Agent note · filed
new-issue-creator-code-b)new-issue-creator-code-b, run 2026-11-05 01:50 CSTidcrate, probe~/git/fleet/probe-failed-id@266875e1e02f: t42 posts after funding, t43 posts with corrected fields, chain 50/51 posts byte-identical). Real TigerBeetle refuses those IDs forever; the only pin is the#[ignore]d live test at tests.rs:1478. Packet enqueued for triage (the LinkedEventFailed-leg treatment is a design call for the worker).packet-6150-triage.json(queue repo-health-code-pilot); body filehidden_files/issue-id-inmem-failed-transfer-ids.md; siblings id(currency_poc): InMemoryLedger accepts and posts zero / int-max account and transfer IDs real TigerBeetle refuses — the reference backend is a broken oracle for ID validity #6135, id(currency_poc/tb_ledger): status mappers panic on unmodelled-but-ordinary TigerBeetle statuses (zero/int-max IDs, closed accounts) the in-memory backend accepts #6108dezren39 commentedon Nov 5, 2026
🤖 Agent note · handed off
60 remaining items
dezren39 commentedon Nov 7, 2026
Picked up by
repo-worker-code-l— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-lposts progress markers; after 30 minutes of silence any other worker may pick this up.)dezren39 commentedon Nov 7, 2026
Released by
repo-worker-code-l(outcome: free). No change (fallback, lane code-l): #6150 triaged by lane code-a 04:30Z today — bug confirmed, fix PR #6367 in flight and actively iterated by other lanes (#6627/#6628 fixes today), Codex P2 unresolved at that check. PR #6367 fresh-checked still not merged on this claim. Resume when Codex clears and PR #6367 merges; do not build a competing PR.dezren39 commentedon Nov 7, 2026
🤖 Agent note · handed off