Skip to content

docs: describe the planning stages, devtools and types now on main - #732

Merged
zzylol merged 10 commits into
mainfrom
docs/677-docs-after-stages
Oct 17, 2026
Merged

zzylol merged 10 commits into
mainfrom
docs/677-docs-after-stages

Conversation

@zzylol

@zzylol zzylol commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #677.

Why

The PRs that landed this week (Pass 2 reuse rules, Stage 2 materialization and the latency check, the AccuracyTarget builders, cost models 1–3, the Pass 2 *Candidate names, FusedComputation, and the DataWorkload reshape into arrival + sources) changed no Markdown, or only the lines that named their own API. The docs therefore still described types, fields and tools that no longer exist on main:

  • run-a-query.md sent readers to show_pre_asap_ir, show_post_asap_ir and dag_export, none of which exists.
  • stage-viewer.md described tabs (2, 4a, 4b), a deployment-inputs panel and --example planner-layering-4a/-4b that the viewer and stage_pipeline do not have, and its numbers predate materialization.
  • Design and developer docs used input_cardinality, data_ingestion_interval, ingestion_rate, continuously_ingesting, Evidence<T> freshness, ResultGuarantee, AccuracyTarget::Exact / Epsilon / EpsilonDelta and EstimatorContract::ClassicHll.
  • library-api.md examples no longer compiled, and it did not mention the stage pipeline at all.

What

