You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df39d3a
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(ir): split L2 relational + converter into asap-l2, slim asap-ir to L3
Per @milind's #57 feedback ("a lot fits into asap-ir"). asap-ir was 3.9k LOC
holding L2 relational + L3 canonical IR + the L2→L3 converter + binder +
resolution. Split along the real (non-cyclic) seam:
- asap-ir (2.3k, was 3.9k): the L3 canonical IR only — query_expr, agg_intent,
expr_ir, schema, names (+ types, workload).
- asap-l2 (1.6k, new): the L2 relational algebra + the L2→L3 converter —
relational, lower (convert_root), binder, column_resolution. Depends on asap-ir.
The apparent L2↔L3 module cycles were doc-comment links, not code deps; the
real graph layers cleanly.
Isolation wins:
- asap-sketch and asap-plan now depend on asap-ir alone — they never pull the
converter/binder machinery (cargo tree: 0 asap-l2 in either).
- Front ends depend on asap-ir (L3 types) + asap-l2 (relational + convert_root).
- Parser quarantine unchanged (promql frontend: 0 datafusion).
Docs (README, design.md §5.1/§6.0/P1, migration-plan) updated: dependency
table, directory tree, and the "why L2 and L3 are separate crates" rationale.
No behavior change; full workspace suite green; clippy --all-targets clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Splitting the front ends **quarantines their parsers**: a caller that needs
51
-
only PromQL depends on `asap-frontend-promql` and never compiles DataFusion,
52
-
and vice-versa (verified with `cargo tree`). `asap-lower` is the convenience
53
-
facade for callers that want both.
51
+
Two isolation wins fall out of this:
52
+
-**The front ends quarantine their parsers** — a caller that needs only PromQL depends on `asap-frontend-promql` and never compiles DataFusion, and vice-versa (verified with `cargo tree`). `asap-lower` is the facade for callers that want both.
53
+
-**L3-only consumers stay lean** — `asap-sketch` and `asap-plan` depend on `asap-ir` alone, so they never pull the L2 relational tree, the converter, or the binder (`asap-l2`). Only the front ends, which actually *lower* queries, need `asap-l2`.
54
54
55
55
### Directory structure
56
56
57
57
```
58
58
crates/
59
-
├── ir/ # asap-ir — the shared IR (largest crate)
59
+
├── ir/ # asap-ir — L3 canonical IR (the shared vocabulary)
cleanly separated and could split into their own crates later if the crate
91
-
grows unwieldy; for now they share one compilation unit to keep the converter's
92
-
tight coupling in-crate.
88
+
**Why L2 and L3 are separate crates.**`asap-ir` is the canonical L3 IR — the
89
+
vocabulary every downstream layer pivots on. The L2 relational tree and the
90
+
L2→L3 converter live in `asap-l2` because only the *front ends* need them: they
91
+
emit L2 and call `convert_root`. Keeping them out of `asap-ir` means the
92
+
optimizer (`asap-plan`), the sketch IR (`asap-sketch`), and any future
93
+
L3-consuming layer compile against a lean core without the converter/binder
94
+
machinery. (The converter co-locates with L2 rather than L3 because it owns the
95
+
L2 tree definition and only *reads* L3.)
93
96
94
97
*(Planned.)* A new deployment model will land by adding one crate with `rules.rs` (pick L4 rules) + `topology.rs` + an emitter, plus one line in `bin/asap-controller/main.rs` — no changes to the IR crates.
0 commit comments