Skip to content

id(currency_poc): validate_and_stage returns the stored original error for a failed transfer ID instead of IdAlreadyFailed (PR #6367) #6628

Closed

Description

@dezren39

Finding (unaddressed PR review comment)

PR #6367 — "id(currency_poc): remember failed transfer IDs in InMemoryLedger (IdAlreadyFailed)" — is still open, and a CodeRabbit finding on it was never fixed or responded to. The 24-hour grace period for open PRs has passed (comment 2026-11-05T20:15:12Z; rechecked 2026-11-06).

Essence of the comment ("Return IdAlreadyFailed for resubmitted failed transfer IDs"): "validate_and_stage returns the stored original error for a failed ID. A transfer that failed with DebitAccountNotFound keeps returning that error after the account exists. The TransferError::IdAlreadyFailed doc comment and the live binding's status mapping both expect IdAlreadyFailed." Suggested fix: check failed_transfers.contains_key(&transfer.id) and return TransferError::IdAlreadyFailed instead of the stored error.

No-response evidence

Still-live evidence

Read on the PR head (7d5d64f9, 2026-11-06), pkgs/id/src/currency_poc/ledger.rs:188-190:

// Check if this transfer ID was previously recorded as failed
if let Some(error) = self.failed_transfers.get(&transfer.id) {
    return Err(*error);
}

The stored original error is returned, not IdAlreadyFailed. The contract mismatch is visible in the same tree: ledger.rs:101-103 defines IdAlreadyFailed with a doc comment naming the resubmission (id_already_failed) behavior, and the live TigerBeetle binding (pkgs/id/src/currency_poc/tb_ledger.rs:223) maps Status::IdAlreadyFailed => Err(TransferError::IdAlreadyFailed) — so the in-memory backend and the live backend return different errors for the same resubmission, and the in-memory error can go stale (it keeps naming a cause, e.g. a missing account, after that cause is fixed).

Dedupe: searched open/closed issues for "IdAlreadyFailed", "6367", "6150" on 2026-11-06 — no issue covers this return-value defect. Issue #6150 is the parent task PR #6367 implements; it asks for failed IDs to be remembered, and does not record that the implementation returns the wrong error for them.

Acceptance criteria

  • Fix the defect: validate_and_stage in the InMemoryLedger returns TransferError::IdAlreadyFailed for any resubmitted ID present in failed_transfers, matching the doc comment and the live binding's mapping; add a test where a transfer fails (e.g. DebitAccountNotFound), the cause is then fixed, and resubmission still returns IdAlreadyFailed; OR resolve this issue with a documented decision explaining why returning the stored original error is the intended contract (and reconcile the doc comment / binding expectation with that decision).
  • Do not reply to or resolve the source PR review thread from the fix work (per the pr-comment-review job rules); the correction lands in the PR itself or is decided here.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-k — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-k posts progress markers; after 30 minutes of silence any other worker may pick this up.)

    Lane K triage: verifying the validate_and_stage stored-error-vs-IdAlreadyFailed finding against PR #6367's current head (ledger.rs:189) and its unresolved CodeRabbit thread.

  5. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 7, 2026
  6. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  7. 25 remaining items

  8. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Progress from repo-worker-code-o: verified: PR #6367 OPEN head fb8079d settled (lane S 03:49Z heartbeat: #6628 now unblocked, branch work pushed); defect still at ledger.rs:188-190 per lane L. Next: resume laptop worktree fb-6627-pr6367, implement IdAlreadyFailed return + acceptance test, push to PR #6367 branch

  9. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Progress from repo-worker-code-o: implementation_complete in laptop worktree fb-6627-pr6367: validate_and_stage now returns IdAlreadyFailed for resubmitted failed IDs + stale recording comment fixed; acceptance test added (fails DebitAccountNotFound, cause fixed, resubmit still IdAlreadyFailed). Next: targeted cargo test on laptop, then commit+push to PR #6367 branch

  10. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Agent note — parked on CI (fallback, lane code-o)

    Done this claim

    Resume condition

    When PR #6367's checks on head 8127030d85 complete: verify test-unit + cargo-check pass (the fmt/clippy failures on the original head 7d5d64f9 were pre-existing — compare, do not attribute), then release issue #6628 outcome=done with the PR #6367 link. Do not merge PR #6367 until sibling #6629 also lands on the branch (lane code-s's condition for #6627 applies to the shared PR). Per fallback §5 this shift ends without releasing; the claim goes stale 30 minutes after the park heartbeat and the issue returns to the pool.

  11. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor

    Progress from repo-worker-code-o: parked on CI: fix commit 8127030 pushed to PR #6367 branch (validate_and_stage returns IdAlreadyFailed + acceptance test); checks on 8127030 queued in runner backlog. Resume: when PR #6367 checks on 8127030 complete, verify test-unit+cargo-check pass (fmt/clippy failures on old head 7d5d64f pre-existing), then release #6628 done; do not merge PR #6367 until sibling #6629 lands

  12. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-r — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-r posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  13. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-r: claimed: verifying code-o fix commit 8127030 on PR 6367 branch (diff + targeted currency_poc tests); PR merge itself belongs to #6627/#6150

  14. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    lane-scratch: code-r /tmp/lane-code-r-20261106-2209 task fb-6628

    🤖 Agent note · done

  15. added and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/triagedTriaged and routed (see agent note)
    on Nov 7, 2026
  16. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-r (outcome: done). fixed in PR #6367 commit 8127030 (validate_and_stage returns IdAlreadyFailed for resubmitted failed IDs + acceptance test); verified by lane code-r: cargo test --lib currency_poc 51 passed 0 failed on laptop; source CodeRabbit thread not replied per issue rules; issue closed completed. PR #6367 merge remains #6627/#6150 scope; #6629 test still separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions