Skip to content

fix(tests): repair controller_plan_to_query_full_roundtrip post-#280 legacy retirement - #289

Merged
zzylol merged 1 commit into
mainfrom
fix/roundtrip-tests-post-handle-query-retirement
May 18, 2026
Merged

zzylol merged 1 commit into
mainfrom
fix/roundtrip-tests-post-handle-query-retirement

Conversation

@zzylol

@zzylol zzylol commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

The two pre-existing failing tests
(controller_plan_to_query_full_roundtrip_ddsketch and _kll) that
PRs #284 and #286 both flagged as predating their work are now green.

  • Diagnosis (option (b) per the task brief): both tests built their
    OTLP DataPoint with start_time_unix_nano: 0. The HLL / CMS /
    CountSketch sibling helpers all use time_unix_nano - 1s and carry
    an explanatory comment block; the DDSketch + KLL helpers were
    missed during that sweep.
  • After PR refactor(query): delete legacy handle_query family (B7.5 v2 redo) #280 retired the legacy handle_query family, the modern
    execute() trait-dispatch path is the only query route. It calls
    SketchStore::query_rangeMutableEpoch::range_query_into, which
    accepts only windows where w.0 >= start && w.1 <= end. The stored
    window is (dp.start_time_unix_nano, dp.time_unix_nano) / 1e6
    with start_time_unix_nano: 0 the window starts in 1970 and gets
    rejected against start = now_ms - lookback_ms. The reducer hits
    NoDataEngineError::CapabilityMiss → HTTP bad_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).
  • Fix: apply the same start_t_ns = time_unix_nano - 1s pattern in
    build_dd_sketch_export + build_kll_export (same fix shape that
    HLL/CMS/CountSketch helpers already had). Production code untouched.
  • Also refreshed the // 4. Soft-check ... docstring + the assertion
    message: both referenced the deleted-refactor(query): delete legacy handle_query family (B7.5 v2 redo) #280 legacy handle_query and
    described the test as deferred. They now describe a strict-success
    check against the modern trait-dispatch path.

Test plan

  • cargo build -p data_plane — clean
  • cargo test -p data_plane --lib727 passed / 0 failed / 2
    ignored
    (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_serves10 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)
  • Re-ran twice — non-flaky
  • Did not touch control_plane/, data_plane/src/, or any of the
    B7.6/B7.7 settled files

🤖 Generated with Claude Code

…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>
@zzylol
zzylol merged commit 6e25171 into main May 18, 2026
@zzylol
zzylol deleted the fix/roundtrip-tests-post-handle-query-retirement branch July 17, 2026 20:05
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