refactor(query): delete legacy handle_query family (B7.5 v2 redo) - #280
Merged
Merged
Conversation
Re-doing B7.5 in a clean branch; the prior attempt's branch was
deleted in a parallel-agent merge confusion. Identical scope:
deletes `ASAPQueryEngine::handle_query`,
`ASAPQueryEngine::handle_query_promql`,
`ASAPQueryEngine::try_handle_query_promql_via_timeline`, the
range-query equivalents, and the whole helper tree rooted at
those entry points. Drops the orphan
`crates/promql_utilities/src/ast_matching/` module. Updates
`process_via_simple_engine` (and other http.rs callers) to route
through modern `QueryEngine::execute()` only.
Preserves the capability-miss notify side-effect by adding
`spawn_capability_miss_notify` calls in modern execute()'s four
miss branches: empty-sids, ghost/unknown sid, capability
mismatch, AND the no-sketch-index fallback at the top of
execute() -- the last one is critical because
`capability_miss_http_e2e_tests::http_capability_miss_feedback_loop_closes_over_http`
wires the engine without `.with_sketch_index(...)`.
Test plan:
* `cargo test -p data_plane --lib`: 712 passed, 0 failed, 2 ignored.
* `cargo test -p data_plane --lib capability_miss_http_e2e`:
1 pass, 1 ignored.
* `cargo test -p control_plane --lib`: 706 pass.
Closes step 4 of #272.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 18, 2026
Closed
zzylol
added a commit
that referenced
this pull request
May 18, 2026
…#272 step 4) (#288) Issue #272 step 4 asks to "re-enable the two ignored cross-reconfigure dispatch tests in `tests/schema_timeline_dispatch_tests.rs`". That file no longer exists: it was deleted in PR #280 (B7.5 v2) along with the legacy `handle_query_promql` family it exercised, and its two ignored tests were `panic!()` stubs with no real implementations. The only remaining ignored cross-reconfigure test (`test_get_timeline_returns_segments_after_reconfigure` in `http.rs:2440`) is wedded to the pre-#189 `SchemaRegistry::reconcile()` contract that eagerly populated the timeline source on YAML POST. Post-#189 the sid lifecycle is explicit (see `lifecycle::reconcile_from_streaming_config` module doc): "There is no 'added' set: sids are minted lazily by the ingest path on first write". Re-enabling the test as written requires either an architectural switch to eager sid minting (contradicts the documented sid lifecycle) or rewriting the test to interleave an ingest step (changes the contract being tested) — both out of scope for #272. Updates the `#[ignore]` reason + comment to document this resolution so the next maintainer doesn't re-investigate. No production change; no test count delta (baseline stays 727 lib + 2 ignored). Closes step 4 of #272 as obsoleted by #280. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
zzylol
added a commit
that referenced
this pull request
May 18, 2026
…legacy retirement (#289) 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
Re-doing B7.5 in a clean branch — the prior attempt's branch was deleted in a parallel-agent merge confusion (the file diff that landed under the original PR title #278 turned out to be the unrelated B3
control_plane/emit/work). Step 4 of #272.ASAPQueryEngine::handle_query,handle_query_promql,try_handle_query_promql_via_timeline, the range-query equivalents, and the whole helper tree rooted at those entry points (build_query_execution_context_promql,execute_query_pipeline,execute_range_query_pipeline,build_promql_execution_context_tail, etc.).crates/promql_utilities/src/ast_matching/module + its lone consumerquery_logics/parsing.rs.process_via_simple_engine, the range-query path, andhandle_precompute_jobinhttp.rsto route exclusively through modernQueryEngine::execute()/execute_range_promql_modern().control_plane_patterns: HashMap<QueryPatternType, Vec<PromQLPattern>>field + initialization fromASAPQueryEngine.Preserves the capability-miss notify side-effect
The legacy path's
find_compatible_aggregation_with_miss_notifyfiredspawn_capability_miss_notifyon miss. Modernexecute()now does the same in all four miss branches:sids.is_empty()(no policy matches candidate)Ghost/Unknownsid classifyhit_sids.is_empty()(capability mismatch)execute()—capability_miss_http_e2e_tests::http_capability_miss_feedback_loop_closes_over_httpwires the engine WITHOUT.with_sketch_index(...), so this branch is the one the test exercises.Test plan
cargo check -p data_plane— cleancargo test -p data_plane --lib— 712 passed, 0 failed, 2 ignoredcargo test -p data_plane --lib capability_miss_http_e2e— 1 pass, 1 ignored, 0 failed (the make-or-break feedback-loop test)cargo test -p control_plane --lib— 706 passcargo check -p promql_utilities— cleancargo check --workspace— cleanCloses step 4 of #272.
🤖 Generated with Claude Code