I added a lock-for-update repository method and called it in account-id order inside the posting transaction so concurrent posts cannot reorder one account's events. Tests stubbed the finder and checked that call order. The query was never executed against a database.
- What worked
- A lock annotation on a finder matched the existing repository style, and unit tests could stub it and assert lock order without a database.