Skip to content

refactor(query): delete legacy handle_query family (B7.5 v2 redo) - #280

Merged
zzylol merged 1 commit into
mainfrom
b7-5-retire-legacy-handle-query-final-v2
May 18, 2026
Merged

zzylol merged 1 commit into
mainfrom
b7-5-retire-legacy-handle-query-final-v2

Conversation

@zzylol

@zzylol zzylol commented May 18, 2026

Copy link
Copy Markdown
Contributor

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.

  • Deletes 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.).
  • Drops orphan crates/promql_utilities/src/ast_matching/ module + its lone consumer query_logics/parsing.rs.
  • Updates process_via_simple_engine, the range-query path, and handle_precompute_job in http.rs to route exclusively through modern QueryEngine::execute() / execute_range_promql_modern().
  • Removes the control_plane_patterns: HashMap<QueryPatternType, Vec<PromQLPattern>> field + initialization from ASAPQueryEngine.

Preserves the capability-miss notify side-effect

The legacy path's find_compatible_aggregation_with_miss_notify fired spawn_capability_miss_notify on miss. Modern execute() now does the same in all four miss branches:

  1. sids.is_empty() (no policy matches candidate)
  2. Ghost/Unknown sid classify
  3. hit_sids.is_empty() (capability mismatch)
  4. CRITICAL — no-sketch-index fallback at the bottom of execute()capability_miss_http_e2e_tests::http_capability_miss_feedback_loop_closes_over_http wires the engine WITHOUT .with_sketch_index(...), so this branch is the one the test exercises.

Test plan

  • cargo check -p data_plane — clean
  • 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, 0 failed (the make-or-break feedback-loop test)
  • cargo test -p control_plane --lib — 706 pass
  • cargo check -p promql_utilities — clean
  • cargo check --workspace — clean

Closes step 4 of #272.

🤖 Generated with Claude Code

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>
@zzylol
zzylol merged commit b58a9fb into main May 18, 2026
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>
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>
@zzylol
zzylol deleted the b7-5-retire-legacy-handle-query-final-v2 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