fix(fuzz): address fuzzer failures for step-invariant and count_values#697
Open
sylr wants to merge 2 commits intothanos-io:mainfrom
Open
fix(fuzz): address fuzzer failures for step-invariant and count_values#697sylr wants to merge 2 commits intothanos-io:mainfrom
sylr wants to merge 2 commits intothanos-io:mainfrom
Conversation
The native histogram fuzzer found a samples-per-step mismatch when queries use the @ modifier (e.g. predict_linear({...}[2m] @ 0.000)). The Thanos engine's step invariant operator caches the first evaluation and replays it for subsequent steps without re-counting samples, while Prometheus counts samples at every step. This is an optimization difference, not a correctness issue. Detect @ modifier usage via VectorSelector.Timestamp/StartOrEnd fields and skip sample comparison for those expressions. Constraint: step invariant operator uses sync.Once for caching, samples only counted on first batch Rejected: Fix sample counting in step invariant operator | would add overhead for non-functional stat tracking Confidence: high Scope-risk: narrow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr> count_values converts float values to string labels, amplifying tiny floating point precision differences between engines into label mismatches. For example, stdvar_over_time may compute 61.24999999999997 vs 61.24999999999998 — both correct within float64 precision, but producing different count_values labels. Constraint: float64 has ~15-16 significant digits; different evaluation order yields different last-digit results Rejected: Fix float precision in stdvar_over_time | both values are equally valid within IEEE 754 Confidence: high Scope-risk: narrow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
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
@modifier, since the Thanos step invariant operator caches results viasync.Onceand replays without re-counting samples per step (telemetry difference, not correctness)count_valuesfrom fuzzer validation, since it stringifies float values into labels, amplifying last-digit float64 precision differences into label mismatchesFuzzNativeHistogramQueryTest plan
FuzzNativeHistogramQuery/df60c8694f1c9759passesFuzzEnginePromQLSmithRangeQuery/59c2955b78c86babpassesgo test ./...passes (no regressions)🤖 Generated with Claude Code