Sensor Time Windows Duplicate a Reading at the End Boundary
Level 2 · node · API · Inclusive end boundary duplicates readings across adjacent windows
Scenario
A fictional equipment sensor API retrieves timestamped readings in millisecond windows. To concatenate adjacent windows without duplicates, each query uses a half-open [fromMs, toMs) interval: include the start and exclude the end. The current service includes the end reading, so a reading on a shared boundary appears in both adjacent windows. Inspect the repository, query service, and controller.
Requirements
Query readings for one sensor within the half-open [fromMs, toMs) interval. Include readings at the start and exclude those at the end. Prevent overlap between adjacent windows while preserving sensor isolation, invalid-window errors, and the original stored records. Do not add external packages.
Acceptance criteria
- The start timestamp is included in the requested window.
- The end timestamp is excluded from the requested window.
- Adjacent windows do not return the same boundary reading twice.
- Readings from other sensors are excluded.
- A start timestamp later than the end raises an error.
- Queries do not modify stored readings.