Skip to content

refactor: delete the dead Language-trait / language_logical_plan L1+L2 scaffold - #230

Merged
zzylol merged 1 commit into
mainfrom
pr-delete-dead-scaffold
May 14, 2026
Merged

zzylol merged 1 commit into
mainfrom
pr-delete-dead-scaffold

Conversation

@zzylol

@zzylol zzylol commented May 14, 2026

Copy link
Copy Markdown
Contributor

Stacked on #229 — review/merge that first.

PR 1 of the "de-legacy the L1/L2 path" cleanup.

What & why

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 — and never wired in. The pipeline that actually runs is query_parser::{promql,sql}.rslegacy_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.

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.rs re-exports, one unused main.rs import, and doc comments. Nothing in data_plane/ or crates/ touches it.

Changes

  • Delete control_plane/src/language_logical_plan/ and control_plane/src/query_parser/language/ (~620 lines).
  • Drop the pub mod / pub use re-exports (lib.rs, query_parser/mod.rs) and the unused main.rs import.
  • design.md: current-state references repointed at the real L1/L2 path (query_parser/{promql,sql}.rslegacy_expr::QueryExpr); the §6 core::query_language / core::logical_plan target design is left intact — the Language-trait extension point gets rebuilt when a second real language backend needs it.

Test plan

  • cargo build --workspace clean
  • cargo test -p control_plane — 741 pass (714 + 27), 0 failures

Next

PR 2 renames legacy_expr → an honest L2-relational name and legacy_to_canonical → an L2→L3 lower name, now that legacy_expr is unambiguously the L2 IR.

🤖 Generated with Claude Code

…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
zzylol force-pushed the pr-delete-dead-scaffold branch from 2006ec1 to 0a62c24 Compare May 14, 2026 21:00
@zzylol
zzylol changed the base branch from pr-slim-legacy-expr to main May 14, 2026 21:00
@zzylol
zzylol merged commit 15836d6 into main May 14, 2026
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>
@zzylol
zzylol deleted the pr-delete-dead-scaffold branch July 17, 2026 20:06
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