Docs only. Each doc keeps its audience; the user's own prose is unchanged except where a name, field or behaviour is now wrong.

  • User guides (docs/user_guide_docs/run-a-query.md, stage-viewer.md, tools/dag-viewer/README.md, root README.md, docs/README.md)
    • run-a-query.md lists the binaries that exist: stage_pipeline, show_logical_dag, analyze_corpora, variant_coverage, sketch_coverage, plus the two examples. Every command in it was run at this head.
    • stage-viewer.md: the tab table has the three tabs examples.json defines (1, 3a, 3b). Example 2 (now with its MatAtQuery plans) and Example 4 (Example 3b under cost models 1, 2 and 3) move to a "no tab, run from the command line" table. The editor section describes the real fields (input tables, SQL or PromQL, ε, metric; no δ, fixed 15 s interval). The option table lists every stage_pipeline flag, including --sql, --table, --name, --metric, --cost-model and the cluster flags. The stale "based on PR feat(dag-viewer): redesign the viewer around the stage pipeline #574" banner and the deployment-inputs panel section are removed.
    • The viewer README's document schema shows cost_per_second, usage, front and the P<n>-m<k> materialization ids.
  • Deployment capabilities (landed with feat(asap-aware-mapping)!: deployment capabilities (supported summaries, raw-data and query-time retention) #730): stage-viewer.md documents --deployment-capabilities (supported_summaries, raw_data_retained, query_time_results_retained), the raw-data rejection and the pass1_pruned listing, and Example 4's row shows kept panes (P3-m2, 8,884.53 per second) and no raw data (P3-m1 selected). The viewer README's schema adds deployment_capabilities and pass1_pruned, and per_node holds only cost_per_second, multiplier and detail. library-api.md lists DeploymentCapabilities and with_deployment_capabilities. planner-layering.md's Stage 2 paragraph and the Example 4 acceptance doc describe MatAtQueryKeptAcrossEvaluations (B3) and the B3 tests that now pass.
  • Measured operation costs and removed legacy cost models (main since ac8493a2): stage-viewer.md and run-a-query.md document stage_pipeline --measured-operation-costs and convert_rqe_atomic_costs; the viewer README's per_node gains price_source; library-api.md adds measured_operation_costs to PlanSelectionSettings and drops the deleted EmpiricalCostModel / PhysicalPlanCostModel rows and comparison; offline-sketch-evidence.md, storage-operation-costs.md and physical-handoff-costs.md say their planner consumer is gone. post-asap-ir.md uses split_shared_by_timing (the rename in chore!: accumulated review nits (column-metric and viewer fixes, timing names, lost tests, stale comments) #737).
  • Developer docs (docs/develop_docs/)
    • library-api.md: dependency pins at a current revision (775e21ee) with asap-planner and tokio for the e2e_plan example, a new section "Plan a workload through the stages" (asap_planner::e2e_plan, run_stage1_to_stage3, PlanningModels, PlanSelectionSettings, CostModel 1–3, ResourceUsage, PlanOutput), the AccuracyTarget builder table, and the legacy search, ranking, strategy, cost-model and selection sections removed, since that code is deleted on main. The doc now reads lowering → planning through the stages → inputs and defaults → export.
    • asap-aware-mapping-architecture.md, asap-aware-mapping-contracts.md and extend-asap-aware-mapping.md are rewritten around the stage code: where each stage lives, the rules each stage's input and output follow, and recipes for adding a summary family, a Pass 2 rule, a Stage 2 option, a Stage 3 check or a frontend construct.
    • metrics-observability-corpora.md describes the Stage 1 measurement the corpus test runs; replacement-explanations.md, planner-vocabulary-migration.md and target-candidate-api-migration.md carry a historical note; develop_docs/README.md lists them under "Historical records".
    • end-to-end-accuracy-guarantees.md, pre-asap-ir.md, offline-sketch-evidence.md, physical-handoff-costs.md, storage-operation-costs.md, physical-compile-coverage.md, target-candidate-api-migration.md: AccuracyGuarantee, the builders, classic HLL's per-source distinct bound, and no dag_export.
  • Design docs
    • planner-layering.md: the shared and Example 2 data tables (arrival, sources[...].series_count, sources[...].sample_interval), the approximate-target sentence, Mixed, the moved workload.rs link, Example 2's SQL recognition, one added paragraph each for what Stage 2 implements and for Stage 3's resource usage and cost models 1–3, and two new rows in the Pass 2 rule table (rollup rule, exact top-k reuse rule), so it lists all five rules. The Problem Definition section, the overview diagram's wording and the lookback / as_of columns keep the original text.
    • planner-layering-example{1,2,3,4}-acceptance.md: counts, costs and test statuses from stage_pipeline and the tests at this head. These include the three Example 1 corrections recorded on Update the docs after the G1–G11 consolidation groups land #677, and Example 3a, where no DDSketch plan is valid any more because the targets are rank errors.
    • analytical-resource-cost.md and planner-runtime-contract.md use the past tense for the removed physical-plan adapter and global_selection; the Example 4 acceptance doc no longer claims B2 ≥ B1, B3 under every model (cost model 1 makes B2 cheapest).
    • input-output-workflow.md, architecture/README.md, concepts/planner-pipeline.md, planner-runtime-contract.md and physical-planning-and-deployment.md describe Stages 0–3 and PlanOutput instead of CandidateLogicalASAPDAGs ranking and global_selection.
    • Docs about the removed search (asap-aware-mapping.md, asap-aware-plan-search.md, evidence-dependent-candidates.md, cse-cost-model.md, asapquery-rule-coverage.md, ddsketch-quantile-ratios.md) carry a historical note; updated_interface_with_pluggable_optimization.md, analytical-resource-cost.md and concat-unique-keys.md get updated status lines.
    • Historical and concept docs: ResultGuarantee → AccuracyGuarantee (the list recorded on Update the docs after the G1–G11 consolidation groups land #677), AccuracyTarget forms, the classic-HLL example in accuracy-models.md, and the old DataWorkload fields in analytical-resource-cost.md.

How

Key code interfaces added / modified

None (docs only).

Before this PR

cargo run -p asap-devtools --bin show_post_asap_ir -- --sample-interval-ms 1000 queries.txt
# error: no bin target named `show_post_asap_ir` in `asap-devtools` package

stage-viewer.md said that Example 2's 12 valid plans were the only valid ones and that a "4b" tab existed. library-api.md built targets with AccuracyTarget::Epsilon(0.01), which no longer compiles.

After this PR

cargo run -p asap-devtools --bin stage_pipeline -- \
    --promql "topk by (job) (10, sum_over_time(http_requests_total[1m]))" \
    --epsilon 0.01 --delta 0.001 --out plan.json
# selected P1 (exact); P2 CMS+heap rejected (weights not proven non-negative),
# P3 CountSketch+heap rejected (no guarantee)

The guides' commands run as written, and Example 2's row in stage-viewer.md reports what the planner does now: 184 physical plans, 20 valid, and P1 at 6.08 per second. The shared count accumulator costs 7.04 per second when it is built once at query time, against 7.44 when it is not materialized.

Verification

  • Ran every command in run-a-query.md and stage-viewer.md at this head: the stage_pipeline examples and options, show_logical_dag (file and stdin), analyze_corpora --corpora and --sql-corpora, variant_coverage, sketch_coverage, and the topk_ir and canonical_examples examples.
  • Started python3 tools/dag-viewer/server.py --skip-build. It wrote the three tab documents and printed its address, and POST /api/plan returned a selected plan.
  • Compiled and ran the library-api.md Rust examples at 775e21ee (temporary test, not committed): the e2e_plan example prints selected P1 at Some(0.000313...) per second with P2 and P3 rejected.
  • Checked the relative links in the changed docs.
  • cargo fmt --all -- --check. No Rust or doc comment changed, so cargo test --doc was not needed.

Limitations and follow-ups

  • Broken source links remain only in documents marked historical (for example cse-cost-model.md's links to cost_model.rs and replacement.rs).
  • Names a parallel rename PR changes (AccuracyTarget.error, --epsilon/--delta/--metric, Rejection.valid) are left as they are on main.
  • planner-layering.md's Problem Definition row ("volume, rate, cardinality and distribution") and its illustrative Example 1 narrative stay as written; the acceptance doc records the planner's numbers.
  • asap-primitive-schema.md was changed only where a type name or field list was wrong (AccuracyGuarantee, its spec fields).

@zzylol zzylol added the documentation Improvements or additions to documentation label Oct 16, 2026
@zzylol
zzylol force-pushed the docs/677-docs-after-stages branch from bd9c717 to 8f1f5b0 Compare October 16, 2026 17:47
@zzylol
zzylol force-pushed the docs/677-docs-after-stages branch from 8f1f5b0 to bc3b43a Compare October 16, 2026 19:07
…nd stage document

run-a-query.md lists the binaries that exist (stage_pipeline,
show_logical_dag, the corpus tools) instead of show_pre_asap_ir,
show_post_asap_ir and dag_export. stage-viewer.md matches the viewer on
main: tabs 1, 3a and 3b, Examples 2 and 4 from the command line with
numbers regenerated by stage_pipeline, the editor's real fields, every
stage_pipeline option including the cost models, and no deployment-inputs
panel. The viewer README shows cost_per_second, usage and front.
…ge pipeline API

library-api.md gains a section on planning a workload through the stages
(e2e_plan, run_stage1_to_stage3, PlanSelectionSettings and cost models
1-3) and uses the AccuracyTarget builders; its examples compile again.
Other developer docs drop dag_export and use the current type names.
…and stage results

The shared and Example 2 data tables use arrival and sources[...]
facts, lookback and as_of are marked as query-text columns, and Stages 2
and 3 say what is implemented (materialization options, resource usage
and cost models 1-3). The acceptance docs carry the counts, costs and
test statuses that stage_pipeline and the tests give at this head.
…rkload fields

AccuracyGuarantee, the AccuracyTarget builders, per-source
max_distinct_per_evaluation for classic HLL, and arrival/sources in the
historical proposals.
The Stage Viewer guide and the viewer README describe
--deployment-capabilities, the document's deployment_capabilities and
pass1_pruned sections and per_node's three fields. library-api.md lists
DeploymentCapabilities; the Stage 2 paragraph and the Example 4
acceptance doc describe MatAtQueryKeptAcrossEvaluations (B3).
…red_by_timing

Measured sketch costs reach Stage 3 through
PlanSelectionSettings::measured_operation_costs (stage_pipeline
--measured-operation-costs, convert_rqe_atomic_costs); per_node gains
price_source. EmpiricalCostModel, PhysicalPlanCostModel and
PhysicalEvidenceSnapshot are gone, so the docs that named them say so.
post-asap-ir.md uses split_shared_by_timing.
…moved

library-api.md drops the search, ranking, strategy, cost-model and
selection sections and keeps lowering, planning through the stages,
inputs and export; its examples compile and run. The architecture,
contracts and extension guides are rewritten around Pass 1, Pass 2,
Stage 2 and Stage 3. Docs about removed APIs carry a historical note, and
the reading paths point at the stage docs.
…sign docs

input-output-workflow.md, the architecture overview, the planner pipeline,
the planner-runtime contract and the physical-planning doc describe
Stages 0-3 and PlanOutput instead of CandidateLogicalASAPDAGs ranking and
global_selection. Docs about the removed search carry a historical note.
@zzylol
zzylol force-pushed the docs/677-docs-after-stages branch from bc3b43a to 3276771 Compare October 17, 2026 20:25
@zzylol zzylol added cost-model Cost formulas, statistics, ranking, and selection dag-viewer DAG export and visualization tooling dev-tools Developer tools, diagnostics, and demos optimizer Workload optimization and plan selection workload Batch, repeating, or multi-query workload modeling labels Oct 17, 2026
planner-layering.md and the acceptance docs keep the original overview
diagram wording and the code font on lookback and as_of. library-api.md
pins a current revision and lists asap-planner and tokio. The analytical
resource cost proposal and the planner-runtime contract use the past
tense for removed code, and the Example 4 acceptance doc no longer claims
B2 >= B1, B3 under every model.
@zzylol
zzylol merged commit fcaa8f1 into main Oct 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cost-model Cost formulas, statistics, ranking, and selection dag-viewer DAG export and visualization tooling dev-tools Developer tools, diagnostics, and demos documentation Improvements or additions to documentation optimizer Workload optimization and plan selection workload Batch, repeating, or multi-query workload modeling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the docs after the G1–G11 consolidation groups land

1 participant