Skip to content

fix(history): align rollups to completed wall-clock minutes - #20

Closed
albertovincenzi wants to merge 1 commit into
fix/durable-rollup-checkpointsfrom
fix/align-history-minute-buckets
Closed

fix(history): align rollups to completed wall-clock minutes#20
albertovincenzi wants to merge 1 commit into
fix/durable-rollup-checkpointsfrom
fix/align-history-minute-buckets

Conversation

@albertovincenzi

Copy link
Copy Markdown
Collaborator

Problem

The counter task slept for a fixed 60 seconds from process startup and stamped the resulting delta with the current minute. A process started at 12:00:37 therefore measured 12:00:37 through 12:01:37 but stored the whole sample as 12:01:00. Charts and rate calculations received shifted buckets containing parts of two real minutes.

Fix

  • calculate the delay to the next UTC minute boundary on every pass
  • store the counter delta under the minute that just completed
  • add boundary tests for an exact boundary, one millisecond after it, and one millisecond before the next one

Dependency

This PR is intentionally based on #13. The reliable checkpoint from that PR must land first so a failed history write cannot advance the sample baseline. Once #13 merges, GitHub can merge this PR as the small follow-up commit shown here.

Review notes for Alice

The exact-boundary case deliberately waits a full minute. Flushing immediately there would create a zero-length sample and move the following delta into the wrong row. The timestamp is also deliberately one minute behind the wake-up boundary because it names the interval that ended at that boundary.

Verification

  • cargo test -p gate-server --lib
  • cargo clippy -p gate-server --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

@alice-viola

Copy link
Copy Markdown
Contributor

Landed on master via #67 (merge commit 944ee9b) as part of the 62-PR integration — this PR's head commit d55da1d is an ancestor of master. GitHub could not mark it merged automatically because its base is fix/durable-rollup-checkpoints, not master. Closing as landed.

@alice-viola alice-viola closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants