GH-5268: fix(briefs): receipts digest — record SentAt = query End to close the sub-second (End, SentAt) skip window - #5271
Conversation
…livery time.Now() (GH-5268) Closes the sub-second (End, SentAt) skip window: an execution completing during Telegram delivery latency fell after one digest's End and before the next digest's start, so it was never receipted. Consecutive windows now tile exactly as [prev.End, now).
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Post-merge review — APPROVEExactly the requested fix, nothing more: Test quality is the highlight: All 3 acceptance criteria met; 8/8 checks green; the only non-receipts change is the additive optional |
Summary
Automated PR created by Pilot for task GH-5268.
Closes #5268
Changes
GitHub Issue GH-5268: fix(briefs): receipts digest — record SentAt = query End to close the sub-second (End, SentAt) skip window
Problem
Follow-up from PR#5258 re-review (note-level, non-blocking): in
ReceiptsScheduler.runDigest(internal/briefs/receipts.go), the executions query usesEnd: nowcaptured at the top of the function, but after delivery the brief_history record is stamped with a freshtime.Now():The next digest windows
[lastRecord.SentAt, now). A run whosecompleted_atlands in the gap(End, SentAt)— i.e. completes during the ~100–500ms of Telegram delivery — is after this digest's window and before the next one's start, so it is never receipted. Breaks the exactly-once guarantee established by GH-5261, just at sub-second scale.Fix
One line: stamp the record with the same
nowused as the queryEnd(SentAt: now), so consecutive windows tile exactly:[prev.End, now).Acceptance
runDigestrecordsSentAtequal to the query'sEndbound (sametime.Timevalue).completed_atexactly between the first digest's queryEndand its (formerly later) send-completion time appears in the second digest — extendTestReceiptsSchedulerRunNow_InFlightRunAppearsInNextDigestor add a sibling.make lint && make testgreen; no other behavior change.Refs