package contribution projection: the resource write and the ledger record are not one transaction #1336
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#1336
Reference in new issue
Block a user
Found while reviewing archie-core-em7s.9 (package contribution projection, merged at
783c0cfc).The projection writes the contribution into the org resource and THEN records the projection ledger, as two separate writes. A failure between them leaves a contributed entry with no ledger row, and a later Withdraw cannot see it -- so the contribution sits in the resource with nothing able to remove it.
Bounded (the Record is a local transaction and the window is small) but it is the non-atomic seam of an otherwise transactional path. Both writes go through the same postgres pool, so one transaction over the resource write and the ledger record closes it.
If the reverse order is simpler, check first that Withdraw is idempotent when a ledger row exists but the resource entry does not -- that is the failure the other order introduces.
Evidence: the lane's own residual-risk note; internal/domain/storepkg/contributions.go (project/withdraw), the ledger queries, and internal/app/controlplane/workflow_projector.go.
Imported from beads
archie-core-gf3f· GitHub #1385 · type bug · priority P3 · created 2026-09-29