Skip to content

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

Open
zzylol wants to merge 7 commits into
mainfrom
docs/677-docs-after-stages
Open

zzylol wants to merge 7 commits into
mainfrom
docs/677-docs-after-stages

Conversation

@zzylol

@zzylol zzylol commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Advances #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: 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 legacy examples fixed to compile (max_error, ? on search_workload*, the 3-argument ASAPStrategies constructor). The legacy-search prose is otherwise unchanged.
    • 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 overview diagram's data-workload node, the shared and Example 2 data tables (arrival, sources[...].series_count, sources[...].sample_interval), lookback and as_of as query-text columns (no code font), the approximate-target sentence, 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 is untouched.
    • 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.
    • 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 (temporary test, not committed).
  • 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

…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.
@zzylol
zzylol force-pushed the docs/677-docs-after-stages branch from 8f1f5b0 to bc3b43a Compare October 16, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant