Repository navigation
refactor: one crate per stage (#1207 PR 0b) - #1229
Merged
Merged
Conversation
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
2 times, most recently
from
November 6, 2026 19:10
ae4843e to
8d020b0
Compare
zzylol
force-pushed
the
refactor/1207-interfaces
branch
from
November 6, 2026 21:28
200ec5c to
341c98b
Compare
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
from
November 6, 2026 21:29
8d020b0 to
d1feaad
Compare
zzylol
force-pushed
the
refactor/1207-interfaces
branch
from
November 6, 2026 21:37
341c98b to
3a75e1e
Compare
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
3 times, most recently
from
November 6, 2026 22:46
cbd0359 to
4445d45
Compare
milindsrivastava1997
previously approved these changes
Nov 7, 2026
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
2 times, most recently
from
November 7, 2026 20:51
84cf80d to
69fed95
Compare
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
3 times, most recently
from
November 9, 2026 03:33
b768e8d to
0e0f75a
Compare
zzylol
force-pushed
the
refactor/1207-interfaces
branch
from
November 9, 2026 04:25
e9d9f5a to
2ed6ec0
Compare
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
from
November 9, 2026 04:31
0e0f75a to
058ea42
Compare
zzylol
force-pushed
the
refactor/1207-interfaces
branch
from
November 10, 2026 13:37
2ed6ec0 to
61541f7
Compare
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
from
November 10, 2026 13:37
058ea42 to
a4290ee
Compare
zzylol
dismissed
milindsrivastava1997’s stale review
November 10, 2026 14:57
The base branch was changed.
Move-only. Split asap-logical-asap-optimization into asap-stage0-memo, asap-stage1-pass1-per-computation-candidates and asap-stage1-pass2-reuse-candidates; rename asap-physical-asap-optimization to asap-stage2-physical-optimization and asap-plan-selection to asap-stage3-plan-selection. The old test_support splits by caller. The crate-graph test checks the new crates; no stage crate depends on another.
Pass 1's tests that build Stage 0's memo and Stage 0's tests that lower PromQL through Pass 1 are deleted, with the dev-dependencies and helpers only they used. lower_promql moves to Pass 1's test fixtures, so Pass 1 no longer depends on the PromQL frontend outside its own tests. The crate-graph test now also checks dev-dependencies between stage crates.
…1207 PR 0b) Frontend tests that compose Pass 1 candidates and Pass 1 tests that lower PromQL through the frontend are deleted, with the helpers, dev-dependencies and test targets only they used. MetricsQL's test that compares with PromQL's lowering goes too, so no frontend tests depend on another frontend. The crate-graph test checks dev-dependencies between stage crates with no exceptions.
…R 0b) The PromQL test that planned through asap-planner is deleted with its planner_support helpers; the PromQL and SQL frontends drop their asap-planner dev-dependency, and PromQL its unused asap-accuracy one. The crate-graph test now also forbids a stage crate's dev-dependency on the facade.
zzylol
force-pushed
the
refactor/1207-crates-per-stage
branch
from
November 10, 2026 15:01
a4290ee to
cadf5d5
Compare
zzylol
marked this pull request as ready for review
November 10, 2026 15:02
zzylol
commented
Nov 10, 2026
zzylol
commented
Nov 10, 2026
#1207 PR 0b) - Pass 1: realization.rs -> summary_realization.rs; computation_targets_tests.rs -> tests.rs. - Pass 2: no memo/ level. rules.rs (Pass2RuleError), rules/rollup.rs, rules/topk.rs, rules/chains.rs (was memo/window_candidates.rs). generate_logical_asap_memo_candidates runs PR 4's steps in order: rollup from the finest common group, top-k reuse, then readout requirements, dead-candidate elimination, chain groups and the logical edges (todo!() until PR 4). The finer-aggregate, scan-label, summary-input and window-rollup stubs are deleted, and so are pass2_local_window_composition and pass2_after_local_window_composition; the developer tools show one Pass 2 step. - Stage 2: catalog/mod.rs -> lib.rs. - Stage 3: select.rs -> lib.rs. - Planner: PlanningModels moves from pass.rs to models.rs.
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
asap-types,asap-accuracy,asap-cost; each crate exposes only what others use; the facade calls the stages in order, checked by the crate-graph test) were not enforceable: Stage 0 and both Stage 1 passes were one crate,asap-logical-asap-optimization, kept apart only by a source-scanning test (pass_layering.rs).asap-stage0-memo,asap-stage1-pass1-per-computation-candidates,asap-stage1-pass2-reuse-candidates, and the renamedasap-stage2-physical-optimization,asap-stage3-plan-selection), moved withgit mv;crate_graph.rsnow also forbids stage-to-stage and stage-to-facade[dev-dependencies], so tests that crossed stage crates are deleted (79 on PR 0's headbe6ea1d6a, pluspass_layering.rs's 2).crate_graph(6 tests) fails on any new edge. Test status: 1,062 passed / 191 failed / 9 ignored, every failure at a PR 0todo!()except one stale fixture.Review guide
828a2aaae); refactor(types): properties and requirements from #1207; chains as time-indexed state (#1207 PR 1) #1227 (PR 1) builds on it. Headc715a25c8. Diff vs base: 95 files, +886 / −2,926.pass1_memo,Pass1Error) and Pass 2's (generate_logical_asap_memo_candidatesand its two steps) are defined in their crate'slib.rs(L5, L6; nological_memo_candidates.rs), and Pass 1's target code iscomputation_targets.rswithcomputation_targets_tests.rs. Tests: same results by name as the previous heada4290eeef(backupbackup/1207-layout-crates-per-stage-a4290eeef).c715a25c8): each stage crate'slib.rsholds the crate doc, the entry function and the re-exports; the other files are by scope (table under Interfaces, "Stage crate layout"). Pass 2's skeleton is PR 4's: the stubs of the old rules 2–7 that PR 4 replaces are deleted (see Decided). Moves and renames otherwise; no logic change.Cargo.tomlmembers and each new crate'sCargo.toml; the three new crate roots (crates/stage0-memo/src/lib.rs,crates/stage1-pass1-per-computation-candidates/src/lib.rs,crates/stage1-pass2-reuse-candidates/src/lib.rs);integration-tests/tests/crate_graph.rs;planner/src/run.rs(paths only).git log --follow); path rewrites inside moved files (crate::pass1::X→crate::X,crate::pass1::computation_targets→crate::computation_targets,crate::stage0::memo_of_queries→asap_stage0_memo::memo_of_queriesin Pass 1 tests only; Pass 2'spass2.rsbecomes the crate root, somemo::rulesresolves from it); module visibility in the new roots (pub(crate) mod→mod); docs' crate names and paths.crate_graph.rsrule; the dev-dependencies removed.Behavior: before → after
No planning behavior changes: planning still reaches PR 0's first
todo!()(Stage 0'smemo_of_queries, filled in by PR 2). The design need is the crate boundary.asap-logical-asap-optimizationasap-stage0-memo,asap-stage1-pass1-per-computation-candidates,asap-stage1-pass2-reuse-candidatesasap-physical-asap-optimization,asap-plan-selectionasap-stage2-physical-optimization,asap-stage3-plan-selection(content unchanged)crate_graph.rsforbids the edge[dev-dependencies]not checked)asap-frontend-promql(optional,test-support)lower_promqlCrate graph (
[dependencies]edges between workspace crates; frontend helpers, devtools and integration-tests omitted). Before:After:
Interfaces
Only crate paths change, and Pass 2's entry is PR 4's (below); no other function body, type or signature changes. Permalinks at the head
c715a25c8.logical-asap-optimization/src/lib.rs(base, deleted) →stage0-memo/src/lib.rs·stage1-pass1-per-computation-candidates/src/lib.rs·test_support.rs·stage1-pass2-reuse-candidates/src/lib.rsPass 2's steps, inside the crate (
todo!()bodies until PR 4;pass2_local_window_compositionandpass2_after_local_window_compositionare not public any more, and the developer tools show one Pass 2 step):types/src/test_support.rsasap-stage2-physical-optimizationandasap-stage3-plan-selectionexpose the same items asasap-physical-asap-optimizationandasap-plan-selection.asap_planner::{DeploymentCapabilities, SupportedSummary}re-export fromasap_types::deployment_capabilities(moved there by PR 0). The stage-document JSON keys (stage1_logical_asap_optimization,stage2_physical_asap_optimization,stage3_plan_selection) are a document format, not crate names, and are unchanged; so are the viewer and the snapshots.The old crate's
test_support.rs, split by caller:generate_per_computation_candidates(re-export ofcomputation_targets)asap_stage1_pass1_per_computation_candidates::test_support(featuretest-support)lower_promqlshare_common_sub_dags(re-export)cse.rs;asap-stage0-memohas notest-supportfeaturepopulation_over_selectorasap_types::test_supportmetric_scan,metric_scan_with_keys,scan,scan_fromstage1-pass1-per-computation-candidates/src/test_fixtures.rs(#[cfg(test)], not exported)cms_summary,weighted,estimate_overPerComputationCandidates(re-export)hll_classic_failure_statistic,aggregate,agg,without_agg,filter,dedup,time_range,entry,entry_withFile → crate map (folder names are crate names without
asap-):logical-asap-optimization/Cargo.tomlCargo.tomls, each with only its own dependencies (asap_sketchlib,serde,rmp-serdeof the old crate were unused)logical-asap-optimization/src/lib.rssrc/stage0.rsstage0-memo/src/lib.rs(src/stage0/cse.rsdeleted in PR 0)src/pass1.rs(pass1_memo,Pass1Error);src/pass1/{computation_targets, computation_targets_tests, realization}.rsstage1-pass1-per-computation-candidates/src/lib.rs(the entry is defined there);computation_targets.rs,tests.rs,summary_realization.rs(only Pass 1 calls it)src/pass2.rs(the entry functions);src/pass2/memo.rs,memo/rules.rs,memo/rules/{finer_aggregate,rollup,scan_labels,summary_inputs,topk}.rs,memo/window_candidates.rsstage1-pass2-reuse-candidates/src/lib.rs(the entry is defined there);rules.rs,rules/{rollup,topk}.rs,rules/chains.rs(wasmemo/window_candidates.rs);memo.rsand thefiner_aggregate,scan_labelsandsummary_inputsstubs deletedsrc/deployment_capabilities.rstypes/src/deployment_capabilities.rson PR 0 (moved there 2026-11-07, same content)tests/pass_layering.rscrate_graph.rschecks itphysical-asap-optimization/**stage2-physical-optimization/**;src/catalog/mod.rs→src/lib.rs(src/catalog/realize.rsdeleted in PR 0)plan-selection/**stage3-plan-selection/**;src/select.rs→src/lib.rs(src/models.rsdeleted in PR 0)planner/src/pass.rs(PlanningModels)planner/src/models.rsStage crate layout (2026-11-10)
Files a later PR creates are named with it; this PR only moves what exists.
stage0-memolib.rs(memo_of_queries)stage1-pass1-per-computation-candidateslib.rs(pass1_memo,Pass1Error),computation_targets.rs,candidates.rs(PR 3),summary_realization.rs(wasrealization.rs),tests.rs(wascomputation_targets_tests.rs),test_fixtures.rs,test_support.rsstage1-pass2-reuse-candidates(nomemo/level)lib.rs(generate_logical_asap_memo_candidates, its steps in order),rules.rs(Pass2RuleError; PR 4's shared helpers),rules/rollup.rs,rules/topk.rs,rules/chains.rs(wasmemo/window_candidates.rs),requirements.rsanddead_candidates.rs(PR 4), tests (PR 4)stage2-physical-optimization(nocatalog/)lib.rs(generate_physical_asap_memo_candidates, wascatalog/mod.rs),candidates.rsandpruning.rs(PR 5),tests.rsstage3-plan-selectionlib.rs(select_plan, wasselect.rs),milp/model.rs,milp/execution_contexts.rsandmilp/objective.rs(PR 6–7),plan.rs(PR 6),report.rs, testsplannerlib.rs,run.rs,pass.rs(OptimizationPass,PassRegistry,optimize,check_contract),models.rs(PlanningModels, moved out ofpass.rs),installable.rsUsage, end to end (
crates/planner/src/run.rs; the flow is unchanged, only the paths):Algorithm changes
None.
Decisions and open questions
Needs reviewer decision: None.
Decided:
finer_aggregate.rsandscan_labels.rs): Pass 2's skeleton is PR 4's from this PR on. PR 4 replaces the old rules 2–7 with its steps: rollup from the finest common group (which covers finer-aggregate reuse, rollup and the pairwise scan-label matching), top-k reuse, readout requirements, dead-candidate elimination and chain groups. So the stubs of finer aggregate, scan widening, summary inputs and window rollup are deleted here, withpass2_local_window_compositionandpass2_after_local_window_composition. Scan widening across label sets is not kept; it is tracked in Share one scan of a source across readers with different predicates, labels and time ranges (subsumption derivations) #951. Summary inputs need no rule: Stage 0 already makes every sub-expression its own group, and Pass 1 (PR 3) builds each summary over the aggregate's input group with the value expression in the build'sSummaryUpdate, a pushed-down key-only filter becoming its ownFiltergroup.OriginOfCandidateForMemoGroup::{SummaryInput, WidenedScans}stay inasap-typesuntil PR 4 deletes them.add_chain_groups(step 5) carries#[allow(dead_code)]until PR 4 calls it after dead-candidate elimination.lib.rsholds the crate doc, the entry function and the re-exports; Stage 2 dropscatalog/, Stage 3'sselect.rsbecomeslib.rs,PlanningModelsgets its ownmodels.rs.lib.rs; Pass 1's target code iscomputation_targets.rs. This PR is restacked onto main after refactor: define every stage's interfaces from #1207 and delete the ones they replace (#1207 PR 0) #1226's file layout; it changes no content beyond the crate split.todo!().crate_graph.rs. Its only users wereexternal_corpus.rs(via PromQL'stests/support.rs, deleted for calling Pass 1) andvector_negation_lowers_as_in_promql.summary_realization.rs(wasrealization.rs) stays in Pass 1 (only Pass 1 calls it, though it was documented as shared). If Pass 2's rules (PR 4) need it, it moves toasap-types(IR helpers) rather than Pass 2 depending on Pass 1.stage1-pass1-per-computation-candidates/src/test_fixtures.rs(#[cfg(test)]), holding the fixtures only Pass 1's own tests call, so the crate does not export them. No new abstraction.Verification
cargo test -p <crate> --all-features --no-fail-fastat the head;cargo fmt --checkandcargo clippy --workspace --all-targets --all-features -- -D warningsclean;crate_graph: 6 passed. Newly failing vs base (PR 0), by test name: 0. Against PR 0 the only differences are the deleted cross-stage tests and the moved test paths (pass1::…→ crate root); no test changed result. Every failure panics at a PR 0todo!(), except the stale fixture (PR 9).retention_msisassertion failed: output.status.success(): 2retention_ms(PR 6): 3; stale old-wire fixture (PR 9): 1;crate_graph6 passedScope-layout check (head
c715a25c8vscadf5d579):cargo test -p asap-stage1-pass1-per-computation-candidates -p asap-stage1-pass2-reuse-candidates -p asap-stage2-physical-optimization -p asap-stage3-plan-selection -p asap-planner -p asap-devtools --no-fail-fast: 59 passed / 74 failed / 4 ignored on both, the same tests by name; no test covered the deleted stubs (their bodies weretodo!()), so none is deleted;cargo check --workspace --testswith no warnings,cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkclean.Restack check (2026-11-10, head
cadf5d579vs previous heada4290eeef):cargo test -p asap-types -p asap-accuracy -p asap-cost -p asap-stage0-memo -p asap-stage1-pass1-per-computation-candidates -p asap-stage1-pass2-reuse-candidates -p asap-stage2-physical-optimization -p asap-stage3-plan-selection --no-fail-fast: 258 passed / 3 failed / 0 ignored on both, the same tests by name (the workload doctests moved withworkload/query.rs);crate_graph: 6 passed;cargo check --workspace --testswith no warnings,cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkclean. The other crates were not rerun for the restack (their changes are import paths). The per-crate table below is from the previous head.The move itself was checked test by test before the rebases:
cargo test --workspace --no-fail-faston PR 0 (dab3d064f) and on this PR's move commit (80b5b09b8) gave every test the same result by name, exceptpass_layering.rs's 2 deleted tests. On each deletion commit (dfc78f40dgroup 1,f6e2daa49group 2,4d5537310group 3),cargo testwas re-run for the crates it changes; each remaining test had its PR 0 result. Per crate then (PR 0 atdab3d064f→ this PR):asap-types200/2/0 → 201/2/0;asap-frontend-promql221/6/1 → 218/0/0;asap-frontend-metricsql18/0/0 → 15/0/0;asap-frontend-sql175/0/0 → 174/0/0;asap-logical-asap-optimization95/13/0 → (stage0-memo 24/0/0, Pass 1 12/1/0, Pass 2 0/0/0);asap-integration-tests102/76/4 → 103/76/4; total 1259/221/10 → 1195/203/9; every other crate unchanged. The old crate's 95/13/0: 24/0/0 stayed in Stage 0 and 12/1/0 in Pass 1; 1/0/0 moved toasap-types(default_supports_everything_and_json_fills_the_rest); 56/12/0 deleted as cross-stage tests (groups 1 and 2); 2/0/0 deleted withpass_layering.rs. The frontends lost 7/5/1 (group 2) and 0/1/0 (group 3).crate_graph.rstests:optional_only_exception_rejects_the_edge_made_non_optionaldeleted (with theonly_if_optionalfield, no optional edge left);checker_ignores_dev_dependencies_and_external_crates→checker_ignores_external_crates_and_non_stage_dev_dependencies; addedchecker_rejects_a_dev_dependency_between_stage_crates(a stage crate's test may not call another stage crate) andchecker_rejects_a_frontend_dev_dependency_on_the_facade(nor the facade). The three new crates get theStagerole; the two renamed keep it.Dev-dependencies removed:
asap-coston the logical and physical crates (no test used them since PR 0 deletedtests/held_memory.rs);asap-planneron the logical crate withtest-support; after the deletions, Pass 1 onasap-stage0-memoandasap-frontend-promql, Stage 0 on Pass 1,asap-frontend-promqlandasap-frontend-sqlonasap-stage0-memoand Pass 1,asap-frontend-metricsqlonasap-stage0-memo, Pass 1 andasap-frontend-promql; group 3:asap-frontend-promqlandasap-frontend-sqlonasap-planner(SQL's had no user),asap-frontend-promqlonasap-accuracy. Pass 2 depends onasap-accuracy(PR 0 gave its entry the&dyn AccuracyEvidence). Themetrics_observabilitytest target is removed fromfrontend-promql/Cargo.toml(docs/develop_docs/metrics-observability-corpora.mdsays so; its fixtures stay).Deleted tests
82 tests deleted as cross-stage (63 passed, 18 failed, 1 ignored on PR 0 as of 2026-11-06), plus
pass_layering.rs's 2. On PR 07708f3668they were 79 (17 passed, 61 failed, 1 ignored; PR 0 renamedasap_input_and_invalid_accuracy_are_rejectedtoasap_input_is_rejectedand deletedcount_min_estimate_over_raw_data_samples_is_gated_on_the_metric). Since 2026-11-09 PR 0 deletes Pass 1's whole-workload composition (P11), so 36 of the tests below are deleted there, not here:a_quantile_estimate_shares_its_raw_data_samples_sign_only_inside_the_unit_interval,a_quantile_of_merged_tumbling_windows_shares_its_raw_data_samples_sign,aggregate_over_topk_candidates_compose,aggregate_replacement_preserves_sql_field_identity,avg_states_out_of_order_are_refused,benchmark_corpora_are_total_and_keep_their_coverage,binding_is_total_over_the_entire_corpus,cms_count_updates_total_ten_for_zero_positive_and_negative_samples,composed_avg_divides_sum_and_count_states,composed_candidate_replaces_chosen_target_with_summary_evaluation,composed_filters_and_having,composed_guarantees,composed_mixed_exact_and_sketch_measures_keep_output_names,composed_multi_measure_aggregate_joins_its_measures,corpus_lowers_and_binds,count_ranked_topk_fuses_to_one_global_heap_sketch,frequency_count_candidates_use_unit_weights,grouped_avg_composition_preserves_the_whole_schema,grouped_count_offers_hydra_but_selection_keeps_per_group_state,heap_weights_over_raw_data_samples_record_an_open_requirement,kubernetes_mixin_aggregates_over_topk_compose,multidimensional_ranked_item_is_a_structured_tuple,nested_sum_merges_into_one_exact_accumulator,normalized_additive_errors_compose_as_absolute_errors,own_having_subquery_is_substituted,per_series_avg_with_series_identity_composes_from_sum_and_count,per_series_rate_keeps_labels_and_retypes_its_state,subpopulation_columns_are_not_part_of_the_ranked_item_tuple,temporal_average_divides_with_a_finite_division_guard,temporal_per_entity_topk_uses_series_identity_and_sample_value,topk_keeps_known_labels_beside_series_identity,uncalibrated_frequency_evaluations_do_not_bypass_accuracy_targets,values_estimating_raw_data_samples_name_their_sign_by_the_metric,whole_expression_topk_over_a_grouped_sum_of_range_sums_reads_the_raw_data_samples,whole_expression_topk_partitions_index_the_heap_input,whole_expression_topk_replaces_the_heap_over_the_exact_sum. The tables keep the original lists for the record (results measured on PR 0 as of 2026-11-06).(1) Stage 0 ↔ Pass 1 (54 tests). Pass 1 takes Stage 0's
Memo, so every Pass 1 test that built its input withmemo_of_queriesgoes.stage0-memo/src/lib.rs(wasstage0.rs),mod testsrepeated_results_share_groups_but_quantile_levels_do_not,equal_keyless_deterministic_results_share_one_group,scalar_and_literal_roots_keep_workload_positions(3)memo_of_queriesover PromQL lowered through Pass 1'slower_promql: equal results share a group, different quantile levels do not;G2 / G2is one group read twice; scalar and literal roots keep their positions. (cse.rsand its 24 tests were deleted in PR 0.)stage1-pass1-per-computation-candidates/src/computation_targets_tests.rsscalar_root_producers_are_discovered_once,example_1_exact_q1_keeps_exact_accumulators_only,asap_input_and_invalid_accuracy_are_rejected,multi_measure_aggregate_has_one_target_per_measure,aggregate_without_realization_is_not_a_target,filtered_measure_keeps_candidates_and_records_its_filter; HAVING placement (11):key_only_having_is_pushed_below_and_keeps_candidates,value_having_stays_above_output_and_keeps_candidates,having_on_one_consumer_of_a_shared_aggregate_stays_above,a_scalar_reference_consumer_keeps_a_key_only_having_above,only_the_adjacent_of_stacked_filters_is_having,global_aggregate_having_stays_above,scalar_reference_filter_is_not_having,promql_scalar_operand_is_not_having,having_shared_with_a_project_consumer_stays_above,without_and_per_entity_having_stays_above,memo_cached_rules_preserve_occurrence_specific_having; composing a chosen candidate (10):composed_candidate_replaces_chosen_target_with_summary_evaluation,composed_filters_and_having,composed_avg_divides_sum_and_count_states,composed_multi_measure_aggregate_joins_its_measures,composed_mixed_exact_and_sketch_measures_keep_output_names,composed_guarantees,own_having_subquery_is_substituted,per_series_avg_with_series_identity_composes_from_sum_and_count,per_series_rate_keeps_labels_and_retypes_its_state,grouped_avg_composition_preserves_the_whole_schema— 27composed_candidate_replaces_chosen_target_with_summary_evaluation,composed_filters_and_having,composed_guarantees,composed_mixed_exact_and_sketch_measures_keep_output_names,composed_multi_measure_aggregate_joins_its_measures,own_having_subquery_is_substituted)computation_candidates_for_intentstay.stage1-pass1-per-computation-candidates/src/computation_targets.rs,mod testswhole_expression_topk_replaces_the_heap_over_the_exact_sum,whole_expression_topk_partitions_index_the_heap_input,whole_expression_topk_over_a_grouped_sum_of_range_sums_reads_the_raw_data_samples,heap_weights_over_raw_data_samples_record_an_open_requirement,grouped_range_sums_a_raw_data_samples_heap_cannot_rank_get_no_fused_heap,a_fused_computation_absorbs_what_its_absorbed_targets_merges_absorb,combinations_skip_choices_a_whole_expression_candidate_absorbs,count_ranked_topk_fuses_to_one_global_heap_sketch; nested-sum merges (4):nested_sum_merges_into_one_exact_accumulator,nested_sum_merge_needs_a_sum_of_sums,nested_sum_merge_never_groups_by_the_dropped_metric_name,nested_sum_merges_do_not_stack; (2)avg_states_out_of_order_are_refused,temporal_average_divides_with_a_finite_division_guard; ranked items (4):multidimensional_ranked_item_is_a_structured_tuple,subpopulation_columns_are_not_part_of_the_ranked_item_tuple,temporal_per_entity_topk_uses_series_identity_and_sample_value,topk_keeps_known_labels_beside_series_identity; raw-data-samples signs (3):a_quantile_estimate_shares_its_raw_data_samples_sign_only_inside_the_unit_interval,a_quantile_of_merged_tumbling_windows_shares_its_raw_data_samples_sign,values_estimating_raw_data_samples_name_their_sign_by_the_metric; (1)guarantee_composition::normalized_additive_errors_compose_as_absolute_errors; (2)stream_norms::a_norm_follows_the_update_weight,stream_norms::the_absolute_bound_names_the_weighted_norm— 24normalized_additive_errors_compose_as_absolute_errors, bothstream_normstests)realization.rs's 5.Helpers deleted with them: in
computation_targets_tests.rscomposed,scan,aggregate_over,aggregate,always,exact_promql,choices_of,assert_sql_count_choices,quantile,grouped_quantile,grouped_count,having_filter,equals,having_of,above_scalar,columns,without_output_aliases,summary_agg; incomputation_targets.rs's testsinventory,inventory_root,inventory_at,open_inventory,heap_weight_domains,composed_with,heap_states,topk_target,enumerated_choices,nested_sum_target,fused_heap,heap_update, and the emptiedmod stream_norms; intest_fixtures.rscms_summary,weighted,estimate_over.(2) Frontends → Stage 0 / Pass 1, Pass 1 → PromQL frontend, MetricsQL → PromQL (27 tests).
frontend-promql/tests/count_planning.rsgrouped_count_offers_hydra_but_selection_keeps_per_group_state,frequency_count_candidates_use_unit_weights,cms_count_updates_total_ten_for_zero_positive_and_negative_samples,logical_candidates_fails_on_a_candidate_that_does_not_compose,aggregate_over_topk_candidates_compose(5)logical_candidates_fails_on_a_candidate_that_does_not_compose,aggregate_over_topk_candidates_compose), 2 failed (frequency_count_candidates_use_unit_weights,cms_count_updates_total_ten_for_zero_positive_and_negative_samples), 1 ignored (grouped_count_offers_hydra_but_selection_keeps_per_group_state)frontend-promql/tests/univmon_candidates.rs(file deleted)uncalibrated_frequency_evaluations_do_not_bypass_accuracy_targets(1)frontend-promql/tests/observability/promql_corpus.rsbinding_is_total_over_the_entire_corpus(1)lowering_is_total_over_the_entire_corpusstays.frontend-promql/tests/observability/metrics_observability.rs(file and test target deleted)benchmark_corpora_are_total_and_keep_their_coverage,kubernetes_mixin_aggregates_over_topk_compose(2)frontend-sql/tests/frequency_l2.rsstage1_offers_exact_and_summary_l2_candidates(1)frontend-metricsql/tests/external_corpus.rs(file deleted)corpus_lowers_and_binds,floor_line(2)floor_linetested only that test's parsing helpers.frontend-metricsql/tests/lowering_semantics.rsvector_negation_lowers_as_in_promql(1)stage1-pass1-per-computation-candidates/src/computation_targets.rs,mod testsaggregate_replacement_preserves_sql_field_identity,raw_data_samples_of_metric_ends_at_any_other_operator,classic_hll_confidence_needs_one_instance_over_a_sources_own_rows;guarantee_composition::{absolute_errors_compose_through_arithmetic, products_and_quotients_of_estimates_have_closed_or_symbolic_bounds, relative_and_rank_errors_compose_only_where_sound, clamp_and_abs_keep_the_largest_argument_error, comparisons_over_estimates_have_no_guarantee, a_scalar_subquery_inherits_its_guarantee, failure_probability_counts_once_per_distinct_estimate, join_beside_an_exact_input_on_exact_columns_keeps_the_guarantee, join_on_an_approximate_key_has_no_guarantee, case_on_exact_columns_keeps_the_branch_guarantee, projection_over_a_join_reads_each_columns_guarantee}(14)classic_hll_confidence_needs_one_instance_over_a_sources_own_rows)mod guarantee_composition(helperswith_bound,abs,rel,lit,arith,call,of,bound,delta,close,join,column,equals,case_over,project) is deleted.Helpers deleted with them:
lower_promql(Pass 1'stest_fixtures.rs);node,node_over,scalar,approximate_and_exact(Pass 1's tests);logical_candidates,local_computation_candidates,LogicalCandidate,require_composed_operator_candidates,logical_plan(PromQL'stests/support.rs);reads_hydra(count_planning.rs);bind_tally,BindTally(promql_corpus.rs). MetricsQL's tests no longer include PromQL'ssupport.rs.(3) Frontends → the facade (1 test).
frontend-promql/tests/count_planning.rsexact_counts_select_count_accumulators(1)todo!())count(up),count by(job)(up)andcount_over_time(up[5m])at an exact target select a count accumulator throughasap_planner::run_planning. The file's 2 fixture tests of lowered count aggregates stay.Helpers deleted with it:
frontend-promql/tests/planner_support.rs(run_all_stages,selected_dag; file deleted);physical_asap_daganddeclared_datain PromQL'stests/support.rs(no caller left). No SQL or MetricsQL test usedasap-planner.End-to-end evidence: not applicable (move-only; planning stops at PR 0's Stage 0
todo!()).Self-review: over-abstraction none added; duplication none; dead code none (clippy
-D warnings).Follow-ups
summary_realization.rs, it moves toasap-types.