Skip to content

fix(id/currency_poc): refuse short create_transfers result vectors (#4669) - #6783

Merged
dezren39 merged 1 commit into
mainfrom
queue/4669-short-results
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/4669-short-results

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

What

Fixes issue #4669: neither the executor's submission path nor the recovery scanner checked that LedgerBackend::create_transfers returned one result per leg. A backend returning a short — or empty — result vector was treated as complete success and the conversion persisted as Posted with nothing (or only part) in the ledger: submit() iterated legs.iter().zip(results.iter()) (zip stops at the shorter side), and recovery's Resubmit path scanned results for a failure entry, which an empty vector vacuously lacks. This is the result-vector side of the vacuous-success shape #4133 hardened for leg vectors. (Implements lane code-f's CONFIRMED triage on the issue.)

Change (all in pkgs/id/src/currency_poc/)

  • executor.rs — submit() bails when results.len() != legs.len(), naming the conversion and both counts, before any per-leg verdict; the record stays Submitted for the recovery scanner.
  • recovery.rs — the Resubmit path treats a short result vector as a rejected resubmission (ResubmissionRejected, record left unresolved, scan continues), never Posted/Resubmitted.
  • ledger.rs — the create_transfers trait doc now states the contract: exactly one result per submitted transfer, in submission order; any other length is a backend failure.
  • tests.rs — a ShortResultBackend test double (reports keep Ok results, posts nothing, delegates lookups to a funded in-memory ledger) with two tests: submit with keep ∈ {0, 1, 2} errors naming the short vector and never advances past Submitted; recovery Resubmit with keep ∈ {0, 2} reports ResubmissionRejected and leaves the record Recorded.

Verification

  • cargo test --lib currency_poc on the laptop: 50 passed, 0 failed (2 new).
  • cargo fmt --check clean on all four touched files.

Fixes #4669.


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

Issue #4669: submit() zipped legs with results, so legs past the end of a short result vector were never examined and the record advanced to Posted unconditionally; recovery Resubmit scanned results for a failure entry, which an empty vector vacuously lacks. Require exactly one result per leg in both paths (submit bails and stays Submitted; Resubmit reports ResubmissionRejected and leaves the record unresolved), state the contract on the LedgerBackend::create_transfers doc, and cover both paths with a ShortResultBackend test double. currency_poc tests 50/50 on the laptop.
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 04:48
@coderabbitai

coderabbitai Bot commented Nov 7, 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 56 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: 0745d1ad-43d8-4695-be15-606dd973110f
Commits

Reviewing files that changed from the base of the PR and between 369710f and 8b3d736.

Files selected for processing: 4

  • pkgs/id/src/currency_poc/executor.rs
  • pkgs/id/src/currency_poc/ledger.rs
  • pkgs/id/src/currency_poc/recovery.rs
  • pkgs/id/src/currency_poc/tests.rs
  • 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

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T04:50:18.835250Z 8b3d736 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.

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

Labels

None yet

Projects

None yet

1 participant