-
Task
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
5
-
False
-
-
True
-
subs-swatch-thunder
-
-
Context
When Phase 2 HBI event processing goes live, tally state initialization becomes critical for capturing the right events. The tally_state table tracks the starting boundary of how far back to look for events during processing.
Critical Issue: When initializing a tally_state record for the first time (no matching previous entry exists), the default behavior must set the boundary to "today minus one day" to ensure all events from the previous day are captured.
Impact: Without proper default behavior, the first-time rollout could miss events or process incorrect time ranges, leading to incomplete or inaccurate tally calculations.
Acceptance Criteria
- Confirmed that tally state initialization sets default to "today minus one day"
- Timezone handling verified correct and consistent
- Default behavior works across all service types
- Comprehensive unit tests covering tally state initialization logic
- Integration tests using TestContainers for database scenarios
- Edge case testing (timezone boundaries, concurrent access, etc.)
- No regressions in existing tally processing functionality
- Test suite executes efficiently (no significant performance impact)
- Code behavior clearly documented