Repository navigation
test: snapshot planner output over real-world queries in CI - #956
Conversation
|
FYI @zzylol |
b105a21 to
8565f98
Compare
zzylol
left a comment
There was a problem hiding this comment.
Thanks, the snapshot idea is what we want for #1008 (DAG viewer and memo in CI). It can't merge as is, though. On current main, all 14 snapshots fail, and the cause is not a changed plan.
1. The snapshot compares search internals that vary from run to run (high)
corpus_snapshots.rs:79-98 (strip_timings) and :181 compare the whole document. We ran the merged tree twice per query, plus once under taskset -c 0, on one machine. q19, q21 and q25 differed between runs, while the selected DAG, materialized_views and cost_per_second were identical:
| query | selected id | status | peak_milp_constraints |
|---|---|---|---|
| q19 | pane-round-12 / -12 / -15 |
evaluation limit / evaluation limit / refinement_limit |
2220 / 2218 / 2463 |
| q21 | pane-round-15-joint-plan-3 |
refinement_limit / time_limit (600 s) / refinement_limit |
– |
| q25 | pane-round-12 / -14 / -15 |
– | 2221 / 2344 / 2461 |
The CI failure on this PR (peak_milp_constraints 2084 → 2086 for q18) is the same variation. Between the PR's base and the CI merge base, the only planner change is a clone() → copy.
Suggested fix: snapshot only the plan.
- Keep: the selected candidate's
daganddisplay_name; itscosts(cost_per_second,per_node,usage) andacceptedentries, written without the generated id;materialized_views,pane_retention_msandaccuracy_guarantees; for a failed query,errorcut before "Search report". Round floats to about 12 significant digits. - Drop:
search.candidate_connections(counters, bounds,status, pane rounds, catalog sizes), thepane-round-N-joint-plan-Kids, and the Stage 1 and Stage 2 candidate lists.
2. Time limits (high)
- q18 now hits the 600 s limit every time on main. With 3000 s it was still running at 28 min 45 s with 12 GB RSS. It took 53–78 s at your base. This is a planner regression, filed as #1023. Please drop q18 from the corpus, or mark it known-slow, until that is fixed.
- 600 s per query only delays the failure, since hitting the limit already fails the test. Suggested: about 60 s per query, and
timeout-minutes: 45on the job.
3. hit_time_limit misses some time limits (medium, :65)
It only compares full_planning_ms with the limit. The seed round's budget (route.rs:114) and the pane-frontier deadline can also end a search. Suggested: also fail when status == "time_limit".
4. Smaller items
docs/develop_docs/planner-snapshots.md:44-45: "under about 10 s and 500 MB" and "identical across two runs plustaskset" no longer hold on main..github/workflows/rust.yml:170-177: caches the whole releasetargeton top of sccache. Suggested:Swatinem/rust-cacheor sccache alone.:126: clear theregenerateddirectory at the start of a run.- After rebasing: #991 renamed
stored_outputstomaterialized_views(andbuilt_attorefresh), so every snapshot changes once. Explain this under "Snapshot changes".
Once the snapshot holds only the plan, please run it twice plus once under taskset -c 0 on main and confirm the files are identical. I can then merge it. The memo enumeration counts from #1003 will be added to the snapshot after that.
8565f98 to
58094e8
Compare
The planner has no reference answer, so pin its output instead: each corpus query's stage_pipeline document (default search) is compared with a committed snapshot. Timings are stripped and a run stopped by the wall-clock budget fails, so snapshots do not depend on machine speed. UPDATE_SNAPSHOTS=1 regenerates them. Part of #941. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG
The o11y-bench queries that default search plans in under 10 s and 500 MB, each on its own, with declared source facts for the corpus metrics. Queries 05, 06 and 11 select no plan and are recorded as failure snapshots. Checked deterministic across two runs and a single-core run. Part of #941. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG
Runs the corpus snapshot test against a release build, since the corpus queries take minutes in debug, and uploads the regenerated snapshots when a plan changed. Part of #941. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG
A developer note on what the snapshots pin, how to regenerate them and how to add queries, plus a Snapshot changes section in the PR template and AGENTS.md so every changed plan is explained. Part of #941. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG
Same selected plans and costs. Only the search report changed: about twice the joint-price solves, and the direct-cost path now validates plans for q19, q22, q23, q25 and q26. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG
The corpus snapshots compared the whole stage_pipeline document, including the search report's counters, status and candidate ids. Those vary from run to run because pane-width rounds have wall-clock budgets, so every snapshot failed on main without any plan change. - Snapshot only the selected Stage 2 candidate (display name, DAG), its cost and accepted accuracy, materialized views, pane retention, warnings and whether the search proved it optimal; for a query that does not plan, the error up to its search report and the rejection causes. Floats are rounded to 12 significant digits. The memo is not built (--no-memo). - Fail on a search report with status time_limit, not only on a run that used the whole budget. - 120 s per query instead of 600 s; the CI job has a 45 min timeout and caches only the cargo registry next to sccache. - Mark q18 (#1023) and q21 (a pane round ends on its wall-clock budget) known_slow and skip them. - Clear the regenerated directory at the start of a run, and write each failing query's full document next to its regenerated snapshot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d status check Co-Authored-By: Claude Opus 5.5 <[email protected]>
58094e8 to
b8791aa
Compare
Why
The planner has no reference answer, so a plan change can slip in unnoticed. Closes #941.
What
crates/devtools/tests/corpus_snapshots.rs: plans each query intests/corpus_snapshots/<corpus>/corpus.jsonwith releasestage_pipeline(default search,--no-memo, 240 s per query) and compares the selected plan with<id>.json.skip_reasonand are skipped.corpus-snapshots(release, sccache, 45 min timeout); on failure it uploads the regenerated snapshots with each query's full document for the DAG viewer.docs/develop_docs/planner-snapshots.md, a Snapshot changes section in the PR template, and an AGENTS.md rule.How
A snapshot holds only what must be stable: the selected Stage 2 candidate's display name and DAG, its cost (
cost_per_second,usage,per_node) and accepted accuracy, materialized views, pane retention, warnings, andproven_optimal(search statusoptimal). A query that does not plan keeps its error up to the search report and its rejection causes. Floats are rounded to 12 significant digits. Candidate ids, the search report, the Stage 1/2 candidate lists and the memo are left out: pane-width rounds have wall-clock budgets, so a different round, with different ids and counters, can find the same plan. A search ended by a wall-clock budget (statustime_limit, or the whole 240 s used) fails instead of being recorded. Only the final pane round's status is checked; an earlier round cut short by its own wall-clock budget is not reported.Before
No check pins planner output on real queries.
After
A PR that changes any corpus plan fails
corpus-snapshotsuntil the snapshots are regenerated (UPDATE_SNAPSHOTS=1 cargo test --release -p asap-devtools --test corpus_snapshots -- --ignored) and the change is explained.Snapshot changes
All snapshots are new in this PR. Compared with this PR's earlier revision, the format changed from the whole stage_pipeline document to the plan alone, so the earlier
stored_outputs→materialized_viewsrename (#991) no longer shows separately. q18 and q21 were removed (skip_reason). On main, q05 and q06 do not plan (every candidate is rejected asexecutor_cannot_compile; the search stops at its evaluation budget of 128 refinements, not at a time limit, so the result is deterministic) and q11 is infeasible; their snapshots record that. Rebased onto main after #989 (sketch state-byte pricing): no snapshot changed.Verification
cargo fmt --all --check;cargo clippy -p asap-devtools --tests -- -D warnings.🤖 Generated with Claude Code