Repository navigation
feat(devtools): asap_planner — one planner CLI that runs the stages up to --run-until (#1161) - #1190
Merged
milindsrivastava1997 merged 10 commits intoNov 4, 2026
Conversation
…tput as text Adds asap_devtools::planning_stages_text and the print_planning_stages bin: the frontends' roots, the memo groups, Pass 1's PerComputationLogicalMemoCandidates, the memo after Pass 2's local window composition, LogicalASAPMemoCandidates, PhysicalASAPMemoCandidates and Stage 3's Selection for one PromQL workload. node_label moves from stage_pipeline to candidate_labels so both share it, and now names a pane chain's layout (pane_width_ms, pane_count). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One binary plans the workload; --text writes the run as text instead of the viewer document, so both outputs come from the same inputs and flags. The text output, now in the aligned format (G1: TimeRange 60s <- G0), also covers what tools/dag-viewer/print_stages.py (#1158) prints: candidates new at each memo step, the selected memo choice, Stage 3's search outcome, cost per plan node and accepted accuracy per query, and with --enumerated the memo choices with their DAGs. --out - writes to standard output. node_label prints a time range as 60s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ints them (#1161) One planner CLI replaces stage_pipeline and show_logical_dag: asap_planner --workload <file>... --run-until stage0|pass1|pass2|stage2|stage3 [--format text|json]. Each stage runs once, with no deadline, over every legal tumbling-window width; Pass 2 prints the memo after local window composition and after the sharing rules. Accuracy guarantees are enforced by default; removed flags are usage errors. Tests move to tests/asap_planner.rs (plus acceptance tests); snapshots, memo_pricing and planner_fuzz go through asap_planner. Five snapshots are now proven optimal (plans unchanged) and q18/q21 are no longer skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and the planner box (#1161) The server plans with asap_planner --run-until stage3 --format json and writes the three small examples into out/. The committed example documents, editor.js and /api/plan are removed; workload files stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1161) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milindsrivastava1997
left a comment
Collaborator
Author
There was a problem hiding this comment.
Automated review (Claude Code, /code-review high). Findings were not independently verified.
- Exit 1 without the usage line for non-argument failures; 2 stays for bad arguments. - Report a Pass 1 rejection before contradictory deployment capabilities, as run_planning does. - Report a Stage 2 failure under Stage 2, not Stage 1. - Attach warnings only to a Stage 3 section that exists. - Number accepted accuracy q1..qN in text, like the warnings. - Build the Stage 0 memo once. - Viewer server and validate_joint_workloads accept a null Stage 3. - Test that the viewer's cost-input files match the presets. - Drop stale --exhaustive/--table references. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milindsrivastava1997
left a comment
Collaborator
Author
There was a problem hiding this comment.
Automated review (Claude Code). Two findings are on lines outside the diff, so they are here:
tools/dag-viewer/stages.js:425: the viewer rejects every partial run. Documents from--run-until stage0|pass1|pass2|stage2are refused because the later sections are null. The user guide still says to open--format jsonoutput in the Stage Viewer. For example,asap_planner --run-until pass2 --format json --out run.json(the example in the bin header) gives "stage2_physical_asap_optimization is missing".docs/develop_docs/joint-candidate-workload-evaluation.md:21: the reproduction doc is out of date. It still says to buildstage_pipelineand pass it tovalidate_joint_workloads.py. The script now sendsasap_plannerflags (--run-until,--format, a--cost-inputsfile), so a frozenstage_pipelinebinary fails every workload with "unknown argument --run-until".
- asap_planner exits 1 when a stage failed, in text and JSON, after writing its output; the viewer server reads the document whenever one was written. - The viewer shows a null (not run) stage section as empty, so --run-until before stage3 and Pass 1 failures open again. - sql_catalog returns the table names; catalog_table_names is gone. - stage0_memo_groups is built only by run_stages_until. - planner_fuzz repro commands say when the exhaustive search may not reproduce. - Docs: exit status; joint-workload reproduction uses asap_planner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Review-body findings, fixed in a3f0282:
|
- stage_pipeline's bin, tests and guide stay deleted; main only removed their deadline flags and ignores, which asap_planner never had. - Pass2RoundState is gone on main; Pass 2's entry is split into pass2_local_window_composition and pass2_after_local_window_composition so asap_planner still prints the local window composition step. - SelectionError::DeadlineReached is gone; SelectionError::NotRun marks a run that stopped before plan selection (asap_planner --run-until). - Snapshot tests keep asap_planner with main's optimal-only checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every --run-until value now names its stage: stage0, stage1_pass1, stage1_pass2, stage2, stage3. The old pass1 and pass2 are usage errors. The JSON run_until uses the same names; the memo step ids (pass1, pass2) are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milindsrivastava1997
deleted the
1161-one-planner-cli-run-stages-up-to-a-chosen-point-print-as-json-or-text
branch
November 4, 2026 15:00
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.
Closes #1161. Lands #1159's two commits (its text printer), so #1159 can be closed.
Why
Inspecting the planner took three overlapping tools (
stage_pipeline,show_logical_dag, #1159's printer), and each had its own flags, time limits and display caps. None of them could stop after a chosen stage, and none showed every tumbling-window width at once.What
A single CLI,
asap_planner, runs the stages up to the one you name and prints each stage's output as text (the default) or as anasap-stage-pipeline/v1JSON document:--run-until. Pass 2 prints two snapshots: the memo after local window composition, andLogicalASAPMemoCandidates. In JSON, the sections of stages that were not run arenull.TumblingWindowWidthDomain::Complete, so every legal width is in one memo.--example,--promql,--sql,--table,--cost-model,--exhaustive,--milp-time-limit-s,--max-displayed,--no-memo,--text, …) is a usage error with exit status 2. An ad hoc query is now a one-query workload file.stage_pipelineandshow_logical_dagare deleted. Every caller is migrated: the corpus and sketch snapshots,memo_pricing,planner_fuzz, the Stage Viewer server, andvalidate_joint_workloads.py.asap_plannerand writes the three small examples (1, 3a, 3b) intoout/.editor.js,/api/plan) and theprovisioned-capacitycost preset are removed. Stage 3 refuses cost models 2 and 3 (Memo search solver: MILP over the memo for all cost models #888), so that preset could not be used.docs/user_guide_docs/asap-planner.md, which replacesstage-pipeline.md.run-a-query.md,stage-viewer.mdandplanner-snapshots.mdare updated.How
run_stages_untilincrates/devtools/src/planning_stages.rscalls Stage 0, Pass 1, Pass 2, Stage 2 and Stage 3 inrun_planning's order and returns after the stage--run-untilnames. It does not callrun_planning, becauserun_planninghas no stop point; #1169 tracks moving the stop point there. The text printer is #1159'splanning_stages_text, which now stops at the same point.Key code interfaces added / modified
asap_planner(crates/devtools/src/bin/asap_planner.rs).asap_devtools::planning_stages:RunUntilrun_stages_until(roots, entries, data, models, until)PlanningStagesRun:run_until,stage0_memo_groups,pass2_local_window_compositionasap_devtools::planning_stages_text::planning_stages_text(&PlanningStagesRun).Pass2RoundState::unexpanded_memo()(asap-logical-asap-optimization), the memo after local window composition. refactor: stage-boundary cleanup — Memo rename, drop MemoSteps and computation_targets, Stage 0 module (#1047, #1054, #1012) #1177 had removed it.memo.stepsis nowstage0,pass1,pass2_local_window_composition,pass2, and there is a new top-levelrun_until.Major algorithm changes
None. The planner's stages are unchanged; only the tool that drives them is new.
Before this PR
This planned under a 30 s budget, in tumbling-window-width rounds, and the JSON showed only the selected round's memo. Logical DAGs needed a separate
show_logical_dag.After this PR
--run-until stage0replacesshow_logical_dag.Measurements on this branch:
validate_joint_workloads.pyselects a plan for all 30 workloads; the slowest takes 9.8 s.Snapshot changes
No plan or cost changed in any snapshot.
proven_optimalfalse → trueshared-quantiles-1h-mvp,quantile-single-mvpproven_optimalfalse → true;search_statusdeadline_reached→optimaldeadline_reached_reasonentries are removed from the manifest.skip_reasonremoved)Tests
tests/asap_planner_acceptance.rs):--run-untilprints exactly the stages up to the one named.null.--run-until, or any removed flag, is a usage error.stage_pipeline.rsis ported totests/asap_planner.rs. Tests of removed features (display cap, exhaustive enumeration, the reference pricer,--name, the planning budget) are deleted.cargo test, clippy and fmt. The viewer tests pass: Node 43/43, Python 95/95.Follow-ups: #1169 (stop point inside
run_planning) and #1186 (cleanup of tools left broken or unused), #1202 (warnings in JSON before Stage 3).🤖 Generated with Claude Code