Repository navigation
Open
Description
Design: docs/design_docs/proposals/testing-infrastructure/README.md (#1353): tests T1–T26, decisions D1–D28, the case.toml spec. This issue holds the implementation plan: one brief per PR, in order.
How to run a PR
Prompt for a fresh agent session:
Implement PR N of #1354. Read its brief and the doc sections it cites. Work in
.worktrees/<name>fromorigin/main. Test only the crates you change, with-j2. Don't push; tell me when it's ready.
- One agent per PR; at most 3 at once (memory).
- Each PR is reviewed by an agent that did not write it, then by a person. PR bodies say "Part of Testing infrastructure: tracking #1354, PR N".
- Wave 1 PRs: separate sessions you can steer. Case-writing PRs: subagents from one coordinating session.
Plan
| PR | What | Depends on |
|---|---|---|
| 0 | Merge #1353 (the design doc) | — |
| Wave 1 (parallel) | ||
| 1 | Golden runner + first Stage 0 cases | 0 |
| 2 | Memo invariants and InvariantViolation |
0 |
| 3 | T14 accuracy property tests | 0 |
| 4 | Printer: 5 significant digits, --summary |
0; merge before 1 commits goldens |
| Wave 2 | ||
| 5 | Rule enum, rule flags, rule_fires |
1 |
| 6 | shuffle and rename mutations |
1 |
| 7 | Invariant exit code in the binary and runner | 1, 2 |
| 8 | time_series_metric catalog field |
0 |
| 9 | D18 Stage 3 tie-break | 0 |
| 10 | planner_fuzz writes case directories |
1 |
| 11+ | Case-writing PRs (see Tests) | 1, plus as noted |
| Wave 3 | ||
| 12 | Corpus snapshots into the runner (D27) | 1, 4 |
| 13 | CI runs everything in release (D19) | 1 |
| 14+ | Existing-test cleanup, one PR per area | — |
Briefs
PR 1: golden runner
- Doc: D5–D8, D15, D25,
case.tomlspec. - Build:
crates/devtools/tests/goldens.rswithlibtest-mimic(harness = false); cases undercrates/devtools/tests/goldens/<area>/<case>/; defaults ingoldens/defaults/. Runsasap_planneras a subprocess. Loadscase.toml(rejects a missingwhy, unknown fields). Compares JSON with numbers at a relative tolerance of 1e-4, everything else exact; prints a line diff and the exact command on failure.UPDATE_SNAPSHOTS=1writesexpected.json. Assertions:same_group,different_grouponly. - Not in scope:
rule_fires(PR 5), mutations (PR 6), invariant exit code (PR 7). The runner rejects these fields until they land. - Done: 3–5 Stage 0 cases (T1) pass; a deliberately wrong
expected.jsonfails with a readable diff.
PR 2: memo invariants
- Doc: T4, T5, T25, D12, D13, D14.
- Build: in
crates/types/src/stages/logical/memo/mod.rs, schema checks infind_or_add_group/add_candidate, and a consistency check (parents/children agree, no orphan groups or candidates, passes only add) run at each stage boundary, always on. A typedInvariantViolation { check, group, origin }, returned as an error, not a panic. - Done: a test per check that builds a violating memo and gets the error; existing per-crate tests still pass. Report the check's runtime on the largest corpus workload.
PR 3: T14 property tests
- Doc: T14, D17.
- Build:
proptestas a dev-dependency ofasap-accuracy. Properties of how ε/δ combine (error_contract,logical_edge,guarantee): monotone, order-independent where it should be, never tighter than an input. Generators include −0.0, NaN, ±Inf, q ∉ [0, 1]. Commit the regressions file. - Done: properties pass, or each failure is filed as an issue with its shrunk input.
PR 4: printer number format and --summary
- Doc: D2, D18, D28.
- Build:
crates/devtools/src/stable_output.rsrounds to 5 significant digits.asap_planner --summary(needs--run-until stage3) prints only plan cost, feasibility andsharing_summary. Regenerate existing snapshots; the PR lists which changed beyond rounding. - Done: snapshot tests pass;
--summaryhas one test.
PR 5: rule names
- Doc: D9, D13,
rule_firesin the spec. - Build:
Ruleenum inasap-types(Display/FromStr, snake_case), one per Pass 2 rule (crates/stage1-pass2-reuse-candidates/src/rules/). Each candidate records theRulethat added it; the JSON prints it.asap_planner --only-rules <a,b>and--disable-rule <a>. Runner gainsrule_fires/rule_does_not_fire. - Done: one golden case per rule showing it fires with
--only-rules.
PR 6: mutations
- Doc: D16,
mutationsin the spec. - Build: a mutations module shared by the runner and
planner_fuzz;shuffle(reorder queries, renumber for comparison) andrename(metrics and labels, consistently across workloads and tables). Runner applies the default["shuffle", "rename"]to every case. - Done: all existing cases pass under both; an order-dependent planner change (hand-made, not committed) is caught.
PR 7: invariant exit code
- Doc: D14.
- Build:
asap_plannerexits with a dedicated code onInvariantViolation; the runner fails such a case even underUPDATE_SNAPSHOTS=1;planner_fuzzcounts it as a finding.
PR 8: time_series_metric
- Doc: D11, T2.
- Build: optional
time_series_metricon a--sql-catalog-tabletable; the SQL frontend lowers that table asSource::TimeSeries { metric }. - Done: one T2 golden case: a PromQL and a SQL query with
same_group = [["q1", "q2"]].
PR 9: Stage 3 tie-break
- Doc: D18.
- Build: in
crates/stage3-plan-selection/src/milp/model/mod.rs, a deterministic tie-break between equal-cost plans (e.g. a tiny penalty on canonical ids); check there is no time limit for small workloads. - Done: a workload with two equal-cost plans selects the same one across runs and query orders.
PR 10: fuzz findings as cases
- Doc: D26.
- Build:
planner_fuzzwritescase/(shrunkworkload.json, non-default inputs,case.tomlwithwhy = "planner_fuzz finding <id>") next to each issue draft.
PR 12: corpus snapshots into the runner
- Doc: D27.
- Build: each
o11y_benchquery becomesgoldens/corpus/o11y_bench/qNN/with--summary; data facts copied into eachworkload.jsonby the corpus generator; deletecorpus_snapshots.rs.
PR 13: CI in release
- Doc: D19, T20.
- Build:
.github/workflows/rust.ymlruns tests in release. Every#[ignore]test runs in a workflow or is deleted.
Tests (case-writing PRs, Wave 2+)
One PR per line; each adds files under its own goldens/<area>/ only. T8 agents are briefed from docs/design_docs/concepts/, not the rule code.
- Stage 0: T1 lowering, T6 group properties
- T3 equivalence within one language
- T2 PromQL ≡ SQL (needs PR 8)
- T7 Pass 1 candidates
- T8 rollup · T8 topk · T8 chains (each needs PR 5; positive and negative cases)
- T10 Stage 2
- Stage 3: T22 sharing, T26 plan-changing inputs, T19 plan cost relations
- Mutations on chosen cases: T9 added query, T13 tighter accuracy, T16 separability, T24 rule removal
- T11 search differential, T12 propagation (separate harnesses; brief when started)
Follow-ups
- Which
integration-testsfiles migrate to JSON goldens. - Rule-firing coverage and mutation testing (
cargo-mutants). - Revisit deferring execution oracles (~33 ledger bugs need one).
Metadata
Metadata
Assignees
Labels
No labels
Activity
zzylol commentedon Nov 16, 2026
D2 (12 significant digits) may churn goldens.
While porting the stage printer to the #1207 memo (#1239), reordering code alone, with no change to the cost model or the plan, moved plan costs by up to 3e-11 relative. That is a change in the 11th significant digit, so a 12-digit text comparison would fail on a refactor that changes nothing.
Illustration (not a measured case): a cost of 0.0085 printed to 12 significant digits is
0.00850000000000; the same cost 3e-11 lower prints as0.00849999999974.Two options:
|a − b| ≤ 1e-9 · max(|a|, |b|), and keep 12 digits in the file for reading.Option 1 keeps the files exact and avoids a near-boundary rounding flip that option 2 still allows. #1239 follows D2 as written (12 digits) for now.
milindsrivastava1997 commentedon Nov 16, 2026
Thanks. Let's do both. Option 1 + print 5 significant digits (based on number of significant digits in AWS cloud pricing)
docs(proposals): D2 prints 5 significant digits, compares with a tole…
milindsrivastava1997 commentedon Nov 17, 2026
Execution plan: superseded by the plan and per-PR briefs in the issue body (2026-11-20), after #1239 and #1207 PR 8 merged.docs(proposals): testing infrastructure design and decisions (#1353)
test(devtools): golden runner and first Stage 0 cases
test(devtools): golden runner and first Stage 0 cases (#1467)
feat(types, planner): memo invariants checked on insertion and after …
fix(accuracy): a measured table rejects a DDSketch α outside (0, 1)
test(accuracy): drop proptest seeds that no longer replay their failures
test(accuracy): G2/G3 fail on a NaN or negative error; L3 reaches eve…
test(accuracy): T14 property tests; no DDSketch guarantee for α outsi…