Skip to content

test: compare bucket and raw chart points by timestamp - #17

Merged
masseselsev merged 1 commit into
masterfrom
fix/chart-test-edge-alignment
Sep 18, 2026
Merged

masseselsev merged 1 commit into
masterfrom
fix/chart-test-edge-alignment

Conversation

@masseselsev

Copy link
Copy Markdown
Owner

Follow-up to #14/#15. The CI release gate on v0.3.34 caught the phase flake the earlier mitigations only narrowed, so the release was pulled back (tag and draft deleted; latest is v0.3.33 and nothing broken was published).

Root cause, finally

The index-aligned comparison assumed the bucket/raw request pair can differ only at the leading point. But each request derives startTime from its own wall clock — on a loaded CI runner the seeding between the two calls crosses a 15-minute grid edge, and then the raw path legitimately drops the oldest display bucket (its samples predate that request's startTime) while the stored bucket cannot be re-cut. That is correct product behavior; the test asserted the wrong invariant.

Reproduced deterministically with eight spinning-core loaders (8/8 failures before, 0/40 after), including runs that straddle the grid edge live.

Change

assertAlignedPoints maps raw points by timestamp: at most one straddling edge is tolerated at the oldest end (skipped, never compared), everything after it must agree exactly. Subset-peak fields (rx/tx_peak_bps) compare under the documented never-invent bound (bucket <= raw) instead of equality when the selection is a proper subset; the matching *_formatted strings are excluded from the strict branch. System and single-interface selections still require full equality of every value — that is where an aggregation bug would actually show.

Verification

  • go test ./internal/... — 6/6 packages.
  • The four equivalence tests, -count=20 under the eight-spinners load simulator — clean.

After merge

Re-tag v0.3.34 and republish (the bump commit is already on master; only the gate was red).

The index-aligned comparison assumed the two paths' windows can differ only at
the leading point, but the raw path's startTime is its own wall clock per
request: on a loaded runner the pair straddles the grid edge and the oldest
bucket point is legitimately absent from raw (or present with a partial-window
value). CI caught it as a 96-vs-95 divergence; eight spinning cores reproduced
it at will.

assertAlignedPoints now maps raw points by timestamp, tolerates at most one
straddling edge at the oldest end (skipped, not compared), and requires exact
agreement everywhere else. Subset-peak fields compare under the never-invent
bound (bucket peak <= raw peak) instead of equality; the formatted peak strings
are excluded from the strict branch for the same reason.

20 repetitions of all four equivalence tests under an eight-spinners load
simulator pass, crossing the grid edge repeatedly.
@masseselsev
masseselsev merged commit 2240189 into master Sep 18, 2026
2 checks passed
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.

1 participant