Prevent a slow cache fill from overwriting a newer product revision
A read for revision 7 starts before an edit, then finishes after revision 8 has already been cached and overwrites it.
- Focused work estimate
- 5h + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Compare-and-set · Concurrency
Estimated field mix
- Distributed systems80%
- Database engineering20%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional wholesale portal caches product availability descriptions across several API instances. Delayed invalidations and slow refreshes bring back old content after edits.
Setup prerequisites
- Create two local cache clients and a synthetic authoritative product store.
- Use a fake clock and controllable read/write barriers.
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
Acceptance criteria
- Use an atomic revision comparison when publishing a fill.
- Reject lower source revisions regardless of completion order.
- Keep projection-version incompatibility separate from source ordering.
Implementation constraints
- Implement with a bounded Redis script or provider-level compare-and-set.
Verification to include
- Pause an old fill, publish the new revision, then resume the old fill.
- Attempt a malformed revision and verify it cannot replace the current value.
Deliverables
- Version-guarded fill and race reproduction
Rollout and recovery
Canary guarded fills; disable cache publication if the adapter lacks atomic comparison.
Value of the work
For the engineer: Practice cache consistency, version guards and recoverable invalidation.
For the team: Review fast derived reads without losing authoritative state or tenant isolation.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.