fix(control_plane): rebase derive_agg_role onto the new parse_query_expr_canonical signature - #429
Merged
Merged
Conversation
…L-string sniff derive_agg_role() used to guess a workload entry's AggRole (Quantile/ Sum/Count/Topk/Other) by sniffing the leading token of its PromQL query_string -- the same duplicate-classifier smell already retired from the live serving path (the old two-analyzer comparison in analyzer-parity-matrix.md, #422). Now parses the query through the same canonical pipeline capability_for()/serving uses (query_parser::parse_query_expr_canonical), runs it through the L3 rule-based optimizer (QueryOptimizer::new(0.0).optimize -- TopKFusion is a pure structural rewrite, ignores the cost model, so the placeholder throughput doesn't affect the outcome) so topk(k, m) actually reaches an Aggregate{TopK} node instead of staying Sort+Limit, then classifies by the real outer AggIntent (collect_agg_intents, now pub(crate) for this reuse). Two things this surfaced: - `(quantile_over_time(0.9, m[5m]))` (redundant wrapping parens) -- the old leading-token sniff finds an empty token at a `(` and mis-defaults to Sum; real classification is unaffected by surface punctuation. New test pins this. - `topk_over_time(...)` was in the old test's query list but isn't a real function this parser (or vanilla PromQL) recognizes at all -- confirmed via grep, nowhere in query_parser/promql.rs or intent_algebra/lower.rs. A workload entry with that query_string would fail to parse anywhere else in the real pipeline too, so the old heuristic classifying it as Topk was itself the bug. Test updated to drop it, with an explanatory comment. cargo build --workspace clean; control_plane 727/727 (one pre-existing, unrelated skip as before), workload:: 33/33 (32 + 1 new test). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…x histogram_quantile role parse_query_expr_canonical now requires an AccuracyTarget (landed in #428, merged after this branch was cut) -- thread the workload entry's own accuracy_sla through via accuracy_target_from_legacy_accuracy_sla rather than leaving this call site broken. Also fixes a real misclassification #428 surfaced: the classic-bucket histogram_quantile(0.99, rate(m_bucket[5m])) shape now lowers to the real, exact-only AggIntent::HistogramQuantile (not the sketchable Quantile the old local parser always substituted). derive_agg_role's wildcard arm already routed this to AggRole::Other correctly -- only the test's expectation was stale, asserting the old parser's behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
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
Supersedes #426 (
feat/derive-agg-role-via-aggintent), which was cut before #428 (L1 adoption) landed and changedparse_query_expr_canonical's signature to require anAccuracyTargetargument. #426 as-is would fail to compile once merged onto currentmain. This PR is #426's branch, merged forward onto currentmain, with the signature call site fixed and one real classification fallout from #428 corrected.entry.accuracy_slathroughaccuracy_target_from_legacy_accuracy_slaatderive_agg_role'sparse_query_expr_canonicalcall site, matching the pattern already used atmain.rs's/pipeline.rs's call sites.agg_role_quantile_query_strings:histogram_quantile(0.99, rate(m_bucket[5m]))now lowers to the real, exact-onlyAggIntent::HistogramQuantile(per control_plane: adopt asap-frontend-promql for L1 parsing (Part B) #428's L1 adoption), not the sketchableQuantilethe old local parser always substituted.derive_agg_role's existing wildcard arm already routes this toAggRole::Othercorrectly (matches its own doc comment) — only the test's expectation was stale. Split into its own test (agg_role_classic_bucket_histogram_quantile_is_other) pinning the real behavior.Test plan
cargo build --workspace --release— cleancargo test --release --lib -p control_plane— 712/712 (1 pre-existing, unrelated skip as before)cargo test --release --lib -p data_plane— 957/957🤖 Generated with Claude Code