Skip to content

fix(purchase): re-drive buys the pre-claim snapshot instead of the claimed row #1037

Closed

Description

@cristim

Problem

claimAndRedrive (internal/purchase/manager.go ~:578-593) claims an execution for re-drive, then calls executeAndFinalize with the exec value it read before the claim, updating only its status. The claim is also unpinned, so it doesn't require the row to be unchanged since that read.

If the row's recommendations, amount or account changed between the read and the claim (an edit or a concurrent writer), the re-drive buys the stale snapshot instead of the row it actually claimed. This is the same check-then-buy gap that #1036 closes for user-triggered paths, on the re-drive path.

Found during the independent review of #1036, which does not introduce it.

Expected

Re-drive executes the row as returned by the claim, or pins the claim to the version it read (for example updated_at or a version column in the conditional UPDATE), and refuses if the row changed.

Evidence

#1036 review: the entry-point table and the manager.go:578-593 read.

Activity

  1. IAmJSD commented on Oct 19, 2026

    @IAmJSD
    Collaborator

    Claiming: working on this

  2. self-assigned this
    on Oct 19, 2026
  3. added a commit that references this issue on Oct 23, 2026
    61bf607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions