diff --git a/.github/workflows/corpus-snapshots.yml b/.github/workflows/corpus-snapshots.yml index caaca3082..f23a19966 100644 --- a/.github/workflows/corpus-snapshots.yml +++ b/.github/workflows/corpus-snapshots.yml @@ -16,8 +16,8 @@ jobs: # change can be committed without a local rerun. corpus-snapshots: runs-on: ubuntu-latest - # Planning takes 2-6 min (6 min on one core) plus the release build; each - # query stops at 240 s. + # Planning takes a few minutes plus the release build; planning has no + # time limit. timeout-minutes: 45 steps: - uses: actions/checkout@v4 @@ -30,8 +30,19 @@ jobs: # Caches the registry and compiled dependencies, keyed per job. - uses: Swatinem/rust-cache@v2 + # For tracing a strict failure that main did not cause to the runner's + # hardware or toolchain. + - name: Show runner CPU and toolchain + run: | + lscpu | grep 'Model name' || true + rustc --version + + # Strict: a plan that changes at the committed plan's cost fails too + # (#1541), so the PR that moves a tie updates the snapshot. - name: Check planner snapshots run: cargo test --release --locked -p asap-planner-cli --test corpus_snapshots -- --include-ignored + env: + STRICT_SNAPSHOTS: 1 - name: Upload regenerated snapshots if: failure() diff --git a/crates/planner-cli/tests/corpus_snapshots.rs b/crates/planner-cli/tests/corpus_snapshots.rs index b6727a8d7..2434f63ef 100644 --- a/crates/planner-cli/tests/corpus_snapshots.rs +++ b/crates/planner-cli/tests/corpus_snapshots.rs @@ -3,10 +3,13 @@ //! The planner has no reference answer, so these tests pin its output //! instead: each corpus query's selected plan (default search) is compared //! with the committed one, and any change fails until the snapshot is -//! regenerated and the change explained in the PR. A changed plan whose -//! cost equals the committed plan's (relative difference at most 1e-9), -//! with the same accuracy, warnings and errors, passes: the selection may return any of several equal-cost plans, and -//! which one can differ between machines. +//! regenerated and the change explained in the PR. That includes a plan +//! that changes at the committed plan's cost (#1541): the nightly workflow +//! sets `STRICT_SNAPSHOTS=1`, and any difference fails. Without it, as on a +//! local run, a changed plan whose cost equals the committed plan's +//! (relative difference at most 1e-9), with the same accuracy, warnings and +//! errors, passes with a note on stderr: the selection may return any of +//! several equal-cost plans, and which one could differ between machines. //! //! Each `tests/corpus_snapshots//corpus.json` declares the shared //! planning inputs and the queries by stable id; `.json` beside it is @@ -17,7 +20,7 @@ //! search over every legal tumbling-window width, with no time limit. //! //! A snapshot holds only the plan, never the search that found it: Stage -//! 3's plan (its `PhysicalASAPDAG`, retention on its nodes), its cost and +//! 3's plan (its `PhysicalASAPDAG`, with the retention and lifetime of its nodes), its cost and //! accepted accuracy per query, and the materialized views; for a query //! that does not plan, the error. The selection MILP's size and timings, //! the Stage 1 and Stage 2 candidate lists and the memo are left out. Floats are as @@ -150,6 +153,19 @@ fn plan_snapshot(document: &Value) -> Map { /// the selection may return either, depending on the machine. const EQUAL_COST_RELATIVE_TOLERANCE: f64 = 1e-9; +/// Whether equal-cost plan changes fail: `STRICT_SNAPSHOTS` is set, as the +/// nightly workflow sets it. +fn strict_snapshots() -> bool { + std::env::var_os("STRICT_SNAPSHOTS").is_some() +} + +/// Whether a snapshot whose text changed from `expected` to `actual` still +/// passes: never when `strict`; otherwise when both select plans of the +/// same cost ([`equal_cost_plan`]). +fn changed_snapshot_passes(expected: &str, actual: &str, strict: bool) -> bool { + !strict && equal_cost_plan(expected, actual) +} + /// Whether the snapshot texts `expected` and `actual` select plans of the /// same cost ([`same_selected_cost`]). fn equal_cost_plan(expected: &str, actual: &str) -> bool { @@ -249,6 +265,7 @@ fn corpus_plans_match_snapshots() { .lock() .unwrap_or_else(|poisoned| poisoned.into_inner()); let update = std::env::var_os("UPDATE_SNAPSHOTS").is_some(); + let strict = strict_snapshots(); // Regenerated snapshots of failing queries, with their full // `asap_planner` documents for the DAG viewer, for CI to upload. // Each corpus clears only its own directory: the sketch plan test writes @@ -305,8 +322,11 @@ fn corpus_plans_match_snapshots() { continue; } let expected = std::fs::read_to_string(&path).unwrap_or_default(); - if expected != actual && equal_cost_plan(&expected, &actual) { - eprintln!("{name}/{id}: plan changed at the committed plan's cost; passes"); + if expected != actual && changed_snapshot_passes(&expected, &actual, strict) { + eprintln!( + "{name}/{id}: plan changed at the committed plan's cost; \ + passes (fails with STRICT_SNAPSHOTS=1)" + ); } else if expected != actual { let out = regenerated.join(&name); std::fs::create_dir_all(&out).unwrap(); @@ -411,9 +431,10 @@ fn first_difference_names_the_line() { ); } -/// A changed plan with the committed plan's cost passes: the planner may -/// pick any of several equal-cost plans, and which one depends on the -/// machine. A dearer or cheaper plan, or one that no longer plans, fails. +/// Outside strict mode, a changed plan with the committed plan's cost +/// passes: the planner may pick any of several equal-cost plans, and which +/// one could depend on the machine. A dearer or cheaper plan, or one that +/// no longer plans, fails. #[test] fn equal_cost_plans_pass() { let plan = |cost: f64| json!({"selected": {"cost": {"cost_per_second": cost}, "dag": {}}}); @@ -457,3 +478,19 @@ fn equal_cost_plans_pass() { &with(json!({"k": 1404}), json!([0.01]), json!(["w"])) )); } + +/// In strict mode (the nightly workflow) any changed snapshot fails, even +/// one selecting a different plan at the committed plan's cost (#1541): +/// committed `k = 1404`, selected `k = 2863` at the same cost. +#[test] +fn equal_cost_plan_changes_fail_when_strict() { + let snapshot = |k: u64| { + serde_json::to_string_pretty(&json!({ + "selected": {"cost": {"cost_per_second": 1.0e-6}, "dag": {"k": k}, "accepted": []}, + })) + .unwrap() + }; + let (committed, regenerated) = (snapshot(1404), snapshot(2863)); + assert!(changed_snapshot_passes(&committed, ®enerated, false)); + assert!(!changed_snapshot_passes(&committed, ®enerated, true)); +} diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q02.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q02.json index 8f8b81587..e77307170 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q02.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q02.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "3b3f67a1f3c9d5b2763c9de99557f43e", + "plan_id": "8019fe7bae92df6ec83c708f4523e66d", "refresh": "at_ingestion", "retention_ms": 3900000, "view_state_key": { @@ -854,9 +854,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -986,9 +984,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1044,9 +1040,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": false, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q05.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q05.json index fb2dd3b6d..eb680dea9 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q05.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q05.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "782b58d5b5663e0807064a09f1d9b98e", + "plan_id": "c37a9b99850aebeabafb27f2277564b6", "refresh": "at_ingestion", "retention_ms": 3900000, "view_state_key": { @@ -80,7 +80,7 @@ "materialized_views": [] }, "node_id": 7, - "plan_id": "782b58d5b5663e0807064a09f1d9b98e", + "plan_id": "c37a9b99850aebeabafb27f2277564b6", "refresh": "at_ingestion", "retention_ms": 3900000, "view_state_key": { @@ -1358,9 +1358,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1490,9 +1488,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1818,9 +1814,7 @@ }, { "id": 9, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1936,9 +1930,7 @@ }, { "id": 11, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1981,9 +1973,7 @@ }, { "id": 12, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2061,9 +2051,7 @@ }, { "id": 14, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q06.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q06.json index ccf75dc61..398295b3c 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q06.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q06.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "9b8f7e452816f875449016c748516f92", + "plan_id": "56947e7146d6c733526cc82f09c99686", "refresh": "at_ingestion", "retention_ms": 3900000, "view_state_key": { @@ -933,9 +933,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1065,9 +1063,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1123,9 +1119,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": false, "fields": [ @@ -1210,9 +1204,7 @@ }, { "id": 8, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": false, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q11.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q11.json index cf4c31ba0..01135c220 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q11.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q11.json @@ -405,9 +405,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -489,9 +487,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q18.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q18.json index c0bb9d7bc..f5d712526 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q18.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q18.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "4f1e762604bbf979289dc017b44a331c", + "plan_id": "3394a2342f7a5ee1ed2ec5c318e6d047", "refresh": "at_ingestion", "retention_ms": 28800000, "view_state_key": { @@ -82,7 +82,7 @@ ] }, "node_id": 2, - "plan_id": "4f1e762604bbf979289dc017b44a331c", + "plan_id": "3394a2342f7a5ee1ed2ec5c318e6d047", "refresh": "at_ingestion", "retention_ms": 28800000, "view_state_key": { @@ -131,7 +131,7 @@ ] }, "node_id": 3, - "plan_id": "4f1e762604bbf979289dc017b44a331c", + "plan_id": "3394a2342f7a5ee1ed2ec5c318e6d047", "refresh": "at_ingestion", "retention_ms": 28800000, "view_state_key": { @@ -178,7 +178,7 @@ "materialized_views": [] }, "node_id": 9, - "plan_id": "4f1e762604bbf979289dc017b44a331c", + "plan_id": "3394a2342f7a5ee1ed2ec5c318e6d047", "refresh": "at_ingestion", "retention_ms": 28800000, "view_state_key": { @@ -227,7 +227,7 @@ ] }, "node_id": 10, - "plan_id": "4f1e762604bbf979289dc017b44a331c", + "plan_id": "3394a2342f7a5ee1ed2ec5c318e6d047", "refresh": "at_ingestion", "retention_ms": 28800000, "view_state_key": { @@ -276,7 +276,7 @@ ] }, "node_id": 11, - "plan_id": "4f1e762604bbf979289dc017b44a331c", + "plan_id": "3394a2342f7a5ee1ed2ec5c318e6d047", "refresh": "at_ingestion", "retention_ms": 28800000, "view_state_key": { @@ -2203,9 +2203,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2335,9 +2333,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2847,9 +2843,7 @@ }, { "id": 13, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2965,9 +2959,7 @@ }, { "id": 15, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -3010,9 +3002,7 @@ }, { "id": 16, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q19.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q19.json index e81f62fab..5a8323694 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q19.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q19.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "6ce757cd533b9cd3e525a35bee1ce088", + "plan_id": "5d0eda2f70b6165b37f7bc26388df9d3", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -82,7 +82,7 @@ ] }, "node_id": 2, - "plan_id": "6ce757cd533b9cd3e525a35bee1ce088", + "plan_id": "5d0eda2f70b6165b37f7bc26388df9d3", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -131,7 +131,7 @@ ] }, "node_id": 3, - "plan_id": "6ce757cd533b9cd3e525a35bee1ce088", + "plan_id": "5d0eda2f70b6165b37f7bc26388df9d3", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -178,7 +178,7 @@ "materialized_views": [] }, "node_id": 9, - "plan_id": "6ce757cd533b9cd3e525a35bee1ce088", + "plan_id": "5d0eda2f70b6165b37f7bc26388df9d3", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -227,7 +227,7 @@ ] }, "node_id": 10, - "plan_id": "6ce757cd533b9cd3e525a35bee1ce088", + "plan_id": "5d0eda2f70b6165b37f7bc26388df9d3", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -276,7 +276,7 @@ ] }, "node_id": 11, - "plan_id": "6ce757cd533b9cd3e525a35bee1ce088", + "plan_id": "5d0eda2f70b6165b37f7bc26388df9d3", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -2202,9 +2202,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2334,9 +2332,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2845,9 +2841,7 @@ }, { "id": 13, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2963,9 +2957,7 @@ }, { "id": 15, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -3008,9 +3000,7 @@ }, { "id": 16, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q20.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q20.json index 1845a9cf7..9705f4a16 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q20.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q20.json @@ -326,9 +326,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q21.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q21.json index 5814bb777..10a350bee 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q21.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q21.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "16936ea2ddee5a4d02b813c938c1d581", + "plan_id": "b021aeef71f8556e964bbbe14ab99cd4", "refresh": "at_ingestion", "retention_ms": 7500000, "view_state_key": { @@ -94,7 +94,7 @@ "cost_per_second": 0.0, "cost_source": "analytical", "cpu_core_seconds_per_second": 0.0, - "detail": "time shift: pass 1000 rows, free; x 1.0167/s; holds 61000 bytes for 0.000 ms", + "detail": "time shift: pass 1000 rows, free; x 1.0167/s", "ingest_cpu_core_seconds_per_second": 0.0, "multiplier": 1, "operator": "TimeShift", @@ -177,7 +177,7 @@ } ], "peak_cpu_cores": 2, - "peak_memory_bytes": 7808133, + "peak_memory_bytes": 7747133, "precompute_load": 0.000025, "recommended_configuration": { "ingest": { @@ -742,9 +742,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -871,9 +869,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -989,9 +985,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q22.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q22.json index c61a0763f..af944272d 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q22.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q22.json @@ -33,7 +33,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "18cb4ce5ea6faeb4cd53939f67c8f61d", + "plan_id": "b523f1f0a5ab0fe1ddd49b9b76f5d585", "refresh": "at_ingestion", "retention_ms": 3900000, "view_state_key": { @@ -737,9 +737,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -855,9 +853,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q23.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q23.json index 0080493be..fa4ef24d6 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q23.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q23.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "caf2808753629aef042a4137c52532cf", + "plan_id": "f5ee1f67bd76919207ede61619d4fdcf", "refresh": "at_ingestion", "retention_ms": 3900000, "view_state_key": { @@ -699,9 +699,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -817,9 +815,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q25.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q25.json index 97ee9285b..77a5fd32b 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q25.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q25.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "ef77cd5303dccd877907b5305d10a2a5", + "plan_id": "f9171cce5b9f73f845a66528c876f6f2", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -44,7 +44,7 @@ ] }, "node_id": 2, - "plan_id": "ef77cd5303dccd877907b5305d10a2a5", + "plan_id": "f9171cce5b9f73f845a66528c876f6f2", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -74,7 +74,7 @@ ] }, "node_id": 3, - "plan_id": "ef77cd5303dccd877907b5305d10a2a5", + "plan_id": "f9171cce5b9f73f845a66528c876f6f2", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -102,7 +102,7 @@ "materialized_views": [] }, "node_id": 9, - "plan_id": "ef77cd5303dccd877907b5305d10a2a5", + "plan_id": "f9171cce5b9f73f845a66528c876f6f2", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -132,7 +132,7 @@ ] }, "node_id": 10, - "plan_id": "ef77cd5303dccd877907b5305d10a2a5", + "plan_id": "f9171cce5b9f73f845a66528c876f6f2", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -162,7 +162,7 @@ ] }, "node_id": 11, - "plan_id": "ef77cd5303dccd877907b5305d10a2a5", + "plan_id": "f9171cce5b9f73f845a66528c876f6f2", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -2031,9 +2031,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2163,9 +2161,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2617,9 +2613,7 @@ }, { "id": 13, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2735,9 +2729,7 @@ }, { "id": 15, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2780,9 +2772,7 @@ }, { "id": 16, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q26.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q26.json index 30b8d60b6..5e4201616 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q26.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q26.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "f413ac4f80b9ec7adf5ccc28716cc089", + "plan_id": "181480781422a741e4c346ac5d5e9401", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -44,7 +44,7 @@ ] }, "node_id": 2, - "plan_id": "f413ac4f80b9ec7adf5ccc28716cc089", + "plan_id": "181480781422a741e4c346ac5d5e9401", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -74,7 +74,7 @@ ] }, "node_id": 3, - "plan_id": "f413ac4f80b9ec7adf5ccc28716cc089", + "plan_id": "181480781422a741e4c346ac5d5e9401", "refresh": "at_ingestion", "retention_ms": 7200000, "view_state_key": { @@ -1022,9 +1022,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1126,9 +1124,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q27.json b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q27.json index 0e63b5d16..fbb2cacdc 100644 --- a/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q27.json +++ b/crates/planner-cli/tests/corpus_snapshots/o11y_bench/q27.json @@ -326,9 +326,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots.rs b/crates/planner-cli/tests/sketch_plan_snapshots.rs index abf9ec4cc..7b5f7e155 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots.rs +++ b/crates/planner-cli/tests/sketch_plan_snapshots.rs @@ -5,10 +5,11 @@ //! sketches (KLL, DDSketch, a CMS heap), share a sketch tumbling-window chain between //! queries or nested windows, answer a ratio of two quantiles from one tumbling window //! chain, and materialize tumbling windows, under the MVP deployment (raw data not -//! retained) and raw data retained. A change to cost, accuracy, warnings -//! or errors fails. A change to sketch kinds, parameters, sizes, sharing, -//! timing or lifetime alone, at the committed plan's cost, passes (see the -//! corpus snapshot module docs). +//! retained) and raw data retained. Any change fails under +//! `STRICT_SNAPSHOTS=1` (the nightly workflow). Without it, a change to +//! cost, accuracy, warnings or errors fails, and a change to sketch kinds, +//! parameters, sizes, sharing, timing or lifetime alone, at the committed +//! plan's cost, passes (see the corpus snapshot module docs). //! //! Small multi-query workloads (#1278) each exercise one planner behavior: //! rollup across label sets, top-k reuse, chain widths and sharing, avg as @@ -33,7 +34,10 @@ use std::path::PathBuf; use serde_json::{json, Value}; -use super::{asap_planner, equal_cost_plan, first_difference, first_differing_path, plan_snapshot}; +use super::{ + asap_planner, changed_snapshot_passes, first_difference, first_differing_path, plan_snapshot, + strict_snapshots, +}; fn repository_root() -> PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..") @@ -95,6 +99,7 @@ fn sketch_plans_match_snapshots() { .lock() .unwrap_or_else(|poisoned| poisoned.into_inner()); let update = std::env::var_os("UPDATE_SNAPSHOTS").is_some(); + let strict = strict_snapshots(); // Beside the corpus snapshots' regenerated files, which CI uploads. let regenerated = PathBuf::from(env!("CARGO_TARGET_TMPDIR")) .join("corpus_snapshots") @@ -134,8 +139,11 @@ fn sketch_plans_match_snapshots() { let difference = match std::fs::read_to_string(&path) { Err(_) => Some("no snapshot".to_owned()), Ok(expected) if expected == actual_text => None, - Ok(expected) if equal_cost_plan(&expected, &actual_text) => { - eprintln!("{id}: plan changed at the committed plan's cost; passes"); + Ok(expected) if changed_snapshot_passes(&expected, &actual_text, strict) => { + eprintln!( + "{id}: plan changed at the committed plan's cost; \ + passes (fails with STRICT_SNAPSHOTS=1)" + ); None } Ok(expected) => Some( diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json index 65982d6fd..66ad812c8 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json @@ -679,9 +679,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -919,9 +917,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1126,9 +1122,7 @@ }, { "id": 8, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json index 74801bcac..18ee2a05b 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "1dbad9b63b6c632668a1db7298a6197f", + "plan_id": "e6bedd5222006e3a9fa505a075df6470", "refresh": "at_ingestion", "retention_ms": 600000, "view_state_key": { @@ -22,7 +22,7 @@ "logical_properties": { "parameters": { "Kll": { - "k": 1404 + "k": 2863 } } }, @@ -46,7 +46,7 @@ "materialized_views": [] }, "node_id": 10, - "plan_id": "1dbad9b63b6c632668a1db7298a6197f", + "plan_id": "e6bedd5222006e3a9fa505a075df6470", "refresh": "at_ingestion", "retention_ms": 180000, "view_state_key": { @@ -80,7 +80,7 @@ ] }, "node_id": 11, - "plan_id": "1dbad9b63b6c632668a1db7298a6197f", + "plan_id": "e6bedd5222006e3a9fa505a075df6470", "refresh": "at_ingestion", "retention_ms": 180000, "view_state_key": { @@ -1247,7 +1247,7 @@ }, "parameters": { "Kll": { - "k": 1404 + "k": 2863 } }, "payload": { @@ -1321,7 +1321,7 @@ }, "parameters": { "Kll": { - "k": 1404 + "k": 2863 } }, "payload": { @@ -1339,9 +1339,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1381,7 +1379,7 @@ }, "parameters": { "Kll": { - "k": 1404 + "k": 2863 } }, "payload": { @@ -1557,7 +1555,7 @@ }, "parameters": { "Kll": { - "k": 1404 + "k": 2863 } }, "payload": { @@ -1575,9 +1573,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1617,7 +1613,7 @@ }, "parameters": { "Kll": { - "k": 1404 + "k": 2863 } }, "payload": { @@ -1954,9 +1950,7 @@ }, { "id": 13, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json index 06a27f92d..968947da7 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json @@ -604,9 +604,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -720,9 +718,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -923,9 +919,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json index 408102795..1b5ba8425 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json @@ -604,9 +604,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -720,9 +718,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -923,9 +919,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json index 0f12c78ff..fc86689b5 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json @@ -460,9 +460,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -575,9 +573,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json index 0f48df13f..5d7f11300 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json @@ -741,7 +741,7 @@ }, "parameters": { "Kmv": { - "k": 26656 + "k": 106263 } }, "payload": { @@ -806,7 +806,7 @@ }, "parameters": { "Kmv": { - "k": 26656 + "k": 106263 } }, "payload": { @@ -824,9 +824,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -866,7 +864,7 @@ }, "parameters": { "Kmv": { - "k": 26656 + "k": 106263 } }, "payload": { @@ -1038,7 +1036,7 @@ }, "parameters": { "Kmv": { - "k": 26656 + "k": 106263 } }, "payload": { @@ -1056,9 +1054,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1098,7 +1094,7 @@ }, "parameters": { "Kmv": { - "k": 26656 + "k": 106263 } }, "payload": { diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json index 3b1298fe0..5b60f8d7e 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json @@ -676,9 +676,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -773,9 +771,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -815,7 +811,7 @@ }, "parameters": { "Kmv": { - "k": 106263 + "k": 26656 } }, "payload": { diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json index b8e06835c..89bdc73b4 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json @@ -520,9 +520,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -562,7 +560,7 @@ }, "parameters": { "Kmv": { - "k": 26656 + "k": 106263 } }, "payload": { @@ -703,9 +701,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json index 20226917a..d528ad363 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json @@ -328,9 +328,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json index b5b5b8f5d..40b096fcc 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json @@ -1094,7 +1094,7 @@ }, "parameters": { "Kll": { - "k": 2863 + "k": 1404 } }, "payload": { @@ -1521,9 +1521,7 @@ }, { "id": 9, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1762,9 +1760,7 @@ }, { "id": 12, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1970,9 +1966,7 @@ }, { "id": 15, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/nested-windows-15m-1h-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/nested-windows-15m-1h-mvp.json index 952d0c400..ed7b8427d 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/nested-windows-15m-1h-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/nested-windows-15m-1h-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "203a67f87428002f9f0baadbc58ace02", + "plan_id": "2e7c4f367ed215083127be9c87601a1a", "refresh": "at_ingestion", "retention_ms": 3600000, "view_state_key": { @@ -865,9 +865,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1101,9 +1099,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json index 2397d0e31..54a7ef906 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json @@ -328,9 +328,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json index 842bf813b..de4f48c15 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json @@ -328,9 +328,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-grouped-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-grouped-mvp.json index 27cbe8f01..bdb021296 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-grouped-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-grouped-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "f7dc3dbf9f6c995d655257d30264a96a", + "plan_id": "d450d834c14314b5c09c5e8227e7e200", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -48,7 +48,7 @@ ] }, "node_id": 2, - "plan_id": "f7dc3dbf9f6c995d655257d30264a96a", + "plan_id": "d450d834c14314b5c09c5e8227e7e200", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -976,9 +976,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1181,9 +1179,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json index b51e00790..d4d4a3102 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json @@ -472,9 +472,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -675,9 +673,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-single-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-single-mvp.json index d35d42f81..403eddbf2 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/quantile-single-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/quantile-single-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "c5a429f13d5fe0d638487a1f29fb6de1", + "plan_id": "0f4579fa2d626127d7f6a7b76cf77058", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -48,7 +48,7 @@ ] }, "node_id": 2, - "plan_id": "c5a429f13d5fe0d638487a1f29fb6de1", + "plan_id": "0f4579fa2d626127d7f6a7b76cf77058", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -820,9 +820,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-long-w01-q3-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-long-w01-q3-mvp.json index aeb54a3aa..ce781e4c9 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-long-w01-q3-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-long-w01-q3-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "af364d44eccce9e553faf9caf2443cd5", + "plan_id": "a273b07a6634f34fffc4dc72d1e03c75", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -48,7 +48,7 @@ ] }, "node_id": 2, - "plan_id": "af364d44eccce9e553faf9caf2443cd5", + "plan_id": "a273b07a6634f34fffc4dc72d1e03c75", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -976,9 +976,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1181,9 +1179,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w01-q3-q8-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w01-q3-q8-mvp.json index 3ae201a31..4d372adb2 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w01-q3-q8-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w01-q3-q8-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "8c2bbba375df73032544bda8ce858852", + "plan_id": "8ab01697d15c320e173f86169de75bce", "refresh": "at_ingestion", "retention_ms": 100000, "view_state_key": { @@ -46,7 +46,7 @@ "materialized_views": [] }, "node_id": 8, - "plan_id": "8c2bbba375df73032544bda8ce858852", + "plan_id": "8ab01697d15c320e173f86169de75bce", "refresh": "at_ingestion", "retention_ms": 1200000, "view_state_key": { @@ -76,7 +76,7 @@ ] }, "node_id": 9, - "plan_id": "8c2bbba375df73032544bda8ce858852", + "plan_id": "8ab01697d15c320e173f86169de75bce", "refresh": "at_ingestion", "retention_ms": 1200000, "view_state_key": { @@ -106,7 +106,7 @@ ] }, "node_id": 10, - "plan_id": "8c2bbba375df73032544bda8ce858852", + "plan_id": "8ab01697d15c320e173f86169de75bce", "refresh": "at_ingestion", "retention_ms": 1200000, "view_state_key": { @@ -1449,9 +1449,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1654,9 +1652,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2106,9 +2102,7 @@ }, { "id": 12, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -2224,9 +2218,7 @@ }, { "id": 14, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w02-q2-q7-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w02-q2-q7-mvp.json index 2a06682f1..1076cee29 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w02-q2-q7-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/random-mixed-seed-862-w02-q2-q7-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "c045967dec81e9d78136e1163a395e6f", + "plan_id": "af3320477653d0707d18063100dbf68f", "refresh": "at_ingestion", "retention_ms": 100000, "view_state_key": { @@ -46,7 +46,7 @@ "materialized_views": [] }, "node_id": 8, - "plan_id": "c045967dec81e9d78136e1163a395e6f", + "plan_id": "af3320477653d0707d18063100dbf68f", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -76,7 +76,7 @@ ] }, "node_id": 9, - "plan_id": "c045967dec81e9d78136e1163a395e6f", + "plan_id": "af3320477653d0707d18063100dbf68f", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -1295,9 +1295,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1500,9 +1498,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1880,9 +1876,7 @@ }, { "id": 11, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1998,9 +1992,7 @@ }, { "id": 13, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json index ec593538d..1e55bcae8 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json @@ -521,9 +521,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -741,9 +739,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json index 236b113a7..4e308f996 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json @@ -535,9 +535,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -776,9 +774,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json index f9529745b..c5a90d3cf 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json @@ -775,9 +775,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json index 3b15f4a19..7f275f176 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json @@ -460,9 +460,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -522,9 +520,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -578,9 +574,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json index 3b15f4a19..7f275f176 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json @@ -460,9 +460,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -522,9 +520,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -578,9 +574,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json index 9e6151c63..178317222 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 5, - "plan_id": "d79a20a6ab11b3524444d7c9ec9f2b14", + "plan_id": "0c301b0a3cd3541f0f9d084588e3143a", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -786,9 +786,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1152,9 +1150,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json index 56a920b2b..c03a7ae1b 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 5, - "plan_id": "18b38ce3ccdf7dac542a187187f7b3c2", + "plan_id": "f761dd61dfe791f267ff34b20ff9ee30", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -786,9 +786,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1152,9 +1150,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json index 16b0dabbd..49bb6a030 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json @@ -535,9 +535,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -776,9 +774,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json index 61955a35e..99ee6ea65 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json @@ -460,9 +460,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -575,9 +573,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json index 974dd8eea..1458ecce1 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json @@ -402,9 +402,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -464,9 +462,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json index dad3a3b89..27a215655 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json @@ -472,9 +472,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -674,9 +672,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json index e368403a6..d765792f2 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json @@ -897,9 +897,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json index 294b3c071..4bb4376f8 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json @@ -511,9 +511,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -683,9 +681,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-guarantees-ignored-mvp.json b/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-guarantees-ignored-mvp.json index 4b705279d..b2b971c93 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-guarantees-ignored-mvp.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/topk-rate-guarantees-ignored-mvp.json @@ -14,7 +14,7 @@ "materialized_views": [] }, "node_id": 1, - "plan_id": "6656cdf755430662cfeaee0364ac65c2", + "plan_id": "54eceb691b5a3ce9ff3b774e562ef431", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -44,7 +44,7 @@ ] }, "node_id": 2, - "plan_id": "6656cdf755430662cfeaee0364ac65c2", + "plan_id": "54eceb691b5a3ce9ff3b774e562ef431", "refresh": "at_ingestion", "retention_ms": 300000, "view_state_key": { @@ -963,9 +963,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1081,9 +1079,7 @@ }, { "id": 6, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -1139,9 +1135,7 @@ }, { "id": 7, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json index 2dcab2353..69480d298 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json @@ -518,9 +518,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -579,9 +577,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -635,9 +631,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -697,9 +691,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json b/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json index 2dcab2353..69480d298 100644 --- a/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json +++ b/crates/planner-cli/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json @@ -518,9 +518,7 @@ }, { "id": 2, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -579,9 +577,7 @@ }, { "id": 3, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -635,9 +631,7 @@ }, { "id": 4, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ @@ -697,9 +691,7 @@ }, { "id": 5, - "lifetime": { - "OneEvaluation": "Memory" - }, + "lifetime": "None", "output_schema": { "closed": true, "fields": [ diff --git a/docs/develop_docs/planner-snapshots.md b/docs/develop_docs/planner-snapshots.md index a85ebc4e0..7b4a71fdd 100644 --- a/docs/develop_docs/planner-snapshots.md +++ b/docs/develop_docs/planner-snapshots.md @@ -5,7 +5,8 @@ produces. For each query in a corpus, the plan that `asap_planner --run-until stage3` selects is committed as a snapshot. The `Corpus snapshots` workflow checks them nightly on `main` (and on demand from the Actions tab, for any branch); a change to any of these plans fails it until the snapshots are -regenerated and the change is explained. +regenerated and the change is explained. That includes a different plan at +the committed plan's cost (see [Strict and local runs](#strict-and-local-runs)). ## Layout @@ -22,19 +23,17 @@ regenerated and the change is explained. Only the plan, which must not change between runs: - `query` and `accuracy_guarantees`; -- `selected`: the selected Stage 2 candidate's `display_name` and `dag`, its - `cost` (`cost_per_second`, `usage`, `per_node`) and `accepted` accuracy; -- `proven_optimal`: whether the search proved the plan optimal (its status is - `optimal`) rather than stopping at an evaluation budget; -- `materialized_views`, `tumbling_window_retention_ms` and any `warnings`; -- for a query that does not plan, `selected: null`, the `error` up to its - embedded search report, and the causes and reasons of the rejections. - -Floats are rounded to 12 significant digits. Everything about the search -except whether it proved the plan optimal is left out: the search report's -counters, bounds and timings, the Stage 1 and Stage 2 candidate lists, and -the memo. Timings vary from run to run, and the rest describes how the plan -was found, not the plan. +- `selected`: the selected plan's `dag` (Stage 3's `PhysicalASAPDAG`, with + the retention and lifetime of its nodes), its `cost` (`cost_per_second`, + `usage`, `per_node`) and `accepted` accuracy per query; +- `materialized_views` and any `warnings`, `materialized_views_error` and + `planner_executor_error`; +- for a query that does not plan, `selected: null` and the `error`. + +Floats are rounded to 12 significant digits. Everything about the search is +left out: the selection MILP's size and timings, the Stage 1 and Stage 2 +candidate lists, and the memo. Timings vary from run to run, and the rest +describes how the plan was found, not the plan. ## Sketch plan snapshots @@ -43,11 +42,9 @@ The corpus queries carry no accuracy target, so their plans are exact. that select sketches: `manifest.json` lists each workload (a workload file, its deployment capabilities and cost inputs files, and whether accuracy guarantees are enforced), and `.json` is its snapshot, holding the same fields as a -corpus snapshot plus every query's text and the `search_status`. The test, +corpus snapshot, with `queries` (every query's text) in place of `query`. The test, `sketch_plans_match_snapshots`, is in the same `corpus_snapshots` binary and -runs nightly with it; the two tests never run at once. Every workload must end -with status `optimal`, unless the manifest gives it a -`deadline_reached_reason`; any other status fails. Regenerate with: +runs nightly with it; the two tests never run at once. Regenerate with: ```sh UPDATE_SNAPSHOTS=1 cargo test --release -p asap-planner-cli --test corpus_snapshots -- --ignored sketch_plans_match_snapshots @@ -55,7 +52,8 @@ UPDATE_SNAPSHOTS=1 cargo test --release -p asap-planner-cli --test corpus_snapsh ## When the check fails -The test names each changed query and its first differing line. CI uploads +The test names each changed query and its first differing line (for a +sketch plan workload, its first differing JSON path). CI uploads the regenerated snapshots, with each one's full `asap_planner` document (`.document.json`, which [`tools/dag-viewer`](../../tools/dag-viewer/README.md) opens), as the `corpus-snapshots` artifact. @@ -69,9 +67,27 @@ UPDATE_SNAPSHOTS=1 cargo test --release -p asap-planner-cli --test corpus_snapsh Then list each changed query and why it changed under **Snapshot changes** in the PR description. +## Strict and local runs + +The nightly workflow sets `STRICT_SNAPSHOTS` (to `1`; any value turns it +on): any difference from a committed snapshot fails, including a different +plan of the same cost (a different KLL `k`, lifetime or sharing, say). Several plans can tie on cost, +and a change to the planner can move which one the selection returns; the +PR that moves it then updates the snapshots, instead of the next PR that +regenerates them picking up the change unexplained. + +Without `STRICT_SNAPSHOTS`, as on a local run, a plan that changed at the +committed plan's cost (relative difference at most 1e-9), with the same +accepted accuracy, warnings and errors, passes and is noted on stderr. +Run with `STRICT_SNAPSHOTS=1` to check what the nightly run will. + +## Other failures + The test also fails, instead of recording a snapshot, in these cases: -- A snapshot file has no matching checked query in `corpus.json`. +- A snapshot file has no matching checked query in `corpus.json`, or no + matching workload in `manifest.json`. +- A sketch plan workload has no snapshot file. - `asap_planner` failed. ## Adding queries