Repository navigation
Conversation
zzylol
force-pushed
the
refactor/1207-accuracy
branch
from
November 9, 2026 10:09
55a1384 to
8a376d3
Compare
… by layer and every pruned candidate with its cause; planner_fuzz costs witnesses over Stage 3's plan; viewer reads the plan; snapshots and pins re-baselined (#1207 PR 9) - asap_planner text and asap-stage-pipeline/v2: Pass 2 logical edges with alpha^log and why each fails, Pass 2 eliminated candidates with root-cause traces, Stage 2 physical edges with alpha^phys, Stage 2 and Stage 3 pruned candidates with reasons, Stage 3 plan and plan_cost; L1/P1 lists, memo node table and same_candidate deleted. - planner_fuzz: plans with accuracy not enforced; witnesses extend Stage 3's PhysicalASAPDAG and are costed by plan_cost; shared nodes are materialized for one evaluation only within one evaluation grid; LongerWindow and NewestTumblingWindows are a TimeRange over the same chain. - PruneReason, RootPruneReason and OriginOfCandidateForMemoGroup serialize snake_case; RejectionCause keeps only Infeasible; ErrorSelectingPlan::Cost deleted. - price -> cost wording; develop docs and planner-layering refreshed; viewer reads the new document. - Corpus and sketch plan snapshots re-baselined; obsolete tests deleted; pins re-baselined.
zzylol
force-pushed
the
refactor/1207-tools
branch
from
November 9, 2026 10:59
cbc838c to
48af3c9
Compare
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.
Base:
refactor/1207-accuracy(#1238, 8a376d3). Head 48af3c9, one commit. Backup of the old head:backup/1207-tools-cbc838ce0. Part of #1207 (#1205 viewer); never merge on its own.Why
The stages' outputs changed under #1207 (memo with θ per candidate, required accuracy, Pass 2 eliminated candidates with root causes, logical and physical edges with α, a Stage 3 plan built directly as a
PhysicalASAPDAG), butasap_planner, the viewer,planner_fuzz, the snapshots and several pinned tests still read the old shapes (L1/P1 lists, floors,selected_dag,search_report) and stopped at PR 9todo!s.What
asap_planner --format textandasap-stage-pipeline/v2show edges by layer (decisions M1/M3/M4/M10): every candidate of an input group with α^log and its reason in the Pass 2 memo step; only physical edges whose logical edge holds, with α^phys and its reason, at Stage 2; the plan's edges markedselected.through G8[0] → G2[1], at G3[0] input 0: metric rule …); Stage 2 and Stage 3 pruned candidates with their reasons. No Pass 1 list (M5).plan,cost(plan_cost),accepted_accuracy_per_query,pruned_candidates, MILP size and times. L1/P1 lists,ShownLogicalCandidate, the memo node table andsame_candidatedeleted (R1, R10).PruneReason,RootPruneReason,OriginOfCandidateForMemoGroupserialize as snake_case (R4); the document uses them directly.planner_fuzz(M2, M7): plans with accuracy not enforced (flag and setting deleted); a witness extends Stage 3's plan and is costed byplan_cost; a shared query-time node becomesOneEvaluationonly for queries on the same evaluation grid;LongerWindow/NewestTumblingWindows= aTimeRangeover the same chain (retention widened to the range).longer_chain_rootsand the realizer-based assignment map deleted.RejectionCausekeeps onlyInfeasible(the one produced);failed_a_checkandErrorSelectingPlan::Costdeleted (PR 6 note).asap-aware-mapping-{architecture,contracts}.md),planner-layering.md(memo components, worked example, stage tables, pruning table; the enumeration section is deleted) and the user guide refreshed.tools/dag-viewer) reads the new document: Stage 0 and the plan as lanes, one plan row, memo view with θ, required accuracy, pruned candidates with causes, logical and physical edges.How
planning_stages_text.rscomputes α^log reasons withasap_accuracy::producer_satisfies_logical_requirementsand the run's evidence (the planner stores only the bool); the JSON document and the text sharelogical_edges_into,edges_per_input,physical_edge_rejection,root_prune_reason_text,selected_edges.planner_fuzz::Planner::costflattens the witness roots, copies each node of the planned DAG (by address) with its timing, lifetime, θ, coverage and retention, adds derived nodes at (QueryTime, None), buildsPhysicalASAPDAG::newand callsplan_cost.Key code interfaces added / modified
planning_stages_text.rs · candidate_labels.rs
planner_fuzz/mod.rs
pruning.rs · report.rs
CLI:
planner_fuzz --ignore-accuracy-guaranteesremoved (always so). Documentasap-stage-pipeline/v2fields: see the header of asap_planner.rs.Usage (
quantile_over_time(0.9, data[5m])every 60 s at phase 0, rank ≤ 0.01, δ 0.01, 1,000 series at 1 s, ingesting):(test
edges_are_listed_by_layer_with_their_alpha_and_rejectionruns this workload.)Major algorithm changes
planner_fuzz witness costing. Problem: witnesses were planned again by Stage 0–3, which Pass 1 refuses (ASAP operators), and the realizer they relied on is gone. After:
Planner::costcosts the witness DAG (W's plan + derived nodes) withplan_cost; sharing is promoted toOneEvaluationonly within one evaluation grid (Stage 3's contexts), so a witness never shares across contexts that Stage 3 cannot (fixes R9's false violations). Correctness:the_selected_plan_costs_what_the_search_selected_it_for(W's plan costs what Stage 3 selected it for). Complexity: one flatten + oneplan_costper witness. Limits: a derivedTimeRangewidens only its direct input's retention.Deletions
same_candidate, memo node table (MemoNodes,group_node),computation_label,candidate_labelsL1/P1 labelsedge_rejectionlogical_edges_into(Pass 2 layer) +physical_edge_rejection(Stage 2 layer)FuzzSettings::enforce_accuracy_guarantees,--ignore-accuracy-guarantees(fuzz)Priced,Planner::price,reference_price,longer_chain_rootsCosted,cost,reference_cost,chain_windowRejectionCausevariants exceptInfeasible,failed_a_check,ErrorSelectingPlan::Costsearch_status,proven_optimalSearchReportdeleted in PR 0enumeration.js, chain expansion, L1/P1 candidate list, old fixturesmaterialized_view_fixtures/stored_outputs_on_main.json+ its testmaterialized_views()stay)pass1_failure_*×2logical_candidate_labels_name_each_query,the_document_names_the_selected_logical_candidatemilp_lower_bound_is_consistent_with_the_selected_costSearchReportdeleted, PR 0)finds_issue_903_looser_accuracy_not_reading_the_exact_resultjoint_search_equivalence: latency-bound test, stddev "unsupported" testRe-baselined pins (new plan correct by the decided design)
different_exact_percentiles_share_the_input_windowOneEvaluation); 0.088328/snested_exact_sum_reuses_newest_tumbling_windows(#924)slower_repeat_reuses_faster_sum(#925)sql_sum_shares_nested_windows_and_slower_readerspromql_quantile_of_rate_binds_kll_over_rate_accumulatorvalue_ranked_topk_over_binary_ratio_finalizes_both_summary_operandsAggregateover Finalizeidentical_ungrouped_queries_share_their_producers,identical_sql_percentiles_share_one_producerpass2_holds_tumbling_windows_at_the_gcd_of_ranges_and_steps, fuzzlonger_window_*fixed_interval_atphase 0edges_are_listed_by_layer…(wasstage2_lists_every_edge…),memo_section…selected partSnapshots (re-baselined; listed, several look wrong and come from open questions):
o11y_bench/q02o11y_bench/q05o11y_bench/q06o11y_bench/q11o11y_bench/q12o11y_bench/q18o11y_bench/q19o11y_bench/q20o11y_bench/q21o11y_bench/q22o11y_bench/q23o11y_bench/q25o11y_bench/q26o11y_bench/q27sketch_plan_snapshots/fuzz-issue903-raw-retainedsketch_plan_snapshots/nested-windows-15m-1h-mvpsketch_plan_snapshots/quantile-grouped-mvpsketch_plan_snapshots/quantile-single-mvpsketch_plan_snapshots/random-mixed-seed-862-long-w01-q3-mvpsketch_plan_snapshots/random-mixed-seed-862-w01-q3-q8-mvpsketch_plan_snapshots/random-mixed-seed-862-w02-q2-q7-mvpsketch_plan_snapshots/ratio-of-quantiles-1h-mvpsketch_plan_snapshots/shared-quantiles-1h-mvpsketch_plan_snapshots/topk-rate-guarantees-ignored-mvpfixed_intervalwithout phase cannot read a chain, so every plan scans raw data; (PR 7 P3/P5) a query-time scan under a range evaluation is costed at its whole retention per step (q12: 3,601,000 samples × 1.0167/s for a 1 s lookback = 21.69/s). Looks wrong; not a PR 9 change.Still failing (14; none at a PR 9 todo, 0 newly failing)
aws_fargate_prices_example_4_in_dollars,deployment_capabilities_flag…,the_nine_query_workload_{lowers_and_installs,selects_a_valid_plan}; viewertest_plan_workload_endpoint…fixed_intervalwithout phase (no chain; with no raw data infeasible)example3a_selects_a_valid_planPhysicalASAPDAG::validaterefuses itworkload_examples_select_valid_plans…, plannercheck_compiles_reports_the_executors_errormilp_search_selects_checked_plans_on_ratio_and_rollupheavyproduction_three_sql_groupings_share_kll,production_sql_distinct_region_service_rollup,rollup_controlled::production_distinct_rollup_finds_shared_kmvgrouped_filtered_quantile_plans(#902)global_kll_quantile_over_no_row_is_null,planner_heap_topk_reference_execution_matches_ground_truthFindings for lower PRs (from the new traces):
3. Metric rule kills the exact path (PR 4/PR 8): in
avg by (job)(q0.5/q0.5 + q0.9),G3[0] BinaryOp <- G2, G2(exact) is eliminated "at G5[0] input 0: metric rule: the consumer's error contract carries [Absolute…], not the producer's Relative": the division's output metrics are judged without its producers, so even exact inputs are cut and the workload is infeasible.4. #902 (PR 4):
… WHERE city = 'NYC'puts the predicate in its ownScan(G4), so no rule offersFilter(city)over the per-city quantile (G8 over G1).5. Display:
AcceptedAccuracyprintsaccepted exact (DDSketch)when the target has no metric and a sketch is read (PR 6/8).Pending approval
asap_planneris a separate binary crate):logical_edges_into,physical_edge_rejection,root_prune_reason_text,edges_per_input,selected_edges(definitions and examples above;edge_rejectionwas approved, this is its split by layer per M4 C①).planning_stages_texttakesevidence(α^log reasons are recomputed, sinceLogicalEdgekeeps only the bool) andplan_cost(Selection no longer carries the cost).a-looser-accuracy,tighter-accuracy) now compare identical plannings and always hold: keep or delete?Before this PR
asap_plannerstopped at PR 9 todos (56 devtools failures); the viewer, fuzz and snapshots read main's shapes.After this PR
Every stage's output, its edges with α and every pruned candidate with its cause are visible in text, JSON and the viewer; the fuzz tester runs on the new plan.
Verification
cargo testper crate (--all-features --no-fail-fast),cargo fmt --check,cargo clippy --workspace --all-features --all-targets -D warningsclean,crate_graphpasses; viewer:node --test memo.test.mjs stages.test.mjs29/0,python3 -m unittest test_viewer test_server80/1 (S4);UPDATE_SNAPSHOTS=1 cargo test --release -p asap-devtools --test corpus_snapshots -- --ignored. Wall-clock tests stay ignored.By name: 0 newly failing; 56 newly passing; 28 absent (renamed price→cost tests, deleted tests above).
Self-review: no shims or aliases; one edge grouping (
edges_per_input) and one α^log reason source for text and JSON; deadcomputation_label, constantselectedlabels replaced; names follow consumer/cost/materialized.