ORIGINAL COMPANY-CONTEXT PRACTICE
Apply price schedules at exact boundaries
Original practice scenario inspired by The TJX Companies, Inc.'s public business context; this is not a reported interview question or a description of its internal systems. A synthetic retail pricing service has effective intervals for markdown prices. Stores may be offline and later replay price updates. Explain representation, conflict detection, and tests for choosing the price at a transaction time.
Written for independent practice using company context; this is not a verified question from a company interview.
A REASONED APPROACH
Model answer.
Represent price schedules as versioned intervals with a defined timezone and endpoint convention. A sale should retain the applied price and schedule version, rather than being repriced silently after a later update.
Work through it
- Use half-open validity intervals and integer minor-unit prices. Validate that intervals for the same item and store do not overlap within a schedule version.
- Distribute versioned snapshots or ordered updates that an offline store can apply idempotently. Detect missing versions instead of guessing that the latest received update is complete.
- Test exact start and end boundaries, a gap, an overlap, daylight-saving changes, and replay after reconnection. Reconcile the applied version against the authoritative schedule.
Tradeoffs to discuss
- Offline continuity may require a documented fallback price. That policy trades operational availability against freshness and must be explicit.
Common pitfalls
- Wall-clock string comparison across timezones is unreliable.
- Overwriting historical schedules makes disputed transaction prices impossible to reconstruct.