noCV
STOCK-109 · Warehouse operations

Invalidate availability cache after committed stock changes

Practice briefBugIntermediate

The product page shows an old available count for five minutes after a warehouse adjustment. A failed adjustment also evicts unrelated retailers' cached stock.

Focused work estimate
2h 30m + prerequisites
Priority in the scenario
Medium
Engineering practice
Caching · Transaction boundaries · Resilience

Estimated field mix

  • Backend50%
  • Distributed systems50%

Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.

Your next step

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 retailer sells bicycle parts from East and West warehouses. Cart reservations last ten minutes, payment callbacks arrive late, and warehouse counts occasionally need correction. The exercise has no real orders or payment integration.

Setup prerequisites

  • Relational modeling
  • Concurrent API requests
  • State transitions

Preceding work

Complete these dependencies, or supply their agreed outputs before taking this ticket.

Acceptance criteria

  • Invalidate only the retailer, warehouse, and SKU affected by a committed change.
  • A rolled-back transaction emits no successful invalidation event.
  • Reservation correctness remains database-backed when the cache is stale or unavailable.

Implementation constraints

  • The cache is a display optimization and cannot authorize a hold.

Verification to include

  • Apply an adjustment and observe the next lookup refresh.
  • Rollback an adjustment and disable Redis; check scope and successful authoritative reads.

Deliverables

  • Scoped cache invalidation and stale-read behavior notes

Rollout and recovery

Reduce cache lifetime before enabling invalidation; bypass the cache if refresh failures rise.

Value of the work

For the engineer: Practice inventory invariants and timed state transitions while balancing customer experience with operational repair.

For the team: Inspect an engineer's handling of overselling, delayed callbacks, warehouse boundaries, and reversible schema changes.

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.