fix(tests): repair controller_plan_to_query_full_roundtrip post-#280 legacy retirement - #289
Merged
Merged
Conversation
…legacy retirement The DDSketch + KLL roundtrip tests carried `start_time_unix_nano: 0` on the OTLP data points they POST to the backend. The HLL/CMS/CountSketch sibling tests already used `time_unix_nano - 1s` for this field (with an explanatory comment block). The two old tests were missed during that sweep. Why this caused the failure: After PR #280 deleted the legacy `handle_query` family, the modern trait-dispatched `execute()` path is the only query route. It calls `SketchStore::query_range(sid, t0_ms, t1_ms)` which delegates to `MutableEpoch::range_query_into`, which accepts only windows where `w.0 >= start && w.1 <= end`. The stored window is `(dp.start_time_unix_nano / 1e6, dp.time_unix_nano / 1e6)`, so a `start_time_unix_nano: 0` produces a window starting in 1970 — which fails `w.0 >= now_ms - lookback_ms` for any sensible `now`, and the reducer hits `NoData` → `CapabilityMiss` → HTTP `bad_data` / "No result for query". Diagnosis (option `(b)`): the tests' construction always had this latent bug, but the legacy `handle_query` path's range semantics happened to accept the (0, time) window — that side-effect is gone post-#280. Fix: mirror the HLL helper's `start_t_ns = time_unix_nano - 1s` pattern in `build_dd_sketch_export` + `build_kll_export`, and refresh the deferred-soft-check docstrings to describe the strict-success expectation. Identical comment block now sits above the `start_time_unix_nano` field in DDSketch / KLL / HLL / CountSketch / CountMin helpers. Production code untouched. Before / after: - before: `cargo test -p data_plane --test e2e_controller_plans_and_backend_serves` → 5 passed / 2 failed - after: 10 passed / 0 failed (the 7 roundtrip cases + 2 streaming-config cases + 1 range-query case all green) - `cargo test -p data_plane --lib` → 727 passed / 0 failed / 2 ignored (no regressions; lib count grew from 715 in #286 via unrelated work landed on main since) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
The two pre-existing failing tests
(
controller_plan_to_query_full_roundtrip_ddsketchand_kll) thatPRs #284 and #286 both flagged as predating their work are now green.
(b)per the task brief): both tests built theirOTLP
DataPointwithstart_time_unix_nano: 0. The HLL / CMS /CountSketch sibling helpers all use
time_unix_nano - 1sand carryan explanatory comment block; the DDSketch + KLL helpers were
missed during that sweep.
handle_queryfamily, the modernexecute()trait-dispatch path is the only query route. It callsSketchStore::query_range→MutableEpoch::range_query_into, whichaccepts only windows where
w.0 >= start && w.1 <= end. The storedwindow is
(dp.start_time_unix_nano, dp.time_unix_nano) / 1e6—with
start_time_unix_nano: 0the window starts in 1970 and getsrejected against
start = now_ms - lookback_ms. The reducer hitsNoData→EngineError::CapabilityMiss→ HTTPbad_data/"No result for query" (the exact failure mode the test docstring
guessed at — but the cause was the test fixture, not the production
query path).
start_t_ns = time_unix_nano - 1spattern inbuild_dd_sketch_export+build_kll_export(same fix shape thatHLL/CMS/CountSketch helpers already had). Production code untouched.
// 4. Soft-check ...docstring + the assertionmessage: both referenced the deleted-refactor(query): delete legacy handle_query family (B7.5 v2 redo) #280 legacy
handle_queryanddescribed the test as deferred. They now describe a strict-success
check against the modern trait-dispatch path.
Test plan
cargo build -p data_plane— cleancargo test -p data_plane --lib— 727 passed / 0 failed / 2ignored (up from refactor(data_plane): rekey backfill processor + SketchStore from agg_id to sid (B7.7) #286's 715 baseline; the delta is unrelated lib
tests added on main since)
cargo test -p data_plane --test e2e_controller_plans_and_backend_serves— 10 passed / 0 failed(7 full-roundtrip cases + 2 streaming-config cases + 1 range-query
case all green; previously 5/7 roundtrips passed and ddsketch + kll
failed)
control_plane/,data_plane/src/, or any of theB7.6/B7.7 settled files
🤖 Generated with Claude Code