fix(querytee): Fix TestProxyEndpoint_QuerySplitting clock-drift bug - #21779
Merged
Conversation
The test captured `threshold = time.Now().Truncate(time.Minute) - 3h` once at setup, then asserted v2-split end times fell within `threshold + 60s`. But the engine router computes `v2End = time.Now() - StorageLag` per request, and for logs queries `alignV2Range` is a no-op (step=0), so v2End drifts second-by-second with wall-clock. When the truncation landed late in a minute and the prior 2-second sleep pushed total drift past 60s, all three queries were misclassified as "recent" — the 0/3 failure seen in CI. Classify queries by whether their end matches the request's end (post-v2 split runs to request end; v2 split ends earlier) instead of an absolute boundary, and widen the mock server's split boundary to threshold + 30m so it stays stable under any plausible drift.
paul1r
approved these changes
May 7, 2026
sophiewaldman
pushed a commit
that referenced
this pull request
May 15, 2026
This was referenced May 20, 2026
This was referenced Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestProxyEndpoint_QuerySplittingwas flaking in CI with0/3instead of2/1for the old/recent query split classification.threshold = time.Now().Truncate(time.Minute) - 3honce at setup, but the engine router computesv2End = time.Now() - StorageLagper request. For logs queries,alignV2Rangeis a no-op (step=0), sov2Enddrifts second-by-second with wall-clock. When the truncation landed late in a minute and the prior 2-second sleep pushed total drift past 60s,v2End > threshold + 60sand all three queries got misclassified as "recent".threshold + 60stothreshold + 30mso it stays stable under any plausible drift.Test plan
go test -tags=assert -count=10 -run TestProxyEndpoint_QuerySplitting ./pkg/querytee/...passes (10/10)go test -tags=assert ./pkg/querytee/...passesNote
Low Risk
Low risk because changes are confined to test logic and only adjust how the mock split boundary and assertions are computed to avoid time.Now() drift flakes.
Overview
Fixes CI flakiness in
TestProxyEndpoint_QuerySplittingby making the mock backend’s split boundary drift-tolerant (usingthreshold + 30mand treating equality as recent).Updates assertions to classify old vs recent sub-queries based on whether the query
endmatches the original requestend(instead of comparing against a step-aligned absolute boundary), and removes the now-unusedstepAlignUphelper.Reviewed by Cursor Bugbot for commit b0ddf34. Bugbot is set up for automated code reviews on this repo. Configure here.