Repository navigation
test: snapshot planner output over real-world queries in CI - #956
Open
milindsrivastava1997 wants to merge 5 commits into
Open
milindsrivastava1997 wants to merge 5 commits into
milindsrivastava1997 wants to merge 5 commits into
Conversation
Collaborator
Author
|
FYI @zzylol |
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 <noreply@anthropic.com> 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 <noreply@anthropic.com> 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 <noreply@anthropic.com> 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 <noreply@anthropic.com> 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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG
milindsrivastava1997
force-pushed
the
941-add-planner-snapshot-tests-to-ci
branch
from
October 28, 2026 00:20
b105a21 to
8565f98
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.
Closes #941.
Why
The planner has no reference answer to test against, so a PR can change the plans chosen for real-world queries without anyone noticing.
What
For 14 o11y-bench PromQL queries, each planned on its own, the
stage_pipelinedocument (default search) is committed as a snapshot. A newcorpus-snapshotsCI job fails when any snapshot changes. The PR must then regenerate the snapshots and explain the change under Snapshot changes.How
crates/devtools/tests/corpus_snapshots.rs(#[ignore], release build):tests/corpus_snapshots/<corpus>/corpus.json, it builds a one-query workload for each query id and runs thestage_pipelinebinary with a 600 s time limit.*_mstimings, and the copy of that report embedded in a selection error.<id>.json.UPDATE_SNAPSHOTS=1rewrites the snapshots instead of comparing.stage_pipelinecrashes..github/workflows/rust.yml: the newcorpus-snapshotsjob runs the test with--release --include-ignored. On failure it uploads the regenerated snapshots as thecorpus-snapshotsartifact.Scope decisions and trial measurements are in the #941 comments.
Key code interfaces added / modified
None. This PR adds a test, test data, a CI job and docs.
Major algorithm changes
None.
Before this PR
A change to plan selection that altered, say, which sketch or pane width a dashboard query uses passed CI as long as the existing assertions held. Nobody saw which real-world plans had changed.
After this PR
The same change fails
corpus-snapshots, names each changed query, and uploads the regenerated snapshots. The author commits them and explains each change under Snapshot changes.Evidence
The check was run locally with
cost_per_memory_byte_secondinResourceUnitCost::illustrative()temporarily raised from 1.25e-7 to 1.25e-5 (memory 100 times more expensive). The change was then reverted; it is not in this PR.Determinism: the run that generated the snapshots, a second run, and a single-core run (
taskset -c 0) produced identical snapshots, taking 53 s, 53 s and 102 s.Verification
crates/devtools/tests/corpus_snapshots.rs):strip_timings_keeps_inputs: removes only the search report's timings and the report embedded in an error. Inputs such asstep_msandpane_retention_msstay.time_limit_detection: a search that used its whole wall-clock budget is detected; one stopped by the evaluation budget, or with no search report, is not.first_difference_names_the_line: the failure message points at the first differing line.corpus_plans_match_snapshots, the 14 o11y-bench snapshots. It passes locally (release build, about 53 s).cargo test --workspace). The new CI job runs for the first time on this PR.Snapshot changes
All 14 snapshots are new:
crates/devtools/tests/corpus_snapshots/o11y_bench/q*.json, about 1.3 MB.After rebasing onto #943, #961 and #959, six were regenerated (8565f98): q02, q19, q22, q23, q25, q26. Their selected plans and costs are unchanged. Only the search report changed: about twice as many joint-price solves, and the direct-cost path now validates plans (q19, q22, q23, q25, q26) instead of always falling back.
Architectural decisions
--exhaustive. With--exhaustive --max-combinations 1000, 17 of the 27 single o11y-bench queries went over an 8 GB memory cap; default search planned 22 of the 27. The cost is that a snapshot records only the candidates the search evaluated.document_oflives in thestage_pipelinebinary. Running the binary needs no refactor, and each query runs in its own process.testjob.corpus.jsonunder stable ids. Editing the source corpus file cannot quietly move a snapshot to a different query.Limitations and follow-up
CAST(... AS TIMESTAMP)predicates. The other SQL corpora are untested.series_count1000, 1 s samples) are assumed, not measured.Human review — do not complete with an agent
🤖 Generated with Claude Code
https://claude.ai/code/session_01CKYtMxgJTLtPW9uAqPpiEG