feat(controller): Phase D — query_language L1 trait + language_logical_plan L2 + PromQL backend - #274
Merged
Merged
Conversation
…l_plan L2 + PromQL backend Introduces the L1 (query_language) and L2 (language_logical_plan) modules per design.md §6. Wraps the existing PromQL parser behind a multi-language Language trait without touching the legacy query_parser surface; SQL, DataFusion, and ElasticDsl backends are stubs returning ParseError::Unimplemented so the type system stays uniform while the DC build ships PromQL only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
zzylol
added a commit
that referenced
this pull request
May 6, 2026
…nfig constructors (#276) PR #204 added the `data_sink: AgentDataSink` field to `AgentCollectorConfig` (production sites updated) but missed nine test-fixture / test-code constructors, leaving `cargo test --release -p controller` blocked at compile-time. This broke the baseline for downstream PRs (#273, #274, #275) which could not run their newly added unit tests. Mechanical fill-in only, no semantic change to existing tests: - 7 sites use `AgentDataSink::default()` (Otlp-to-backend) — the canonical default that PR #204 introduced for new pipelines. - 2 sites (`config::agent::tests::ddsketch_cfg` and `main::api_tests::generated_agent_yaml_contains_opamp_extension`) pin `AgentDataSink::PrometheusScrape { endpoint: "0.0.0.0:8889" }` because their pre-existing assertions check for the legacy `prometheus` exporter on :8889. Pinning the sink keeps the test semantics intact rather than rewriting the asserts. After the fix: - `cargo build --release -p controller` clean. - `cargo test --release -p controller --no-run` clean (was the blocker). - `cargo test --release -p controller` runs 395 tests; 389 pass, 6 pre-existing failures unrelated to `data_sink`: * 2 in `analyzer::tests` — float-precision asserts. * 4 in `opamp::tests` / `api_tests` — protobuf framing ("invalid tag value: 0") on `ServerToAgent` decode. These are tracked separately and out of scope for this PR. - Newly-shipped tests now run end-to-end: `query_language` (8), `language_logical_plan` (6), `types_v2` (7), `algebra` (intent_algebra family, 6+). 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
Phase D of the controller-design alignment per
controller/docs/design.md§6: introduces L1 (query_language) + L2 (language_logical_plan) and wraps the existing PromQL parser behind a multi-languageLanguagetrait. PromQL is the only active backend;Sql,DataFusion,ElasticDslare stubbed withParseError::Unimplementedso the type system is uniform while the DC build ships PromQL only.controller/src/query_language/):Languagetrait +LanguageAstsum + per-language sub-modules. PromQL backend is a thin adapter overquery_parser::{parse_query, parse_query_expr}— no parsing logic duplicated.controller/src/language_logical_plan/):LanguageLogicalPlan(one variant per language) +lower_to_logical_plan(LanguageAst) -> LanguageLogicalPlanpass. PromQL's L2 IS the existingQueryExprtree (rebadged + paired with a flatLanguageLogicalPlanSummaryprojection).query_parser/is read-only — its public surface (parse_query,parse_query_expr,ParsedQuery) stays unchanged for back-compat withanalyzer::Analyzer.Module layout
Coordination with Phase B
controller/src/main.rsadd:mod query_language; mod language_logical_plan;— may conflict with Phase B'smod intent_algebra;. Trivial 3-way merge. The crate has nolib.rs(bin-only), so module declarations live inmain.rsinstead — orchestrator should treat both phases' edits the same way regardless.Pre-existing test breakage (NOT introduced here)
origin/mainatbe44752(post-#273) has 9 pre-existing E0063 errors in test code incontroller/src/config/{agent,asapquery_backend,precompute}.rsandcontroller/src/main.rs::api_tests— all readingmissing field 'data_sink' in initializer of types::AgentCollectorConfig. #273 addeddata_sinktoAgentCollectorConfigbut missed those test sites. Per Phase D constraints I cannot touchtypes.rs,config/, ormain.rs::api_tests, so I left them alone. Consequence:cargo build --release -p controller— clean (my new modules add zero warnings).cargo check --release --testsforquery_language/language_logical_plan— clean (my new test code compiles).cargo test --release -p controller— fails to build due to pre-existing feat(controller): additive QuerySpec types from design.md (QueryShape/DataShape/AccuracyTarget/QueryLanguage) #273 oversight, NOT due to anything in this PR.cargo clippy --release -p controller --all-targets -- -D warnings— fails on pre-existingKLL/HLL/etc. naming-acronym warnings intypes.rs; zero clippy hits in this PR's new modules (cargo clippy --releasefiltered toquery_language|language_logical_planreturns nothing).Recommend a follow-up trivial fix-test PR (or amend #273) to populate
data_sinkin those constructors.Test plan
cargo test --release -p controller query_language— all 8 new tests green.cargo test --release -p controller language_logical_plan— all 6 new tests green.cargo test --release -p controller query_parser— existing tests not regressed (this PR does not modifyquery_parser/).cargo build --release -p controllerclean.query_language/orlanguage_logical_plan/.🤖 Generated with Claude Code