Interfaces
New data requires a new search. Which conditions ensure a valid result?
A repeat call can arrive after a timetable change.
Starting point Test overall load and origin-destination hotspots separately.
Assumptions for the example case
A fictional journey planner for buses, trains and walking routes in one region. Each response binds a timetable version and a real-time snapshot. The scope ends with journey information, without a booking commitment. All quantities, thresholds and operational objectives are illustrative assumptions.
Four response classes
Four response classes
A fully explored search space establishes a result or no route; an exhausted time budget yields only partial results or a timeout.
Proposed domain contracts
- POST
/reisesuchenStart travel search with fixed data.
- Input
- queryKey, originStop, destinationStop, departureInstant, accessibilityNeeds, maxTransfers
- Result
- Alternatives, snapshotId, generatedAt, realtimeAge and complete/partial/no-route/timeout.
- Retry behaviour
- The same queryKey and payload return the same frozen response. A new search requires a new key.
- POST
/fahrplanstaende/aktivierungenActivate validated import.
- Input
- importHash, baseGeneration, validityInterval
- Result
- New generation or version conflict.
- Retry behaviour
- The same import is activated once; a changed payload under the same key causes a conflict.
New data requires a new search.
queryKey binds the input and completed response version.
A repeat call can arrive after a timetable change.
Identical content returns the stored result; a different destination causes a conflict. A new key binds the current snapshot and may return different alternatives.
- Alternative considered
- Recalculating under the same key silently changes the response.
- Trade-off
- Updating requires a new key.
- Reassess
- Longer result retention requires an explicit retention period.
Try it yourself
Compare replaying Q-41, reusing its key with a changed destination, and explicitly starting a new search.
A hint for your attempt
A repeat call can arrive after a timetable change.
Compare with a possible solution
- Replay
- Identical content returns the stored result; a different destination causes a conflict.
- New search
- A new key binds the current snapshot and may return different alternatives.
Apply to your project
How does this principle apply in your own project: New data requires a new search.