Context
When multiple admin users or automated processes operate on the same subscription simultaneously, last-writer-wins causes silent data loss.
Current Limitation/Problem
A support agent updating subscription notes can be overwritten by billing's status change. No conflict detection exists.
Expected Outcome
Optimistic Concurrency Control (OCC) using version numbers: each entity has a version field incremented on write. Updates include WHERE version = N and fail with 409 on conflict.
Acceptance Criteria
Technical Scope
- db/migrations/ - add version column to subscription, invoice, plan tables
- backend/shared/occ/ - OptimisticLockService (version check + increment)
- backend/subscription/controller/ - version validation in update endpoints
- backend/billing/controller/ - version validation in billing operations
- mobile/app/services/ - conflict retry logic with exponential backoff
Context
When multiple admin users or automated processes operate on the same subscription simultaneously, last-writer-wins causes silent data loss.
Current Limitation/Problem
A support agent updating subscription notes can be overwritten by billing's status change. No conflict detection exists.
Expected Outcome
Optimistic Concurrency Control (OCC) using version numbers: each entity has a version field incremented on write. Updates include WHERE version = N and fail with 409 on conflict.
Acceptance Criteria
Technical Scope