refactor: delete the dead Language-trait / language_logical_plan L1+L2 scaffold - #230
Merged
Merged
Conversation
…2 scaffold
`query_parser/language/` (the `Language` trait, `LanguageAst`,
`PromQLLanguage` + stub `SqlLanguage`/`ElasticDslLanguage`, `PromQLAst`)
and `language_logical_plan/` (`LanguageLogicalPlan`, `lower_to_logical_plan`)
were built as the "real" L1/L2 stack ahead of their call site — and then
never wired in. The pipeline that actually runs goes
`query_parser::{promql,sql}.rs` → `legacy_expr::QueryExpr` (L2) →
`legacy_to_canonical` (L3); this parallel stack fed nothing.
It had also drifted out of sync: `LanguageLogicalPlan::PromQL.tree` is
typed as the canonical L3 `QueryExpr` and filled from
`parse_query_expr_canonical`, so the "L2" layer didn't even hold an L2
tree, and its module docs contradicted each other on whether
`legacy_expr` was L2 or L3.
Verified no consumers outside the two directories — the only references
were `lib.rs` / `query_parser/mod.rs` re-exports, an unused `main.rs`
import, and doc comments. Nothing in `data_plane/` or `crates/` touches
it. ~620 lines of dead code removed.
The per-language `Language`-trait extension point is a reasonable design
(design.md §6 `core::query_language` / `core::logical_plan` still describe
it as the target) — it gets rebuilt when a second real language backend
needs it, rather than kept as drifting scaffolding. design.md's
current-state references updated to point at the real L1/L2 path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zzylol
force-pushed
the
pr-delete-dead-scaffold
branch
from
May 14, 2026 21:00
2006ec1 to
0a62c24
Compare
2 tasks
zzylol
added a commit
that referenced
this pull request
May 14, 2026
…canonical → lower_to_canonical (#231) The "legacy" naming was a misnomer. After #228–#230, `legacy_expr` is the real, current **L2 relational IR** every `query_parser` front end emits, and `legacy_to_canonical` is the genuine **L2→L3 lowering pass** — neither is removable debt; the 5-layer design mandates both layers exist. Pure rename, no behavior change: * `intent_algebra/legacy_expr.rs` → `intent_algebra/relational.rs` * `intent_algebra/legacy_to_canonical.rs`→ `intent_algebra/lower_to_canonical.rs` * the `convert_legacy` re-export alias → `convert` All ~25 consumer modules updated to the new paths; module-header docs and design.md §3/§6 references refreshed so they describe `relational` as the L2 IR rather than calling it legacy. The type is still spelled `QueryExpr` (consumers already disambiguate it from the canonical `query_expr::QueryExpr` via the established `LQueryExpr` alias) — a type rename is a separate, larger change if wanted. The word "legacy" no longer appears in any live module path or identifier in this area; remaining "legacy" mentions elsewhere refer to genuinely pre-canonical code (the untyped optimizer/physical path, `accuracy_sla`, etc.), not this IR. 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.
Stacked on #229 — review/merge that first.
PR 1 of the "de-legacy the L1/L2 path" cleanup.
What & why
query_parser/language/(theLanguagetrait,LanguageAst,PromQLLanguage+ stubSqlLanguage/ElasticDslLanguage,PromQLAst) andlanguage_logical_plan/(LanguageLogicalPlan,lower_to_logical_plan) were built as the "real" L1/L2 stack — and never wired in. The pipeline that actually runs isquery_parser::{promql,sql}.rs→legacy_expr::QueryExpr(L2) →legacy_to_canonical(L3). This parallel stack fed nothing.It had also drifted out of sync:
LanguageLogicalPlan::PromQL.treeis typed as the canonical L3QueryExprand filled fromparse_query_expr_canonical— so the "L2" layer didn't even hold an L2 tree — and its module docs contradicted each other on whetherlegacy_exprwas L2 or L3.This was the root of the "two things both called L2" confusion flagged in the #229 follow-up discussion.
Verification
Grepped the whole workspace — the only references outside the two deleted directories were
lib.rs/query_parser/mod.rsre-exports, one unusedmain.rsimport, and doc comments. Nothing indata_plane/orcrates/touches it.Changes
control_plane/src/language_logical_plan/andcontrol_plane/src/query_parser/language/(~620 lines).pub mod/pub usere-exports (lib.rs,query_parser/mod.rs) and the unusedmain.rsimport.query_parser/{promql,sql}.rs→legacy_expr::QueryExpr); the §6core::query_language/core::logical_plantarget design is left intact — theLanguage-trait extension point gets rebuilt when a second real language backend needs it.Test plan
cargo build --workspacecleancargo test -p control_plane— 741 pass (714 + 27), 0 failuresNext
PR 2 renames
legacy_expr→ an honest L2-relational name andlegacy_to_canonical→ an L2→L3lowername, now thatlegacy_expris unambiguously the L2 IR.🤖 Generated with Claude Code