From a82991b679a7fef8d0c91b6ee1d82cd0b3c7e79d Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 26 Jul 2026 02:33:41 +0000 Subject: [PATCH 1/8] WIP: test umbrella dissolution --- dag/gunbc/commit_workflow.dag | 10 +- dag/std/realization_schedule.dag | 2 + src/v1/stage0/src/cli_run.rs | 8 +- src/v1/stage0/src/lib.rs | 1 + src/v1/stage0/src/test_module_hygiene.rs | 556 +++++++++++++++++++++++ 5 files changed, 573 insertions(+), 4 deletions(-) create mode 100644 src/v1/stage0/src/test_module_hygiene.rs diff --git a/dag/gunbc/commit_workflow.dag b/dag/gunbc/commit_workflow.dag index 404a4ffa6a2..fe0498b731a 100644 --- a/dag/gunbc/commit_workflow.dag +++ b/dag/gunbc/commit_workflow.dag @@ -656,9 +656,13 @@ fn witness_entries_from_enrollments(rows: List) -> List - concat(acc, fold(check_fns, init: [], f: fn(fns, check_fn) { - concat(fns, [ScheduleWitnessEntry { entry: entry, function: check_fn, kind: kind }]) - })) + if check_fns.count() == 0 { + concat(acc, [ScheduleWitnessEntry { entry: entry, function: "", kind: kind }]) + } else { + concat(acc, fold(check_fns, init: [], f: fn(fns, check_fn) { + concat(fns, [ScheduleWitnessEntry { entry: entry, function: check_fn, kind: kind }]) + })) + } CommitSpecGate { gate: _ } => acc CommitCargoFmtCheck => acc } diff --git a/dag/std/realization_schedule.dag b/dag/std/realization_schedule.dag index b844c7d82a6..84988dec723 100644 --- a/dag/std/realization_schedule.dag +++ b/dag/std/realization_schedule.dag @@ -66,6 +66,8 @@ fn witness_kind_eq(a: WitnessKind, b: WitnessKind) -> Bool { } } +data schedule_witness_entry_function_optional_note: String = "function is OPTIONAL at file grain (umbrella dissolution U3, 2026-07-26): the empty string means Absent — the executor enumerates the entry's test fns through the same path discovery uses (scan_test_decl_names / floor_discovery_scan_test_decl_names). Non-empty keeps fn grain (per-row wet budgets, QuarantineProbeExpectRed probes, roster_registry rows that legitimately stay fn-scoped). CommitWitnessClaim.check_fns: [] projects one ScheduleWitnessEntry with function: \"\". Dissolve-on: Optional when enrollment is derived from discovery (commit_witness_claim_roster_dissolution_trigger)." + type ScheduleWitnessEntry { entry: String function: String diff --git a/src/v1/stage0/src/cli_run.rs b/src/v1/stage0/src/cli_run.rs index 34c2981fc73..ffdc58b821c 100644 --- a/src/v1/stage0/src/cli_run.rs +++ b/src/v1/stage0/src/cli_run.rs @@ -13110,6 +13110,9 @@ pub fn discover_floor_witness_roster( discovery_scope_dirs: &[String], ) -> Result, String> { floor_filename_hygiene_refusal_via_producer(source_roots)?; + // U2 — orphan plain fns in *_test.dag (enroll-or-refuse). Lives in the naming walk, + // not a new lens (umbrella-dissolution fence). + crate::test_module_hygiene::check_orphan_helpers_or_err(source_roots)?; let mut rows = invoke_floor_discovery_producer(source_roots, scan_dirs, exclude_substrings)?; rows = apply_discovery_scope_dirs_filter(rows, discovery_scope_dirs); let FloorLensImportGraph { @@ -15505,7 +15508,10 @@ fn run_discovery_corpus_with_options_inner( .iter() .map(|r| (r.entry.clone(), r.function.clone())) .collect(); - for (entry, function) in explicit_entries { + // U3 — empty function = file-grain: enumerate via the same test-decl scan discovery uses. + let expanded_explicit = + crate::test_module_hygiene::expand_explicit_entries(explicit_entries)?; + for (entry, function) in &expanded_explicit { if seen.insert((entry.clone(), function.clone())) { rows.push(DiscoveryRow { label: function.clone(), diff --git a/src/v1/stage0/src/lib.rs b/src/v1/stage0/src/lib.rs index 0ed8ae70c8b..45272eaacf2 100644 --- a/src/v1/stage0/src/lib.rs +++ b/src/v1/stage0/src/lib.rs @@ -17,6 +17,7 @@ use im::{OrdSet as BTreeSet, Vector as Vec}; pub mod cli_run; pub mod coproduct_reflection; +pub mod test_module_hygiene; pub mod extdeps_cargo; pub mod extdeps_cargo_version; pub mod extdeps_external_authority; diff --git a/src/v1/stage0/src/test_module_hygiene.rs b/src/v1/stage0/src/test_module_hygiene.rs new file mode 100644 index 00000000000..1812068915c --- /dev/null +++ b/src/v1/stage0/src/test_module_hygiene.rs @@ -0,0 +1,556 @@ +//! Test-module umbrella dissolution + orphan-helper hygiene (proud-wren-892). +//! +//! U1 — umbrella roster via the real front-end (`parse_dag_file`). +//! U2 — plain fns in `*_test.dag` unreachable from test-fn / data-init roots refuse. +//! U3 — empty `function` on an explicit entry means file-grain: enumerate test decls +//! through the same `scan_test_decl_names` path discovery uses. + +use im::HashMap; +use std::collections::{BTreeMap, BTreeSet, HashSet, VecDeque}; +use std::path::{Path, PathBuf}; +use std::rc::Rc; + +use crate::module_path_index::parsed_dag_file::parse_dag_file; +use crate::std_syntax::BinOp; +use crate::v1_compiler_infer_items::{item_kind, ItemKind}; +use crate::v1_std_core::{ + authored_name_at, binop_left, binop_right, block_stmts, expr_call_func_at, ExprData, Node, +}; + +/// Empty `ScheduleWitnessEntry.function` / empty `CommitWitnessClaim.check_fns` means +/// file-grain: the executor enumerates the entry's test fns (U3). +pub fn is_file_grain_function(function: &str) -> bool { + function.is_empty() +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct UmbrellaRecord { + pub entry: String, + pub umbrella_fn: String, + pub conjuncts: Vec, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct OrphanHelper { + pub entry: String, + pub name: String, +} + +fn collect_dag_files(root: &Path, out: &mut Vec) { + let entries = match std::fs::read_dir(root) { + Ok(e) => e, + Err(_) => return, + }; + for ent in entries.flatten() { + let path = ent.path(); + if path.is_dir() { + collect_dag_files(&path, out); + } else if path.extension().and_then(|e| e.to_str()) == Some("dag") { + out.push(path); + } + } +} + +fn is_test_dag_path(path: &str) -> bool { + Path::new(path) + .file_name() + .and_then(|s| s.to_str()) + .map(|n| n.ends_with("_test.dag")) + .unwrap_or(false) +} + +fn scan_test_decl_names(content: &str) -> Vec { + let mut out = Vec::new(); + for line in content.lines() { + let trimmed = line.trim_start(); + let rest = trimmed + .strip_prefix("test fn ") + .or_else(|| trimmed.strip_prefix("test data ")); + if let Some(rest) = rest { + let name: String = rest + .chars() + .take_while(|c| c.is_alphanumeric() || *c == '_') + .collect(); + if !name.is_empty() { + out.push(name); + } + } + } + out +} + +/// Public: same enumerator discovery uses for test-marked decls in an entry file. +pub fn enumerate_entry_test_fns(entry_path: &str) -> Result, String> { + let content = std::fs::read_to_string(entry_path) + .map_err(|e| format!("file-grain enumerate: read {entry_path}: {e}"))?; + let names = scan_test_decl_names(&content); + if names.is_empty() { + return Err(format!( + "file-grain enumerate: entry {entry_path} has no test fn / test data declarations" + )); + } + Ok(names) +} + +/// Expand explicit (entry, function) pairs: empty function → all test decls in the entry. +pub fn expand_explicit_entries( + explicit_entries: &[(String, String)], +) -> Result, String> { + let mut out = Vec::new(); + let mut seen: HashSet<(String, String)> = HashSet::new(); + for (entry, function) in explicit_entries { + if is_file_grain_function(function) { + for name in enumerate_entry_test_fns(entry)? { + let key = (entry.clone(), name.clone()); + if seen.insert(key.clone()) { + out.push(key); + } + } + } else { + let key = (entry.clone(), function.clone()); + if seen.insert(key.clone()) { + out.push(key); + } + } + } + Ok(out) +} + +fn walk_calls(node: &Rc, si: &Rc>>, out: &mut HashSet) { + match node.expr_data.as_ref() { + ExprData::ExprCall { .. } => { + let name = expr_call_func_at(node.clone(), si.clone()); + if !name.is_empty() { + out.insert(name); + } + } + _ => {} + } + for child in node.children.iter() { + walk_calls(child, si, out); + } +} + +fn peel_block(body: &Rc) -> Rc { + match body.expr_data.as_ref() { + ExprData::ExprBlock => { + let stmts = block_stmts(body.clone()); + if stmts.len() == 1 { + peel_block(&stmts[0]) + } else if let Some(last) = stmts.last() { + peel_block(last) + } else { + body.clone() + } + } + _ => body.clone(), + } +} + +/// If `expr` is a pure conjunction of nullary calls to names in `nullary_locals`, +/// return those call names in left-to-right order. Otherwise None. +fn umbrella_conjuncts( + expr: &Rc, + si: &Rc>>, + nullary_locals: &HashSet, +) -> Option> { + match expr.expr_data.as_ref() { + ExprData::ExprBinOp { op: BinOp::And, .. } => { + let left = umbrella_conjuncts(&binop_left(expr.clone()), si, nullary_locals)?; + let right = umbrella_conjuncts(&binop_right(expr.clone()), si, nullary_locals)?; + let mut out = left; + out.extend(right); + Some(out) + } + ExprData::ExprCall { .. } => { + let name = expr_call_func_at(expr.clone(), si.clone()); + let arg_count = expr + .children + .iter() + .filter(|a| !a.children.is_empty()) + .count(); + if arg_count == 0 && nullary_locals.contains(&name) { + Some(vec![name]) + } else { + None + } + } + ExprData::ExprBlock => umbrella_conjuncts(&peel_block(expr), si, nullary_locals), + _ => None, + } +} + +struct ModuleFns { + /// name -> (is_test, param_count, body) + fns: BTreeMap>)>, + /// data/const initializer bodies (reachability roots for fixture constructors) + data_bodies: Vec>, + si: Rc>>, +} + +fn analyze_test_module(path: &Path, content: &str) -> Option { + let parsed = parse_dag_file(path)?; + let test_names: HashSet = scan_test_decl_names(content).into_iter().collect(); + let mut fns = BTreeMap::new(); + let mut data_bodies = Vec::new(); + for item in parsed.items.iter() { + let name = authored_name_at(parsed.source_indices.clone(), item.clone()); + if name.is_empty() { + continue; + } + let kind = item_kind(item.clone()); + match kind { + ItemKind::FnItem | ItemKind::FuncItem => { + let param_count = item.params.len(); + let is_test = test_names.contains(&name); + fns.insert(name, (is_test, param_count, item.body.clone())); + } + ItemKind::DataItem => { + if let Some(body) = item.body.clone() { + data_bodies.push(body); + } + } + _ => {} + } + } + Some(ModuleFns { + fns, + data_bodies, + si: parsed.source_indices, + }) +} + +fn umbrellas_in_module(entry: &str, module: &ModuleFns) -> Vec { + let nullary_locals: HashSet = module + .fns + .iter() + .filter(|(_, (is_test, params, _))| !*is_test && *params == 0) + .map(|(n, _)| n.clone()) + .collect(); + let mut out = Vec::new(); + for (name, (is_test, _params, body)) in &module.fns { + if !is_test { + continue; + } + let Some(body) = body else { continue }; + let peeled = peel_block(body); + let Some(conjuncts) = umbrella_conjuncts(&peeled, &module.si, &nullary_locals) else { + continue; + }; + // A conjunction requires ≥2 conjuncts; census used ≥3 as the upper-bound filter. + if conjuncts.len() < 2 { + continue; + } + out.push(UmbrellaRecord { + entry: entry.to_string(), + umbrella_fn: name.clone(), + conjuncts, + }); + } + out +} + +fn orphans_in_module(entry: &str, module: &ModuleFns) -> Vec { + let plain: HashSet = module + .fns + .iter() + .filter(|(_, (is_test, _, _))| !*is_test) + .map(|(n, _)| n.clone()) + .collect(); + if plain.is_empty() { + return Vec::new(); + } + let mut reachable: HashSet = HashSet::new(); + let mut queue: VecDeque = VecDeque::new(); + + // Roots: test fn bodies + data/const initializers (fixture surface). + for (name, (is_test, _, body)) in &module.fns { + if *is_test { + reachable.insert(name.clone()); + if let Some(body) = body { + let mut calls = HashSet::new(); + walk_calls(body, &module.si, &mut calls); + for c in calls { + if plain.contains(&c) { + queue.push_back(c); + } + } + } + } + } + for body in &module.data_bodies { + let mut calls = HashSet::new(); + walk_calls(body, &module.si, &mut calls); + for c in calls { + if plain.contains(&c) { + queue.push_back(c); + } + } + } + + while let Some(n) = queue.pop_front() { + if !reachable.insert(n.clone()) { + continue; + } + if let Some((_, _, Some(body))) = module.fns.get(&n) { + let mut calls = HashSet::new(); + walk_calls(body, &module.si, &mut calls); + for c in calls { + if plain.contains(&c) && !reachable.contains(&c) { + queue.push_back(c); + } + } + } + } + + let mut orphans = Vec::new(); + for name in &plain { + if !reachable.contains(name) { + orphans.push(OrphanHelper { + entry: entry.to_string(), + name: name.clone(), + }); + } + } + orphans.sort_by(|a, b| a.name.cmp(&b.name)); + orphans +} + +fn repo_relative(path: &Path, ws: &Path) -> String { + path.strip_prefix(ws) + .unwrap_or(path) + .to_string_lossy() + .into_owned() +} + +/// U1 — parse every `*_test.dag` under `roots` and emit the umbrella roster. +pub fn collect_umbrella_roster(roots: &[String]) -> Result, String> { + let ws = std::env::current_dir().map_err(|e| format!("cwd: {e}"))?; + let mut files = Vec::new(); + for root in roots { + collect_dag_files(&ws.join(root), &mut files); + } + files.sort(); + let mut out = Vec::new(); + let mut parse_failures = Vec::new(); + for path in files { + let rel = repo_relative(&path, &ws); + if !is_test_dag_path(&rel) { + continue; + } + let content = match std::fs::read_to_string(&path) { + Ok(c) => c, + Err(e) => { + parse_failures.push(format!("read {rel}: {e}")); + continue; + } + }; + let Some(module) = analyze_test_module(&path, &content) else { + parse_failures.push(format!("parse failed: {rel}")); + continue; + }; + out.extend(umbrellas_in_module(&rel, &module)); + } + if !parse_failures.is_empty() && out.is_empty() { + return Err(format!( + "umbrella roster: no modules parsed ({})", + parse_failures.len() + )); + } + out.sort_by(|a, b| (&a.entry, &a.umbrella_fn).cmp(&(&b.entry, &b.umbrella_fn))); + Ok(out) +} + +/// U2 — orphan plain fns across `*_test.dag` under roots. +pub fn collect_orphan_helpers(roots: &[String]) -> Result, String> { + let ws = std::env::current_dir().map_err(|e| format!("cwd: {e}"))?; + let mut files = Vec::new(); + for root in roots { + collect_dag_files(&ws.join(root), &mut files); + } + files.sort(); + let mut out = Vec::new(); + for path in files { + let rel = repo_relative(&path, &ws); + if !is_test_dag_path(&rel) { + continue; + } + let content = match std::fs::read_to_string(&path) { + Ok(c) => c, + Err(_) => continue, + }; + let Some(module) = analyze_test_module(&path, &content) else { + continue; + }; + out.extend(orphans_in_module(&rel, &module)); + } + out.sort_by(|a, b| (&a.entry, &a.name).cmp(&(&b.entry, &b.name))); + Ok(out) +} + +/// Fail-closed orphan check for the naming walk. `roots` are source roots. +pub fn check_orphan_helpers_or_err(roots: &[String]) -> Result<(), String> { + let orphans = collect_orphan_helpers(roots)?; + if orphans.is_empty() { + return Ok(()); + } + let mut lines: Vec = Vec::new(); + lines.push(format!( + "test-module orphan-helper hygiene (DESIGN §5/§6 enroll-or-refuse): {} plain fn(s) in `*_test.dag` \ + are unreachable from every test fn and data/const initializer in their module — silent \ + de-enrollment. Promote to `test fn` or delete:", + orphans.len() + )); + // Cap the printed list so the diagnostic stays usable; full count is in the header. + for o in orphans.iter().take(40) { + lines.push(format!(" {}::{}", o.entry, o.name)); + } + if orphans.len() > 40 { + lines.push(format!(" … and {} more", orphans.len() - 40)); + } + Err(lines.join("\n")) +} + +/// Orphan check scoped to an explicit set of absolute/relative entry paths (RED fixtures). +pub fn check_orphan_helpers_in_entries(entry_paths: &[String]) -> Result<(), String> { + let mut orphans = Vec::new(); + for entry in entry_paths { + let path = Path::new(entry); + if !is_test_dag_path(entry) { + continue; + } + let content = std::fs::read_to_string(path) + .map_err(|e| format!("orphan check read {entry}: {e}"))?; + let Some(module) = analyze_test_module(path, &content) else { + return Err(format!("orphan check: parse failed for {entry}")); + }; + orphans.extend(orphans_in_module(entry, &module)); + } + if orphans.is_empty() { + return Ok(()); + } + let mut lines = vec![format!( + "test-module orphan-helper hygiene: {} unreachable plain fn(s):", + orphans.len() + )]; + for o in &orphans { + lines.push(format!(" {}::{}", o.entry, o.name)); + } + Err(lines.join("\n")) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::time::{SystemTime, UNIX_EPOCH}; + + fn tmp_dir() -> PathBuf { + let n = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_nanos(); + let dir = std::env::temp_dir().join(format!("gunbc_umbrella_hygiene_{n}")); + std::fs::create_dir_all(&dir).unwrap(); + dir + } + + #[test] + fn orphan_plant_reds_then_removing_greens() { + let dir = tmp_dir(); + let file = dir.join("orphan_plant_test.dag"); + std::fs::write( + &file, + r#"module orphan_plant_fixture + +test fn live_holds() -> Bool { + true +} + +fn dark_unreachable_check() -> Bool { + false +} +"#, + ) + .unwrap(); + let entry = file.to_string_lossy().into_owned(); + let err = check_orphan_helpers_in_entries(&[entry.clone()]) + .expect_err("planted dark helper must red"); + assert!( + err.contains("dark_unreachable_check"), + "must name the orphan fn: {err}" + ); + std::fs::write( + &file, + r#"module orphan_plant_fixture + +test fn live_holds() -> Bool { + true +} +"#, + ) + .unwrap(); + check_orphan_helpers_in_entries(&[entry]).expect("removing plant must green"); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn file_grain_enumerate_yields_two_test_fns() { + let dir = tmp_dir(); + let file = dir.join("two_fn_file_grain_test.dag"); + std::fs::write( + &file, + r#"module two_fn_file_grain + +test fn alpha_holds() -> Bool { true } + +test fn beta_holds() -> Bool { true } +"#, + ) + .unwrap(); + let entry = file.to_string_lossy().into_owned(); + let expanded = + expand_explicit_entries(&[(entry.clone(), String::new())]).expect("expand"); + assert_eq!(expanded.len(), 2, "file-grain row must yield two verdicts"); + let names: BTreeSet<_> = expanded.into_iter().map(|(_, f)| f).collect(); + assert_eq!( + names, + ["alpha_holds".to_string(), "beta_holds".to_string()] + .into_iter() + .collect() + ); + let missing = expand_explicit_entries(&[(entry, "does_not_exist_fn".into())]); + // Non-empty function is not validated here — discovery refuses missing fns at eval. + assert!(missing.is_ok()); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn umbrella_detection_on_conjunction() { + let dir = tmp_dir(); + let file = dir.join("umbrella_shape_test.dag"); + std::fs::write( + &file, + r#"module umbrella_shape + +fn a_holds() -> Bool { true } +fn b_holds() -> Bool { true } +fn c_holds() -> Bool { true } + +test fn umbrella_holds() -> Bool { + a_holds() && b_holds() && c_holds() +} +"#, + ) + .unwrap(); + let content = std::fs::read_to_string(&file).unwrap(); + let module = analyze_test_module(&file, &content).expect("parse"); + let umbrellas = umbrellas_in_module("umbrella_shape_test.dag", &module); + assert_eq!(umbrellas.len(), 1); + assert_eq!(umbrellas[0].umbrella_fn, "umbrella_holds"); + assert_eq!( + umbrellas[0].conjuncts, + vec!["a_holds", "b_holds", "c_holds"] + ); + let _ = std::fs::remove_dir_all(&dir); + } +} From a1c3afc02cc93c933e5203048b9839757fb6f5a7 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 26 Jul 2026 02:43:52 +0000 Subject: [PATCH 2/8] WIP: test umbrella dissolution --- dag/test/claim/budget_tree_witness_test.dag | 30 +-- .../claim/cache_key_completeness_test.dag | 42 ++-- dag/test/claim/cache_layer_planner_test.dag | 27 +-- dag/test/claim/cache_purity_verdict_test.dag | 9 +- .../claim/cargo_target_path_witness_test.dag | 21 +- dag/test/claim/cargo_version_witness_test.dag | 24 +- .../claim/ci_budget_tree_witness_test.dag | 42 ++-- .../claim/ci_compile_jobs_witness_test.dag | 41 ++-- .../ci_concurrency_policy_witness_test.dag | 11 +- .../ci_deploy_target_host_witness_test.dag | 42 ++-- dag/test/claim/ci_deploy_witness_test.dag | 32 +-- .../claim/ci_failure_class_witness_test.dag | 30 +-- dag/test/claim/ci_heal_job_witness_test.dag | 32 +-- .../claim/ci_oom_reclassify_witness_test.dag | 24 +- .../claim/ci_runner_seam_witness_test.dag | 18 +- .../claim/ci_runner_target_witness_test.dag | 33 +-- .../claim/ci_yaml_serializer_witness_test.dag | 63 ++---- .../claim/commit_workflow_witness_test.dag | 47 ++-- .../compile_source_model_witness_test.dag | 21 +- ...component_dispatch_button_witness_test.dag | 17 +- dag/test/claim/config_record_emit_test.dag | 30 +-- .../cpu_l1_cache_geometry_witness_test.dag | 11 +- .../cpu_l2_l3_cache_geometry_witness_test.dag | 17 +- dag/test/claim/css_grain_witness_test.dag | 17 +- .../deploy_access_privilege_witness_test.dag | 18 +- .../deploy_mutation_gate_witness_test.dag | 30 +-- .../descent_evidence_lattice_witness_test.dag | 15 +- .../claim/design_palette_witness_test.dag | 80 +++---- ...sign_register_lift_parity_witness_test.dag | 17 +- dag/test/claim/diff_baseline_witness_test.dag | 35 +-- .../dispatch_presentation_witness_test.dag | 17 +- dag/test/claim/econ_wedge_witness_test.dag | 35 +-- .../claim/emit_host_gate_witness_test.dag | 21 +- .../claim/exec_arg_limit_witness_test.dag | 11 +- .../extdeps_anemia_grounding_witness_test.dag | 24 +- ...deps_git_diff_name_status_witness_test.dag | 54 ++--- .../extdeps_git_versioning_witness_test.dag | 27 +-- ...thub_errors_url_grounding_witness_test.dag | 12 +- .../extdeps_llm_claude_trust_witness_test.dag | 35 +-- ...xtdeps_llm_type_grounding_witness_test.dag | 45 ++-- .../extdeps_round2_grounding_witness_test.dag | 57 ++--- .../extdeps_version_semver_witness_test.dag | 42 ++-- .../claim/extdeps_version_witness_test.dag | 18 +- .../claim/falsifier_workflow_witness_test.dag | 20 +- .../filesystem_entry_kind_witness_test.dag | 21 +- .../fleet_converge_apply_witness_test.dag | 18 +- .../claim/fleet_converge_cli_witness_test.dag | 27 +-- dag/test/claim/fleet_host_budget_test.dag | 53 ++--- ...fleet_show_effective_read_witness_test.dag | 66 ++---- .../claim/free_tier_serving_witness_test.dag | 35 +-- .../claim/generated_artifact_drift_test.dag | 26 +-- .../claim/gha_expression_roundtrip_test.dag | 27 +-- .../claim/githooks_pre_push_emit_test.dag | 23 +- dag/test/claim/gitignore_gate_test.dag | 18 +- .../gitlab_10k_income_series_witness_test.dag | 74 ++----- .../go_module_versioning_witness_test.dag | 60 ++--- ...interconnect_and_sm_cache_witness_test.dag | 14 +- .../claim/grounded_principal_witness_test.dag | 84 +++---- .../claim/hardware_selection_witness_test.dag | 27 +-- .../hermetic_fixture_realization_test.dag | 18 +- .../claim/hetzner_cost_quote_witness_test.dag | 12 +- ...ld_cache_provision_design_witness_test.dag | 90 +++----- .../host_converge_delta_witness_test.dag | 24 +- .../host_converge_realize_witness_test.dag | 15 +- .../host_converge_slice1_witness_test.dag | 35 +-- .../claim/host_effect_apply_witness_test.dag | 60 ++--- .../claim/host_effect_plan_witness_test.dag | 14 +- ...host_identity_observation_witness_test.dag | 93 +++----- .../claim/host_phase_status_witness_test.dag | 32 +-- .../claim/host_swap_backing_witness_test.dag | 23 +- ...host_toolchain_components_witness_test.dag | 24 +- dag/test/claim/html_emit_witness_test.dag | 29 +-- .../claim/html_markup_xss_witness_test.dag | 32 +-- dag/test/claim/html_roundtrip_test.dag | 20 +- .../claim/http_serve_route_witness_test.dag | 23 +- .../interpreter_kernel_model_witness_test.dag | 21 +- .../jedec_ddr_generation_witness_test.dag | 21 +- dag/test/claim/js_site_emit_test.dag | 48 ++-- dag/test/claim/json_emit_witness_test.dag | 75 ++----- .../claim/keyed_delta_fold_witness_test.dag | 93 +++----- dag/test/claim/layout_render_witness_test.dag | 27 +-- dag/test/claim/lens_verdict_witness_test.dag | 21 +- .../claim/live_deploy/apply_witness_test.dag | 11 +- dag/test/claim/live_deploy/emit_test.dag | 86 +++---- .../claim/live_deploy/intent_witness_test.dag | 14 +- .../live_deploy/operations_witness_test.dag | 45 ++-- .../live_deploy/readiness_witness_test.dag | 74 ++----- .../service_ready_witness_test.dag | 38 +--- ...shape_catalog_integration_witness_test.dag | 8 +- dag/test/claim/machine_shape_witness_test.dag | 26 +-- .../claim/markdown_inline_render_test.dag | 26 +-- .../markdown_markup_xss_witness_test.dag | 45 ++-- dag/test/claim/markdown_roundtrip_test.dag | 18 +- dag/test/claim/markdown_source_emit_test.dag | 12 +- .../claim/markup_medium_convergence_test.dag | 20 +- .../claim/markup_serializer_witness_test.dag | 35 +-- .../materialized_secret_witness_test.dag | 23 +- .../claim/measure_lifted_algebra_test.dag | 42 ++-- dag/test/claim/media_type_witness_test.dag | 17 +- .../claim/medium_fidelity_witness_test.dag | 21 +- .../membership_reconcile_witness_test.dag | 26 +-- .../nested_fold_generic_param_emit_test.dag | 8 +- .../observation_ci_render_witness_test.dag | 56 ++--- .../claim/observation_crawl_replay_test.dag | 11 +- .../observation_emit_census_witness_test.dag | 53 ++--- .../observation_lockstep_witness_test.dag | 20 +- .../claim/observation_model_witness_test.dag | 98 +++----- .../observation_tty_render_witness_test.dag | 32 +-- .../oomd_install_grounding_witness_test.dag | 71 ++---- dag/test/claim/output_policy_witness_test.dag | 66 ++---- .../claim/pareto_dominance_witness_test.dag | 21 +- dag/test/claim/perturbation_kernel_test.dag | 18 +- dag/test/claim/power_watt_witness_test.dag | 12 +- .../claim/pricing_surface_witness_test.dag | 20 +- .../python_pep440_version_witness_test.dag | 54 ++--- dag/test/claim/react_jsx_emit_test.dag | 15 +- .../readback_independence_witness_test.dag | 23 +- .../realization_reconcile_witness_test.dag | 12 +- .../claim/realization_scale_agnostic_test.dag | 15 +- ...ealization_schedule_critical_path_test.dag | 15 +- .../realization_schedule_witness_test.dag | 9 +- dag/test/claim/realization_witness_test.dag | 18 +- dag/test/claim/realize_kernel_test.dag | 27 +-- .../claim/reconcile_in_process_cache_test.dag | 27 +-- .../claim/regional_compute_witness_test.dag | 32 +-- .../claim/render_glyphs_ansi_witness_test.dag | 24 +- .../claim/render_surface_witness_test.dag | 21 +- .../retained_shell_script_witness_test.dag | 8 +- dag/test/claim/roadmap_authority_test.dag | 42 ++-- .../roadmap_belt_actuate_witness_test.dag | 113 ++++------ dag/test/claim/roadmap_belt_witness_test.dag | 56 ++--- ...roadmap_dispatch_actuator_witness_test.dag | 71 ++---- dag/test/claim/roadmap_document_test.dag | 23 +- dag/test/claim/roadmap_emit_test.dag | 20 +- .../claim/roadmap_frontier_witness_test.dag | 32 +-- dag/test/claim/roadmap_gate_test.dag | 18 +- dag/test/claim/roadmap_model_test.dag | 26 +-- dag/test/claim/roadmap_page_witness_test.dag | 72 ++---- .../claim/roadmap_register_witness_test.dag | 47 ++-- .../claim/roadmap_sandbox_witness_test.dag | 29 +-- dag/test/claim/roadmap_serve_witness_test.dag | 38 +--- .../claim/roadmap_spawner_witness_test.dag | 45 ++-- .../roadmap_static_site_witness_test.dag | 35 +-- dag/test/claim/roadmap_status_test.dag | 60 ++--- .../claim/roadmap_tactile_witness_test.dag | 77 +++---- ...runnable_resource_profile_witness_test.dag | 21 +- .../claim/runner_placement_witness_test.dag | 66 ++---- ...lot_enforcement_grounding_witness_test.dag | 36 +-- .../runner_unit_live_read_witness_test.dag | 42 ++-- dag/test/claim/rust_gates_ci_witness_test.dag | 17 +- ...he_local_content_verified_on_read_test.dag | 15 +- .../claim/scm_agentic_stress_witness_test.dag | 35 +-- .../claim/scm_issuer_corpus_witness_test.dag | 47 ++-- .../scm_provider_matrix_witness_test.dag | 41 ++-- .../claim/scm_serving_model_witness_test.dag | 35 +-- .../sec_edgar_rollins_chemed_witness_test.dag | 20 +- dag/test/claim/sec_edgar_witness_test.dag | 14 +- ...shell_exec_run_argv_embed_witness_test.dag | 14 +- .../claim/site_accent_study_witness_test.dag | 26 +-- ...er_memory_cap_plan_verify_witness_test.dag | 30 +-- ...v3_runner_memory_converge_witness_test.dag | 36 +-- dag/test/claim/ssh_transport_witness_test.dag | 11 +- .../stage0_crate_layout_witness_test.dag | 14 +- .../claim/stage0_emit_model_witness_test.dag | 12 +- ...mctl_status_read_scaffold_witness_test.dag | 17 +- ...ilscale_acl_phase2_design_witness_test.dag | 36 +-- .../terminal_capability_witness_test.dag | 21 +- .../claim/transport_fidelity_witness_test.dag | 17 +- ...ped_argv_exec_realization_witness_test.dag | 41 ++-- .../types_arch_collapse_witness_test.dag | 28 +-- dag/test/claim/uri_grounding_witness_test.dag | 12 +- .../claim/uri_path_match_witness_test.dag | 26 +-- .../claim/uri_path_parse_witness_test.dag | 27 +-- dag/test/claim/void_element_test.dag | 20 +- dag/test/claim/wcag_contrast_witness_test.dag | 23 +- dag/test/claim/yaml_ingest_witness_test.dag | 30 +-- .../yaml_multiline_block_witness_test.dag | 15 +- dag/test/claim/yaml_quoting_witness_test.dag | 30 +-- src/v1/stage0/src/cli_run.rs | 3 +- src/v1/stage0/src/lib.rs | 2 +- src/v1/stage0/src/test_module_hygiene.rs | 45 ++-- src/v2/extdeps/languages/rust_test.dag | 192 +--------------- .../react/structural_receipts_test.dag | 45 ---- .../affected_set/edit_locus_resolver_test.dag | 2 +- .../lens/cost/disj_alternative_floor_test.dag | 8 +- .../lens/cost/loop_iteration_floor_test.dag | 8 +- .../sg_claims_test.dag | 16 +- .../table_decision_tree/sg_claims_test.dag | 15 +- src/v2/std/reducible_test.dag | 8 +- ...ffected_set_disposition_both_axes_test.dag | 18 +- .../affected_set_witness_a_prove_test.dag | 15 +- .../freemonoid_first_skip_witness_test.dag | 18 +- .../test/claim/bash_build_round_trip_test.dag | 14 +- src/v2/test/claim/bash_command_fold_test.dag | 209 +++++------------- ...ild_artifact_verification_witness_test.dag | 14 +- .../claim/c_compilation_unit_witness_test.dag | 35 +-- .../test/claim/ci_floor_plan_witness_test.dag | 40 +--- src/v2/test/claim/ci_spec_witness_test.dag | 71 ++---- .../claim/compilation_unit_witness_test.dag | 41 ++-- .../compile_eval_thesis_proof_test.dag | 12 +- .../test/claim/computation_identity_test.dag | 17 +- .../claim/concept_index_enumeration_test.dag | 36 +-- .../claim/cross_tree_import_model_test.dag | 30 +-- ...agnostic_sequence_outcome_witness_test.dag | 20 +- .../test/claim/discovery_enumeration_test.dag | 12 +- .../emit/decl_emit_consolidated_test.dag | 18 +- .../claim/emit/rust_bind_let_emit_test.dag | 7 +- .../claim/emit/rust_conditional_emit_test.dag | 8 +- .../emit/rust_field_access_emit_test.dag | 7 +- .../emit/rust_fold_call_closure_emit_test.dag | 7 +- .../emit/rust_literal_bind_emit_test.dag | 26 +-- .../emit/rust_logic_complement_emit_test.dag | 8 +- .../emit/rust_logic_meet_join_emit_test.dag | 7 +- .../test/claim/emit/rust_loop_emit_test.dag | 8 +- .../test/claim/emit/rust_match_emit_test.dag | 8 +- .../emit/rust_record_construct_emit_test.dag | 8 +- .../emit/rust_variant_construct_emit_test.dag | 8 +- .../semantic_decl_serialize_parity_test.dag | 14 +- .../test/claim/emit/type_alias_emit_test.dag | 12 +- .../add_arrow_eval_by_execution_test.dag | 50 ++--- .../execution/bind_eval_by_execution_test.dag | 24 +- .../claim/execution/bind_round_trip_test.dag | 11 +- .../branch_eval_by_execution_test.dag | 23 +- .../branch_if_then_else_round_trip_test.dag | 11 +- .../dag_add_emit_round_trip_test.dag | 13 +- ...lassical_not_ingested_equals_eval_test.dag | 14 -- ...ngest_grammar_relation_round_trip_test.dag | 17 +- ...t_python_same_language_round_trip_test.dag | 33 +-- ...pescript_same_language_round_trip_test.dag | 34 +-- .../floor_diff_observe_witness_test.dag | 14 +- .../execution/loop_eval_by_execution_test.dag | 27 +-- .../claim/execution/loop_round_trip_test.dag | 11 +- .../execution/match_bool_round_trip_test.dag | 11 +- ...pick_ingested_structural_lowering_test.dag | 11 +- .../gha_workflow_yaml_fold_serialize_test.dag | 11 +- .../formal_productions_for_lhs_test.dag | 9 +- .../claim/grammar/validate_grammar_test.dag | 15 +- src/v2/test/claim/grounding_lens_test.dag | 51 ++--- .../facts_readback_verdict_perturb_test.dag | 9 +- .../transport_script_position_test.dag | 21 +- .../impossible_bug/release_demos_test.dag | 11 +- .../claim/locality_affinity_witness_test.dag | 41 ++-- ...cross_tree_real_ingest_activation_test.dag | 9 +- .../gauntlet_lane_enrollment_witness_test.dag | 9 +- ...parse_table_memo_governed_witness_test.dag | 25 +-- ...idate_ingest_staging_stage_bisect_test.dag | 123 ----------- .../manual/add_body_emit_python_test.dag | 7 +- .../manual/bind_demand_driven_eval_test.dag | 25 +-- src/v2/test/claim/manual/bind_emit_test.dag | 36 +-- .../manual/branch_if_then_else_emit_test.dag | 186 +--------------- .../manual/branch_infer_if_then_else_test.dag | 8 +- .../test/claim/manual/branch_infer_test.dag | 13 +- .../branch_lazy_arm_eval_acceptance_test.dag | 11 +- ...language_add_python_to_typescript_test.dag | 14 -- .../claim/manual/field_access_emit_test.dag | 11 +- ...nd_witness_distinct_node_zip_fold_test.dag | 2 +- .../manual/find_witness_identity_test.dag | 2 +- .../manual/floor_drain_retention_test.dag | 9 +- .../manual/fold_call_closure_emit_test.dag | 11 +- .../test/claim/manual/ingest_bridge_test.dag | 21 +- .../manual/inhabitant_neutralization_test.dag | 75 +------ .../manual/loop_demand_driven_eval_test.dag | 6 +- src/v2/test/claim/manual/loop_emit_test.dag | 36 +-- .../map_lookup_miss_witness_violates_test.dag | 8 +- .../map_structural_key_equality_test.dag | 16 +- .../claim/manual/match_bool_emit_test.dag | 52 +---- .../match_infer_fail_open_audit_test.dag | 2 +- .../manual/medium_node_instantiation_test.dag | 12 +- ...e_serializer_determinism_fidelity_test.dag | 9 +- .../medium_source_text_instantiation_test.dag | 12 +- .../manual/path_y_fidelity_successor_test.dag | 13 +- .../manual/record_construct_emit_test.dag | 11 +- src/v2/test/claim/manual/runtime_run_test.dag | 11 +- .../manual/target_carriers_fidelity_test.dag | 24 +- ...t_eager_materialize_dedup_cutover_test.dag | 9 +- .../module_resolution_plan_witness_test.dag | 14 +- ...ame_resolve_cross_tree_resolution_test.dag | 14 +- .../test/claim/native_cache_fusion_test.dag | 11 +- .../test/claim/operand_flow_witness_test.dag | 20 +- .../parse/parse_binding_fidelity_test.dag | 59 ----- .../parse/parse_table_content_key_test.dag | 18 +- src/v2/test/claim/pr_native_batch_test.dag | 8 +- .../provenance/occurrence_id_model_test.dag | 24 +- .../parse_stamp_span_index_test.dag | 9 +- .../claim/realization_runner_witness_test.dag | 41 +--- .../claim/realize_advisory_soundness_test.dag | 20 +- ...alified_module_projection_resolve_test.dag | 8 +- .../rust_crate_partition_witness_test.dag | 56 ++--- .../self_host/emit_coverage_frontier_test.dag | 26 +-- .../native_routing_frontier_test.dag | 20 +- .../claim/self_host/parity_window_test.dag | 20 +- .../wet_receipt_enrollment_witness_test.dag | 44 ++-- .../self_host/witness_bulk_routing_test.dag | 20 +- .../test/claim/sql_create_table_fold_test.dag | 36 +-- src/v2/test/claim/witness_admission_test.dag | 44 ++-- src/v2/test/manual/ownership_movable_test.dag | 17 +- 296 files changed, 2408 insertions(+), 6272 deletions(-) diff --git a/dag/test/claim/budget_tree_witness_test.dag b/dag/test/claim/budget_tree_witness_test.dag index c1facf289d1..fcffc965318 100644 --- a/dag/test/claim/budget_tree_witness_test.dag +++ b/dag/test/claim/budget_tree_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.budget_tree_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn claim(name: String, amount: std.nat.Nat, p: BudgetPriority) -> BudgetClaim { @@ -43,58 +42,47 @@ fn is_guaranteed_shortfall(r: BudgetReconciliation) -> Bool { match r { GuaranteedShortfall { shortfall: s } => true _ => false } } -fn witness_conservation_residue_lens() -> Bool { +test fn witness_conservation_residue_lens() -> Bool { node_conserves_local(node: leaf_node(cap: 120)) && !node_conserves_local(node: leaf_node(cap: 100)) } -fn witness_tree_conservation_recursive() -> Bool { +test fn witness_tree_conservation_recursive() -> Bool { node_conserves(node: root_with(child: child_node(cap: 120))) && !node_conserves(node: root_with(child: child_node(cap: 100))) } -fn witness_divide_once() -> Bool { +test fn witness_divide_once() -> Bool { let two_children = [child_node(cap: 100), child_node(cap: 100)] let tight = BudgetNode { name: "r", appropriation: appr(n: 150), claims: [], children: two_children } let roomy = BudgetNode { name: "r", appropriation: appr(n: 250), claims: [], children: two_children } return !node_conserves_local(node: tight) && node_conserves_local(node: roomy) } -fn witness_admission_is_construction() -> Bool { +test fn witness_admission_is_construction() -> Bool { let admitted = admit_all(appropriation: appr(n: 90), candidates: claim_items(claims: sample_claims())) return within_appropriation(appropriation: appr(n: 90), items: admitted.committed) && admitted.refused.length() > 0 } -fn witness_balance_states() -> Bool { +test fn witness_balance_states() -> Bool { (node_balance(node: leaf_node(cap: 200)) == Surplus) && (node_balance(node: leaf_node(cap: 110)) == Balanced) && (node_balance(node: leaf_node(cap: 100)) == Deficit) } -fn witness_reconcile_all_satisfied() -> Bool { +test fn witness_reconcile_all_satisfied() -> Bool { is_all_satisfied(r: product.budget_tree.reconcile(node: leaf_node(cap: 120), actual: byte_size(count: 120))) } -fn witness_reconcile_evicts_best_effort() -> Bool { +test fn witness_reconcile_evicts_best_effort() -> Bool { is_evicted(r: product.budget_tree.reconcile(node: leaf_node(cap: 120), actual: byte_size(count: 90))) } -fn witness_reconcile_guaranteed_shortfall() -> Bool { +test fn witness_reconcile_guaranteed_shortfall() -> Bool { is_guaranteed_shortfall(r: product.budget_tree.reconcile(node: leaf_node(cap: 120), actual: byte_size(count: 50))) } -fn witness_method_is_zero_based() -> Bool { +test fn witness_method_is_zero_based() -> Bool { budget_tree_method == ZeroBased } -test fn budget_tree_holds() -> Bool { - witness_conservation_residue_lens() - && witness_tree_conservation_recursive() - && witness_divide_once() - && witness_admission_is_construction() - && witness_balance_states() - && witness_reconcile_all_satisfied() - && witness_reconcile_evicts_best_effort() - && witness_reconcile_guaranteed_shortfall() - && witness_method_is_zero_based() -} diff --git a/dag/test/claim/cache_key_completeness_test.dag b/dag/test/claim/cache_key_completeness_test.dag index 2c42e400a2e..4342dd3facb 100644 --- a/dag/test/claim/cache_key_completeness_test.dag +++ b/dag/test/claim/cache_key_completeness_test.dag @@ -1,21 +1,20 @@ module test.claim.cache_key_completeness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_module: String = "test.claim.cache_key_completeness" -fn witness_cav_toolchain_derives_transform() -> Bool { +test fn witness_cav_toolchain_derives_transform() -> Bool { let inputs = content_addressed_inputs(triggers: [ToolchainChange, ManualPurge]) catalog_has_vendor_only_key_inputs(inputs: inputs) && (inputs.length() == 2) } -fn witness_cav_no_toolchain_derives_subject_only() -> Bool { +test fn witness_cav_no_toolchain_derives_subject_only() -> Bool { let inputs = content_addressed_inputs(triggers: [ManualPurge]) !catalog_has_vendor_only_key_inputs(inputs: inputs) && (inputs.length() == 1) } -fn witness_live_resolved_graph_derives_toolchain() -> Bool { +test fn witness_live_resolved_graph_derives_toolchain() -> Bool { let inputs = catalog_inputs_considered(kd: resolved_graph_cache_facts.key_derivation) catalog_has_vendor_only_key_inputs(inputs: inputs) && (inputs.length() == 2) } @@ -64,64 +63,49 @@ fn no_promise_native_facts() -> CatalogKeyDerivationFacts { } } -fn witness_complete_green_on_sound_cited() -> Bool { +test fn witness_complete_green_on_sound_cited() -> Bool { cache_key_derivation_complete(facts: sound_cited_facts()) } -fn witness_complete_red_on_undercited() -> Bool { +test fn witness_complete_red_on_undercited() -> Bool { !cache_key_derivation_complete(facts: undercited_native_facts()) } -fn witness_verdict_holds_on_sound_cited() -> Bool { +test fn witness_verdict_holds_on_sound_cited() -> Bool { match v2.extdeps.cache.key_completeness_verdict.cache_key_completeness_verdict(facts: sound_cited_facts(), module_name: witness_module) { Holds => true _ => false } } -fn witness_verdict_violation_on_undercited() -> Bool { +test fn witness_verdict_violation_on_undercited() -> Bool { match v2.extdeps.cache.key_completeness_verdict.cache_key_completeness_verdict(facts: undercited_native_facts(), module_name: witness_module) { Violation { diagnostic: _ } => true _ => false } } -fn witness_hand_authored_exempt() -> Bool { +test fn witness_hand_authored_exempt() -> Bool { cache_key_derivation_complete(facts: hand_authored_facts()) } -fn witness_native_not_exempt() -> Bool { +test fn witness_native_not_exempt() -> Bool { !cache_key_derivation_complete(facts: undercited_native_facts()) } -fn witness_no_promise_complete() -> Bool { +test fn witness_no_promise_complete() -> Bool { cache_key_derivation_complete(facts: no_promise_native_facts()) } -fn witness_promise_without_input_incomplete() -> Bool { +test fn witness_promise_without_input_incomplete() -> Bool { !cache_key_derivation_complete(facts: undercited_native_facts()) } -fn witness_live_catalog_holds() -> Bool { +test fn witness_live_catalog_holds() -> Bool { cache_catalog_key_completeness_holds(catalog: cache_catalog) } -fn witness_live_resolved_graph_complete() -> Bool { +test fn witness_live_resolved_graph_complete() -> Bool { cache_key_derivation_complete(facts: resolved_graph_cache_facts.key_derivation) } -test fn cache_key_completeness_witnesses() -> Bool { - witness_cav_toolchain_derives_transform() - && witness_cav_no_toolchain_derives_subject_only() - && witness_live_resolved_graph_derives_toolchain() - && witness_complete_green_on_sound_cited() - && witness_complete_red_on_undercited() - && witness_verdict_holds_on_sound_cited() - && witness_verdict_violation_on_undercited() - && witness_hand_authored_exempt() - && witness_native_not_exempt() - && witness_no_promise_complete() - && witness_promise_without_input_incomplete() - && witness_live_catalog_holds() - && witness_live_resolved_graph_complete() -} diff --git a/dag/test/claim/cache_layer_planner_test.dag b/dag/test/claim/cache_layer_planner_test.dag index 7a1bece5d7c..a6edb63eb5a 100644 --- a/dag/test/claim/cache_layer_planner_test.dag +++ b/dag/test/claim/cache_layer_planner_test.dag @@ -1,6 +1,5 @@ module test.claim.cache_layer_planner - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data cheap_recompute: CostAccount = cost_account_measured( @@ -24,7 +23,7 @@ data gha_only_deployment: CacheDeploymentBackends = CacheDeploymentBackends { available: [gha_actions_cache_id], } -fn witness_cheap_recompute_skips_wan_layers() -> Bool { +test fn witness_cheap_recompute_skips_wan_layers() -> Bool { let plan = plan_cache_layers( deployment: wan_deployment, recompute: cheap_recompute, @@ -37,7 +36,7 @@ fn witness_cheap_recompute_skips_wan_layers() -> Bool { && !cache_layer_plan_contains_id(plan: plan, id: gha_actions_cache_id) } -fn witness_expensive_recompute_reaches_wan_layers() -> Bool { +test fn witness_expensive_recompute_reaches_wan_layers() -> Bool { let plan = plan_cache_layers( deployment: wan_deployment, recompute: expensive_recompute, @@ -48,7 +47,7 @@ fn witness_expensive_recompute_reaches_wan_layers() -> Bool { && cache_layer_plan_contains_id(plan: plan, id: gha_actions_cache_id) } -fn witness_plan_orders_locality_nearest_first() -> Bool { +test fn witness_plan_orders_locality_nearest_first() -> Bool { let plan = plan_cache_layers( deployment: wan_deployment, recompute: expensive_recompute, @@ -58,7 +57,7 @@ fn witness_plan_orders_locality_nearest_first() -> Bool { cache_layer_plan_respects_locality_order(plan: plan, catalog: cache_catalog_rows) } -fn witness_plan_primary_and_fallback_projections() -> Bool { +test fn witness_plan_primary_and_fallback_projections() -> Bool { let plan = plan_cache_layers( deployment: wan_deployment, recompute: expensive_recompute, @@ -69,7 +68,7 @@ fn witness_plan_primary_and_fallback_projections() -> Bool { && cache_layer_plan_fallback(plan: plan) == sccache_local_id } -fn witness_unavailable_backends_omitted() -> Bool { +test fn witness_unavailable_backends_omitted() -> Bool { let plan = plan_cache_layers( deployment: gha_only_deployment, recompute: expensive_recompute, @@ -81,7 +80,7 @@ fn witness_unavailable_backends_omitted() -> Bool { && !cache_layer_plan_contains_id(plan: plan, id: rustup_toolchain_store_id) } -fn witness_empty_plan_means_recompute_only() -> Bool { +test fn witness_empty_plan_means_recompute_only() -> Bool { let plan = plan_cache_layers( deployment: CacheDeploymentBackends { available: [] }, recompute: expensive_recompute, @@ -91,24 +90,14 @@ fn witness_empty_plan_means_recompute_only() -> Bool { plan.layers.length() == 0 } -fn witness_vendor_only_key_inputs_omission_is_explicit() -> Bool { +test fn witness_vendor_only_key_inputs_omission_is_explicit() -> Bool { sccache_local_projected.key_derivation.vendor_only_key_inputs_omitted && !parse_table_memo_projected.key_derivation.vendor_only_key_inputs_omitted } -fn witness_vendor_transport_encoding_projection_is_honest() -> Bool { +test fn witness_vendor_transport_encoding_projection_is_honest() -> Bool { sccache_local_projected.transport_encoding == NativeInternalEncoding && !sccache_local_projected.vendor_transport_encoding_collapsed && cargo_target_dir_projected.vendor_transport_encoding_collapsed } -test fn cache_layer_planner_witnesses() -> Bool { - witness_cheap_recompute_skips_wan_layers() - && witness_expensive_recompute_reaches_wan_layers() - && witness_plan_orders_locality_nearest_first() - && witness_plan_primary_and_fallback_projections() - && witness_unavailable_backends_omitted() - && witness_empty_plan_means_recompute_only() - && witness_vendor_only_key_inputs_omission_is_explicit() - && witness_vendor_transport_encoding_projection_is_honest() -} diff --git a/dag/test/claim/cache_purity_verdict_test.dag b/dag/test/claim/cache_purity_verdict_test.dag index e5791c538c0..18451d7b9a3 100644 --- a/dag/test/claim/cache_purity_verdict_test.dag +++ b/dag/test/claim/cache_purity_verdict_test.dag @@ -1,6 +1,5 @@ module test.claim.cache_purity_verdict - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn sample_violation() -> CachePurityViolation { @@ -12,21 +11,17 @@ fn sample_violation() -> CachePurityViolation { } } -fn witness_pure_on_match() -> Bool { +test fn witness_pure_on_match() -> Bool { match cache_purity_verdict(warm_equals_cold: true, violation: sample_violation()) { Pure => true _ => false } } -fn witness_impure_on_divergence() -> Bool { +test fn witness_impure_on_divergence() -> Bool { match cache_purity_verdict(warm_equals_cold: false, violation: sample_violation()) { Impure { violation: _ } => true _ => false } } -test fn cache_purity_verdict_witnesses() -> Bool { - witness_pure_on_match() - && witness_impure_on_divergence() -} diff --git a/dag/test/claim/cargo_target_path_witness_test.dag b/dag/test/claim/cargo_target_path_witness_test.dag index 3a9e8b91b11..ff72316a4f4 100644 --- a/dag/test/claim/cargo_target_path_witness_test.dag +++ b/dag/test/claim/cargo_target_path_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.cargo_target_path - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn render_file_path(parts: FilePathParts) -> String { @@ -19,29 +18,29 @@ fn render_candidates(stem: String) -> String { }) } -fn lib_lands_on_src_lib() -> Bool { +test fn lib_lands_on_src_lib() -> Bool { render_target(target: Lib, package_name: "v1-compiler") == "src/lib.rs" } -fn package_bin_collapses_to_main() -> Bool { +test fn package_bin_collapses_to_main() -> Bool { render_target(target: Bin { name: "v1-compiler" }, package_name: "v1-compiler") == "src/main.rs" } -fn other_bin_lands_under_src_bin() -> Bool { +test fn other_bin_lands_under_src_bin() -> Bool { render_target(target: Bin { name: "helper" }, package_name: "v1-compiler") == "src/bin/helper.rs" } -fn test_example_bench_dirs() -> Bool { +test fn test_example_bench_dirs() -> Bool { render_target(target: CargoTest { name: "integration" }, package_name: "v1-compiler") == "tests/integration.rs" && render_target(target: Example { name: "demo" }, package_name: "v1-compiler") == "examples/demo.rs" && render_target(target: Bench { name: "throughput" }, package_name: "v1-compiler") == "benches/throughput.rs" } -fn module_stem_two_candidates() -> Bool { +test fn module_stem_two_candidates() -> Bool { render_candidates(stem: "parser") == "src/parser.rs;src/parser/mod.rs" } -fn edition_tokens_render() -> Bool { +test fn edition_tokens_render() -> Bool { rust_edition_str(edition: Edition2015) == "2015" && rust_edition_str(edition: Edition2018) == "2018" && rust_edition_str(edition: Edition2021) == "2021" @@ -49,11 +48,3 @@ fn edition_tokens_render() -> Bool { && rust_edition_str(edition: default_rust_edition) == "2021" } -test fn cargo_target_path_witnesses() -> Bool { - lib_lands_on_src_lib() - && package_bin_collapses_to_main() - && other_bin_lands_under_src_bin() - && test_example_bench_dirs() - && module_stem_two_candidates() - && edition_tokens_render() -} diff --git a/dag/test/claim/cargo_version_witness_test.dag b/dag/test/claim/cargo_version_witness_test.dag index 75a4296d8f1..3477b26f97e 100644 --- a/dag/test/claim/cargo_version_witness_test.dag +++ b/dag/test/claim/cargo_version_witness_test.dag @@ -1,14 +1,13 @@ module test.claim.cargo_version - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_stage0_default_package_version() -> Bool { +test fn w_stage0_default_package_version() -> Bool { default_stage0_package_version == "0.1.0" && render_cargo_package_version_field(version: default_stage0_package_version) == "version = \"0.1.0\"" } -fn w_package_version_field_renders() -> Bool { +test fn w_package_version_field_renders() -> Bool { let pkg = CargoPackage { name: "demo", version: "2.4.6", @@ -18,7 +17,7 @@ fn w_package_version_field_renders() -> Bool { render_cargo_package_version_field(version: pkg.version) == "version = \"2.4.6\"" } -fn w_registry_dep_version_requirements() -> Bool { +test fn w_registry_dep_version_requirements() -> Bool { let serde = CargoDependency { name: "serde", source: RegistryDep { version: "1", features: ["derive", "rc"] } @@ -41,30 +40,21 @@ fn w_registry_dep_version_requirements() -> Bool { } } -fn w_requirement_distinct_from_package_version() -> Bool { +test fn w_requirement_distinct_from_package_version() -> Bool { render_cargo_version_requirement_toml(req: "1") != render_cargo_package_version_field(version: "1.0.0") } -fn w_emitter_header_prefix_uses_default() -> Bool { +test fn w_emitter_header_prefix_uses_default() -> Bool { render_cargo_package_header_prefix(name: "demo-crate") == "[package]\nname = \"demo-crate\"\nversion = \"0.1.0\"" } -fn w_min_cargo_version_grounded() -> Bool { +test fn w_min_cargo_version_grounded() -> Bool { min_cargo_version == ">= 1.56" } fn dep_requirement_one() -> CargoVersionRequirement { "1" } -fn w_tool_floor_distinct_from_dep_requirement() -> Bool { +test fn w_tool_floor_distinct_from_dep_requirement() -> Bool { min_cargo_version != dep_requirement_one() } -test fn cargo_version_witnesses() -> Bool { - w_stage0_default_package_version() - && w_package_version_field_renders() - && w_registry_dep_version_requirements() - && w_requirement_distinct_from_package_version() - && w_emitter_header_prefix_uses_default() - && w_min_cargo_version_grounded() - && w_tool_floor_distinct_from_dep_requirement() -} diff --git a/dag/test/claim/ci_budget_tree_witness_test.dag b/dag/test/claim/ci_budget_tree_witness_test.dag index 57aa7f3ccb0..980b0307f1a 100644 --- a/dag/test/claim/ci_budget_tree_witness_test.dag +++ b/dag/test/claim/ci_budget_tree_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.ci_budget_tree_witness - data live_tree_disposition: LiveTreeDisposition = ReadsLiveTree fn fitting_slice() -> Int { @@ -11,18 +10,18 @@ fn oversized_slice() -> Int { 214748364800 } -fn witness_live_trees_conserve() -> Bool { +test fn witness_live_trees_conserve() -> Bool { node_conserves(node: srv1_budget_tree) && node_conserves(node: srv2_budget_tree) && node_conserves(node: srv3_budget_tree) } -fn witness_live_is_fail_closed() -> Bool { +test fn witness_live_is_fail_closed() -> Bool { byte_size_count(b: srv1_gha_runner_pool_budget()) == 0 && byte_size_count(b: srv1_dashboard_session_pool_budget()) == byte_size_count(b: host_allocatable_bytes(offer: srv1_offer)) } -fn witness_measured_fixture_derives_positive_runner_pool() -> Bool { +test fn witness_measured_fixture_derives_positive_runner_pool() -> Bool { let tree = host_budget_tree_at(name: "srv1", offer: srv1_offer, session_slice: byte_size(fitting_slice())) let runner_pool = match budget_tree_gha_runner_pool_node(tree: tree) { BudgetChildFound { node: n } => byte_size_count(b: n.appropriation.ceiling) @@ -32,7 +31,7 @@ fn witness_measured_fixture_derives_positive_runner_pool() -> Bool { node_conserves(node: tree) && runner_pool > 0 && runner_pool == expected } -fn witness_overcommit_fails_conservation() -> Bool { +test fn witness_overcommit_fails_conservation() -> Bool { let tree = host_budget_tree_at(name: "srv1", offer: srv1_offer, session_slice: byte_size(oversized_slice())) let runner_pool = match budget_tree_gha_runner_pool_node(tree: tree) { BudgetChildFound { node: n } => byte_size_count(b: n.appropriation.ceiling) @@ -41,14 +40,14 @@ fn witness_overcommit_fails_conservation() -> Bool { runner_pool == 0 && !node_conserves(node: tree) } -fn witness_three_way_conservation_live() -> Bool { +test fn witness_three_way_conservation_live() -> Bool { let overhead = byte_size_count(b: srv1_fixed_overhead_bytes()) let gha = byte_size_count(b: srv1_gha_runner_pool_budget()) let dash = byte_size_count(b: srv1_dashboard_session_pool_budget()) overhead + gha + dash <= byte_size_count(b: srv1_host_ram()) } -fn witness_srv2_symmetric_to_srv1() -> Bool { +test fn witness_srv2_symmetric_to_srv1() -> Bool { let s1 = host_budget_tree_at(name: "srv1", offer: srv1_offer, session_slice: byte_size(fitting_slice())) let s2 = host_budget_tree_at(name: "srv2", offer: srv2_offer, session_slice: byte_size(fitting_slice())) let p1 = match budget_tree_gha_runner_pool_node(tree: s1) { @@ -62,7 +61,7 @@ fn witness_srv2_symmetric_to_srv1() -> Bool { p1 == p2 && p1 > 0 } -fn witness_two_pools_present() -> Bool { +test fn witness_two_pools_present() -> Bool { let gha_found = match budget_tree_gha_runner_pool_node(tree: srv1_budget_tree) { BudgetChildFound { node: _ } => true BudgetChildMissing => false @@ -74,14 +73,14 @@ fn witness_two_pools_present() -> Bool { return gha_found && dash_found } -fn witness_unknown_child_is_absent() -> Bool { +test fn witness_unknown_child_is_absent() -> Bool { match budget_child_named(node: srv1_budget_tree, name: "__no_such_child__") { BudgetChildFound { node: _ } => false BudgetChildMissing => true } } -fn witness_spawn_width_budget_within_per_runner_cap() -> Bool { +test fn witness_spawn_width_budget_within_per_runner_cap() -> Bool { let fleet_budget = byte_size_count(b: ci_runner_target_ram_speed_budget(target: FleetSelfHosted)) byte_size_count(b: srv1_floor_memory_budget()) > 0 && fleet_budget <= byte_size_count(b: gunbc_ci_runner_slot_memory_max_live) @@ -89,20 +88,20 @@ fn witness_spawn_width_budget_within_per_runner_cap() -> Bool { && fleet_budget < byte_size_count(b: srv1_host_ram()) } -fn witness_hard_cap_is_runner_cgroup_cap() -> Bool { +test fn witness_hard_cap_is_runner_cgroup_cap() -> Bool { byte_size_count(b: srv1_ci_run_container_hard_cap()) == byte_size_count(b: gunbc_ci_runner_cgroup_memory_cap) } -fn witness_cap_split_runner_lt_session() -> Bool { +test fn witness_cap_split_runner_lt_session() -> Bool { witness_runner_cgroup_cap_lt_dashboard_session_cap() && byte_size_count(b: gunbc_ci_dashboard_session_container_cap) > byte_size_count(b: gunbc_ci_runner_cgroup_memory_cap) } -fn witness_floor_budget_equals_selected_target_budget_holds() -> Bool { +test fn witness_floor_budget_equals_selected_target_budget_holds() -> Bool { witness_floor_budget_equals_selected_target_budget() } -fn witness_srv3_symmetric_to_srv1() -> Bool { +test fn witness_srv3_symmetric_to_srv1() -> Bool { let s1 = host_budget_tree_at(name: "srv1", offer: srv1_offer, session_slice: byte_size(fitting_slice())) let s3 = host_budget_tree_at(name: "srv3", offer: srv3_offer, session_slice: byte_size(fitting_slice())) let p1 = match budget_tree_gha_runner_pool_node(tree: s1) { @@ -116,18 +115,3 @@ fn witness_srv3_symmetric_to_srv1() -> Bool { p1 == p3 && p3 > 0 } -test fn ci_budget_tree_holds() -> Bool { - witness_live_trees_conserve() - && witness_live_is_fail_closed() - && witness_measured_fixture_derives_positive_runner_pool() - && witness_overcommit_fails_conservation() - && witness_three_way_conservation_live() - && witness_srv2_symmetric_to_srv1() - && witness_srv3_symmetric_to_srv1() - && witness_two_pools_present() - && witness_unknown_child_is_absent() - && witness_spawn_width_budget_within_per_runner_cap() - && witness_hard_cap_is_runner_cgroup_cap() - && witness_cap_split_runner_lt_session() - && witness_floor_budget_equals_selected_target_budget_holds() -} diff --git a/dag/test/claim/ci_compile_jobs_witness_test.dag b/dag/test/claim/ci_compile_jobs_witness_test.dag index 7a724f82a01..d84d083e818 100644 --- a/dag/test/claim/ci_compile_jobs_witness_test.dag +++ b/dag/test/claim/ci_compile_jobs_witness_test.dag @@ -54,12 +54,12 @@ fn live_derived_jobs() -> Int { ) } -fn witness_committed_measurement_derives_multi_lane() -> Bool { +test fn witness_committed_measurement_derives_multi_lane() -> Bool { let n = live_derived_jobs() n >= 2 && n <= 128 } -fn witness_committed_lanes_fit_live_slot_cap() -> Bool { +test fn witness_committed_lanes_fit_live_slot_cap() -> Bool { let n = live_derived_jobs() match gunbc_ci_compile_measurement { CompileJobMeasured { per_rustc_peak: peak, procs_per_job: _, pids_budget: _ } => @@ -68,7 +68,7 @@ fn witness_committed_lanes_fit_live_slot_cap() -> Bool { } } -fn witness_unmeasured_still_refuses() -> Bool { +test fn witness_unmeasured_still_refuses() -> Bool { jobs_is_refuse(ci_compile_jobs_for( measurement: CompileJobUnmeasured, hardware_threads: hardware_thread_count(128), @@ -77,7 +77,7 @@ fn witness_unmeasured_still_refuses() -> Bool { )) } -fn witness_pids_budget_binds_the_count() -> Bool { +test fn witness_pids_budget_binds_the_count() -> Bool { jobs_count_or( ci_compile_jobs_for( measurement: measured_with_pids(p: 24), @@ -89,7 +89,7 @@ fn witness_pids_budget_binds_the_count() -> Bool { ) == 8 } -fn witness_memory_budget_binds_the_count() -> Bool { +test fn witness_memory_budget_binds_the_count() -> Bool { jobs_count_or( ci_compile_jobs_for( measurement: sample_measured(), @@ -101,11 +101,11 @@ fn witness_memory_budget_binds_the_count() -> Bool { ) == 2 } -fn witness_force_serial_overrides_committed_row() -> Bool { +test fn witness_force_serial_overrides_committed_row() -> Bool { jobs_count_or(ci_compile_jobs(memory_budget: byte_size(137438953472), force_serial: true), 0) == 1 } -fn witness_force_serial_beats_wide_budget() -> Bool { +test fn witness_force_serial_beats_wide_budget() -> Bool { jobs_count_or( ci_compile_jobs_for( measurement: sample_measured(), @@ -117,7 +117,7 @@ fn witness_force_serial_beats_wide_budget() -> Bool { ) == 1 } -fn witness_unreadable_budget_falls_back_serial() -> Bool { +test fn witness_unreadable_budget_falls_back_serial() -> Bool { jobs_count_or( ci_compile_jobs_for( measurement: sample_measured(), @@ -129,39 +129,24 @@ fn witness_unreadable_budget_falls_back_serial() -> Bool { ) == 1 } -fn witness_nextest_flag_spelling() -> Bool { +test fn witness_nextest_flag_spelling() -> Bool { join_space(xs: cargo_nextest_build_jobs_flag(count: 8)) == "--build-jobs 8" } -fn witness_build_flag_spelling() -> Bool { +test fn witness_build_flag_spelling() -> Bool { join_space(xs: cargo_build_jobs_flag(count: 8)) == "--jobs 8" } -fn witness_count_or_serial_passes_measured_count() -> Bool { +test fn witness_count_or_serial_passes_measured_count() -> Bool { compile_jobs_count_or_serial(jobs: CompileJobs { count: 8 }) == 8 } -fn witness_count_or_serial_refuse_falls_to_serial() -> Bool { +test fn witness_count_or_serial_refuse_falls_to_serial() -> Bool { compile_jobs_count_or_serial(jobs: CompileJobsRefuse { reason: "unmeasured" }) == 1 } -fn witness_live_rust_gate_uses_slot_budget_lanes() -> Bool { +test fn witness_live_rust_gate_uses_slot_budget_lanes() -> Bool { let expected = concat("--build-jobs ", to_string(live_derived_jobs())) join_space(xs: rust_gate_build_jobs_args()) == expected } -test fn ci_compile_jobs_witnesses() -> Bool { - witness_committed_measurement_derives_multi_lane() - && witness_committed_lanes_fit_live_slot_cap() - && witness_unmeasured_still_refuses() - && witness_pids_budget_binds_the_count() - && witness_memory_budget_binds_the_count() - && witness_force_serial_overrides_committed_row() - && witness_force_serial_beats_wide_budget() - && witness_unreadable_budget_falls_back_serial() - && witness_nextest_flag_spelling() - && witness_build_flag_spelling() - && witness_count_or_serial_passes_measured_count() - && witness_count_or_serial_refuse_falls_to_serial() - && witness_live_rust_gate_uses_slot_budget_lanes() -} diff --git a/dag/test/claim/ci_concurrency_policy_witness_test.dag b/dag/test/claim/ci_concurrency_policy_witness_test.dag index 1ee650fdb3a..50e4aafd339 100644 --- a/dag/test/claim/ci_concurrency_policy_witness_test.dag +++ b/dag/test/claim/ci_concurrency_policy_witness_test.dag @@ -12,11 +12,11 @@ import extdeps.github.actions { import v2.std.collection { Present } import v2.std.text { String } -fn ci_concurrency_cancel_expression_holds() -> Bool { +test fn ci_concurrency_cancel_expression_holds() -> Bool { ci_concurrency_cancel_in_progress_expression() == ci_concurrency_cancel_in_progress_if } -fn ci_concurrency_event_scoped_stop_policy_holds() -> Bool { +test fn ci_concurrency_event_scoped_stop_policy_holds() -> Bool { match ci_workflow.concurrency { Present { value: spec } => match spec { @@ -36,14 +36,9 @@ fn ci_concurrency_event_scoped_stop_policy_holds() -> Bool { } } -fn ci_concurrency_stop_policy_discriminates_merge_group() -> Bool { +test fn ci_concurrency_stop_policy_discriminates_merge_group() -> Bool { ci_concurrency_cancel_in_progress_if != "true" && ci_concurrency_cancel_in_progress_if != "false" && ci_concurrency_cancel_in_progress_if != "github.event_name != 'merge_group'" } -test fn ci_concurrency_policy_witness_holds() -> Bool { - ci_concurrency_cancel_expression_holds() - && ci_concurrency_event_scoped_stop_policy_holds() - && ci_concurrency_stop_policy_discriminates_merge_group() -} diff --git a/dag/test/claim/ci_deploy_target_host_witness_test.dag b/dag/test/claim/ci_deploy_target_host_witness_test.dag index a6b727b3e0f..150cabe2cfe 100644 --- a/dag/test/claim/ci_deploy_target_host_witness_test.dag +++ b/dag/test/claim/ci_deploy_target_host_witness_test.dag @@ -1,9 +1,8 @@ module test.claim.ci_deploy_target_host_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_srv1_hostname_proves_target() -> Bool { +test fn witness_srv1_hostname_proves_target() -> Bool { let proof = deploy_target_proof_from_access(access: ci_deploy_srv1_access) deploy_target_host_apply_permitted( proof: proof, @@ -12,7 +11,7 @@ fn witness_srv1_hostname_proves_target() -> Bool { ) } -fn witness_srv2_hostname_refused_for_srv1_deploy() -> Bool { +test fn witness_srv2_hostname_refused_for_srv1_deploy() -> Bool { deploy_local_apply_refused_for_observed_host( host: ci_deploy_srv1_access.host.identity, transport: ci_deploy_srv1_access.transport, @@ -21,7 +20,7 @@ fn witness_srv2_hostname_refused_for_srv1_deploy() -> Bool { ) } -fn witness_srv12_runner_name_refused_for_srv1_deploy() -> Bool { +test fn witness_srv12_runner_name_refused_for_srv1_deploy() -> Bool { deploy_local_apply_refused_for_observed_host( host: ci_deploy_srv1_access.host.identity, transport: ci_deploy_srv1_access.transport, @@ -30,7 +29,7 @@ fn witness_srv12_runner_name_refused_for_srv1_deploy() -> Bool { ) } -fn witness_ubicloud_runner_name_refused_for_local_apply() -> Bool { +test fn witness_ubicloud_runner_name_refused_for_local_apply() -> Bool { deploy_local_apply_refused_for_observed_host( host: ci_deploy_srv1_access.host.identity, transport: ci_deploy_srv1_access.transport, @@ -39,7 +38,7 @@ fn witness_ubicloud_runner_name_refused_for_local_apply() -> Bool { ) } -fn witness_ssh_transport_structural_proof_holds() -> Bool { +test fn witness_ssh_transport_structural_proof_holds() -> Bool { let ssh_access = deploy_access_with_ssh_transport( access: ci_deploy_srv1_access, ssh_host: operator_host_srv1 @@ -49,7 +48,7 @@ fn witness_ssh_transport_structural_proof_holds() -> Bool { ) } -fn witness_ssh_transport_mismatch_refused() -> Bool { +test fn witness_ssh_transport_mismatch_refused() -> Bool { let ssh_access = deploy_access_with_ssh_transport( access: ci_deploy_srv1_access, ssh_host: operator_host_srv2 @@ -63,7 +62,7 @@ fn label_list_contains(labels: List, needle: String) -> Bool { fold(labels, init: false, f: (acc, l) => acc || (l == needle)) } -fn witness_deploy_stage_pins_srv1_runner_label() -> Bool { +test fn witness_deploy_stage_pins_srv1_runner_label() -> Bool { gunbc_ci_deploy_srv1_stage.runner == gunbc_ci_deploy_srv1_runner_spec() && match gunbc_ci_deploy_srv1_stage.runner { SelfHosted { labels: labels } => @@ -73,7 +72,7 @@ fn witness_deploy_stage_pins_srv1_runner_label() -> Bool { } } -fn witness_deploy_job_not_on_ubicloud_runner() -> Bool { +test fn witness_deploy_job_not_on_ubicloud_runner() -> Bool { match gunbc_ci_deploy_srv1_stage.runner { RunsOnExpression { expression: _ } => false SelfHosted { labels: _ } => true @@ -81,7 +80,7 @@ fn witness_deploy_job_not_on_ubicloud_runner() -> Bool { } } -fn witness_preflight_script_checks_target_host() -> Bool { +test fn witness_preflight_script_checks_target_host() -> Bool { let script = deploy_target_host_preflight_script(access: ci_deploy_srv1_access) string_contains(s: script, pattern: "deploy-target-host: PASS host=srv1") && string_contains(s: script, pattern: deploy_target_host_refusal_local) @@ -89,7 +88,7 @@ fn witness_preflight_script_checks_target_host() -> Bool { && string_contains(s: script, pattern: "printenv RUNNER_NAME") } -fn witness_ci_yml_deploy_job_pins_srv1_runner() -> Bool { +test fn witness_ci_yml_deploy_job_pins_srv1_runner() -> Bool { let yaml = expected_ci_yml() let enrolled = length(gunbc_ci_deploy_stages) > 0 string_contains(s: yaml, pattern: " deploy_dashboard_srv1:") == enrolled @@ -97,14 +96,14 @@ fn witness_ci_yml_deploy_job_pins_srv1_runner() -> Bool { && !string_contains(s: yaml, pattern: " deploy_dashboard_srv1:\n runs-on: ubicloud-standard-16-arm") } -fn witness_local_proof_requires_host_identity() -> Bool { +test fn witness_local_proof_requires_host_identity() -> Bool { match deploy_target_proof_from_access(access: ci_deploy_srv1_access) { RunnerIdentityOnHost { host: id } => id == operator_host_srv1 _ => false } } -fn witness_access_host_is_srv1() -> Bool { +test fn witness_access_host_is_srv1() -> Bool { ci_deploy_srv1_access.host == srv1_host && match ci_deploy_srv1_access.transport { LocalShell => true @@ -112,22 +111,7 @@ fn witness_access_host_is_srv1() -> Bool { } } -fn witness_observed_hostname_reads_typed_op_hermetic() -> Bool { +test fn witness_observed_hostname_reads_typed_op_hermetic() -> Bool { deploy_target_host_observed_hostname() == "localhost" } -test fn ci_deploy_target_host_witnesses() -> Bool { - witness_srv1_hostname_proves_target() - && witness_srv2_hostname_refused_for_srv1_deploy() - && witness_srv12_runner_name_refused_for_srv1_deploy() - && witness_ubicloud_runner_name_refused_for_local_apply() - && witness_ssh_transport_structural_proof_holds() - && witness_ssh_transport_mismatch_refused() - && witness_deploy_stage_pins_srv1_runner_label() - && witness_deploy_job_not_on_ubicloud_runner() - && witness_preflight_script_checks_target_host() - && witness_ci_yml_deploy_job_pins_srv1_runner() - && witness_local_proof_requires_host_identity() - && witness_access_host_is_srv1() - && witness_observed_hostname_reads_typed_op_hermetic() -} diff --git a/dag/test/claim/ci_deploy_witness_test.dag b/dag/test/claim/ci_deploy_witness_test.dag index b7b2f738a88..6295a0a4634 100644 --- a/dag/test/claim/ci_deploy_witness_test.dag +++ b/dag/test/claim/ci_deploy_witness_test.dag @@ -42,13 +42,13 @@ fn ci_deploy_runner_principal_name() -> String { grounded_posix_principal_name(p: ci_deploy_srv1_access.principal) as String } -fn witness_deploy_stage_targets_live_deploy_wet() -> Bool { +test fn witness_deploy_stage_targets_live_deploy_wet() -> Bool { gunbc_ci_deploy_srv1_stage.entry == live_deploy_apply_entry && gunbc_ci_deploy_srv1_stage.function == live_deploy_apply_srv1_wet_function && gunbc_ci_deploy_srv1_stage.needs == ["ci"] } -fn witness_deploy_access_uses_local_apply_on_srv1() -> Bool { +test fn witness_deploy_access_uses_local_apply_on_srv1() -> Bool { let access = ci_deploy_srv1_access access.host == srv1_host && grounded_posix_principal_name(p: access.principal) == "ghrunner" @@ -59,7 +59,7 @@ fn witness_deploy_access_uses_local_apply_on_srv1() -> Bool { } } -fn witness_deploy_access_sudo_miss_surfaces_sudoers_hint() -> Bool { +test fn witness_deploy_access_sudo_miss_surfaces_sudoers_hint() -> Bool { let actor = DeployAccessActor { observed_name: fleet_posix_principal(key: FleetAccountCiRunner).posix.name, sudo_granted: false, @@ -79,7 +79,7 @@ fn witness_deploy_access_sudo_miss_surfaces_sudoers_hint() -> Bool { } } -fn witness_deploy_access_sudoers_line_authority() -> Bool { +test fn witness_deploy_access_sudoers_line_authority() -> Bool { string_contains( s: deploy_access_sudoers_line( access: ci_deploy_srv1_access, @@ -89,11 +89,11 @@ fn witness_deploy_access_sudoers_line_authority() -> Bool { ) } -fn witness_ci_spec_carries_deploy_stages() -> Bool { +test fn witness_ci_spec_carries_deploy_stages() -> Bool { gunbc_ci_spec.deploy_stages == gunbc_ci_deploy_stages } -fn witness_deploy_invoke_runs_gunbc_wet() -> Bool { +test fn witness_deploy_invoke_runs_gunbc_wet() -> Bool { let script = gunbc_ci_deploy_invoke(stage: gunbc_ci_deploy_srv1_stage) string_contains(s: script, pattern: live_deploy_apply_entry) && string_contains(s: script, pattern: live_deploy_apply_srv1_wet_function) @@ -101,7 +101,7 @@ fn witness_deploy_invoke_runs_gunbc_wet() -> Bool { && string_contains(s: script, pattern: "--source-root \"$ROOT/dag\"") } -fn witness_deploy_invoke_does_not_rebuild_release_bins() -> Bool { +test fn witness_deploy_invoke_does_not_rebuild_release_bins() -> Bool { let script = gunbc_ci_deploy_invoke(stage: gunbc_ci_deploy_srv1_stage) !string_contains(s: script, pattern: ci_release_build_line()) && !string_contains(s: script, pattern: ci_release_build_script()) @@ -110,7 +110,7 @@ fn witness_deploy_invoke_does_not_rebuild_release_bins() -> Bool { && !string_contains(s: script, pattern: "CARGO_BUILD_JOBS=1") } -fn witness_ci_yml_deploy_job_consumes_release_bins_artifact() -> Bool { +test fn witness_ci_yml_deploy_job_consumes_release_bins_artifact() -> Bool { let yaml = expected_ci_yml() string_contains(s: yaml, pattern: " deploy_dashboard_srv1:") && string_contains(s: yaml, pattern: " - name: Download release-bins artifact") @@ -121,12 +121,12 @@ fn witness_ci_yml_deploy_job_consumes_release_bins_artifact() -> Bool { && !string_contains(s: yaml, pattern: "Deploy dashboard to srv1 (live_deploy_apply_srv1_wet)\n run: |\n ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)\n \"$CARGO_BIN\" build") } -fn witness_workflow_deploy_job_matches_enrollment() -> Bool { +test fn witness_workflow_deploy_job_matches_enrollment() -> Bool { let deploy_jobs = filter(ci_workflow.jobs, j => j.id == "deploy_dashboard_srv1") length(deploy_jobs) == length(gunbc_ci_deploy_stages) } -fn witness_ci_yml_deploy_job_matches_enrollment() -> Bool { +test fn witness_ci_yml_deploy_job_matches_enrollment() -> Bool { let yaml = expected_ci_yml() let enrolled = length(gunbc_ci_deploy_stages) > 0 string_contains(s: yaml, pattern: " deploy_dashboard_srv1:") == enrolled @@ -134,15 +134,3 @@ fn witness_ci_yml_deploy_job_matches_enrollment() -> Bool { && string_contains(s: yaml, pattern: live_deploy_apply_srv1_wet_function) == enrolled } -test fn ci_deploy_witnesses() -> Bool { - witness_deploy_stage_targets_live_deploy_wet() - && witness_deploy_access_uses_local_apply_on_srv1() - && witness_deploy_access_sudo_miss_surfaces_sudoers_hint() - && witness_deploy_access_sudoers_line_authority() - && witness_ci_spec_carries_deploy_stages() - && witness_deploy_invoke_runs_gunbc_wet() - && witness_deploy_invoke_does_not_rebuild_release_bins() - && witness_ci_yml_deploy_job_consumes_release_bins_artifact() - && witness_workflow_deploy_job_matches_enrollment() - && witness_ci_yml_deploy_job_matches_enrollment() -} diff --git a/dag/test/claim/ci_failure_class_witness_test.dag b/dag/test/claim/ci_failure_class_witness_test.dag index 8db732f4551..66ec6163439 100644 --- a/dag/test/claim/ci_failure_class_witness_test.dag +++ b/dag/test/claim/ci_failure_class_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.ci_failure_class_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn class_is_infra(c: FloorFailureClass) -> Bool { @@ -49,7 +48,7 @@ fn list_has_signature(xs: List, target: InfraSignature) -> Bool fold(xs, init: false, f: fn(acc, sig) { acc || (sig == target) }) } -fn witness_real_infra_reasons_are_non_blocking() -> Bool { +test fn witness_real_infra_reasons_are_non_blocking() -> Bool { let eagain = "error: failed to run custom build command\nResource temporarily unavailable (os error 11)" let spawn = "error: could not compile; caused by: failed to spawn process" let sccache = "sccache: encountered fatal error\nsccache: error: Connection refused (os error 111)" @@ -68,7 +67,7 @@ fn witness_real_infra_reasons_are_non_blocking() -> Bool { && (floor_failure_blocks_merge(c: classify_failure_reason(reason: sccache_exec)) == false) } -fn witness_structural_not_swallowed_as_infra() -> Bool { +test fn witness_structural_not_swallowed_as_infra() -> Bool { let compile_err = "error[E0599]: no method named `frobnicate` found for type `Node`" let inference = "type inference failed: cannot unify Int with String at dag/gunbc/foo.dag:42" let assertion = "witness cheap_pool_chunk_totality_holds returned false (1 uncovered claim)" @@ -85,30 +84,30 @@ fn witness_structural_not_swallowed_as_infra() -> Bool { && floor_exit_blocks_merge(e: ExitFailure { code: 137, reason: oom_structural }) } -fn witness_bare_exit_137_fails_closed() -> Bool { +test fn witness_bare_exit_137_fails_closed() -> Bool { let bare = ExitFailure { code: 137, reason: "Process completed with exit code 137." } outcome_is_structural(o: classify_floor_exit(e: bare)) && floor_exit_blocks_merge(e: bare) } -fn witness_unknown_reason_fails_closed() -> Bool { +test fn witness_unknown_reason_fails_closed() -> Bool { let unknown = "some entirely novel failure mode we have never grounded" class_is_structural(c: classify_failure_reason(reason: unknown)) && floor_exit_blocks_merge(e: ExitFailure { code: 1, reason: unknown }) } -fn witness_floor_green_does_not_block() -> Bool { +test fn witness_floor_green_does_not_block() -> Bool { (floor_exit_blocks_merge(e: ExitSuccess) == false) && outcome_is_no_failure(o: classify_floor_exit(e: ExitSuccess)) } -fn witness_grep_alternation_is_single_authority() -> Bool { +test fn witness_grep_alternation_is_single_authority() -> Bool { let expected = "Resource temporarily unavailable|failed to spawn|sccache: encountered fatal error|(exit status: 254)|sccache: error: failed to execute compile" (infra_retry_grep_alternation() == expected) && string_contains(s: infra_retry_grep_alternation(), pattern: "Resource temporarily unavailable|failed to spawn") } -fn witness_build_retry_subset_excludes_job_signals() -> Bool { +test fn witness_build_retry_subset_excludes_job_signals() -> Bool { let build = build_retry_infra_signatures() (list_len(xs: build) == 5) && (list_len(xs: verdict_infra_signatures) == 6) @@ -116,7 +115,7 @@ fn witness_build_retry_subset_excludes_job_signals() -> Bool { && (string_contains(s: infra_retry_grep_alternation(), pattern: infra_signature_match_substring(sig: RunnerLost)) == false) } -fn witness_every_signature_is_grounded() -> Bool { +test fn witness_every_signature_is_grounded() -> Bool { fold(verdict_infra_signatures, init: true, f: fn(acc, sig) { acc && (infra_signature_origin(sig: sig) != "") @@ -124,19 +123,8 @@ fn witness_every_signature_is_grounded() -> Bool { }) } -fn witness_verdict_computed_but_gating_deferred() -> Bool { +test fn witness_verdict_computed_but_gating_deferred() -> Bool { (gating_is_enforced(s: merge_freshness_gating_status) == false) && (merge_freshness_verdict_is_consumed_to_block() == false) } -test fn ci_failure_class_witnesses() -> Bool { - witness_every_signature_is_grounded() - && witness_real_infra_reasons_are_non_blocking() - && witness_structural_not_swallowed_as_infra() - && witness_bare_exit_137_fails_closed() - && witness_unknown_reason_fails_closed() - && witness_floor_green_does_not_block() - && witness_grep_alternation_is_single_authority() - && witness_build_retry_subset_excludes_job_signals() - && witness_verdict_computed_but_gating_deferred() -} diff --git a/dag/test/claim/ci_heal_job_witness_test.dag b/dag/test/claim/ci_heal_job_witness_test.dag index 076687120dd..e2bec10f94d 100644 --- a/dag/test/claim/ci_heal_job_witness_test.dag +++ b/dag/test/claim/ci_heal_job_witness_test.dag @@ -57,15 +57,15 @@ fn workflow_contents_is_read(w: Workflow) -> Bool { } } -fn heal_job_enrolled_in_ci_workflow() -> Bool { +test fn heal_job_enrolled_in_ci_workflow() -> Bool { fold(ci_workflow.jobs, init: false, f: (acc, j) => acc || (j.id == "heal_generated_artifacts")) } -fn heal_job_needs_build_not_ci() -> Bool { +test fn heal_job_needs_build_not_ci() -> Bool { ci_heal_generated_artifacts_job().needs == ["build"] } -fn heal_job_runs_on_pr_only() -> Bool { +test fn heal_job_runs_on_pr_only() -> Bool { match ci_heal_generated_artifacts_job().if_condition { Present { value: s } => (s == ci_regen_heal_if) @@ -75,23 +75,23 @@ fn heal_job_runs_on_pr_only() -> Bool { } } -fn heal_job_has_scoped_contents_write() -> Bool { +test fn heal_job_has_scoped_contents_write() -> Bool { job_contents_is_write(j: ci_heal_generated_artifacts_job()) } -fn contents_write_is_scoped_to_heal_only() -> Bool { +test fn contents_write_is_scoped_to_heal_only() -> Bool { workflow_contents_is_read(w: ci_workflow) && job_has_no_write(j: ci_build_job()) && job_has_no_write(j: ci_job()) && job_contents_is_write(j: ci_heal_generated_artifacts_job()) } -fn heal_regen_targets_generated_artifact_main_wet() -> Bool { +test fn heal_regen_targets_generated_artifact_main_wet() -> Bool { (ci_heal_generated_artifact_regen_function == "main_wet") && (ci_heal_generated_artifact_gate_entry == "dag/tools/generated_artifact_gate.dag") } -fn heal_commit_scope_is_artifact_only() -> Bool { +test fn heal_commit_scope_is_artifact_only() -> Bool { let script = gunbc_ci_heal_commit_push_script() string_contains(s: script, pattern: concat("git add \"", artifact_path(a: CiYamlArtifact))) && string_contains(s: script, pattern: "git diff --cached --quiet") @@ -99,13 +99,13 @@ fn heal_commit_scope_is_artifact_only() -> Bool { && (count(committed_generated_artifact_paths()) > 0) } -fn heal_git_add_is_existence_guarded() -> Bool { +test fn heal_git_add_is_existence_guarded() -> Bool { let script = gunbc_ci_heal_commit_push_script() string_contains(s: script, pattern: concat("if [ -e \"", artifact_path(a: CiYamlArtifact))) && string_contains(s: script, pattern: "not staging:") } -fn heal_push_targets_triggering_branch() -> Bool { +test fn heal_push_targets_triggering_branch() -> Bool { let script = gunbc_ci_heal_commit_push_script() string_contains(s: script, pattern: "git push origin HEAD:${{ github.head_ref || github.ref_name }}") && !string_contains(s: script, pattern: "git push origin HEAD:main") @@ -139,19 +139,7 @@ fn step_checks_out_branch(s: Step) -> Bool { } } -fn heal_checks_out_triggering_branch() -> Bool { +test fn heal_checks_out_triggering_branch() -> Bool { fold(ci_heal_generated_artifacts_job().steps, init: false, f: (acc, s) => acc || step_checks_out_branch(s: s)) } -test fn ci_heal_job_witnesses() -> Bool { - heal_job_enrolled_in_ci_workflow() - && heal_job_needs_build_not_ci() - && heal_job_runs_on_pr_only() - && heal_job_has_scoped_contents_write() - && contents_write_is_scoped_to_heal_only() - && heal_regen_targets_generated_artifact_main_wet() - && heal_commit_scope_is_artifact_only() - && heal_git_add_is_existence_guarded() - && heal_push_targets_triggering_branch() - && heal_checks_out_triggering_branch() -} diff --git a/dag/test/claim/ci_oom_reclassify_witness_test.dag b/dag/test/claim/ci_oom_reclassify_witness_test.dag index c9aa2c28820..92c0b789928 100644 --- a/dag/test/claim/ci_oom_reclassify_witness_test.dag +++ b/dag/test/claim/ci_oom_reclassify_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.ci_oom_reclassify_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn bare_137_outcome() -> FloorOutcome { @@ -43,7 +42,7 @@ fn clustered_simultaneous() -> ClusteringEvidence { Clustered { signal: SimultaneousMultiJobDeath { job_count: 3 } } } -fn witness_clustered_oom_promotes_137_to_infra_nonblocking() -> Bool { +test fn witness_clustered_oom_promotes_137_to_infra_nonblocking() -> Bool { let before = bare_137_outcome() let after = reclassify_floor_outcome(o: before, oom: confirmed_cgroup_oom(), clustering: clustered_simultaneous()) outcome_is_structural(o: before) @@ -52,7 +51,7 @@ fn witness_clustered_oom_promotes_137_to_infra_nonblocking() -> Bool { && (floor_outcome_blocks_merge(o: after) == false) } -fn witness_boot_id_reset_clustering_also_promotes() -> Bool { +test fn witness_boot_id_reset_clustering_also_promotes() -> Bool { let before = bare_137_outcome() let clu = clustering_signal_from_boot_id(boot_id_before: "boot-uuid-A", boot_id_after: "boot-uuid-B") let after = reclassify_floor_outcome(o: before, oom: confirmed_oomd_oom(), clustering: clu) @@ -61,14 +60,14 @@ fn witness_boot_id_reset_clustering_also_promotes() -> Bool { && (floor_outcome_blocks_merge(o: after) == false) } -fn witness_lone_137_no_clustering_stays_structural_blocks() -> Bool { +test fn witness_lone_137_no_clustering_stays_structural_blocks() -> Bool { let before = bare_137_outcome() let after = reclassify_floor_outcome(o: before, oom: confirmed_cgroup_oom(), clustering: NotClustered) outcome_is_structural(o: after) && floor_outcome_blocks_merge(o: after) } -fn witness_no_confirmed_oom_stays_structural_blocks() -> Bool { +test fn witness_no_confirmed_oom_stays_structural_blocks() -> Bool { let before = bare_137_outcome() let after = reclassify_floor_outcome(o: before, oom: no_oom(), clustering: clustered_simultaneous()) (oom_is_confirmed(o: no_oom()) == false) @@ -76,18 +75,18 @@ fn witness_no_confirmed_oom_stays_structural_blocks() -> Bool { && floor_outcome_blocks_merge(o: after) } -fn witness_dispatch_two_handlers_one_fact() -> Bool { +test fn witness_dispatch_two_handlers_one_fact() -> Bool { oom_is_confirmed(o: confirmed_cgroup_oom()) && oom_is_confirmed(o: confirmed_oomd_oom()) && (oom_is_confirmed(o: no_oom()) == false) } -fn witness_boot_id_oracle_discriminates() -> Bool { +test fn witness_boot_id_oracle_discriminates() -> Bool { host_boot_id_reset(boot_id_before: "boot-uuid-A", boot_id_after: "boot-uuid-B") && (host_boot_id_reset(boot_id_before: "boot-uuid-A", boot_id_after: "boot-uuid-A") == false) } -fn witness_reclassify_never_demotes_or_touches_non_137() -> Bool { +test fn witness_reclassify_never_demotes_or_touches_non_137() -> Bool { let no_failure = reclassify_floor_outcome(o: NoFailure, oom: confirmed_cgroup_oom(), clustering: clustered_simultaneous()) let already_infra = FloorFailed { class: gunbc.ci_failure_class.Infra { signature: ClusteredOutOfMemoryKill } } let still_infra = reclassify_floor_outcome(o: already_infra, oom: no_oom(), clustering: NotClustered) @@ -99,12 +98,3 @@ fn witness_reclassify_never_demotes_or_touches_non_137() -> Bool { && floor_outcome_blocks_merge(o: unchanged) } -test fn ci_oom_reclassify_witnesses() -> Bool { - witness_clustered_oom_promotes_137_to_infra_nonblocking() - && witness_boot_id_reset_clustering_also_promotes() - && witness_lone_137_no_clustering_stays_structural_blocks() - && witness_no_confirmed_oom_stays_structural_blocks() - && witness_dispatch_two_handlers_one_fact() - && witness_boot_id_oracle_discriminates() - && witness_reclassify_never_demotes_or_touches_non_137() -} diff --git a/dag/test/claim/ci_runner_seam_witness_test.dag b/dag/test/claim/ci_runner_seam_witness_test.dag index 34a5746b605..1b906253732 100644 --- a/dag/test/claim/ci_runner_seam_witness_test.dag +++ b/dag/test/claim/ci_runner_seam_witness_test.dag @@ -1,23 +1,22 @@ module test.claim.ci_runner_seam_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_ci_runner_spec_derives_from_fleet_offer() -> Bool { +test fn witness_ci_runner_spec_derives_from_fleet_offer() -> Bool { gunbc_ci_runner_spec() == runner_spec_from_offer(offer: gunbc_ci_fleet_offer) } -fn witness_ci_workflow_runner_matches_selected_target() -> Bool { +test fn witness_ci_workflow_runner_matches_selected_target() -> Bool { ci_workflow.jobs.first().runner == gunbc_ci_selected_runner_spec() } -fn witness_ci_yaml_runs_on_projects_selected_labels() -> Bool { +test fn witness_ci_yaml_runs_on_projects_selected_labels() -> Bool { let yaml = expected_ci_yml() string_contains(s: yaml, pattern: " runs-on: [self-hosted, linux, arm64]") && !string_contains(s: yaml, pattern: " runs-on: [ubicloud-standard-16-arm]") } -fn witness_ci_runner_spec_is_self_hosted_arm64_linux() -> Bool { +test fn witness_ci_runner_spec_is_self_hosted_arm64_linux() -> Bool { match gunbc_ci_runner_spec() { SelfHosted { labels: ls } => ls.length() == 3 @@ -28,14 +27,7 @@ fn witness_ci_runner_spec_is_self_hosted_arm64_linux() -> Bool { } } -fn witness_selected_target_is_operator_fleet_routing() -> Bool { +test fn witness_selected_target_is_operator_fleet_routing() -> Bool { gunbc_ci_selected_runner_spec() == gunbc_ci_runner_spec() } -test fn ci_runner_seam_holds() -> Bool { - witness_selected_target_is_operator_fleet_routing() - && witness_ci_runner_spec_derives_from_fleet_offer() - && witness_ci_workflow_runner_matches_selected_target() - && witness_ci_yaml_runs_on_projects_selected_labels() - && witness_ci_runner_spec_is_self_hosted_arm64_linux() -} diff --git a/dag/test/claim/ci_runner_target_witness_test.dag b/dag/test/claim/ci_runner_target_witness_test.dag index d8a388f5b2d..55e5323bae5 100644 --- a/dag/test/claim/ci_runner_target_witness_test.dag +++ b/dag/test/claim/ci_runner_target_witness_test.dag @@ -1,29 +1,28 @@ module test.claim.ci_runner_target_witness - -fn witness_fleet_target_projects_fleet_derivation() -> Bool { +test fn witness_fleet_target_projects_fleet_derivation() -> Bool { ci_runner_target_spec(target: FleetSelfHosted) == gunbc_ci_runner_spec() } -fn witness_selected_target_projects_fleet() -> Bool { +test fn witness_selected_target_projects_fleet() -> Bool { gunbc_ci_selected_runner_spec() == ci_runner_target_spec(target: FleetSelfHosted) } -fn witness_ubicloud_target_projects_catalog_label() -> Bool { +test fn witness_ubicloud_target_projects_catalog_label() -> Bool { match ci_runner_target_spec(target: UbicloudRunner { row: ubicloud_standard_16_arm_catalog }) { SelfHosted { labels: ls } => ls.length() == 1 && ls.first() == "ubicloud-standard-16-arm" _ => false } } -fn witness_github_private_target_projects_hosted_scalar_variant() -> Bool { +test fn witness_github_private_target_projects_hosted_scalar_variant() -> Bool { match ci_runner_target_spec(target: GithubHostedRunner { row: github_hosted_ubuntu_2404_arm_private_catalog }) { HostedRunner { label: l } => runner_label_string(label: l) == "ubuntu-24.04-arm" _ => false } } -fn witness_runner_yaml_forms_discriminate_hosted_vs_label_routed() -> Bool { +test fn witness_runner_yaml_forms_discriminate_hosted_vs_label_routed() -> Bool { let hosted = runner_yaml(spec: ci_runner_target_spec(target: GithubHostedRunner { row: github_hosted_ubuntu_2404_arm_private_catalog })) let label_routed = runner_yaml(spec: ci_runner_target_spec(target: UbicloudRunner { row: ubicloud_standard_16_arm_catalog })) hosted == yaml_string(s: "ubuntu-24.04-arm") @@ -31,7 +30,7 @@ fn witness_runner_yaml_forms_discriminate_hosted_vs_label_routed() -> Bool { && hosted != string_list_flow(items: ["ubuntu-24.04-arm"]) } -fn witness_fleet_regime_is_slot_carved_with_throttle_line() -> Bool { +test fn witness_fleet_regime_is_slot_carved_with_throttle_line() -> Bool { match ci_runner_target_memory_regime(target: FleetSelfHosted) { SlotCarved { desired: d } => let high = byte_size_count(b: d.memory_high) @@ -41,14 +40,14 @@ fn witness_fleet_regime_is_slot_carved_with_throttle_line() -> Bool { } } -fn witness_cloud_regime_is_whole_machine() -> Bool { +test fn witness_cloud_regime_is_whole_machine() -> Bool { match ci_runner_target_memory_regime(target: UbicloudRunner { row: ubicloud_standard_16_arm_catalog }) { SlotCarved { desired: _ } => false WholeMachine { ram: r } => byte_size_count(b: r) == 48000000000 } } -fn witness_ubicloud_arm_family_holds_cited_ratio() -> Bool { +test fn witness_ubicloud_arm_family_holds_cited_ratio() -> Bool { let arm_rows = filter( ubicloud_runner_catalog(), predicate: fn(row) { string_contains(s: row.runs_on_label, pattern: "-arm") } @@ -59,28 +58,16 @@ fn witness_ubicloud_arm_family_holds_cited_ratio() -> Bool { }) } -fn witness_github_visibility_axis_discriminates() -> Bool { +test fn witness_github_visibility_axis_discriminates() -> Bool { let private_bytes = byte_size_count(b: github_hosted_ubuntu_2404_arm_private_catalog.memory_bytes) let public_bytes = byte_size_count(b: github_hosted_ubuntu_2404_arm_public_catalog.memory_bytes) private_bytes < public_bytes } -fn witness_selected_regime_is_slot_carved() -> Bool { +test fn witness_selected_regime_is_slot_carved() -> Bool { match ci_runner_target_memory_regime(target: selected_ci_runner_target()) { SlotCarved { desired: _ } => true WholeMachine { ram: _ } => false } } -test fn ci_runner_target_witnesses() -> Bool { - witness_fleet_target_projects_fleet_derivation() - && witness_selected_target_projects_fleet() - && witness_selected_regime_is_slot_carved() - && witness_ubicloud_target_projects_catalog_label() - && witness_github_private_target_projects_hosted_scalar_variant() - && witness_runner_yaml_forms_discriminate_hosted_vs_label_routed() - && witness_fleet_regime_is_slot_carved_with_throttle_line() - && witness_cloud_regime_is_whole_machine() - && witness_ubicloud_arm_family_holds_cited_ratio() - && witness_github_visibility_axis_discriminates() -} diff --git a/dag/test/claim/ci_yaml_serializer_witness_test.dag b/dag/test/claim/ci_yaml_serializer_witness_test.dag index ea93ee2323a..515e87cebf5 100644 --- a/dag/test/claim/ci_yaml_serializer_witness_test.dag +++ b/dag/test/claim/ci_yaml_serializer_witness_test.dag @@ -1,20 +1,19 @@ module test.claim.ci_yaml_serializer_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_fetch_depth_is_int_not_string() -> Bool { +test fn witness_fetch_depth_is_int_not_string() -> Bool { let with_block = yaml_mapping(entries: [kv(key: "fetch-depth", value: yaml_int(n: 0))]) let out = serialize_yaml(v: with_block) (out == "fetch-depth: 0\n") && (out != "fetch-depth: \"0\"\n") } -fn witness_rustflags_empty_string_quoted() -> Bool { +test fn witness_rustflags_empty_string_quoted() -> Bool { let with_block = yaml_mapping(entries: [kv(key: "rustflags", value: yaml_string(s: ""))]) serialize_yaml(v: with_block) == "rustflags: ''\n" } -fn witness_steps_sequence_elements_are_yaml_values() -> Bool { +test fn witness_steps_sequence_elements_are_yaml_values() -> Bool { let job = ci_workflow.jobs.first() match steps_yaml(steps: job.steps) { YamlSequence { elements: els } => (els.length() == job.steps.length()) && (els.length() > 0) @@ -61,22 +60,22 @@ fn witness_jobs_yaml_serializes() -> Bool { ])) != "" } -fn witness_project_workflow_serializes() -> Bool { +test fn witness_project_workflow_serializes() -> Bool { serialize_yaml(v: project_workflow_to_yaml(workflow: ci_workflow)) != "" } -fn witness_ci_yaml_gate_red_on_perturbed_bytes() -> Bool { +test fn witness_ci_yaml_gate_red_on_perturbed_bytes() -> Bool { let expected = expected_ci_yml() ci_yml_drifted(committed: concat(expected, "\n# perturb")) && !ci_yml_drifted(committed: expected) } -fn witness_ci_yaml_gate_red_on_wrong_fetch_depth_type() -> Bool { +test fn witness_ci_yaml_gate_red_on_wrong_fetch_depth_type() -> Bool { let expected = expected_ci_yml() ci_yml_drifted(committed: concat("fetch-depth: \"0\"\n", expected)) } -fn witness_cache_path_block_scalar() -> Bool { +test fn witness_cache_path_block_scalar() -> Bool { let yaml = expected_ci_yml() string_contains( s: yaml, @@ -94,7 +93,7 @@ fn witness_cache_path_block_scalar() -> Bool { ) } -fn witness_restore_keys_block_scalar_indent() -> Bool { +test fn witness_restore_keys_block_scalar_indent() -> Bool { let yaml = expected_ci_yml() string_contains( s: yaml, @@ -103,7 +102,7 @@ fn witness_restore_keys_block_scalar_indent() -> Bool { !string_contains(s: yaml, pattern: " restore-keys: |\n cargo-ci-") } -fn witness_rustup_run_block_scalar_not_quoted() -> Bool { +test fn witness_rustup_run_block_scalar_not_quoted() -> Bool { let yaml = expected_ci_yml() let rustup_line = concat( " rustup default \"$(rustup show active-toolchain | awk '", @@ -113,13 +112,13 @@ fn witness_rustup_run_block_scalar_not_quoted() -> Bool { !string_contains(s: yaml, pattern: "run: \"rustup default") } -fn witness_cache_key_plain_not_quoted() -> Bool { +test fn witness_cache_key_plain_not_quoted() -> Bool { let yaml = expected_ci_yml() string_contains(s: yaml, pattern: " key: cargo-ci-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles") && !string_contains(s: yaml, pattern: "key: \"cargo-ci") } -fn witness_multiline_without_block_scalar_is_invalid() -> Bool { +test fn witness_multiline_without_block_scalar_is_invalid() -> Bool { let broken = concat( concat( " path: ${{ runner.temp }}/cargo/registry/index/\n", @@ -130,7 +129,7 @@ fn witness_multiline_without_block_scalar_is_invalid() -> Bool { !string_contains(s: expected_ci_yml(), pattern: broken) } -fn witness_cache_path_not_flat_multiline_sibling() -> Bool { +test fn witness_cache_path_not_flat_multiline_sibling() -> Bool { !string_contains( s: expected_ci_yml(), pattern: concat( @@ -140,14 +139,14 @@ fn witness_cache_path_not_flat_multiline_sibling() -> Bool { ) } -fn witness_restore_keys_content_deeper_than_key() -> Bool { +test fn witness_restore_keys_content_deeper_than_key() -> Bool { !string_contains( s: expected_ci_yml(), pattern: " restore-keys: |\n cargo-ci-" ) } -fn witness_sccache_wired_when_fleet_daemon_up() -> Bool { +test fn witness_sccache_wired_when_fleet_daemon_up() -> Bool { let yaml = expected_ci_yml() string_contains(s: yaml, pattern: "if sccache --show-stats >/dev/null 2>&1; then") && string_contains(s: yaml, pattern: "RUSTC_WRAPPER=sccache") && @@ -157,7 +156,7 @@ fn witness_sccache_wired_when_fleet_daemon_up() -> Bool { !string_contains(s: yaml, pattern: "SCCACHE_DIR=$RUNNER_TEMP/sccache") } -fn witness_cargo_jobs_derived_and_jobserver_decoupled() -> Bool { +test fn witness_cargo_jobs_derived_and_jobserver_decoupled() -> Bool { let yaml = expected_ci_yml() let n = ci_cargo_build_jobs_count() string_contains(s: yaml, pattern: "echo \"MAKEFLAGS=\" >> \"$GITHUB_ENV\"") && @@ -167,7 +166,7 @@ fn witness_cargo_jobs_derived_and_jobserver_decoupled() -> Bool { n >= 2 } -fn witness_gunbc_ci_step_projects_run_script_markers() -> Bool { +test fn witness_gunbc_ci_step_projects_run_script_markers() -> Bool { let yaml = expected_ci_yml() let floor_script = gunbc_ci_floor_run(spec: gunbc_ci_spec) let build_script = ci_release_build_script() @@ -179,12 +178,12 @@ fn witness_gunbc_ci_step_projects_run_script_markers() -> Bool { string_contains(s: floor_script, pattern: "$ROOT/target/release/claim_executor") } -fn witness_cache_uses_runner_context_not_env() -> Bool { +test fn witness_cache_uses_runner_context_not_env() -> Bool { template_uses_context(template: ci_cache_path_template, target: Runner) && !template_uses_context(template: ci_cache_path_template, target: Env) } -fn witness_cache_runner_env_scope_red_control() -> Bool { +test fn witness_cache_runner_env_scope_red_control() -> Bool { let bad = ExpressionTemplate { segments: [ Interpolation { expression: ContextAccess { context: extdeps.github.expressions.Env, path: ["CARGO_HOME"] } }, @@ -194,11 +193,11 @@ fn witness_cache_runner_env_scope_red_control() -> Bool { !template_uses_context(template: bad, target: Env)) } -fn witness_no_runner_vars_accessed_via_env_context() -> Bool { +test fn witness_no_runner_vars_accessed_via_env_context() -> Bool { !any_template_accesses_runner_var_via_env(templates: ci_workflow_expression_templates) } -fn witness_no_runner_env_context_red_control() -> Bool { +test fn witness_no_runner_env_context_red_control() -> Bool { let bad = concat(ci_workflow_expression_templates, [ ExpressionTemplate { segments: [ @@ -208,25 +207,3 @@ fn witness_no_runner_env_context_red_control() -> Bool { any_template_accesses_runner_var_via_env(templates: bad) } -test fn ci_yaml_serializer_keystone_holds() -> Bool { - witness_fetch_depth_is_int_not_string() && - witness_rustflags_empty_string_quoted() && - witness_steps_sequence_elements_are_yaml_values() && - witness_project_workflow_serializes() && - witness_ci_yaml_gate_red_on_perturbed_bytes() && - witness_ci_yaml_gate_red_on_wrong_fetch_depth_type() && - witness_cache_path_block_scalar() && - witness_restore_keys_block_scalar_indent() && - witness_rustup_run_block_scalar_not_quoted() && - witness_cache_key_plain_not_quoted() && - witness_multiline_without_block_scalar_is_invalid() && - witness_cache_path_not_flat_multiline_sibling() && - witness_restore_keys_content_deeper_than_key() && - witness_sccache_wired_when_fleet_daemon_up() && - witness_cargo_jobs_derived_and_jobserver_decoupled() && - witness_gunbc_ci_step_projects_run_script_markers() && - witness_cache_uses_runner_context_not_env() && - witness_cache_runner_env_scope_red_control() && - witness_no_runner_vars_accessed_via_env_context() && - witness_no_runner_env_context_red_control() -} diff --git a/dag/test/claim/commit_workflow_witness_test.dag b/dag/test/claim/commit_workflow_witness_test.dag index 4168e182d67..6d6ec256f76 100644 --- a/dag/test/claim/commit_workflow_witness_test.dag +++ b/dag/test/claim/commit_workflow_witness_test.dag @@ -28,25 +28,25 @@ import v2.std.live_tree { LiveTreeDisposition, ReadsLiveTree } data live_tree_disposition: LiveTreeDisposition = ReadsLiveTree -fn witness_ci_spec_projects_from_roster() -> Bool { +test fn witness_ci_spec_projects_from_roster() -> Bool { gate_lists_eq(left: gunbc_ci_floor_gates, right: commit_workflow_ci_floor_gates) } -fn witness_local_tidy_spec_projects_from_roster() -> Bool { +test fn witness_local_tidy_spec_projects_from_roster() -> Bool { local_tidy_lists_eq(left: local_tidy_checks, right: commit_workflow_local_tidy_checks) } -fn witness_ci_jobs_share_yaml_handler() -> Bool { +test fn witness_ci_jobs_share_yaml_handler() -> Bool { realization_handler_for_surface(surface: GithubActionsCiJob) == CiYamlHandler && realization_artifact_for_surface(surface: GithubActionsCiJob) == CiYamlArtifact } -fn witness_pre_push_handler_binding() -> Bool { +test fn witness_pre_push_handler_binding() -> Bool { realization_handler_for_surface(surface: GitPrePushHook) == GitPrePushScriptHandler && realization_artifact_for_surface(surface: GitPrePushHook) == GithooksPrePushArtifact } -fn witness_realization_bindings_match_dispatch() -> Bool { +test fn witness_realization_bindings_match_dispatch() -> Bool { fold(commit_workflow_realization_bindings, init: true, f: fn(acc, b) { acc && realization_handler_for_surface(surface: b.surface) == b.handler @@ -54,37 +54,37 @@ fn witness_realization_bindings_match_dispatch() -> Bool { }) } -fn witness_realization_artifact_paths() -> Bool { +test fn witness_realization_artifact_paths() -> Bool { realization_artifact_path(surface: GithubActionsCiJob) == artifact_path(a: CiYamlArtifact) && realization_artifact_path(surface: GitPrePushHook) == artifact_path(a: GithooksPrePushArtifact) } -fn witness_roster_nonempty() -> Bool { +test fn witness_roster_nonempty() -> Bool { length(commit_gate_roster) > 0 && length(commit_workflow_realization_bindings) == 2 } -fn witness_roster_spans_wellformed() -> Bool { +test fn witness_roster_spans_wellformed() -> Bool { roster_witness_spans_wellformed(roster: commit_gate_roster) } -fn witness_span_undeclared_is_wellformed() -> Bool { +test fn witness_span_undeclared_is_wellformed() -> Bool { witness_span_wellformed(span: SpanUndeclared) } -fn witness_span_accepts_declared_seam() -> Bool { +test fn witness_span_accepts_declared_seam() -> Bool { witness_span_wellformed(span: SpanSeams { seams: [WitnessSeam { producer: "v2.04_infer", consumer: "v2.06_translate" }] }) } -fn witness_span_rejects_self_seam() -> Bool { +test fn witness_span_rejects_self_seam() -> Bool { !witness_span_wellformed(span: SpanSeams { seams: [WitnessSeam { producer: "v2.04_infer", consumer: "v2.04_infer" }] }) } -fn witness_span_rejects_duplicate_seams() -> Bool { +test fn witness_span_rejects_duplicate_seams() -> Bool { !witness_span_wellformed(span: SpanSeams { seams: [ WitnessSeam { producer: "v2.04_infer", consumer: "v2.06_translate" }, @@ -93,13 +93,13 @@ fn witness_span_rejects_duplicate_seams() -> Bool { }) } -fn witness_span_rejects_empty_seam_list() -> Bool { +test fn witness_span_rejects_empty_seam_list() -> Bool { !witness_span_wellformed(span: SpanSeams { seams: [] }) } data allowed_long_lane_explicit_entry: String = "src/v2/test/claim/long/parse_table_memo_governed_witness_test.dag" -fn witness_floor_roster_has_no_slow_long_lane_entries() -> Bool { +test fn witness_floor_roster_has_no_slow_long_lane_entries() -> Bool { !any( project_ci_floor_witness_entries(roster: commit_gate_roster), e => @@ -109,22 +109,3 @@ fn witness_floor_roster_has_no_slow_long_lane_entries() -> Bool { ) } -test fn commit_workflow_witnesses() -> Bool { - witness_roster_nonempty() - && witness_ci_spec_projects_from_roster() - && witness_local_tidy_spec_projects_from_roster() - && witness_ci_jobs_share_yaml_handler() - && witness_pre_push_handler_binding() - && witness_realization_bindings_match_dispatch() - && witness_realization_artifact_paths() - && witness_floor_roster_has_no_slow_long_lane_entries() -} - -test fn commit_workflow_span_kind_witnesses() -> Bool { - witness_roster_spans_wellformed() - && witness_span_undeclared_is_wellformed() - && witness_span_accepts_declared_seam() - && witness_span_rejects_self_seam() - && witness_span_rejects_duplicate_seams() - && witness_span_rejects_empty_seam_list() -} diff --git a/dag/test/claim/compile_source_model_witness_test.dag b/dag/test/claim/compile_source_model_witness_test.dag index 1264eef2eb9..d289839f530 100644 --- a/dag/test/claim/compile_source_model_witness_test.dag +++ b/dag/test/claim/compile_source_model_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.compile_source_model_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn role_is_entry(r: SourceRootRole) -> Bool { @@ -11,7 +10,7 @@ fn role_is_pool(r: SourceRootRole) -> Bool { match r { EntrySourceRoot => false, DependencyPoolRoot => true } } -fn w_flags_parse() -> Bool { +test fn w_flags_parse() -> Bool { match dependency_pool_index_from_flag(flag: "strict") { Present { value: StrictPoolIndex } => true _ => false @@ -26,23 +25,23 @@ fn w_flags_parse() -> Bool { } } -fn w_primary_precedence_roles() -> Bool { +test fn w_primary_precedence_roles() -> Bool { role_is_entry(r: source_root_role(root_index: 0, pool_index: PrimaryPrecedencePoolIndex)) && role_is_pool(r: source_root_role(root_index: 1, pool_index: PrimaryPrecedencePoolIndex)) } -fn w_strict_roles_all_entry() -> Bool { +test fn w_strict_roles_all_entry() -> Bool { role_is_entry(r: source_root_role(root_index: 0, pool_index: StrictPoolIndex)) && role_is_entry(r: source_root_role(root_index: 1, pool_index: StrictPoolIndex)) } -fn w_pool_fill_only_policy() -> Bool { +test fn w_pool_fill_only_policy() -> Bool { !pool_fill_only_for_role(role: EntrySourceRoot, pool_index: PrimaryPrecedencePoolIndex) && pool_fill_only_for_role(role: DependencyPoolRoot, pool_index: PrimaryPrecedencePoolIndex) && !pool_fill_only_for_role(role: DependencyPoolRoot, pool_index: StrictPoolIndex) } -fn w_indexing_branch_table() -> Bool { +test fn w_indexing_branch_table() -> Bool { skip_pool_module_when_indexed(module_already_indexed: true, pool_fill_only: true) && !skip_pool_module_when_indexed(module_already_indexed: true, pool_fill_only: false) && duplicate_module_path_across_index_is_error(module_already_indexed: true, pool_fill_only: false) && @@ -50,15 +49,7 @@ fn w_indexing_branch_table() -> Bool { duplicate_module_path_within_root_scan_is_error() } -fn w_compile_entry_root_index() -> Bool { +test fn w_compile_entry_root_index() -> Bool { compile_entry_source_root_index() == 0 } -test fn compile_source_model_witnesses() -> Bool { - w_flags_parse() && - w_primary_precedence_roles() && - w_strict_roles_all_entry() && - w_pool_fill_only_policy() && - w_indexing_branch_table() && - w_compile_entry_root_index() -} diff --git a/dag/test/claim/component_dispatch_button_witness_test.dag b/dag/test/claim/component_dispatch_button_witness_test.dag index 0c472cff529..d64f54a28cb 100644 --- a/dag/test/claim/component_dispatch_button_witness_test.dag +++ b/dag/test/claim/component_dispatch_button_witness_test.dag @@ -18,35 +18,28 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data component_dispatch_button_witness_note: String = "P0 keystone: the component concept, executable. The dispatch button's terminal states are DERIVED from the belt wire vocabulary and cross-checked total both directions; the RED control resurrects the exact drift the dispatch-button incident was — a wire label with no state row — and proves the totality check LOCATES it (returns the missing label), not vacuously passes. The role split (ok -> figure, refusal -> boundary) is proven derived from the ok-label authority, so a label moving across the ok line moves its chip material by derivation." -fn witness_scale_well_formed() -> Bool { +test fn witness_scale_well_formed() -> Bool { scale_well_formed() } -fn witness_dispatch_button_states_total_over_wire() -> Bool { +test fn witness_dispatch_button_states_total_over_wire() -> Bool { dispatch_button_wire_total() && dispatch_button_terminal_count() == belt_dispatch_all_status_labels().length() && belt_dispatch_all_status_labels().length() == 6 } -fn witness_dropped_state_is_located_red() -> Bool { +test fn witness_dropped_state_is_located_red() -> Bool { let broken = component_drop_state(c: dispatch_button_component(), drop_key: "spawned") let gaps = labels_missing_state(c: broken, wire_labels: belt_dispatch_all_status_labels()) gaps.length() == 1 && all(gaps, g => g == "spawned") } -fn witness_no_fabricated_state() -> Bool { +test fn witness_no_fabricated_state() -> Bool { states_missing_label(c: dispatch_button_component(), wire_labels: belt_dispatch_all_status_labels()).length() == 0 } -fn witness_terminal_role_split_follows_ok_set() -> Bool { +test fn witness_terminal_role_split_follows_ok_set() -> Bool { all(component_terminal_states(c: dispatch_button_component()), s => state_kind_ok(k: s.kind) == any(belt_dispatch_ok_status_labels(), l => l == state_kind_key(k: s.kind))) } -test fn component_dispatch_button_keystone_holds() -> Bool { - witness_scale_well_formed() - && witness_dispatch_button_states_total_over_wire() - && witness_dropped_state_is_located_red() - && witness_no_fabricated_state() - && witness_terminal_role_split_follows_ok_set() -} diff --git a/dag/test/claim/config_record_emit_test.dag b/dag/test/claim/config_record_emit_test.dag index 3c4f247277a..1ac510b5180 100644 --- a/dag/test/claim/config_record_emit_test.dag +++ b/dag/test/claim/config_record_emit_test.dag @@ -1,6 +1,5 @@ module test.claim.config_record_emit_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data flat_proto: LayoutProtocol = LayoutProtocol { indent_unit: "" } @@ -20,35 +19,35 @@ fn render_record(knobs: SerializationKnobs, fields: List) -> String render(doc: serialize_record_doc(knobs: knobs, fields: fields), proto: flat_proto) } -fn witness_yaml_field_uses_colon_separator() -> Bool { +test fn witness_yaml_field_uses_colon_separator() -> Bool { match yaml_format.record { null => false knobs => render_field(knobs: knobs, key: "name", value: "gunbc") == "name: gunbc" } } -fn witness_toml_field_uses_equals_and_double_quotes() -> Bool { +test fn witness_toml_field_uses_equals_and_double_quotes() -> Bool { match toml_format.record { null => false knobs => render_field(knobs: knobs, key: "name", value: "gunbc") == "name = \"gunbc\"" } } -fn witness_makefile_field_uses_equals_no_quotes() -> Bool { +test fn witness_makefile_field_uses_equals_no_quotes() -> Bool { match makefile_format.record { null => false knobs => render_field(knobs: knobs, key: "CC", value: "gcc") == "CC = gcc" } } -fn witness_gitignore_has_no_record_knobs() -> Bool { +test fn witness_gitignore_has_no_record_knobs() -> Bool { match gitignore_format.record { null => true _ => false } } -fn witness_yaml_toml_fields_differ() -> Bool { +test fn witness_yaml_toml_fields_differ() -> Bool { match yaml_format.record { null => false yaml_knobs => match toml_format.record { @@ -60,7 +59,7 @@ fn witness_yaml_toml_fields_differ() -> Bool { } } -fn witness_yaml_two_fields_newline_joined() -> Bool { +test fn witness_yaml_two_fields_newline_joined() -> Bool { match yaml_format.record { null => false knobs => @@ -71,7 +70,7 @@ fn witness_yaml_two_fields_newline_joined() -> Bool { } } -fn witness_manifest_knobs_space_separated() -> Bool { +test fn witness_manifest_knobs_space_separated() -> Bool { render_fields( knobs: manifest_record_knobs, fields: [ @@ -81,7 +80,7 @@ fn witness_manifest_knobs_space_separated() -> Bool { ) == "host=srv1 runner_count=4" } -fn witness_json_knobs_produce_quoted_record() -> Bool { +test fn witness_json_knobs_produce_quoted_record() -> Bool { render_record( knobs: json_record_knobs, fields: [ @@ -91,7 +90,7 @@ fn witness_json_knobs_produce_quoted_record() -> Bool { ) == "{\"host\": \"srv1\", \"runner_count\": \"4\"}" } -fn witness_same_fields_differ_across_knobs() -> Bool { +test fn witness_same_fields_differ_across_knobs() -> Bool { let fields = [ serial_field(key: "host", value: serial_scalar(text: "srv1")), serial_field(key: "runner_count", value: serial_scalar(text: "4")) @@ -100,14 +99,3 @@ fn witness_same_fields_differ_across_knobs() -> Bool { render_record(knobs: json_record_knobs, fields: fields) } -test fn config_record_emit_keystone_holds() -> Bool { - witness_yaml_field_uses_colon_separator() && - witness_toml_field_uses_equals_and_double_quotes() && - witness_makefile_field_uses_equals_no_quotes() && - witness_gitignore_has_no_record_knobs() && - witness_yaml_toml_fields_differ() && - witness_yaml_two_fields_newline_joined() && - witness_manifest_knobs_space_separated() && - witness_json_knobs_produce_quoted_record() && - witness_same_fields_differ_across_knobs() -} diff --git a/dag/test/claim/cpu_l1_cache_geometry_witness_test.dag b/dag/test/claim/cpu_l1_cache_geometry_witness_test.dag index 169bec66fec..dcf553c4c83 100644 --- a/dag/test/claim/cpu_l1_cache_geometry_witness_test.dag +++ b/dag/test/claim/cpu_l1_cache_geometry_witness_test.dag @@ -17,26 +17,21 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data ampere_altra_l1_data_kibibytes_per_core: Nat = 64 data ampere_altra_l1_line_bytes: Nat = 64 -fn w_ampere_l1_geometry_matches_datasheet() -> Bool { +test fn w_ampere_l1_geometry_matches_datasheet() -> Bool { let g = ampere_altra_l1_cache_geometry byte_size_count(b: g.data_capacity_per_core) == ampere_altra_l1_data_kibibytes_per_core * 1024 && byte_size_count(b: g.instruction_capacity_per_core) == ampere_altra_l1_data_kibibytes_per_core * 1024 && byte_size_count(b: g.line_size) == ampere_altra_l1_line_bytes } -fn w_ampere_catalog_rows_share_cited_l1_geometry() -> Bool { +test fn w_ampere_catalog_rows_share_cited_l1_geometry() -> Bool { altra_max_m12830_catalog.l1_cache == ampere_altra_l1_cache_geometry && altra_q6430_catalog.l1_cache == ampere_altra_l1_cache_geometry } -fn w_ampere_l1_citations_cover_all_fields() -> Bool { +test fn w_ampere_l1_citations_cover_all_fields() -> Bool { let citations = altra_max_m12830_catalog.l1_cache_citations list_length(items: citations) == 3 && citations.first().authority == ampere_altra_rev_a1_datasheet_authority } -test fn cpu_l1_cache_geometry_witnesses() -> Bool { - w_ampere_l1_geometry_matches_datasheet() - && w_ampere_catalog_rows_share_cited_l1_geometry() - && w_ampere_l1_citations_cover_all_fields() -} diff --git a/dag/test/claim/cpu_l2_l3_cache_geometry_witness_test.dag b/dag/test/claim/cpu_l2_l3_cache_geometry_witness_test.dag index 7b074c9d192..7e03f91cf6e 100644 --- a/dag/test/claim/cpu_l2_l3_cache_geometry_witness_test.dag +++ b/dag/test/claim/cpu_l2_l3_cache_geometry_witness_test.dag @@ -24,24 +24,24 @@ data ampere_altra_max_l3_mebibytes: Nat = 16 data ampere_altra_classic_l3_mebibytes: Nat = 32 data ampere_altra_l3_line_bytes: Nat = 64 -fn w_ampere_l2_geometry_matches_datasheet() -> Bool { +test fn w_ampere_l2_geometry_matches_datasheet() -> Bool { let g = ampere_altra_l2_cache_geometry byte_size_count(b: g.capacity_per_core) == ampere_altra_l2_mebibytes_per_core * 1024 * 1024 && byte_size_count(b: g.line_size) == ampere_altra_l2_line_bytes } -fn w_ampere_catalog_rows_share_cited_l2_geometry() -> Bool { +test fn w_ampere_catalog_rows_share_cited_l2_geometry() -> Bool { altra_max_m12830_catalog.l2_cache == ampere_altra_l2_cache_geometry && altra_q6430_catalog.l2_cache == ampere_altra_l2_cache_geometry } -fn w_ampere_l2_citations_cover_all_fields() -> Bool { +test fn w_ampere_l2_citations_cover_all_fields() -> Bool { let citations = ampere_altra_l2_cache_citations list_length(items: citations) == 2 && citations.first().authority == ampere_altra_rev_a1_datasheet_authority } -fn w_ampere_l3_geometry_diverges_by_sku() -> Bool { +test fn w_ampere_l3_geometry_diverges_by_sku() -> Bool { byte_size_count(b: altra_max_m12830_catalog.l3_cache.capacity) == ampere_altra_max_l3_mebibytes * 1024 * 1024 && byte_size_count(b: altra_q6430_catalog.l3_cache.capacity) == ampere_altra_classic_l3_mebibytes * 1024 * 1024 && byte_size_count(b: altra_max_m12830_catalog.l3_cache.line_size) == ampere_altra_l3_line_bytes @@ -50,17 +50,10 @@ fn w_ampere_l3_geometry_diverges_by_sku() -> Bool { && altra_q6430_catalog.l3_cache == ampere_altra_classic_l3_cache_geometry } -fn w_ampere_l3_citations_diverge_by_family_datasheet() -> Bool { +test fn w_ampere_l3_citations_diverge_by_family_datasheet() -> Bool { list_length(items: altra_max_m12830_catalog.l3_cache_citations) == 2 && list_length(items: altra_q6430_catalog.l3_cache_citations) == 2 && altra_max_m12830_catalog.l3_cache_citations.first().authority == ampere_altra_rev_a1_datasheet_authority && altra_q6430_catalog.l3_cache_citations.first().authority == ampere_altra_classic_rev_a1_datasheet_authority } -test fn cpu_l2_l3_cache_geometry_witnesses() -> Bool { - w_ampere_l2_geometry_matches_datasheet() - && w_ampere_catalog_rows_share_cited_l2_geometry() - && w_ampere_l2_citations_cover_all_fields() - && w_ampere_l3_geometry_diverges_by_sku() - && w_ampere_l3_citations_diverge_by_family_datasheet() -} diff --git a/dag/test/claim/css_grain_witness_test.dag b/dag/test/claim/css_grain_witness_test.dag index 936d8a2970b..237080591c4 100644 --- a/dag/test/claim/css_grain_witness_test.dag +++ b/dag/test/claim/css_grain_witness_test.dag @@ -13,7 +13,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data css_grain_witness_note: String = "D5 keystone: the CSS grain (extdeps.languages.css) is the typed authority for the register's property names and selector subjects — the last stringly medium in the served stack, now typed. The serializers reproduce the emitted strings byte-exact (the register's whole-stylesheet byte-identity is proven by the lift-parity + register witnesses; here the grain's OWN serializers are pinned with RED controls). RawSelector is the COUNTED frontier: raw_selector_count is the honest residue number (selectors still expressed as raw text — descendant/compound/functional-pseudo, awaiting the combinator grammar), and RawProperty is the same escape for a non-standard property name." -fn witness_property_wire_byte_exact() -> Bool { +test fn witness_property_wire_byte_exact() -> Bool { css_property_wire(p: FontSize) == "font-size" && css_property_wire(p: BorderColor) == "border-color" && css_property_wire(p: ColorScheme) == "color-scheme" @@ -23,12 +23,12 @@ fn witness_property_wire_byte_exact() -> Bool { data property_wire_red_note: String = "RED control: css_property_wire must produce the upstream hyphenated spelling; a camelCase or underscored mis-serialization reds the byte-exact pin above (browsers are the consumer)." -fn witness_property_wire_red() -> Bool { +test fn witness_property_wire_red() -> Bool { css_property_wire(p: FontSize) != "fontSize" && css_property_wire(p: FontSize) != "font_size" } -fn witness_selector_wire_byte_exact() -> Bool { +test fn witness_selector_wire_byte_exact() -> Bool { selector_subject_wire(s: ClassSelector { name: "dispatch-btn" }) == ".dispatch-btn" && selector_subject_wire(s: ElementSelector { tag: "body" }) == "body" && selector_subject_wire(s: PseudoSuffix { base: "a", pseudo: "hover" }) == "a:hover" @@ -37,7 +37,7 @@ fn witness_selector_wire_byte_exact() -> Bool { data selector_wire_red_note: String = "RED control: a ClassSelector must serialize with its leading dot; dropping it reds. RawSelector carries the exact text so a complex selector emits byte-identical." -fn witness_selector_wire_red() -> Bool { +test fn witness_selector_wire_red() -> Bool { selector_subject_wire(s: ClassSelector { name: "x" }) != "x" && selector_subject_wire(s: ClassSelector { name: "x" }) == ".x" } @@ -52,15 +52,8 @@ fn d5_sample_subjects() -> List { ] } -fn witness_raw_selector_census() -> Bool { +test fn witness_raw_selector_census() -> Bool { raw_selector_count(subjects: d5_sample_subjects()) == 2 && raw_selector_count(subjects: [ClassSelector { name: "only-simple" }]) == 0 } -test fn css_grain_witnesses() -> Bool { - witness_property_wire_byte_exact() - && witness_property_wire_red() - && witness_selector_wire_byte_exact() - && witness_selector_wire_red() - && witness_raw_selector_census() -} diff --git a/dag/test/claim/deploy_access_privilege_witness_test.dag b/dag/test/claim/deploy_access_privilege_witness_test.dag index 2a3fba4bd30..0b20808486c 100644 --- a/dag/test/claim/deploy_access_privilege_witness_test.dag +++ b/dag/test/claim/deploy_access_privilege_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.deploy_access_privilege_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data privilege_mutation_marker: String = "host-mutation-privilege-marker-7f3a" @@ -9,7 +8,7 @@ fn host_os_target() -> NodeControlPlane { HostOs { node: srv1_host } } -fn witness_modeled_unprivileged_fixture_is_denied() -> Bool { +test fn witness_modeled_unprivileged_fixture_is_denied() -> Bool { let d = deploy_access_check( access: ci_deploy_srv1_access, actor: deploy_access_unprivileged_fixture_actor() @@ -24,7 +23,7 @@ fn witness_modeled_unprivileged_fixture_is_denied() -> Bool { } } -fn witness_unprivileged_mutation_refused_before_shell() -> Bool { +test fn witness_unprivileged_mutation_refused_before_shell() -> Bool { match host_effect_apply_gated( access: ci_deploy_srv1_access, target: host_os_target(), @@ -49,7 +48,7 @@ fn witness_unprivileged_mutation_refused_before_shell() -> Bool { } } -fn witness_unprivileged_mutation_directive_is_refused_terminal() -> Bool { +test fn witness_unprivileged_mutation_directive_is_refused_terminal() -> Bool { let r = host_effect_apply_gated( access: ci_deploy_srv1_access, target: host_os_target(), @@ -72,7 +71,7 @@ fn witness_unprivileged_mutation_directive_is_refused_terminal() -> Bool { } } -fn witness_privileged_fixture_mutation_applies() -> Bool { +test fn witness_privileged_fixture_mutation_applies() -> Bool { reconciliation_converged(r: host_effect_apply_gated( access: ci_deploy_srv1_access, target: host_os_target(), @@ -85,7 +84,7 @@ fn witness_privileged_fixture_mutation_applies() -> Bool { )) } -fn witness_privileged_fixture_surfaces_stdout() -> Bool { +test fn witness_privileged_fixture_surfaces_stdout() -> Bool { match host_effect_apply_gated( access: ci_deploy_srv1_access, target: host_os_target(), @@ -104,10 +103,3 @@ fn witness_privileged_fixture_surfaces_stdout() -> Bool { } } -test fn deploy_access_privilege_witnesses() -> Bool { - witness_modeled_unprivileged_fixture_is_denied() - && witness_unprivileged_mutation_refused_before_shell() - && witness_unprivileged_mutation_directive_is_refused_terminal() - && witness_privileged_fixture_mutation_applies() - && witness_privileged_fixture_surfaces_stdout() -} diff --git a/dag/test/claim/deploy_mutation_gate_witness_test.dag b/dag/test/claim/deploy_mutation_gate_witness_test.dag index 5f73e4b0f50..d675b53ffb6 100644 --- a/dag/test/claim/deploy_mutation_gate_witness_test.dag +++ b/dag/test/claim/deploy_mutation_gate_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.deploy_mutation_gate_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data mutation_gate_marker: String = "deploy-mutation-gate-marker-c4e2" @@ -19,7 +18,7 @@ fn srv2_host_observation() -> DeployTargetHostObservation { ) } -fn witness_decision_meet_preserves_left_denial_reason() -> Bool { +test fn witness_decision_meet_preserves_left_denial_reason() -> Bool { let left = std.access.Deny { reason: Present { value: "host-deny-reason" } } let right = std.access.Deny { reason: Present { value: "access-deny-reason" } } match decision_meet(a: left, b: right) { @@ -32,7 +31,7 @@ fn witness_decision_meet_preserves_left_denial_reason() -> Bool { } } -fn witness_wrong_host_unprivileged_both_deny_surfaces_host_reason_only() -> Bool { +test fn witness_wrong_host_unprivileged_both_deny_surfaces_host_reason_only() -> Bool { let gate = deploy_mutation_gate( access: ci_deploy_srv1_access, fixture_actor: Present { value: deploy_access_unprivileged_fixture_actor() }, @@ -47,7 +46,7 @@ fn witness_wrong_host_unprivileged_both_deny_surfaces_host_reason_only() -> Bool } } -fn witness_wrong_host_unprivileged_both_deny_refused_before_shell() -> Bool { +test fn witness_wrong_host_unprivileged_both_deny_refused_before_shell() -> Bool { match live_deploy_fold( spec: deployment_spec_srv1(), effect: ShellCommand { script: concat("echo ", mutation_gate_marker, " && exit 99") }, @@ -67,7 +66,7 @@ fn witness_wrong_host_unprivileged_both_deny_refused_before_shell() -> Bool { } } -fn witness_wrong_host_privileged_gate_denies() -> Bool { +test fn witness_wrong_host_privileged_gate_denies() -> Bool { let gate = deploy_mutation_gate( access: ci_deploy_srv1_access, fixture_actor: Present { @@ -85,7 +84,7 @@ fn witness_wrong_host_privileged_gate_denies() -> Bool { } } -fn witness_right_host_unprivileged_gate_denies() -> Bool { +test fn witness_right_host_unprivileged_gate_denies() -> Bool { match deploy_mutation_gate( access: ci_deploy_srv1_access, fixture_actor: Present { value: deploy_access_unprivileged_fixture_actor() }, @@ -96,7 +95,7 @@ fn witness_right_host_unprivileged_gate_denies() -> Bool { } } -fn witness_right_host_privileged_gate_permits() -> Bool { +test fn witness_right_host_privileged_gate_permits() -> Bool { match deploy_mutation_gate( access: ci_deploy_srv1_access, fixture_actor: Present { @@ -109,7 +108,7 @@ fn witness_right_host_privileged_gate_permits() -> Bool { } } -fn witness_wrong_host_privileged_refused_before_shell() -> Bool { +test fn witness_wrong_host_privileged_refused_before_shell() -> Bool { match live_deploy_fold( spec: deployment_spec_srv1(), effect: ShellCommand { script: concat("echo ", mutation_gate_marker, " && exit 99") }, @@ -130,7 +129,7 @@ fn witness_wrong_host_privileged_refused_before_shell() -> Bool { } } -fn witness_right_host_unprivileged_refused_before_shell() -> Bool { +test fn witness_right_host_unprivileged_refused_before_shell() -> Bool { match live_deploy_fold( spec: deployment_spec_srv1(), effect: ShellCommand { script: concat("echo ", mutation_gate_marker, " && exit 99") }, @@ -149,7 +148,7 @@ fn witness_right_host_unprivileged_refused_before_shell() -> Bool { } } -fn witness_right_host_privileged_may_apply() -> Bool { +test fn witness_right_host_privileged_may_apply() -> Bool { reconciliation_converged(r: live_deploy_fold( spec: deployment_spec_srv1(), effect: ShellCommand { script: "true" }, @@ -162,14 +161,3 @@ fn witness_right_host_privileged_may_apply() -> Bool { )) } -test fn deploy_mutation_gate_witnesses() -> Bool { - witness_decision_meet_preserves_left_denial_reason() - && witness_wrong_host_unprivileged_both_deny_surfaces_host_reason_only() - && witness_wrong_host_privileged_gate_denies() - && witness_right_host_unprivileged_gate_denies() - && witness_right_host_privileged_gate_permits() - && witness_wrong_host_privileged_refused_before_shell() - && witness_wrong_host_unprivileged_both_deny_refused_before_shell() - && witness_right_host_unprivileged_refused_before_shell() - && witness_right_host_privileged_may_apply() -} diff --git a/dag/test/claim/descent_evidence_lattice_witness_test.dag b/dag/test/claim/descent_evidence_lattice_witness_test.dag index fcca501079d..579dd083e76 100644 --- a/dag/test/claim/descent_evidence_lattice_witness_test.dag +++ b/dag/test/claim/descent_evidence_lattice_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.descent_evidence_lattice - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn rank_of_meet(a: DescentEvidence, b: DescentEvidence) -> Int { @@ -11,7 +10,7 @@ fn rank_of_join(a: DescentEvidence, b: DescentEvidence) -> Int { evidence_rank(e: descent_evidence_lattice_join(a: a, b: b)) } -fn meet_agrees_with_lattice() -> Bool { +test fn meet_agrees_with_lattice() -> Bool { rank_of_meet(a: Strict, b: Strict) == 2 && rank_of_meet(a: Strict, b: NonIncreasing) == 1 && rank_of_meet(a: Strict, b: DescentUnknown) == 0 @@ -20,27 +19,21 @@ fn meet_agrees_with_lattice() -> Bool { && rank_of_meet(a: DescentUnknown, b: DescentUnknown) == 0 } -fn join_agrees_with_lattice() -> Bool { +test fn join_agrees_with_lattice() -> Bool { rank_of_join(a: DescentUnknown, b: DescentUnknown) == 0 && rank_of_join(a: DescentUnknown, b: NonIncreasing) == 1 && rank_of_join(a: NonIncreasing, b: Strict) == 2 && rank_of_join(a: Strict, b: Strict) == 2 } -fn promote_never_fabricates_strict() -> Bool { +test fn promote_never_fabricates_strict() -> Bool { evidence_rank(e: promote_to_strict(evidence: NonIncreasing)) == 1 && evidence_rank(e: promote_to_strict(evidence: DescentUnknown)) == 0 && evidence_rank(e: promote_to_strict(evidence: Strict)) == 2 } -fn meet_is_not_join_red_control() -> Bool { +test fn meet_is_not_join_red_control() -> Bool { rank_of_meet(a: Strict, b: DescentUnknown) == 0 && rank_of_join(a: Strict, b: DescentUnknown) == 2 } -test fn descent_evidence_lattice_witnesses() -> Bool { - meet_agrees_with_lattice() - && join_agrees_with_lattice() - && promote_never_fabricates_strict() - && meet_is_not_join_red_control() -} diff --git a/dag/test/claim/design_palette_witness_test.dag b/dag/test/claim/design_palette_witness_test.dag index 7327e7caea3..e2980b2ee04 100644 --- a/dag/test/claim/design_palette_witness_test.dag +++ b/dag/test/claim/design_palette_witness_test.dag @@ -36,14 +36,14 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_catalog_admissible() -> Bool { +test fn witness_catalog_admissible() -> Bool { catalog_admissible() && swatch_set_admissible(s: island_pastel) && swatch_set_admissible(s: okabe_ito) && swatch_set_admissible(s: solarized) } -fn witness_hex_serialization_matches_authored() -> Bool { +test fn witness_hex_serialization_matches_authored() -> Bool { swatch_paint(sw: island_mint) == "#9dffb0" && swatch_paint(sw: island_aqua) == "#81f1f7" && swatch_paint(sw: island_ivory) == "#fffffa" @@ -52,11 +52,11 @@ fn witness_hex_serialization_matches_authored() -> Bool { && swatch_paint(sw: island_loam) == "#724d15" } -fn witness_pairing_matrix_total() -> Bool { +test fn witness_pairing_matrix_total() -> Bool { graded_pairings(s: island_pastel).length() == 30 } -fn witness_camel_ivory_near_miss() -> Bool { +test fn witness_camel_ivory_near_miss() -> Bool { let r = srgb8_contrast_ratio_x100(a: island_camel.color, b: island_ivory.color) r >= 280 && r < 300 && grade_rank(g: grade_of_contrast(contrast_x100: r)) == 0 @@ -71,14 +71,14 @@ fn authored_five() -> SwatchSet { } } -fn witness_authored_set_has_no_text_pairing() -> Bool { +test fn witness_authored_set_has_no_text_pairing() -> Bool { let five = authored_five() swatches_of(s: five).length() == 5 && !set_text_capable(s: five) && pairings_at_least(s: five, min_rank: 1).length() == 0 } -fn witness_loam_carries_text_capability() -> Bool { +test fn witness_loam_carries_text_capability() -> Bool { set_text_capable(s: island_pastel) && srgb8_contrast_at_least(a: island_loam.color, b: island_mint.color, threshold_hundredths: wcag_aa_normal_text_hundredths) && srgb8_contrast_at_least(a: island_loam.color, b: island_aqua.color, threshold_hundredths: wcag_aa_normal_text_hundredths) @@ -87,7 +87,7 @@ fn witness_loam_carries_text_capability() -> Bool { && pairings_at_least(s: island_pastel, min_rank: 2).length() == 8 } -fn witness_grade_kernel_discriminates() -> Bool { +test fn witness_grade_kernel_discriminates() -> Bool { let black = Srgb8 { r: 0, g: 0, b: 0 } let white = Srgb8 { r: 255, g: 255, b: 255 } srgb8_contrast_ratio_x100(a: black, b: white) == 2100 @@ -97,7 +97,7 @@ fn witness_grade_kernel_discriminates() -> Bool { && !srgb8_admissible(c: Srgb8 { r: 256, g: 0, b: 0 }) } -fn witness_camel_hsl_projection() -> Bool { +test fn witness_camel_hsl_projection() -> Bool { let proj = srgb8_to_hsl_projection(c: island_camel.color) match proj { Chromatic { h, s_pct, l_pct } => h == 35 && s_pct == 53 && l_pct == 51 @@ -105,7 +105,7 @@ fn witness_camel_hsl_projection() -> Bool { } } -fn witness_hsl_projection_red_on_off_by_one_hue() -> Bool { +test fn witness_hsl_projection_red_on_off_by_one_hue() -> Bool { let proj = srgb8_to_hsl_projection(c: island_camel.color) match proj { Chromatic { h, s_pct, l_pct } => !(h == 36 && s_pct == 53 && l_pct == 51) @@ -113,21 +113,21 @@ fn witness_hsl_projection_red_on_off_by_one_hue() -> Bool { } } -fn witness_achromatic_maps_to_variant_not_hue_zero() -> Bool { +test fn witness_achromatic_maps_to_variant_not_hue_zero() -> Bool { match srgb8_to_hsl_projection(c: Srgb8 { r: 128, g: 128, b: 128 }) { Achromatic { l_pct: _ } => true Chromatic { h: _, s_pct: _, l_pct: _ } => false } } -fn witness_chromatic_still_projects_hue() -> Bool { +test fn witness_chromatic_still_projects_hue() -> Bool { match srgb8_to_hsl_projection(c: Srgb8 { r: 255, g: 0, b: 0 }) { Chromatic { h, s_pct, l_pct: _ } => h >= 0 && s_pct > 0 Achromatic { l_pct: _ } => false } } -fn witness_gray_never_yields_hue_zero_as_red() -> Bool { +test fn witness_gray_never_yields_hue_zero_as_red() -> Bool { match srgb8_to_hsl_projection(c: Srgb8 { r: 127, g: 127, b: 127 }) { Chromatic { h: 0, s_pct: 0, l_pct: _ } => false Chromatic { h: _, s_pct: _, l_pct: _ } => true @@ -135,21 +135,21 @@ fn witness_gray_never_yields_hue_zero_as_red() -> Bool { } } -fn witness_camel_passes_quiet_envelope() -> Bool { +test fn witness_camel_passes_quiet_envelope() -> Bool { quiet_envelope_srgb8(c: island_camel.color) } -fn witness_mint_refused_by_quiet_envelope() -> Bool { +test fn witness_mint_refused_by_quiet_envelope() -> Bool { !quiet_envelope_srgb8(c: island_mint.color) } -fn witness_ivory_refused_despite_near_achromatic_oklch() -> Bool { +test fn witness_ivory_refused_despite_near_achromatic_oklch() -> Bool { !quiet_envelope_srgb8(c: island_ivory.color) } data ivory_hsl_proxy_defect_note: String = "Teaching case: ivory (255,255,250) is refused by the HSL quiet_envelope despite perceptual near-achromatic OKLCH chroma (~0.007) — documents the HSL-proxy defect that design-register-library.md sect 10 schedules for OKLCH reground; this witness pins the defect, it does not fix it." -fn witness_cited_palette_counts() -> Bool { +test fn witness_cited_palette_counts() -> Bool { swatches_of(s: okabe_ito).length() == 8 && swatches_of(s: solarized).length() == 16 && palette_catalog.length() == 3 @@ -163,7 +163,7 @@ fn ladder_step_matches_catalog(step_name: String, step_color: Srgb8) -> Bool { && row.color.b == step_color.b)) } -fn witness_solarized_base_ladder_order_and_count() -> Bool { +test fn witness_solarized_base_ladder_order_and_count() -> Bool { solarized_base_ladder.length() == 8 && all(solarized_base_ladder, step => ladder_step_matches_catalog(step_name: step.name, step_color: step.color)) } @@ -185,7 +185,7 @@ fn solarized_mode_partner(name: String) -> String { else { name } } -fn witness_solarized_base_mode_pairing_involution() -> Bool { +test fn witness_solarized_base_mode_pairing_involution() -> Bool { solarized_base_mode_pairs.length() == 4 && has_solarized_mode_pair(dark: "base03", light: "base3") && has_solarized_mode_pair(dark: "base02", light: "base2") @@ -195,12 +195,12 @@ fn witness_solarized_base_mode_pairing_involution() -> Bool { && solarized_mode_partner(name: solarized_mode_partner(name: "base03")) == "base03" } -fn witness_base16_digit_refuses_out_of_range() -> Bool { +test fn witness_base16_digit_refuses_out_of_range() -> Bool { hex_digit_char_lower(d: 16) == base16_digit_refusal_sentinel && hex_digit_char_lower(d: -1) == base16_digit_refusal_sentinel } -fn witness_uint8_channel_inclusive_max_value_present() -> Bool { +test fn witness_uint8_channel_inclusive_max_value_present() -> Bool { match uint8_channel_inclusive_max_value_derived() { Present { value: derived } => derived == uint8_channel_inclusive_max && uint8_channel_inclusive_max_value() == uint8_channel_inclusive_max @@ -208,68 +208,40 @@ fn witness_uint8_channel_inclusive_max_value_present() -> Bool { } } -fn witness_workspace_for_use_completion_admissible() -> Bool { +test fn witness_workspace_for_use_completion_admissible() -> Bool { swatch_set_for_use_admissible(u: island_pastel_for_workspace) && swatches_for_use(u: island_pastel_for_workspace).length() == 10 && swatches_of(s: island_pastel).length() == 6 && swatch_paint(sw: island_venom) == "#8a2f23" } -fn witness_in_family_inks_carry_their_fills() -> Bool { +test fn witness_in_family_inks_carry_their_fills() -> Bool { grade_rank(g: grade_pairing(figure: island_mint_ink, ground: island_mint).grade) >= 2 && grade_rank(g: grade_pairing(figure: island_butter_ink, ground: island_butter).grade) >= 2 && grade_rank(g: grade_pairing(figure: island_aqua_ink, ground: island_aqua).grade) >= 2 } -fn witness_venom_carries_ivory_text_and_refuses_loam() -> Bool { +test fn witness_venom_carries_ivory_text_and_refuses_loam() -> Bool { let on_ivory = grade_pairing(figure: island_ivory, ground: island_venom) let on_loam = grade_pairing(figure: island_venom, ground: island_loam) grade_rank(g: on_ivory.grade) == 3 && grade_rank(g: on_loam.grade) == 0 } -fn witness_graduated_default_clears_text_aa() -> Bool { +test fn witness_graduated_default_clears_text_aa() -> Bool { count(workspace_band_paints()) == 5 && all(workspace_band_paints(), p => srgb8_contrast_at_least(a: p.ink.color, b: p.fill.color, threshold_hundredths: wcag_aa_normal_text_hundredths)) } -fn witness_pressed_stop_derivation_and_legibility() -> Bool { +test fn witness_pressed_stop_derivation_and_legibility() -> Bool { swatch_paint(sw: Swatch { name: "probe", color: pressed_stop(c: Srgb8 { r: 0, g: 158, b: 115 }) }) == "#008560" && all(workspace_band_paints(), p => srgb8_contrast_at_least(a: p.ink.color, b: pressed_stop(c: p.fill.color), threshold_hundredths: wcag_aa_large_text_and_graphics_hundredths)) } -fn witness_for_use_refuses_empty_and_duplicate() -> Bool { +test fn witness_for_use_refuses_empty_and_duplicate() -> Bool { !swatch_set_for_use_admissible(u: SwatchSetForUse { name: "x", base: island_pastel, completions: [], use_note: "control" }) && !swatch_set_for_use_admissible(u: SwatchSetForUse { name: "x", base: island_pastel, completions: [swatch_filed(sw: Swatch { name: "mint", color: island_venom.color })], use_note: "control" }) } -test fn design_palette_catalog_keystone_holds() -> Bool { - witness_catalog_admissible() - && witness_hex_serialization_matches_authored() - && witness_pairing_matrix_total() - && witness_camel_ivory_near_miss() - && witness_authored_set_has_no_text_pairing() - && witness_loam_carries_text_capability() - && witness_grade_kernel_discriminates() - && witness_camel_hsl_projection() - && witness_hsl_projection_red_on_off_by_one_hue() - && witness_achromatic_maps_to_variant_not_hue_zero() - && witness_chromatic_still_projects_hue() - && witness_gray_never_yields_hue_zero_as_red() - && witness_camel_passes_quiet_envelope() - && witness_mint_refused_by_quiet_envelope() - && witness_ivory_refused_despite_near_achromatic_oklch() - && witness_cited_palette_counts() - && witness_solarized_base_ladder_order_and_count() - && witness_solarized_base_mode_pairing_involution() - && witness_base16_digit_refuses_out_of_range() - && witness_uint8_channel_inclusive_max_value_present() - && witness_workspace_for_use_completion_admissible() - && witness_venom_carries_ivory_text_and_refuses_loam() - && witness_in_family_inks_carry_their_fills() - && witness_graduated_default_clears_text_aa() - && witness_pressed_stop_derivation_and_legibility() - && witness_for_use_refuses_empty_and_duplicate() -} diff --git a/dag/test/claim/design_register_lift_parity_witness_test.dag b/dag/test/claim/design_register_lift_parity_witness_test.dag index 8506b6091ce..27a81eb2637 100644 --- a/dag/test/claim/design_register_lift_parity_witness_test.dag +++ b/dag/test/claim/design_register_lift_parity_witness_test.dag @@ -43,30 +43,23 @@ fn emission_content_digest(s: String) -> String { content_hash_atom(value: s as NonEmptyStr) as String } -fn witness_moodboard_css_digest_pinned() -> Bool { +test fn witness_moodboard_css_digest_pinned() -> Bool { emission_content_digest(s: moodboard_css()) == moodboard_css_lift_parity_digest } -fn witness_moodboard_html_digest_pinned() -> Bool { +test fn witness_moodboard_html_digest_pinned() -> Bool { emission_content_digest(s: moodboard_html()) == moodboard_html_lift_parity_digest } -fn witness_accent_study_html_digest_pinned() -> Bool { +test fn witness_accent_study_html_digest_pinned() -> Bool { emission_content_digest(s: accent_study_html()) == accent_study_html_lift_parity_digest } -fn witness_roadmap_css_digest_pinned() -> Bool { +test fn witness_roadmap_css_digest_pinned() -> Bool { emission_content_digest(s: roadmap_css()) == roadmap_css_lift_parity_digest } -fn witness_moodboard_thesis_themes_digest_pinned() -> Bool { +test fn witness_moodboard_thesis_themes_digest_pinned() -> Bool { moodboard_digest() == moodboard_thesis_themes_lift_parity_digest } -test fn design_register_lift_parity_holds() -> Bool { - witness_moodboard_css_digest_pinned() - && witness_moodboard_html_digest_pinned() - && witness_accent_study_html_digest_pinned() - && witness_roadmap_css_digest_pinned() - && witness_moodboard_thesis_themes_digest_pinned() -} diff --git a/dag/test/claim/diff_baseline_witness_test.dag b/dag/test/claim/diff_baseline_witness_test.dag index 7792be16855..cd72d4d31ff 100644 --- a/dag/test/claim/diff_baseline_witness_test.dag +++ b/dag/test/claim/diff_baseline_witness_test.dag @@ -43,78 +43,65 @@ fn selected_ref(res: DiffBaselineResolution) -> String { } } -fn witness_stacked_pr_selects_actual_base() -> Bool { +test fn witness_stacked_pr_selects_actual_base() -> Bool { let res = resolve_case(override_ref: none, event_name: "pull_request", base_ref: Present { value: "feature/B" }) arm_tag(res: res) == "merge_target" && selected_ref(res: res) == "origin/feature/B" && selected_ref(res: res) != "origin/main" } -fn witness_main_pr_equivalent_to_push_parent() -> Bool { +test fn witness_main_pr_equivalent_to_push_parent() -> Bool { let res = resolve_case(override_ref: none, event_name: "pull_request", base_ref: Present { value: "main" }) arm_tag(res: res) == "merge_target" && selected_ref(res: res) == "origin/main" && selected_ref(res: res) == (gunbc_merge_target_ref as String) } -fn witness_push_keeps_todays_policy() -> Bool { +test fn witness_push_keeps_todays_policy() -> Bool { let res = resolve_case(override_ref: none, event_name: "push", base_ref: none) arm_tag(res: res) == "push_parent" && selected_ref(res: res) == "origin/main" } -fn witness_workflow_dispatch_keeps_todays_policy() -> Bool { +test fn witness_workflow_dispatch_keeps_todays_policy() -> Bool { let res = resolve_case(override_ref: none, event_name: "workflow_dispatch", base_ref: none) arm_tag(res: res) == "push_parent" && selected_ref(res: res) == "origin/main" } -fn witness_bootstrap_no_event_is_push_parent() -> Bool { +test fn witness_bootstrap_no_event_is_push_parent() -> Bool { let res = resolve_case(override_ref: none, event_name: "", base_ref: none) arm_tag(res: res) == "push_parent" && selected_ref(res: res) == "origin/main" } -fn witness_operator_override_is_typed_arm() -> Bool { +test fn witness_operator_override_is_typed_arm() -> Bool { let res = resolve_case(override_ref: Present { value: "HEAD~20" }, event_name: "schedule", base_ref: none) arm_tag(res: res) == "operator_override" && selected_ref(res: res) == "HEAD~20" } -fn witness_merge_group_uses_push_parent() -> Bool { +test fn witness_merge_group_uses_push_parent() -> Bool { let res = resolve_case(override_ref: none, event_name: "merge_group", base_ref: none) arm_tag(res: res) == "push_parent" && selected_ref(res: res) == "origin/main" } -fn witness_schedule_no_override_is_push_parent() -> Bool { +test fn witness_schedule_no_override_is_push_parent() -> Bool { let res = resolve_case(override_ref: none, event_name: "schedule", base_ref: none) arm_tag(res: res) == "push_parent" && selected_ref(res: res) == "origin/main" } -fn witness_unknown_event_refuses() -> Bool { +test fn witness_unknown_event_refuses() -> Bool { arm_tag(res: resolve_case(override_ref: none, event_name: "deployment_status", base_ref: none)) == "refused" } -fn witness_pull_request_empty_base_refuses() -> Bool { +test fn witness_pull_request_empty_base_refuses() -> Bool { arm_tag(res: resolve_case(override_ref: none, event_name: "pull_request", base_ref: Present { value: "" })) == "refused" } -fn witness_pull_request_absent_base_refuses() -> Bool { +test fn witness_pull_request_absent_base_refuses() -> Bool { arm_tag(res: resolve_case(override_ref: none, event_name: "pull_request", base_ref: none)) == "refused" } -test fn diff_baseline_resolution_holds() -> Bool { - witness_stacked_pr_selects_actual_base() - && witness_main_pr_equivalent_to_push_parent() - && witness_push_keeps_todays_policy() - && witness_workflow_dispatch_keeps_todays_policy() - && witness_bootstrap_no_event_is_push_parent() - && witness_operator_override_is_typed_arm() - && witness_merge_group_uses_push_parent() - && witness_schedule_no_override_is_push_parent() - && witness_unknown_event_refuses() - && witness_pull_request_empty_base_refuses() - && witness_pull_request_absent_base_refuses() -} diff --git a/dag/test/claim/dispatch_presentation_witness_test.dag b/dag/test/claim/dispatch_presentation_witness_test.dag index 96a07963dd4..6fd9030ce0e 100644 --- a/dag/test/claim/dispatch_presentation_witness_test.dag +++ b/dag/test/claim/dispatch_presentation_witness_test.dag @@ -23,7 +23,7 @@ fn role_var_for_label(wire_label: String) -> String { init: "", f: (acc, s) => role_var(r: s.role)) } -fn witness_reserved_width_is_caption_projection() -> Bool { +test fn witness_reserved_width_is_caption_projection() -> Bool { let captions = dispatch_caption_set() let real = dispatch_reserved_ch() real == longest_label_len(labels: captions) + 2 @@ -33,7 +33,7 @@ fn witness_reserved_width_is_caption_projection() -> Bool { && string_contains(s: roadmap_css(), pattern: join([to_string(real), "ch"], "")) } -fn witness_chip_material_is_band_paint() -> Bool { +test fn witness_chip_material_is_band_paint() -> Bool { let css = roadmap_css() let ok_block = css_block( selector: join([".dispatch-btn.", dispatch_class_ok], ""), @@ -56,7 +56,7 @@ fn witness_chip_material_is_band_paint() -> Bool { && role_var_for_label(wire_label: "spawned") == role_var(r: FigureRole) } -fn witness_chip_wrong_paint_not_shipped() -> Bool { +test fn witness_chip_wrong_paint_not_shipped() -> Bool { let wrong = css_block( selector: join([".dispatch-btn.", dispatch_class_ok], ""), decls: [ @@ -67,14 +67,14 @@ fn witness_chip_wrong_paint_not_shipped() -> Bool { !string_contains(s: roadmap_css(), pattern: wrong) } -fn witness_located_fields_surface_to_title() -> Bool { +test fn witness_located_fields_surface_to_title() -> Bool { let js = dispatch_client_js_source() string_contains(s: js, pattern: "b.title =") && string_contains(s: js, pattern: "j.step") && string_contains(s: js, pattern: "j.detail") } -fn witness_js_and_css_share_class_authority() -> Bool { +test fn witness_js_and_css_share_class_authority() -> Bool { let js = dispatch_client_js_source() let css = roadmap_css() string_contains(s: js, pattern: dispatch_class_ok) @@ -85,10 +85,3 @@ fn witness_js_and_css_share_class_authority() -> Bool { && string_contains(s: css, pattern: join([".dispatch-btn.", dispatch_class_requested], "")) } -test fn dispatch_presentation_keystone_holds() -> Bool { - witness_reserved_width_is_caption_projection() - && witness_chip_material_is_band_paint() - && witness_chip_wrong_paint_not_shipped() - && witness_located_fields_surface_to_title() - && witness_js_and_css_share_class_authority() -} diff --git a/dag/test/claim/econ_wedge_witness_test.dag b/dag/test/claim/econ_wedge_witness_test.dag index 7d18e7319d4..4a8257985a5 100644 --- a/dag/test/claim/econ_wedge_witness_test.dag +++ b/dag/test/claim/econ_wedge_witness_test.dag @@ -136,7 +136,7 @@ data github_zero_vcpu_runner_fixture: GithubActionsRunnerPriceRow = GithubAction pricing_citation: "witness-fixture#runner-thread-count-unknown", } -fn w_gitlab_gross_margin_envelope_derived_from_filed_components() -> Bool { +test fn w_gitlab_gross_margin_envelope_derived_from_filed_components() -> Bool { match derive_margin_envelope_from_filed_facts( revenue: gitlab_fy2026_revenue, profit: gitlab_fy2026_gross_profit, @@ -152,7 +152,7 @@ fn w_gitlab_gross_margin_envelope_derived_from_filed_components() -> Bool { } } -fn w_gitlab_gross_margin_envelope_red_on_perturbed_gross_profit() -> Bool { +test fn w_gitlab_gross_margin_envelope_red_on_perturbed_gross_profit() -> Bool { match filed_amount(fact: gitlab_fy2026_gross_profit) { Present { value: gross_profit } => { let perturbed = usd_whole_dollars( @@ -180,7 +180,7 @@ fn w_gitlab_gross_margin_envelope_red_on_perturbed_gross_profit() -> Bool { } } -fn w_rollins_operating_margin_envelope_derived() -> Bool { +test fn w_rollins_operating_margin_envelope_derived() -> Bool { match derive_margin_envelope_from_filed_facts( revenue: rollins_fy2025_revenue, profit: rollins_fy2025_operating_income, @@ -196,7 +196,7 @@ fn w_rollins_operating_margin_envelope_derived() -> Bool { } } -fn w_chemed_operating_margin_envelope_derived() -> Bool { +test fn w_chemed_operating_margin_envelope_derived() -> Bool { match derive_margin_envelope_from_filed_facts( revenue: chemed_fy2025_revenue, profit: chemed_fy2025_operating_income, @@ -212,12 +212,12 @@ fn w_chemed_operating_margin_envelope_derived() -> Bool { } } -fn w_hetzner_ax41_threads_cited_from_amd_catalog() -> Bool { +test fn w_hetzner_ax41_threads_cited_from_amd_catalog() -> Bool { hardware_thread_count_value(t: hetzner_dedicated_server_threads(row: hetzner_ax41_1_ltd_price)) == hardware_thread_count_value(t: ryzen_5_3600_catalog.threads) && hardware_thread_count_value(t: ryzen_5_3600_catalog.threads) == 12 } -fn w_github_hetzner_knowable_wedge_derived_with_declared_assumptions() -> Bool { +test fn w_github_hetzner_knowable_wedge_derived_with_declared_assumptions() -> Bool { match derive_github_hetzner_ci_minute_wedge( umbrella_row: github_actions_linux_2core_price, floor_row: hetzner_ax41_1_ltd_price, @@ -233,7 +233,7 @@ fn w_github_hetzner_knowable_wedge_derived_with_declared_assumptions() -> Bool { } } -fn w_github_hetzner_knowable_wedge_red_on_unknown_assumptions() -> Bool { +test fn w_github_hetzner_knowable_wedge_red_on_unknown_assumptions() -> Bool { match derive_github_hetzner_ci_minute_wedge( umbrella_row: github_actions_linux_2core_price, floor_row: hetzner_ax41_1_ltd_price, @@ -244,7 +244,7 @@ fn w_github_hetzner_knowable_wedge_red_on_unknown_assumptions() -> Bool { } } -fn w_github_hetzner_knowable_wedge_red_on_zero_utilization() -> Bool { +test fn w_github_hetzner_knowable_wedge_red_on_zero_utilization() -> Bool { match derive_github_hetzner_ci_minute_wedge( umbrella_row: github_actions_linux_2core_price, floor_row: hetzner_ax41_1_ltd_price, @@ -257,7 +257,7 @@ fn w_github_hetzner_knowable_wedge_red_on_zero_utilization() -> Bool { } } -fn w_github_hetzner_knowable_wedge_red_on_floor_currency_mismatch() -> Bool { +test fn w_github_hetzner_knowable_wedge_red_on_floor_currency_mismatch() -> Bool { match derive_github_hetzner_ci_minute_wedge( umbrella_row: github_actions_linux_2core_price, floor_row: hetzner_ax41_usd_floor_fixture, @@ -270,7 +270,7 @@ fn w_github_hetzner_knowable_wedge_red_on_floor_currency_mismatch() -> Bool { } } -fn w_github_hetzner_knowable_wedge_red_on_floor_exceeds_umbrella() -> Bool { +test fn w_github_hetzner_knowable_wedge_red_on_floor_exceeds_umbrella() -> Bool { match derive_github_hetzner_ci_minute_wedge( umbrella_row: github_tiny_umbrella_fixture, floor_row: hetzner_ax41_1_ltd_price, @@ -283,7 +283,7 @@ fn w_github_hetzner_knowable_wedge_red_on_floor_exceeds_umbrella() -> Bool { } } -fn w_github_hetzner_knowable_wedge_red_on_zero_runner_threads() -> Bool { +test fn w_github_hetzner_knowable_wedge_red_on_zero_runner_threads() -> Bool { match derive_github_hetzner_ci_minute_wedge( umbrella_row: github_zero_vcpu_runner_fixture, floor_row: hetzner_ax41_1_ltd_price, @@ -296,16 +296,3 @@ fn w_github_hetzner_knowable_wedge_red_on_zero_runner_threads() -> Bool { } } -test fn econ_wedge_witness_holds() -> Bool { - w_gitlab_gross_margin_envelope_derived_from_filed_components() - && w_gitlab_gross_margin_envelope_red_on_perturbed_gross_profit() - && w_rollins_operating_margin_envelope_derived() - && w_chemed_operating_margin_envelope_derived() - && w_hetzner_ax41_threads_cited_from_amd_catalog() - && w_github_hetzner_knowable_wedge_derived_with_declared_assumptions() - && w_github_hetzner_knowable_wedge_red_on_unknown_assumptions() - && w_github_hetzner_knowable_wedge_red_on_zero_utilization() - && w_github_hetzner_knowable_wedge_red_on_floor_currency_mismatch() - && w_github_hetzner_knowable_wedge_red_on_floor_exceeds_umbrella() - && w_github_hetzner_knowable_wedge_red_on_zero_runner_threads() -} diff --git a/dag/test/claim/emit_host_gate_witness_test.dag b/dag/test/claim/emit_host_gate_witness_test.dag index c0b20537bbb..39ccb39670b 100644 --- a/dag/test/claim/emit_host_gate_witness_test.dag +++ b/dag/test/claim/emit_host_gate_witness_test.dag @@ -1,41 +1,32 @@ module test.claim.emit_host_gate_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn nonempty(s: String) -> Bool { s != "" } -fn w_rust_fixture_nonempty() -> Bool { +test fn w_rust_fixture_nonempty() -> Bool { nonempty(s: rust_stdout_fixture_source) } -fn w_python_fixture_nonempty() -> Bool { +test fn w_python_fixture_nonempty() -> Bool { nonempty(s: python_stdout_fixture_source) } -fn w_go_fixture_nonempty() -> Bool { +test fn w_go_fixture_nonempty() -> Bool { nonempty(s: go_stdout_fixture_source) } -fn w_ts_fixture_nonempty() -> Bool { +test fn w_ts_fixture_nonempty() -> Bool { nonempty(s: ts_host_fixture_source) } -fn w_byte_count_is_five() -> Bool { +test fn w_byte_count_is_five() -> Bool { byte_size_count(stdout_byte_count) == 5 } -fn w_ts_byte_count_is_four() -> Bool { +test fn w_ts_byte_count_is_four() -> Bool { byte_size_count(ts_signed_i32_le_byte_count) == 4 } -test fn emit_host_gate_witnesses() -> Bool { - w_rust_fixture_nonempty() && - w_python_fixture_nonempty() && - w_go_fixture_nonempty() && - w_ts_fixture_nonempty() && - w_byte_count_is_five() && - w_ts_byte_count_is_four() -} diff --git a/dag/test/claim/exec_arg_limit_witness_test.dag b/dag/test/claim/exec_arg_limit_witness_test.dag index 364e33a454a..8fd591201d5 100644 --- a/dag/test/claim/exec_arg_limit_witness_test.dag +++ b/dag/test/claim/exec_arg_limit_witness_test.dag @@ -18,18 +18,18 @@ data exec_arg_limit_witness_note: String = "Single-authority closure for the Lin data v1_interpreter_source_path: String = "src/v1/stage0/src/v1_interpreter.rs" -fn witness_host_exec_arg_max_strlen_is_execve_formula() -> Bool { +test fn witness_host_exec_arg_max_strlen_is_execve_formula() -> Bool { host_exec_arg_max_strlen == host_exec_arg_max_strlen_from_page( page: x86_64_linux_architecture_profile.page_size, page_factor: linux_execve_max_arg_strlen_page_factor, ) } -fn witness_linux_page_size_uniform_on_deploy_architectures() -> Bool { +test fn witness_linux_page_size_uniform_on_deploy_architectures() -> Bool { byte_size_count(x86_64_linux_architecture_profile.page_size) == byte_size_count(aarch64_linux_architecture_profile.page_size) } -fn witness_rust_const_mirrors_authority() -> Bool { +test fn witness_rust_const_mirrors_authority() -> Bool { let src = filesystem_read(path: v1_interpreter_source_path) let expected = to_string(byte_size_count(b: host_exec_arg_max_strlen)) string_contains( @@ -38,8 +38,3 @@ fn witness_rust_const_mirrors_authority() -> Bool { ) } -test fn exec_arg_limit_witnesses() -> Bool { - witness_host_exec_arg_max_strlen_is_execve_formula() - && witness_linux_page_size_uniform_on_deploy_architectures() - && witness_rust_const_mirrors_authority() -} diff --git a/dag/test/claim/extdeps_anemia_grounding_witness_test.dag b/dag/test/claim/extdeps_anemia_grounding_witness_test.dag index f154714d792..7f33aff2374 100644 --- a/dag/test/claim/extdeps_anemia_grounding_witness_test.dag +++ b/dag/test/claim/extdeps_anemia_grounding_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.extdeps_anemia_grounding_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data sample_email: Email = "author@example.com" @@ -8,7 +7,7 @@ data sample_sha: CommitSha = "abc1234def5678901234567890abcd1234567890" data sample_ref: GitRef = "feature/widgets" data sample_path: std.types.FilePath = "dag/extdeps/git/git.dag" -fn w_git_author_email_grounded() -> Bool { +test fn w_git_author_email_grounded() -> Bool { let author = GitAuthor { name: "Example Author", email: sample_email, @@ -17,7 +16,7 @@ fn w_git_author_email_grounded() -> Bool { author.email == sample_email } -fn w_pull_request_ref_grounded() -> Bool { +test fn w_pull_request_ref_grounded() -> Bool { let head = PullRequestRef { ref: sample_ref, sha: sample_sha, @@ -26,7 +25,7 @@ fn w_pull_request_ref_grounded() -> Bool { head.ref == sample_ref && head.sha == sample_sha } -fn w_pull_review_commit_id_grounded() -> Bool { +test fn w_pull_review_commit_id_grounded() -> Bool { let review = PullReview { id: 1, body: "Looks good", @@ -37,7 +36,7 @@ fn w_pull_review_commit_id_grounded() -> Bool { review.commit_id == sample_sha } -fn w_review_comment_path_grounded() -> Bool { +test fn w_review_comment_path_grounded() -> Bool { let comment = ReviewComment { id: 1, node_id: "PRRC_kwDO", @@ -50,7 +49,7 @@ fn w_review_comment_path_grounded() -> Bool { comment.path == sample_path } -fn w_digest_subject_survives_grounded_pull_request_ref() -> Bool { +test fn w_digest_subject_survives_grounded_pull_request_ref() -> Bool { let pr = extdeps.github.pulls.PullRequest { number: 42, title: "Ground extdeps git/github fields", @@ -77,11 +76,11 @@ fn w_digest_subject_survives_grounded_pull_request_ref() -> Bool { subject.head_sha == sample_sha && subject.base_ref == "main" } -fn w_cpu_tdp_watts_power_dimension() -> Bool { +test fn w_cpu_tdp_watts_power_dimension() -> Bool { watt_count(altra_max_m12830_catalog.tdp_watts) == 183 } -fn w_cpu_catalog_row_tdp_not_bare_int() -> Bool { +test fn w_cpu_catalog_row_tdp_not_bare_int() -> Bool { let row = CpuModelCatalogRow { model_number: "TEST", oem_listing_id: none, @@ -102,12 +101,3 @@ fn w_cpu_catalog_row_tdp_not_bare_int() -> Bool { watt_count(row.tdp_watts) == 99 } -test fn extdeps_anemia_grounding_witnesses() -> Bool { - w_git_author_email_grounded() - && w_pull_request_ref_grounded() - && w_pull_review_commit_id_grounded() - && w_review_comment_path_grounded() - && w_digest_subject_survives_grounded_pull_request_ref() - && w_cpu_tdp_watts_power_dimension() - && w_cpu_catalog_row_tdp_not_bare_int() -} diff --git a/dag/test/claim/extdeps_git_diff_name_status_witness_test.dag b/dag/test/claim/extdeps_git_diff_name_status_witness_test.dag index 77ea85a18b6..6116838e4be 100644 --- a/dag/test/claim/extdeps_git_diff_name_status_witness_test.dag +++ b/dag/test/claim/extdeps_git_diff_name_status_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.extdeps_git_diff_name_status_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn append_name_status_token(acc: String, token: String) -> String { @@ -29,7 +28,7 @@ fn is_truncated(raw: String) -> Bool { } } -fn w_modified_single_entry() -> Bool { +test fn w_modified_single_entry() -> Bool { let raw = join_name_status_tokens(["M", "file.txt"]) let entries = well_formed_entries(raw: raw) entries.length() == 1 @@ -44,7 +43,7 @@ fn w_modified_single_entry() -> Bool { } } -fn w_added_entry() -> Bool { +test fn w_added_entry() -> Bool { let raw = join_name_status_tokens(["A", "new_file.txt"]) let entries = well_formed_entries(raw: raw) entries.length() == 1 @@ -54,7 +53,7 @@ fn w_added_entry() -> Bool { } } -fn w_deleted_entry() -> Bool { +test fn w_deleted_entry() -> Bool { let raw = join_name_status_tokens(["D", "gone.txt"]) let entries = well_formed_entries(raw: raw) entries.length() == 1 @@ -65,7 +64,7 @@ fn w_deleted_entry() -> Bool { } } -fn w_renamed_entry_carries_similarity_and_old_path() -> Bool { +test fn w_renamed_entry_carries_similarity_and_old_path() -> Bool { let raw = join_name_status_tokens(["R100", "old_name.txt", "new_name.txt"]) let entries = well_formed_entries(raw: raw) entries.length() == 1 @@ -80,7 +79,7 @@ fn w_renamed_entry_carries_similarity_and_old_path() -> Bool { } } -fn w_copied_entry_carries_similarity_and_old_path() -> Bool { +test fn w_copied_entry_carries_similarity_and_old_path() -> Bool { let raw = join_name_status_tokens(["C87", "source.txt", "copy.txt"]) let entries = well_formed_entries(raw: raw) entries.length() == 1 @@ -95,7 +94,7 @@ fn w_copied_entry_carries_similarity_and_old_path() -> Bool { } } -fn w_mixed_multi_entry_blob_preserves_order_and_arity() -> Bool { +test fn w_mixed_multi_entry_blob_preserves_order_and_arity() -> Bool { let raw = join_name_status_tokens([ "M", "a.txt", "A", "b.txt", @@ -114,7 +113,7 @@ fn w_mixed_multi_entry_blob_preserves_order_and_arity() -> Bool { } } -fn w_unrecognized_status_letter_is_typed_not_absorbed() -> Bool { +test fn w_unrecognized_status_letter_is_typed_not_absorbed() -> Bool { let raw = join_name_status_tokens(["X", "weird.txt"]) let entries = well_formed_entries(raw: raw) entries.length() == 1 @@ -125,7 +124,7 @@ fn w_unrecognized_status_letter_is_typed_not_absorbed() -> Bool { && git_diff_status_entries_any_unknown(entries: entries) } -fn w_malformed_rename_score_is_typed_unknown_not_absorbed() -> Bool { +test fn w_malformed_rename_score_is_typed_unknown_not_absorbed() -> Bool { let raw = join_name_status_tokens(["Rxx", "old.txt", "new.txt"]) let entries = well_formed_entries(raw: raw) match entries.first().status { @@ -135,34 +134,34 @@ fn w_malformed_rename_score_is_typed_unknown_not_absorbed() -> Bool { && git_diff_status_entries_any_unknown(entries: entries) } -fn w_malformed_rename_score_corruption_stays_fail_closed_downstream() -> Bool { +test fn w_malformed_rename_score_corruption_stays_fail_closed_downstream() -> Bool { let raw = join_name_status_tokens(["Rxx", "old.txt", "new.txt", "M", "trailing.txt"]) let entries = well_formed_entries(raw: raw) git_diff_status_entries_any_unknown(entries: entries) } -fn w_recognized_entries_are_never_flagged_unknown() -> Bool { +test fn w_recognized_entries_are_never_flagged_unknown() -> Bool { let raw = join_name_status_tokens(["M", "a.txt", "A", "b.txt"]) let entries = well_formed_entries(raw: raw) !git_diff_status_entries_any_unknown(entries: entries) } -fn w_lone_trailing_status_token_is_typed_truncated_not_empty() -> Bool { +test fn w_lone_trailing_status_token_is_typed_truncated_not_empty() -> Bool { let raw = join_name_status_tokens(["M"]) is_truncated(raw: raw) && well_formed_entries(raw: raw).length() == 0 } -fn w_rename_missing_new_path_is_typed_truncated_not_empty() -> Bool { +test fn w_rename_missing_new_path_is_typed_truncated_not_empty() -> Bool { let raw = join_name_status_tokens(["R100", "old.txt"]) is_truncated(raw: raw) && well_formed_entries(raw: raw).length() == 0 } -fn w_complete_stream_is_never_flagged_truncated() -> Bool { +test fn w_complete_stream_is_never_flagged_truncated() -> Bool { let raw = join_name_status_tokens(["M", "a.txt", "R100", "old.txt", "new.txt"]) !is_truncated(raw: raw) } -fn w_truncated_outcome_is_a_distinct_variant_from_complete() -> Bool { +test fn w_truncated_outcome_is_a_distinct_variant_from_complete() -> Bool { let raw = join_name_status_tokens(["M"]) match git_diff_name_status_parse(raw: raw) { GitDiffNameStatusTruncated { pending: _, entries: _ } => true @@ -170,7 +169,7 @@ fn w_truncated_outcome_is_a_distinct_variant_from_complete() -> Bool { } } -fn w_touched_paths_derives_both_sides_of_a_rename() -> Bool { +test fn w_touched_paths_derives_both_sides_of_a_rename() -> Bool { let raw = join_name_status_tokens(["M", "a.txt", "R100", "old_d.txt", "new_d.txt"]) let entries = well_formed_entries(raw: raw) let touched = git_diff_status_entries_touched_paths(entries: entries) @@ -180,7 +179,7 @@ fn w_touched_paths_derives_both_sides_of_a_rename() -> Bool { && list_contains_string(xs: touched, needle: "new_d.txt") } -fn w_departed_paths_names_deletions_and_rename_sources_only() -> Bool { +test fn w_departed_paths_names_deletions_and_rename_sources_only() -> Bool { let raw = join_name_status_tokens([ "M", "a.txt", "D", "gone.txt", @@ -198,26 +197,7 @@ fn w_departed_paths_names_deletions_and_rename_sources_only() -> Bool { && !list_contains_string(xs: departed, needle: "copy.txt") } -fn w_empty_raw_produces_no_entries() -> Bool { +test fn w_empty_raw_produces_no_entries() -> Bool { well_formed_entries(raw: "").length() == 0 } -test fn extdeps_git_diff_name_status_witnesses() -> Bool { - w_modified_single_entry() - && w_added_entry() - && w_deleted_entry() - && w_renamed_entry_carries_similarity_and_old_path() - && w_copied_entry_carries_similarity_and_old_path() - && w_mixed_multi_entry_blob_preserves_order_and_arity() - && w_unrecognized_status_letter_is_typed_not_absorbed() - && w_malformed_rename_score_is_typed_unknown_not_absorbed() - && w_malformed_rename_score_corruption_stays_fail_closed_downstream() - && w_recognized_entries_are_never_flagged_unknown() - && w_lone_trailing_status_token_is_typed_truncated_not_empty() - && w_rename_missing_new_path_is_typed_truncated_not_empty() - && w_complete_stream_is_never_flagged_truncated() - && w_truncated_outcome_is_a_distinct_variant_from_complete() - && w_touched_paths_derives_both_sides_of_a_rename() - && w_departed_paths_names_deletions_and_rename_sources_only() - && w_empty_raw_produces_no_entries() -} diff --git a/dag/test/claim/extdeps_git_versioning_witness_test.dag b/dag/test/claim/extdeps_git_versioning_witness_test.dag index 1d683b60207..883bb809bbd 100644 --- a/dag/test/claim/extdeps_git_versioning_witness_test.dag +++ b/dag/test/claim/extdeps_git_versioning_witness_test.dag @@ -1,15 +1,14 @@ module test.claim.extdeps_git_versioning_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_git_2_0_anchor() -> Bool { +test fn w_git_2_0_anchor() -> Bool { git_2_0_release.major == 2 && git_2_0_release.minor == 0 && git_2_0_release.patch == 0 } -fn w_release_version_compare_major_minor_patch() -> Bool { +test fn w_release_version_compare_major_minor_patch() -> Bool { let older = GitReleaseVersion { major: 2, minor: 43, patch: 0 } let newer = GitReleaseVersion { major: 2, minor: 44, patch: 0 } let same = GitReleaseVersion { major: 2, minor: 43, patch: 1 } @@ -31,7 +30,7 @@ fn w_release_version_compare_major_minor_patch() -> Bool { } } -fn w_major_breaking_release_orders_above_prior_minor_series() -> Bool { +test fn w_major_breaking_release_orders_above_prior_minor_series() -> Bool { let git_1_9 = GitReleaseVersion { major: 1, minor: 9, patch: 5 } match git_release_version_compare(a: git_1_9, b: git_2_0_release) { Less => true @@ -39,7 +38,7 @@ fn w_major_breaking_release_orders_above_prior_minor_series() -> Bool { } } -fn w_platform_suffix_is_structural_not_stringly() -> Bool { +test fn w_platform_suffix_is_structural_not_stringly() -> Bool { let plain = GitCliReportedVersion { git_release: git_2_0_release, suffix: GitVersionPlain @@ -51,15 +50,15 @@ fn w_platform_suffix_is_structural_not_stringly() -> Bool { plain.suffix != windows.suffix } -fn w_spec_citation_points_at_breaking_changes_doc() -> Bool { +test fn w_spec_citation_points_at_breaking_changes_doc() -> Bool { string_contains(s: git_release_versioning_spec_url, pattern: "BreakingChanges.html") } -fn w_git_release_to_version_identity() -> Bool { +test fn w_git_release_to_version_identity() -> Bool { git_release_to_version_identity(v: git_2_0_release) == "2.0.0" } -fn w_git_release_version_scheme_equal() -> Bool { +test fn w_git_release_version_scheme_equal() -> Bool { match git_release_version_scheme.compare( a: git_release_to_version_identity(v: git_2_0_release), b: "2.0.0" @@ -69,17 +68,7 @@ fn w_git_release_version_scheme_equal() -> Bool { } } -fn w_min_git_version_grounded() -> Bool { +test fn w_min_git_version_grounded() -> Bool { min_git_version == ">= 2.0.0" } -test fn extdeps_git_versioning_witnesses() -> Bool { - w_git_2_0_anchor() - && w_release_version_compare_major_minor_patch() - && w_major_breaking_release_orders_above_prior_minor_series() - && w_platform_suffix_is_structural_not_stringly() - && w_spec_citation_points_at_breaking_changes_doc() - && w_git_release_to_version_identity() - && w_git_release_version_scheme_equal() - && w_min_git_version_grounded() -} diff --git a/dag/test/claim/extdeps_github_errors_url_grounding_witness_test.dag b/dag/test/claim/extdeps_github_errors_url_grounding_witness_test.dag index dd27403f912..ebf3017bb4d 100644 --- a/dag/test/claim/extdeps_github_errors_url_grounding_witness_test.dag +++ b/dag/test/claim/extdeps_github_errors_url_grounding_witness_test.dag @@ -1,11 +1,10 @@ module test.claim.extdeps_github_errors_url_grounding_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data sample_docs_url: NonEmptyStr = "https://docs.github.com/rest" -fn w_github_error_shape_documentation_url_grounded() -> Bool { +test fn w_github_error_shape_documentation_url_grounded() -> Bool { let row = GitHubErrorShape { message: "Not Found", documentation_url: Present { value: sample_docs_url }, @@ -16,14 +15,14 @@ fn w_github_error_shape_documentation_url_grounded() -> Bool { } } -fn w_github_error_example_inhabits_url() -> Bool { +test fn w_github_error_example_inhabits_url() -> Bool { match github_error_example.documentation_url { Present { value: url } => url == sample_docs_url Absent => false } } -fn w_github_error_shape_absent_documentation_url() -> Bool { +test fn w_github_error_shape_absent_documentation_url() -> Bool { let row = GitHubErrorShape { message: "Server Error", documentation_url: none, @@ -34,8 +33,3 @@ fn w_github_error_shape_absent_documentation_url() -> Bool { } } -test fn extdeps_github_errors_url_grounding_witnesses() -> Bool { - w_github_error_shape_documentation_url_grounded() - && w_github_error_example_inhabits_url() - && w_github_error_shape_absent_documentation_url() -} diff --git a/dag/test/claim/extdeps_llm_claude_trust_witness_test.dag b/dag/test/claim/extdeps_llm_claude_trust_witness_test.dag index 2cbb87b6f07..976d15f23a9 100644 --- a/dag/test/claim/extdeps_llm_claude_trust_witness_test.dag +++ b/dag/test/claim/extdeps_llm_claude_trust_witness_test.dag @@ -17,49 +17,49 @@ fn seeded(config: String) -> Bool { claude_workspace_trust_seeded(config_text: config, project_path: root()) } -fn w_trust_store_path_shape() -> Bool { +test fn w_trust_store_path_shape() -> Bool { claude_trust_store_path(home: "/home/u") == "/home/u/.claude.json" } -fn w_minimal_seeded_entry_accepts() -> Bool { +test fn w_minimal_seeded_entry_accepts() -> Bool { seeded(config: "\{\"projects\":\{\"/opt/gunbc/dispatch-worktrees\":\{\"hasTrustDialogAccepted\":true\}\}\}") } -fn w_whitespace_variant_accepts() -> Bool { +test fn w_whitespace_variant_accepts() -> Bool { seeded(config: "\{\n \"projects\": \{\n \"/opt/gunbc/dispatch-worktrees\": \{\n \"hasTrustDialogAccepted\" : true\n \}\n \}\n\}") } -fn w_enriched_entry_with_nested_object_and_brace_in_string_accepts() -> Bool { +test fn w_enriched_entry_with_nested_object_and_brace_in_string_accepts() -> Bool { seeded(config: "\{\"projects\":\{\"/opt/gunbc/dispatch-worktrees\":\{\"mcpServers\":\{\"a\":\{\}\},\"lastSessionFirstPrompt\":\"fix \} brace\",\"hasTrustDialogAccepted\":true\}\}\}") } -fn w_flag_false_refuses() -> Bool { +test fn w_flag_false_refuses() -> Bool { !seeded(config: "\{\"projects\":\{\"/opt/gunbc/dispatch-worktrees\":\{\"hasTrustDialogAccepted\":false\}\}\}") } -fn w_flag_true_on_other_key_refuses() -> Bool { +test fn w_flag_true_on_other_key_refuses() -> Bool { !seeded(config: "\{\"projects\":\{\"/opt/gunbc/dispatch-worktrees\":\{\"hasTrustDialogAccepted\":false,\"hasCompletedProjectOnboarding\":true\}\}\}") } -fn w_absent_root_refuses() -> Bool { +test fn w_absent_root_refuses() -> Bool { !seeded(config: "\{\"projects\":\{\"/opt/other\":\{\"hasTrustDialogAccepted\":true\}\}\}") } -fn w_path_as_array_value_is_not_a_key() -> Bool { +test fn w_path_as_array_value_is_not_a_key() -> Bool { !seeded(config: "\{\"githubRepoPaths\":\{\"o/r\":[\"/opt/gunbc/dispatch-worktrees\"]\}\}") } -fn w_array_value_then_real_key_accepts() -> Bool { +test fn w_array_value_then_real_key_accepts() -> Bool { seeded(config: "\{\"githubRepoPaths\":\{\"o/r\":[\"/opt/gunbc/dispatch-worktrees\"]\},\"projects\":\{\"/opt/gunbc/dispatch-worktrees\":\{\"hasTrustDialogAccepted\":true\}\}\}") } -fn w_empty_and_garbage_refuse() -> Bool { +test fn w_empty_and_garbage_refuse() -> Bool { !seeded(config: "") && !seeded(config: "not json at all") && !seeded(config: "\{\"projects\":\{\"/opt/gunbc/dispatch-worktrees\":") } -fn w_argv_head_is_program_authority() -> Bool { +test fn w_argv_head_is_program_authority() -> Bool { let argv = shape_claude_invoke_argv( session_id: "u", node_id: "n", @@ -75,16 +75,3 @@ fn w_argv_head_is_program_authority() -> Bool { } } -test fn extdeps_llm_claude_trust_witnesses() -> Bool { - w_trust_store_path_shape() - && w_minimal_seeded_entry_accepts() - && w_whitespace_variant_accepts() - && w_enriched_entry_with_nested_object_and_brace_in_string_accepts() - && w_flag_false_refuses() - && w_flag_true_on_other_key_refuses() - && w_absent_root_refuses() - && w_path_as_array_value_is_not_a_key() - && w_array_value_then_real_key_accepts() - && w_empty_and_garbage_refuse() - && w_argv_head_is_program_authority() -} diff --git a/dag/test/claim/extdeps_llm_type_grounding_witness_test.dag b/dag/test/claim/extdeps_llm_type_grounding_witness_test.dag index c378daa4c4a..17f394064c7 100644 --- a/dag/test/claim/extdeps_llm_type_grounding_witness_test.dag +++ b/dag/test/claim/extdeps_llm_type_grounding_witness_test.dag @@ -1,9 +1,8 @@ module test.claim.extdeps_llm_type_grounding_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_openai_tool_call_type_known() -> Bool { +test fn w_openai_tool_call_type_known() -> Bool { let row = ToolCall { id: "call_1", type: OpenAiToolCallFunction, @@ -13,14 +12,14 @@ fn w_openai_tool_call_type_known() -> Bool { && openai_tool_call_type_label(OpenAiToolCallFunction) == "function" } -fn w_openai_tool_call_type_other_accepts_extension() -> Bool { +test fn w_openai_tool_call_type_other_accepts_extension() -> Bool { match parse_openai_tool_call_type("custom_tool") { OpenAiToolCallTypeOther { raw: r } => r == "custom_tool" OpenAiToolCallFunction => false } } -fn w_openai_responses_output_content_type() -> Bool { +test fn w_openai_responses_output_content_type() -> Bool { let row = OpenAiResponses200OutputContent { type: OpenAiResponsesOutputText, text: "hello", @@ -30,14 +29,14 @@ fn w_openai_responses_output_content_type() -> Bool { && openai_responses_output_content_type_label(OpenAiResponsesOutputText) == "output_text" } -fn w_openai_responses_output_content_type_other() -> Bool { +test fn w_openai_responses_output_content_type_other() -> Bool { match parse_openai_responses_output_content_type("refusal") { OpenAiResponsesOutputContentTypeOther { raw: r } => r == "refusal" OpenAiResponsesOutputText => false } } -fn w_openai_responses_output_item_type() -> Bool { +test fn w_openai_responses_output_item_type() -> Bool { let row = OpenAiResponses200OutputItem { id: Present { value: "msg_1" }, type: OpenAiResponsesOutputMessage, @@ -49,14 +48,14 @@ fn w_openai_responses_output_item_type() -> Bool { && openai_responses_output_item_type_label(OpenAiResponsesOutputMessage) == "message" } -fn w_openai_responses_output_item_type_other() -> Bool { +test fn w_openai_responses_output_item_type_other() -> Bool { match parse_openai_responses_output_item_type("reasoning") { OpenAiResponsesOutputItemTypeOther { raw: r } => r == "reasoning" OpenAiResponsesOutputMessage => false } } -fn w_openai_responses_status_known_and_other() -> Bool { +test fn w_openai_responses_status_known_and_other() -> Bool { let label_ok = openai_responses_status_label(OpenAiResponsesStatusCompleted) == "completed" let known_routes_to_known = match parse_openai_responses_status("incomplete") { OpenAiResponsesStatusIncomplete => true @@ -70,7 +69,7 @@ fn w_openai_responses_status_known_and_other() -> Bool { label_ok && known_routes_to_known && unknown_routes_to_other } -fn w_openai_responses_output_item_status_known_and_other() -> Bool { +test fn w_openai_responses_output_item_status_known_and_other() -> Bool { let row = OpenAiResponses200OutputItem { id: Present { value: "msg_1" }, type: OpenAiResponsesOutputMessage, @@ -89,7 +88,7 @@ fn w_openai_responses_output_item_status_known_and_other() -> Bool { row_ok && unknown_routes_to_other } -fn w_openai_error_type_known_and_other() -> Bool { +test fn w_openai_error_type_known_and_other() -> Bool { let known = OpenAiErrorDetails { message: "bad", type: OpenAiInvalidRequestError, @@ -110,7 +109,7 @@ fn w_openai_error_type_known_and_other() -> Bool { } } -fn w_anthropic_image_media_type() -> Bool { +test fn w_anthropic_image_media_type() -> Bool { let source = Base64Image { media_type: ImageJpeg, data: "abc" } match source { Base64Image { media_type: mt, data: _ } => @@ -120,7 +119,7 @@ fn w_anthropic_image_media_type() -> Bool { } } -fn w_anthropic_image_media_type_other() -> Bool { +test fn w_anthropic_image_media_type_other() -> Bool { match parse_anthropic_image_media_type("image/heic") { AnthropicImageMediaTypeOther { raw: r } => r == "image/heic" ImageJpeg => false @@ -130,14 +129,14 @@ fn w_anthropic_image_media_type_other() -> Bool { } } -fn w_cache_control_type() -> Bool { +test fn w_cache_control_type() -> Bool { let row = CacheControl { type: CacheEphemeral {} } match row.type { CacheEphemeral {} => cache_control_type_label(CacheEphemeral {}) == "ephemeral" } } -fn w_anthropic_messages_object_type() -> Bool { +test fn w_anthropic_messages_object_type() -> Bool { let body = AnthropicMessages200Body { id: "msg_01", type: MessagesObjectMessage {}, @@ -161,7 +160,7 @@ fn w_anthropic_messages_object_type() -> Bool { } } -fn w_anthropic_error_envelope_and_detail_types() -> Bool { +test fn w_anthropic_error_envelope_and_detail_types() -> Bool { let envelope_ok = match anthropic_error_example.type { AnthropicErrorEnvelope {} => anthropic_error_envelope_type_label(AnthropicErrorEnvelope {}) == "error" @@ -180,19 +179,3 @@ fn w_anthropic_error_envelope_and_detail_types() -> Bool { } } -test fn extdeps_llm_type_grounding_witnesses() -> Bool { - w_openai_tool_call_type_known() - && w_openai_tool_call_type_other_accepts_extension() - && w_openai_responses_output_content_type() - && w_openai_responses_output_content_type_other() - && w_openai_responses_output_item_type() - && w_openai_responses_output_item_type_other() - && w_openai_responses_status_known_and_other() - && w_openai_responses_output_item_status_known_and_other() - && w_openai_error_type_known_and_other() - && w_anthropic_image_media_type() - && w_anthropic_image_media_type_other() - && w_cache_control_type() - && w_anthropic_messages_object_type() - && w_anthropic_error_envelope_and_detail_types() -} diff --git a/dag/test/claim/extdeps_round2_grounding_witness_test.dag b/dag/test/claim/extdeps_round2_grounding_witness_test.dag index 06734e5a2a2..1498cfed014 100644 --- a/dag/test/claim/extdeps_round2_grounding_witness_test.dag +++ b/dag/test/claim/extdeps_round2_grounding_witness_test.dag @@ -1,18 +1,17 @@ module test.claim.extdeps_round2_grounding_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_sql_dialect_postgres_label() -> Bool { +test fn w_sql_dialect_postgres_label() -> Bool { sql_dialect_wire_label(Postgres) == "postgres" } -fn w_sql_dialect_mysql_not_postgres() -> Bool { +test fn w_sql_dialect_mysql_not_postgres() -> Bool { sql_dialect_wire_label(Mysql) == "mysql" && sql_dialect_wire_label(Mysql) != sql_dialect_wire_label(Postgres) } -fn w_sql_migration_step_carries_dialect_enum() -> Bool { +test fn w_sql_migration_step_carries_dialect_enum() -> Bool { let step = SqlMigrationStep { name: "init", operation: CreateTable, @@ -23,16 +22,16 @@ fn w_sql_migration_step_carries_dialect_enum() -> Bool { step.dialect == Sqlite } -fn w_http_content_type_html_label() -> Bool { +test fn w_http_content_type_html_label() -> Bool { media_type_wire_label(m: text_html_utf8) == "text/html; charset=utf-8" } -fn w_http_content_type_plain_not_html() -> Bool { +test fn w_http_content_type_plain_not_html() -> Bool { media_type_wire_label(m: text_plain_utf8) == "text/plain; charset=utf-8" && media_type_wire_label(m: text_plain_utf8) != media_type_wire_label(m: text_html_utf8) } -fn w_served_static_route_content_type_media_type() -> Bool { +test fn w_served_static_route_content_type_media_type() -> Bool { let row = ServedStaticRoute { method: GET, path_pattern: PathTemplate { tokens: [] }, @@ -45,12 +44,12 @@ fn w_served_static_route_content_type_media_type() -> Bool { && media_type_wire_label(m: row.content_type) == "text/html; charset=utf-8" } -fn w_sigv4_grounded_region_service() -> Bool { +test fn w_sigv4_grounded_region_service() -> Bool { aws_region_wire_label(UsEast1) == "us-east-1" && aws_service_wire_label(S3) == "s3" } -fn w_sigv4_auth_scheme_carries_enums() -> Bool { +test fn w_sigv4_auth_scheme_carries_enums() -> Bool { match SigV4 { region: UsEast1, service: S3 } { SigV4 => true Protocol => false @@ -58,7 +57,7 @@ fn w_sigv4_auth_scheme_carries_enums() -> Bool { } } -fn w_gcp_api_endpoint_service_enum() -> Bool { +test fn w_gcp_api_endpoint_service_enum() -> Bool { let endpoint = GcpApiEndpoint { service: GcpStorage, base_url: "https://storage.googleapis.com/storage/v1", @@ -69,7 +68,7 @@ fn w_gcp_api_endpoint_service_enum() -> Bool { && gcp_service_wire_label(GcpSts) == "sts" } -fn w_gcp_project_id_refinement() -> Bool { +test fn w_gcp_project_id_refinement() -> Bool { let project = GcpProject { project_id: "my-gcp-project", project_number: 123456789, @@ -78,7 +77,7 @@ fn w_gcp_project_id_refinement() -> Bool { project.project_id == "my-gcp-project" } -fn w_gcp_rpc_code_grounded_and_other() -> Bool { +test fn w_gcp_rpc_code_grounded_and_other() -> Bool { let example_ok = match gcp_error_example.error.status { Present { value: c } => c == GcpRpcCodePermissionDenied Absent => false @@ -96,7 +95,7 @@ fn w_gcp_rpc_code_grounded_and_other() -> Bool { example_ok && label_ok && known_routes_to_known && unknown_routes_to_other } -fn w_service_account_email_grounded() -> Bool { +test fn w_service_account_email_grounded() -> Bool { let sa_row = GcpServiceAccount { email: "runner@my-project.iam.gserviceaccount.com", unique_id: "123456789", @@ -106,7 +105,7 @@ fn w_service_account_email_grounded() -> Bool { sa_row.email == "runner@my-project.iam.gserviceaccount.com" } -fn w_gpu_compute_capability_sm_label() -> Bool { +test fn w_gpu_compute_capability_sm_label() -> Bool { let cap = GpuComputeCapability { vendor: nvidia, major: 8, minor: 9 } match gpu_compute_capability_sm_label(cap) { GpuCapabilityLabelOk { label: label } => label == "sm_8_9" @@ -114,7 +113,7 @@ fn w_gpu_compute_capability_sm_label() -> Bool { } } -fn w_gpu_amd_label_distinct_from_nvidia() -> Bool { +test fn w_gpu_amd_label_distinct_from_nvidia() -> Bool { let cap = GpuComputeCapability { vendor: amd, major: 11, minor: 0 } match gpu_compute_capability_sm_label(cap) { GpuCapabilityLabelOk { label: label } => label == "gfx110" @@ -122,7 +121,7 @@ fn w_gpu_amd_label_distinct_from_nvidia() -> Bool { } } -fn w_intel_capability_label_refuses_fail_closed() -> Bool { +test fn w_intel_capability_label_refuses_fail_closed() -> Bool { let cap = GpuComputeCapability { vendor: intel, major: 1, minor: 0 } match gpu_compute_capability_sm_label(cap) { GpuCapabilityLabelOk { label: _ } => false @@ -130,7 +129,7 @@ fn w_intel_capability_label_refuses_fail_closed() -> Bool { } } -fn w_gpu_facts_structured_compute_capability() -> Bool { +test fn w_gpu_facts_structured_compute_capability() -> Bool { let gpu = GpuFacts { vendor: nvidia, model: "H100", @@ -150,7 +149,7 @@ fn w_gpu_facts_structured_compute_capability() -> Bool { } } -fn w_ampere_capability_label_refuses_fail_closed() -> Bool { +test fn w_ampere_capability_label_refuses_fail_closed() -> Bool { let cap = GpuComputeCapability { vendor: ampere, major: 1, minor: 0 } match gpu_compute_capability_sm_label(cap) { GpuCapabilityLabelOk { label: _ } => false @@ -158,29 +157,9 @@ fn w_ampere_capability_label_refuses_fail_closed() -> Bool { } } -fn w_hardware_vendor_single_authority() -> Bool { +test fn w_hardware_vendor_single_authority() -> Bool { let accel = AcceleratorFacts { vendor: amd, model: "MI300X" } let gpu_cap = GpuComputeCapability { vendor: amd, major: 11, minor: 0 } accel.vendor == gpu_cap.vendor } -test fn extdeps_round2_grounding_witnesses() -> Bool { - w_sql_dialect_postgres_label() - && w_sql_dialect_mysql_not_postgres() - && w_sql_migration_step_carries_dialect_enum() - && w_http_content_type_html_label() - && w_http_content_type_plain_not_html() - && w_served_static_route_content_type_media_type() - && w_sigv4_grounded_region_service() - && w_sigv4_auth_scheme_carries_enums() - && w_gcp_api_endpoint_service_enum() - && w_gcp_project_id_refinement() - && w_gcp_rpc_code_grounded_and_other() - && w_service_account_email_grounded() - && w_gpu_compute_capability_sm_label() - && w_gpu_amd_label_distinct_from_nvidia() - && w_intel_capability_label_refuses_fail_closed() - && w_gpu_facts_structured_compute_capability() - && w_ampere_capability_label_refuses_fail_closed() - && w_hardware_vendor_single_authority() -} diff --git a/dag/test/claim/extdeps_version_semver_witness_test.dag b/dag/test/claim/extdeps_version_semver_witness_test.dag index 52692a66ac4..552b7c4fa46 100644 --- a/dag/test/claim/extdeps_version_semver_witness_test.dag +++ b/dag/test/claim/extdeps_version_semver_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.extdeps_version_semver - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn semver_identity_1_2_3() -> SemVerIdentity { "1.2.3" } @@ -58,27 +57,27 @@ fn semver_1_0_0_build_1() -> SemVerVersion { } } -fn w_semver_identity_inhabits_version_identity() -> Bool { +test fn w_semver_identity_inhabits_version_identity() -> Bool { semver_identity_1_2_3() == "1.2.3" } -fn w_semver_constraint_inhabits_version_constraint() -> Bool { +test fn w_semver_constraint_inhabits_version_constraint() -> Bool { semver_constraint_caret() == "^1.2" } -fn w_identity_distinct_from_constraint() -> Bool { +test fn w_identity_distinct_from_constraint() -> Bool { semver_identity_1_0_0() != semver_constraint_one() } -fn w_semver_scheme_equality_compare() -> Bool { +test fn w_semver_scheme_equality_compare() -> Bool { semver_scheme.compare("1.0.0", "1.0.0") == std.algebra.Equal } -fn w_semver_scheme_wire_label_ordering() -> Bool { +test fn w_semver_scheme_wire_label_ordering() -> Bool { semver_scheme.compare("1.0.0", "2.0.0") == std.algebra.Less } -fn w_semver_compare_identifier_numeric_less_than_alphanumeric() -> Bool { +test fn w_semver_compare_identifier_numeric_less_than_alphanumeric() -> Bool { match semver_compare_identifier( a: SemVerNumericIdentifier { value: 1 }, b: SemVerAlphanumericIdentifier { label: "alpha" } @@ -88,27 +87,27 @@ fn w_semver_compare_identifier_numeric_less_than_alphanumeric() -> Bool { } } -fn w_semver_version_label_core() -> Bool { +test fn w_semver_version_label_core() -> Bool { semver_version_label(v: semver_1_0_0()) == "1.0.0" } -fn w_semver_version_label_pre_release() -> Bool { +test fn w_semver_version_label_pre_release() -> Bool { semver_version_label(v: semver_1_0_0_alpha_0()) == "1.0.0-0.alpha.1" } -fn w_semver_version_label_build_ignored_in_compare() -> Bool { +test fn w_semver_version_label_build_ignored_in_compare() -> Bool { semver_version_label(v: semver_1_0_0_build_1()) == "1.0.0+1" && semver_compare(a: semver_1_0_0(), b: semver_1_0_0_build_1()) == std.algebra.Equal } -fn w_semver_compare_pre_release_less_than_release() -> Bool { +test fn w_semver_compare_pre_release_less_than_release() -> Bool { match semver_compare(a: semver_1_0_0_alpha_1(), b: semver_1_0_0()) { Less => true _ => false } } -fn w_semver_compare_pre_release_longer_set_greater() -> Bool { +test fn w_semver_compare_pre_release_longer_set_greater() -> Bool { match semver_compare(a: semver_1_0_0_alpha(), b: semver_1_0_0_alpha_1()) { Less => match semver_compare(a: semver_1_0_0_alpha_1(), b: semver_1_0_0_alpha()) { @@ -119,7 +118,7 @@ fn w_semver_compare_pre_release_longer_set_greater() -> Bool { } } -fn w_semver_compare_major_minor_patch() -> Bool { +test fn w_semver_compare_major_minor_patch() -> Bool { let older = SemVerVersion { major: 1, minor: 2, patch: 3, pre_release: [], build: [] } let newer = SemVerVersion { major: 1, minor: 2, patch: 4, pre_release: [], build: [] } match semver_compare(a: older, b: newer) { @@ -132,22 +131,7 @@ fn w_semver_compare_major_minor_patch() -> Bool { } } -fn w_semver_to_version_identity() -> Bool { +test fn w_semver_to_version_identity() -> Bool { semver_to_version_identity(v: semver_1_0_0()) == "1.0.0" } -test fn extdeps_version_semver_witnesses() -> Bool { - w_semver_identity_inhabits_version_identity() - && w_semver_constraint_inhabits_version_constraint() - && w_identity_distinct_from_constraint() - && w_semver_scheme_equality_compare() - && w_semver_scheme_wire_label_ordering() - && w_semver_compare_identifier_numeric_less_than_alphanumeric() - && w_semver_version_label_core() - && w_semver_version_label_pre_release() - && w_semver_version_label_build_ignored_in_compare() - && w_semver_compare_pre_release_less_than_release() - && w_semver_compare_pre_release_longer_set_greater() - && w_semver_compare_major_minor_patch() - && w_semver_to_version_identity() -} diff --git a/dag/test/claim/extdeps_version_witness_test.dag b/dag/test/claim/extdeps_version_witness_test.dag index ee3a84ab744..a0fe3b131e7 100644 --- a/dag/test/claim/extdeps_version_witness_test.dag +++ b/dag/test/claim/extdeps_version_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.extdeps_version_base - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn identity_1_0_0() -> VersionIdentity { "1.0.0" } @@ -9,23 +8,23 @@ fn constraint_ge_1() -> VersionConstraint { ">= 1.0.0" } fn mk_equal() -> std.algebra.Ordering { std.algebra.Equal } -fn w_identity_label_preserved() -> Bool { +test fn w_identity_label_preserved() -> Bool { identity_1_0_0() == "1.0.0" } -fn w_distinct_identities_not_equal() -> Bool { +test fn w_distinct_identities_not_equal() -> Bool { identity_1_0_0() != identity_2_0_0() } -fn w_constraint_label_preserved() -> Bool { +test fn w_constraint_label_preserved() -> Bool { constraint_ge_1() == ">= 1.0.0" } -fn w_coreutils_constraint_grounded() -> Bool { +test fn w_coreutils_constraint_grounded() -> Bool { min_coreutils_version == ">= 8.0" } -fn w_ordering_exhaustive_match() -> Bool { +test fn w_ordering_exhaustive_match() -> Bool { match mk_equal() { Less => false Equal => true @@ -33,10 +32,3 @@ fn w_ordering_exhaustive_match() -> Bool { } } -test fn extdeps_version_base_witnesses() -> Bool { - w_identity_label_preserved() - && w_distinct_identities_not_equal() - && w_constraint_label_preserved() - && w_coreutils_constraint_grounded() - && w_ordering_exhaustive_match() -} diff --git a/dag/test/claim/falsifier_workflow_witness_test.dag b/dag/test/claim/falsifier_workflow_witness_test.dag index ae7988a69d1..7d226dd477a 100644 --- a/dag/test/claim/falsifier_workflow_witness_test.dag +++ b/dag/test/claim/falsifier_workflow_witness_test.dag @@ -20,15 +20,15 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn falsifier_cron_renders_every_four_hours_utc() -> Bool { +test fn falsifier_cron_renders_every_four_hours_utc() -> Bool { render_cron_schedule(s: falsifier_cadence_cron) == "0 0,4,8,12,16,20 * * *" } -fn falsifier_cron_render_discriminates() -> Bool { +test fn falsifier_cron_render_discriminates() -> Bool { !(render_cron_schedule(s: falsifier_cadence_cron) == "0 7 * * *") } -fn falsifier_concurrency_queues_not_cancels() -> Bool { +test fn falsifier_concurrency_queues_not_cancels() -> Bool { match falsifier_workflow.concurrency { Present { value: spec } => match spec { @@ -48,16 +48,16 @@ fn falsifier_concurrency_queues_not_cancels() -> Bool { } } -fn falsifier_backstop_is_step_sum_plus_prelude() -> Bool { +test fn falsifier_backstop_is_step_sum_plus_prelude() -> Bool { gunbc_falsifier_job_backstop_timeout_minutes() == (gunbc_ci_release_build_step_timeout_minutes + gunbc_falsifier_step_timeout_minutes + gunbc_falsifier_compile_clean_cold_control_timeout_minutes + gunbc_falsifier_native_cache_cold_control_timeout_minutes + gunbc_ci_aux_step_timeout_minutes + gunbc_ci_aux_step_timeout_minutes + gunbc_ci_prelude_allowance_minutes) && !(gunbc_falsifier_job_backstop_timeout_minutes() == gunbc_falsifier_step_timeout_minutes) } -fn falsifier_artifact_path_is_workflow_file() -> Bool { +test fn falsifier_artifact_path_is_workflow_file() -> Bool { artifact_path(a: FalsifierYamlArtifact) == ".github/workflows/falsifier.yml" } -fn falsifier_yaml_projection_evaluates() -> Bool { +test fn falsifier_yaml_projection_evaluates() -> Bool { length_of(s: expected_falsifier_yml()) > 0 } @@ -65,11 +65,3 @@ fn length_of(s: String) -> Int { s.length() } -test fn falsifier_workflow_witness_holds() -> Bool { - falsifier_cron_renders_every_four_hours_utc() - && falsifier_cron_render_discriminates() - && falsifier_concurrency_queues_not_cancels() - && falsifier_backstop_is_step_sum_plus_prelude() - && falsifier_artifact_path_is_workflow_file() - && falsifier_yaml_projection_evaluates() -} diff --git a/dag/test/claim/filesystem_entry_kind_witness_test.dag b/dag/test/claim/filesystem_entry_kind_witness_test.dag index 43d35ca1ecb..d34c15f9e5a 100644 --- a/dag/test/claim/filesystem_entry_kind_witness_test.dag +++ b/dag/test/claim/filesystem_entry_kind_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.filesystem_entry_kind_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn is_other(k: EntryKind) -> Bool { @@ -13,31 +12,23 @@ fn is_symlink(k: EntryKind) -> Bool { match k { Symlink => true _ => false } } -fn w_posix_socket_is_other() -> Bool { +test fn w_posix_socket_is_other() -> Bool { is_other(k: posix_entry_kind(t: S_IFSOCK)) } -fn w_posix_regular_is_regular() -> Bool { +test fn w_posix_regular_is_regular() -> Bool { is_regular(k: posix_entry_kind(t: S_IFREG)) } -fn w_posix_symlink_is_symlink() -> Bool { +test fn w_posix_symlink_is_symlink() -> Bool { is_symlink(k: posix_entry_kind(t: S_IFLNK)) } -fn w_ntfs_junction_is_other() -> Bool { +test fn w_ntfs_junction_is_other() -> Bool { is_other(k: ntfs_entry_kind(t: MountPointReparse)) } -fn w_ntfs_symlink_is_symlink() -> Bool { +test fn w_ntfs_symlink_is_symlink() -> Bool { is_symlink(k: ntfs_entry_kind(t: SymlinkReparse)) } -fn w_ntfs_normal_is_regular() -> Bool { +test fn w_ntfs_normal_is_regular() -> Bool { is_regular(k: ntfs_entry_kind(t: NormalFile)) } -test fn filesystem_entry_kind_witnesses() -> Bool { - w_posix_socket_is_other() && - w_posix_regular_is_regular() && - w_posix_symlink_is_symlink() && - w_ntfs_junction_is_other() && - w_ntfs_symlink_is_symlink() && - w_ntfs_normal_is_regular() -} diff --git a/dag/test/claim/fleet_converge_apply_witness_test.dag b/dag/test/claim/fleet_converge_apply_witness_test.dag index 8c705795202..7c6df6451cd 100644 --- a/dag/test/claim/fleet_converge_apply_witness_test.dag +++ b/dag/test/claim/fleet_converge_apply_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.fleet_converge_apply_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn fixture_srv3_host_converge() -> HostConverge { @@ -29,7 +28,7 @@ fn fixture_srv3_host_converge() -> HostConverge { } } -fn witness_unsound_policy_refused() -> Bool { +test fn witness_unsound_policy_refused() -> Bool { match converge_apply( policy: ConvergePolicyUnsound { reason: "fixture" }, transport: LocalShell @@ -39,7 +38,7 @@ fn witness_unsound_policy_refused() -> Bool { } } -fn witness_converge_apply_fail_closed_on_knob_frontier() -> Bool { +test fn witness_converge_apply_fail_closed_on_knob_frontier() -> Bool { match converge_apply( policy: ConvergePolicyDerived { hosts: [fixture_srv3_host_converge()] }, transport: LocalShell @@ -50,12 +49,12 @@ fn witness_converge_apply_fail_closed_on_knob_frontier() -> Bool { } } -fn witness_thin_invocation_argv() -> Bool { +test fn witness_thin_invocation_argv() -> Bool { let inv = fleet_converge_thin_invocation(host: operator_host_srv3) inv.argv.length() == 4 } -fn witness_emit_artifact_carriers_name_bash_emit_scaffolds() -> Bool { +test fn witness_emit_artifact_carriers_name_bash_emit_scaffolds() -> Bool { match bootstrap_fragment_script_carrier_scaffold { Terminal { reason: _ } => true Scaffold { dissolves_to: _, bind: _ } => false @@ -70,7 +69,7 @@ fn witness_emit_artifact_carriers_name_bash_emit_scaffolds() -> Bool { } } -fn witness_emit_artifact_transport_rejects_shell_command() -> Bool { +test fn witness_emit_artifact_transport_rejects_shell_command() -> Bool { !fleet_converge_apply_result_converged(r: converge_apply( policy: ConvergePolicyDerived { hosts: [fixture_srv3_host_converge()] }, transport: EmitArtifactThenThinRun { @@ -80,10 +79,3 @@ fn witness_emit_artifact_transport_rejects_shell_command() -> Bool { )) } -test fn fleet_converge_apply_holds() -> Bool { - witness_unsound_policy_refused() - && witness_converge_apply_fail_closed_on_knob_frontier() - && witness_thin_invocation_argv() - && witness_emit_artifact_carriers_name_bash_emit_scaffolds() - && witness_emit_artifact_transport_rejects_shell_command() -} diff --git a/dag/test/claim/fleet_converge_cli_witness_test.dag b/dag/test/claim/fleet_converge_cli_witness_test.dag index 22baa0c5b64..be8f41d2c5a 100644 --- a/dag/test/claim/fleet_converge_cli_witness_test.dag +++ b/dag/test/claim/fleet_converge_cli_witness_test.dag @@ -1,9 +1,8 @@ module test.claim.fleet_converge_cli_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_converge_cli_srv1_routes_to_slice1_not_realize_frontier() -> Bool { +test fn witness_converge_cli_srv1_routes_to_slice1_not_realize_frontier() -> Bool { converge_cli_routes_to_slice1(host: "srv1") && match host_converge_slice1_fixture_receipt() { Present { value: receipt } => receipt.host == operator_host_srv1 @@ -11,12 +10,12 @@ fn witness_converge_cli_srv1_routes_to_slice1_not_realize_frontier() -> Bool { } } -fn witness_converge_cli_srv3_routes_to_slice1_not_realize_frontier() -> Bool { +test fn witness_converge_cli_srv3_routes_to_slice1_not_realize_frontier() -> Bool { converge_cli_routes_to_slice1(host: "srv3") && !converge_cli_routes_to_slice1(host: "srv2") } -fn witness_converge_cli_run_srv2_fails_closed_on_knob_frontier() -> Bool { +test fn witness_converge_cli_run_srv2_fails_closed_on_knob_frontier() -> Bool { let r = converge_cli_run(host: "srv2") r.host == "srv2" && r.applied == 0 @@ -35,7 +34,7 @@ fn witness_converge_cli_run_srv2_fails_closed_on_knob_frontier() -> Bool { } } -fn witness_converge_cli_run_unknown_host_refuses() -> Bool { +test fn witness_converge_cli_run_unknown_host_refuses() -> Bool { let r = converge_cli_run(host: "no-such-fleet-host") r.host == "no-such-fleet-host" && r.applied == 0 @@ -54,7 +53,7 @@ fn witness_converge_cli_run_unknown_host_refuses() -> Bool { } } -fn witness_converge_cli_unknown_host_and_compute_inventory_absent_are_distinct_causes() -> Bool { +test fn witness_converge_cli_unknown_host_and_compute_inventory_absent_are_distinct_causes() -> Bool { let unknown = UnknownHost { host: "no-such-fleet-host" } let inventory_absent = ComputeInventoryAbsent { host: "gunbc-ci-fleet" } match unknown { @@ -77,7 +76,7 @@ fn witness_converge_cli_unknown_host_and_compute_inventory_absent_are_distinct_c ) } -fn witness_converge_cli_refusal_causes_discriminate() -> Bool { +test fn witness_converge_cli_refusal_causes_discriminate() -> Bool { let srv2 = converge_cli_run(host: "srv2") let unknown = converge_cli_run(host: "no-such-fleet-host") match srv2.reason { @@ -102,7 +101,7 @@ fn witness_converge_cli_refusal_causes_discriminate() -> Bool { } } -fn witness_converge_cli_receipt_line_matches_byte_locked_grammar() -> Bool { +test fn witness_converge_cli_receipt_line_matches_byte_locked_grammar() -> Bool { let converged = ConvergeCliReceipt { host: "srv9", applied: 3, drifted: 0, verdict: VerdictConverged, reason: none } let refused = ConvergeCliReceipt { host: "srv1", @@ -115,7 +114,7 @@ fn witness_converge_cli_receipt_line_matches_byte_locked_grammar() -> Bool { && converge_cli_receipt_line(r: refused) == "converge-receipt host=srv1 applied=0 drifted=0 verdict=absent" } -fn witness_converge_cli_output_projects_receipt_and_exit_signal() -> Bool { +test fn witness_converge_cli_output_projects_receipt_and_exit_signal() -> Bool { let out = converge_cli_output(host: "no-such-fleet-host") out.line == "converge-receipt host=no-such-fleet-host applied=0 drifted=0 verdict=absent" && !out.converged @@ -125,13 +124,3 @@ fn witness_converge_cli_output_projects_receipt_and_exit_signal() -> Bool { } } -test fn fleet_converge_cli_witness_holds() -> Bool { - witness_converge_cli_srv1_routes_to_slice1_not_realize_frontier() - && witness_converge_cli_srv3_routes_to_slice1_not_realize_frontier() - && witness_converge_cli_run_srv2_fails_closed_on_knob_frontier() - && witness_converge_cli_run_unknown_host_refuses() - && witness_converge_cli_refusal_causes_discriminate() - && witness_converge_cli_unknown_host_and_compute_inventory_absent_are_distinct_causes() - && witness_converge_cli_receipt_line_matches_byte_locked_grammar() - && witness_converge_cli_output_projects_receipt_and_exit_signal() -} diff --git a/dag/test/claim/fleet_host_budget_test.dag b/dag/test/claim/fleet_host_budget_test.dag index 9e6206d6eeb..b57648b9969 100644 --- a/dag/test/claim/fleet_host_budget_test.dag +++ b/dag/test/claim/fleet_host_budget_test.dag @@ -130,27 +130,27 @@ fn sound_plan() -> FleetHostPlan { full_plan(citation: fixture_citation(), runner: fixture_runner_measured(), session_slice: session_slice_fixture(), policy: fitting_headroom(), oomd: OomdEnforced) } -fn witness_live_plan_fail_closed() -> Bool { +test fn witness_live_plan_fail_closed() -> Bool { is_unsound(plan: fleet_host_plan()) } -fn witness_jobserver_absent_unsound() -> Bool { +test fn witness_jobserver_absent_unsound() -> Bool { is_unsound(plan: full_plan(citation: JobserverAbsent, runner: fixture_runner_measured(), session_slice: session_slice_fixture(), policy: fitting_headroom(), oomd: OomdEnforced)) } -fn witness_runner_baseline_unmeasured_unsound() -> Bool { +test fn witness_runner_baseline_unmeasured_unsound() -> Bool { is_unsound(plan: full_plan(citation: fixture_citation(), runner: fixture_runner_unmeasured(), session_slice: session_slice_fixture(), policy: fitting_headroom(), oomd: OomdEnforced)) } -fn witness_headroom_unset_unsound() -> Bool { +test fn witness_headroom_unset_unsound() -> Bool { is_unsound(plan: full_plan(citation: fixture_citation(), runner: fixture_runner_measured(), session_slice: session_slice_fixture(), policy: HeadroomUnset, oomd: OomdEnforced)) } -fn witness_oomd_unverified_unsound() -> Bool { +test fn witness_oomd_unverified_unsound() -> Bool { is_unsound(plan: full_plan(citation: fixture_citation(), runner: fixture_runner_measured(), session_slice: session_slice_fixture(), policy: fitting_headroom(), oomd: OomdUnverified)) } -fn witness_headroom_below_floor_unsound() -> Bool { +test fn witness_headroom_below_floor_unsound() -> Bool { let floor = oomd_actuation_floor(host: host_125gib()) match resolve_headroom(policy: HeadroomSet { bytes: byte_size(1073741824) }, floor: floor) { HeadroomUnsound { reason: _ } => true @@ -158,7 +158,7 @@ fn witness_headroom_below_floor_unsound() -> Bool { } } -fn witness_headroom_at_or_above_floor_resolved() -> Bool { +test fn witness_headroom_at_or_above_floor_resolved() -> Bool { let floor = oomd_actuation_floor(host: host_125gib()) match resolve_headroom(policy: HeadroomSet { bytes: floor }, floor: floor) { HeadroomResolved { bytes: b } => byte_size_count(b: b) == byte_size_count(b: floor) @@ -166,7 +166,7 @@ fn witness_headroom_at_or_above_floor_resolved() -> Bool { } } -fn witness_tokens_memory_bound_binds() -> Bool { +test fn witness_tokens_memory_bound_binds() -> Bool { let cfg = fixture_cfg() let tokens = hardware_thread_count_value(t: derive_jobserver_tokens(nproc: hardware_thread_count(count: 128), mem_total: host_125gib(), cfg: cfg)) tokens > 0 && tokens < 120 @@ -180,12 +180,12 @@ fn oversized_margin_cfg() -> JobserverConfig { } } -fn witness_margin_exceeds_nproc_saturates() -> Bool { +test fn witness_margin_exceeds_nproc_saturates() -> Bool { let tokens = hardware_thread_count_value(t: derive_jobserver_tokens(nproc: hardware_thread_count(count: 8), mem_total: host_125gib(), cfg: oversized_margin_cfg())) tokens == 0 } -fn witness_runner_cpu_cap_is_cores_minus_margin() -> Bool { +test fn witness_runner_cpu_cap_is_cores_minus_margin() -> Bool { match sound_plan() { FleetHostPlanDerived { name: _, tree: _, runner_slice_cap: _, effective_build_tokens: _, effective_runner_cpu_cap: cpu, build_step: _ } => hardware_thread_count_value(t: cpu) == 120 @@ -193,7 +193,7 @@ fn witness_runner_cpu_cap_is_cores_minus_margin() -> Bool { } } -fn witness_plan_derives_and_conserves() -> Bool { +test fn witness_plan_derives_and_conserves() -> Bool { match sound_plan() { FleetHostPlanDerived { name: _, tree: t, runner_slice_cap: slice, effective_build_tokens: tk, effective_runner_cpu_cap: cpu, build_step: _ } => node_conserves(node: t) @@ -204,13 +204,13 @@ fn witness_plan_derives_and_conserves() -> Bool { } } -fn witness_runner_slice_is_session_worstcase_only() -> Bool { +test fn witness_runner_slice_is_session_worstcase_only() -> Bool { let slice = runner_slice_cap(host: host_125gib(), overhead: overhead_16gib(), session_slice: session_slice_fixture(), headroom: fitting_headroom_bytes()) let expected = byte_size_count(b: host_125gib()) - byte_size_count(b: overhead_16gib()) - byte_size_count(b: session_slice_fixture()) - byte_size_count(b: fitting_headroom_bytes()) byte_size_count(b: slice) == expected } -fn witness_runner_slice_excludes_build_pool() -> Bool { +test fn witness_runner_slice_excludes_build_pool() -> Bool { let cfg = fixture_cfg() let slice = runner_slice_cap(host: host_125gib(), overhead: overhead_16gib(), session_slice: session_slice_fixture(), headroom: fitting_headroom_bytes()) let build_pool_bytes = byte_size_count(b: cfg.mib_per_job) * hardware_thread_count_value(t: derive_jobserver_tokens(nproc: hardware_thread_count(count: 128), mem_total: host_125gib(), cfg: cfg)) @@ -219,47 +219,28 @@ fn witness_runner_slice_excludes_build_pool() -> Bool { byte_size_count(b: slice) > 0 && double_subtract_would_starve } -fn witness_host_conserves_exactly() -> Bool { +test fn witness_host_conserves_exactly() -> Bool { let slice = runner_slice_cap(host: host_125gib(), overhead: overhead_16gib(), session_slice: session_slice_fixture(), headroom: fitting_headroom_bytes()) let whole = byte_size_count(b: overhead_16gib()) + byte_size_count(b: session_slice_fixture()) + byte_size_count(b: fitting_headroom_bytes()) + byte_size_count(b: slice) whole == byte_size_count(b: host_125gib()) } -fn witness_tree_conserves() -> Bool { +test fn witness_tree_conserves() -> Bool { let slice = runner_slice_cap(host: host_125gib(), overhead: overhead_16gib(), session_slice: session_slice_fixture(), headroom: fitting_headroom_bytes()) let tree = fleet_host_budget_tree(name: "fixture", host: host_125gib(), overhead: overhead_16gib(), runner_baseline: runner_idle_bytes(), session_slice: session_slice_fixture(), headroom: fitting_headroom_bytes(), runner_slice: slice) node_conserves(node: tree) } -fn witness_overcommit_tree_refused() -> Bool { +test fn witness_overcommit_tree_refused() -> Bool { let bloated_slice = byte_size(byte_size_count(b: host_125gib())) let tree = fleet_host_budget_tree(name: "overcommit", host: host_125gib(), overhead: overhead_16gib(), runner_baseline: runner_idle_bytes(), session_slice: session_slice_fixture(), headroom: fitting_headroom_bytes(), runner_slice: bloated_slice) !node_conserves(node: tree) } -fn witness_runner_slice_cap_drift_red_receipt() -> Bool { +test fn witness_runner_slice_cap_drift_red_receipt() -> Bool { let disk = byte_size(70391285350) runner_slice_cap_drifted(disk_cap: disk, effective: CapUnbounded) && !runner_slice_cap_drifted(disk_cap: disk, effective: CapEffective { bytes: disk }) && runner_slice_cap_drifted(disk_cap: disk, effective: CapEffective { bytes: byte_size(55307438489) }) } -test fn fleet_model_holds() -> Bool { - witness_live_plan_fail_closed() - && witness_jobserver_absent_unsound() - && witness_runner_baseline_unmeasured_unsound() - && witness_headroom_unset_unsound() - && witness_oomd_unverified_unsound() - && witness_headroom_below_floor_unsound() - && witness_headroom_at_or_above_floor_resolved() - && witness_tokens_memory_bound_binds() - && witness_margin_exceeds_nproc_saturates() - && witness_runner_cpu_cap_is_cores_minus_margin() - && witness_plan_derives_and_conserves() - && witness_runner_slice_is_session_worstcase_only() - && witness_runner_slice_excludes_build_pool() - && witness_host_conserves_exactly() - && witness_tree_conserves() - && witness_overcommit_tree_refused() - && witness_runner_slice_cap_drift_red_receipt() -} diff --git a/dag/test/claim/fleet_show_effective_read_witness_test.dag b/dag/test/claim/fleet_show_effective_read_witness_test.dag index 98c29605883..963fc91d7e8 100644 --- a/dag/test/claim/fleet_show_effective_read_witness_test.dag +++ b/dag/test/claim/fleet_show_effective_read_witness_test.dag @@ -1,41 +1,40 @@ module test.claim.fleet_show_effective_read_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn per_slot_cap_wire() -> String { to_string(byte_size_count(b: gunbc_ci_runner_cgroup_memory_cap)) } -fn witness_slice_cap_parse_empty_is_absent() -> Bool { +test fn witness_slice_cap_parse_empty_is_absent() -> Bool { match parse_systemd_memory_limit_show(raw: "") { MemoryLimitAbsent => true _ => false } } -fn witness_slice_cap_parse_infinity_is_unbounded() -> Bool { +test fn witness_slice_cap_parse_infinity_is_unbounded() -> Bool { match parse_systemd_memory_limit_show(raw: "infinity") { MemoryLimitUnbounded => true _ => false } } -fn witness_width_parse_empty_is_absent() -> Bool { +test fn witness_width_parse_empty_is_absent() -> Bool { match parse_runner_width_active_count(raw: "") { Absent => true Present { value: _ } => false } } -fn witness_width_parse_count_is_typed() -> Bool { +test fn witness_width_parse_count_is_typed() -> Bool { match parse_runner_width_active_count(raw: "10") { Present { value: n } => n == 10 Absent => false } } -fn witness_oom_wire_parses_to_sixty_percent() -> Bool { +test fn witness_oom_wire_parses_to_sixty_percent() -> Bool { match parse_managed_oom_pressure_limit_show(raw: "2576980377") { Present { value: p } => percent_count(p: p) == 60 @@ -47,13 +46,13 @@ fn witness_oom_wire_parses_to_sixty_percent() -> Bool { } } -fn witness_oom_show_value_single_authority() -> Bool { +test fn witness_oom_show_value_single_authority() -> Bool { managed_oom_pressure_limit_show_value( p: gunbc_oomd_sessions_policy.managed_oom_memory_pressure_limit ) == 2576980377 } -fn witness_oom_fixture_converges_to_policy_percent() -> Bool { +test fn witness_oom_fixture_converges_to_policy_percent() -> Bool { match oom_pressure_limit_live_read_typed(row: gunbc_srv1_oom_pressure_limit_fixture_row) { Present { value: read } => oom_pressure_limit_converge_verdict( @@ -64,7 +63,7 @@ fn witness_oom_fixture_converges_to_policy_percent() -> Bool { } } -fn witness_srv1_slice_cap_infinity_drifts_against_pool_budget() -> Bool { +test fn witness_srv1_slice_cap_infinity_drifts_against_pool_budget() -> Bool { let read = runner_slice_cap_live_read_typed(row: gunbc_srv1_runner_slice_cap_fixture_row) match slice_property_memory_max_verdict( read: read, @@ -76,7 +75,7 @@ fn witness_srv1_slice_cap_infinity_drifts_against_pool_budget() -> Bool { } } -fn witness_srv2_slice_cap_converges_to_pool_budget() -> Bool { +test fn witness_srv2_slice_cap_converges_to_pool_budget() -> Bool { let read = runner_slice_cap_live_read_typed(row: gunbc_srv2_runner_slice_cap_fixture_row) match slice_property_memory_max_verdict( read: read, @@ -88,7 +87,7 @@ fn witness_srv2_slice_cap_converges_to_pool_budget() -> Bool { } } -fn witness_srv1_01_per_slot_infinity_drifts() -> Bool { +test fn witness_srv1_01_per_slot_infinity_drifts() -> Bool { let read = runner_unit_live_read_typed(row: gunbc_srv1_runner_unit_live_read_fixture) let target = PerSlotMemoryCap { dropin_path: gunbc_runner_per_slot_dropin_path, @@ -104,7 +103,7 @@ fn witness_srv1_01_per_slot_infinity_drifts() -> Bool { data srv1_width_drift_note: String = "The 2026-07-03 srv1 snapshot (10 active runner units) CONVERGED against the pre-carve declaration; the 2026-07-11 slot re-carve (16GiB memory.max slots, gunbc.ci_floor_measurement live row) shrank declared_runner_count to floor(pool/16GiB) = 5, so the same observation now DRIFTS - and that drift is the real fact: the hosts still run the pre-carve width, the same oversubscription the falsifier exit-137 receipts located. The parse-typing claim above deliberately pins the literal (a parse fixture must not depend on a live-derived count - that fusion is why this witness went latent-red when the re-carve landed). Dissolve-on: a post-re-carve width readback replaces the fixture row and this witness flips back to asserting convergence." -fn witness_srv1_width_drifts_from_declared_count_after_recarve() -> Bool { +test fn witness_srv1_width_drifts_from_declared_count_after_recarve() -> Bool { match runner_width_live_read_typed(row: gunbc_srv1_runner_width_fixture_row) { Present { value: read } => runner_width_converge_verdict( @@ -115,7 +114,7 @@ fn witness_srv1_width_drifts_from_declared_count_after_recarve() -> Bool { } } -fn witness_srv2_width_drifts_from_declared_count() -> Bool { +test fn witness_srv2_width_drifts_from_declared_count() -> Bool { match runner_width_live_read_typed(row: gunbc_srv2_runner_width_fixture_row) { Present { value: read } => runner_width_converge_verdict( @@ -126,20 +125,20 @@ fn witness_srv2_width_drifts_from_declared_count() -> Bool { } } -fn witness_infinity_slice_read_is_read_observed_unbounded() -> Bool { +test fn witness_infinity_slice_read_is_read_observed_unbounded() -> Bool { match show_effective_read_from_slice_cap_row(row: gunbc_srv1_runner_slice_cap_fixture_row) { ReadObserved { value: CapUnbounded } => true _ => false } } -fn witness_infinity_slice_read_cannot_converge() -> Bool { +test fn witness_infinity_slice_read_cannot_converge() -> Bool { show_effective_read_cannot_converge( read: show_effective_read_from_slice_cap_row(row: gunbc_srv1_runner_slice_cap_fixture_row) ) } -fn witness_empty_slice_read_is_read_absent() -> Bool { +test fn witness_empty_slice_read_is_read_absent() -> Bool { match show_effective_read_from_slice_cap_row( row: RunnerSliceCapLiveReadRow { slice_unit: "system-actions-runner.slice", @@ -152,7 +151,7 @@ fn witness_empty_slice_read_is_read_absent() -> Bool { } } -fn witness_srv1_grounded_receipt_lists_every_fixture_runner_unit() -> Bool { +test fn witness_srv1_grounded_receipt_lists_every_fixture_runner_unit() -> Bool { match fixture_srv1_host_effective_read_grounded_receipt() { Present { value: r } => fleet_receipt_unit_count(receipt: r.effective) == 2 @@ -163,7 +162,7 @@ fn witness_srv1_grounded_receipt_lists_every_fixture_runner_unit() -> Bool { } } -fn witness_srv2_grounded_receipt_lists_every_fixture_runner_unit() -> Bool { +test fn witness_srv2_grounded_receipt_lists_every_fixture_runner_unit() -> Bool { match fixture_srv2_host_effective_read_grounded_receipt() { Present { value: r } => fleet_receipt_unit_count(receipt: r.effective) == 2 @@ -174,7 +173,7 @@ fn witness_srv2_grounded_receipt_lists_every_fixture_runner_unit() -> Bool { } } -fn witness_committed_show_reads_are_fail_closed_absent() -> Bool { +test fn witness_committed_show_reads_are_fail_closed_absent() -> Bool { match gunbc_fleet_runner_slice_cap_show_effective_read { ReadAbsent { reason: _ } => true _ => false @@ -193,7 +192,7 @@ fn witness_committed_show_reads_are_fail_closed_absent() -> Bool { } } -fn witness_runner_slot_enforcement_committed_is_fail_closed() -> Bool { +test fn witness_runner_slot_enforcement_committed_is_fail_closed() -> Bool { match gunbc_runner_slot_enforcement_committed(expected_cap: gunbc_ci_runner_cgroup_memory_cap) { RunnerSlotEnforced => false RunnerSlotUnenforced { reason: _ } => true @@ -210,7 +209,7 @@ fn witness_show_property_local_read_holds() -> Bool { } } -fn witness_transport_reads_use_show_property_authority() -> Bool { +test fn witness_transport_reads_use_show_property_authority() -> Bool { systemctl_show_property_operation_argv_matches_transport( unit: "system-actions-runner.slice" as NonEmptyStr, property: MemoryMax, @@ -219,7 +218,7 @@ fn witness_transport_reads_use_show_property_authority() -> Bool { && string_contains(s: fleet_runner_width_count_read_script(instance_glob: "actions-runner@srv1-*.service"), pattern: "list-units") } -fn witness_show_property_injection_metachar_refused() -> Bool { +test fn witness_show_property_injection_metachar_refused() -> Bool { match systemctl_show_property_operation_argv( unit: "foo\"; rm -rf /" as NonEmptyStr, property: MemoryMax, @@ -233,26 +232,3 @@ fn witness_show_property_injection_metachar_refused() -> Bool { } } -test fn fleet_show_effective_read_v0_knobs_ground() -> Bool { - witness_slice_cap_parse_empty_is_absent() - && witness_slice_cap_parse_infinity_is_unbounded() - && witness_width_parse_empty_is_absent() - && witness_width_parse_count_is_typed() - && witness_oom_wire_parses_to_sixty_percent() - && witness_oom_show_value_single_authority() - && witness_oom_fixture_converges_to_policy_percent() - && witness_srv1_slice_cap_infinity_drifts_against_pool_budget() - && witness_srv2_slice_cap_converges_to_pool_budget() - && witness_srv1_01_per_slot_infinity_drifts() - && witness_srv1_width_drifts_from_declared_count_after_recarve() - && witness_srv2_width_drifts_from_declared_count() - && witness_infinity_slice_read_is_read_observed_unbounded() - && witness_infinity_slice_read_cannot_converge() - && witness_empty_slice_read_is_read_absent() - && witness_srv1_grounded_receipt_lists_every_fixture_runner_unit() - && witness_srv2_grounded_receipt_lists_every_fixture_runner_unit() - && witness_committed_show_reads_are_fail_closed_absent() - && witness_runner_slot_enforcement_committed_is_fail_closed() - && witness_transport_reads_use_show_property_authority() - && witness_show_property_injection_metachar_refused() -} diff --git a/dag/test/claim/free_tier_serving_witness_test.dag b/dag/test/claim/free_tier_serving_witness_test.dag index 829ad52f9fb..680d1675d24 100644 --- a/dag/test/claim/free_tier_serving_witness_test.dag +++ b/dag/test/claim/free_tier_serving_witness_test.dag @@ -66,7 +66,7 @@ data zero_floor_registered_users_fixture: RegisteredUserCountRow = RegisteredUse citation: gitlab_fy2026_registered_users.citation, } -fn w_10k_users_floor_is_two_ax41_boxes() -> Bool { +test fn w_10k_users_floor_is_two_ax41_boxes() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsDeclared { @@ -80,7 +80,7 @@ fn w_10k_users_floor_is_two_ax41_boxes() -> Bool { } } -fn w_100k_users_floor_scales_to_nineteen_boxes() -> Bool { +test fn w_100k_users_floor_scales_to_nineteen_boxes() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsDeclared { @@ -94,7 +94,7 @@ fn w_100k_users_floor_scales_to_nineteen_boxes() -> Bool { } } -fn w_gitlab_fy2026_average_serving_cost_upper_bound() -> Bool { +test fn w_gitlab_fy2026_average_serving_cost_upper_bound() -> Bool { match average_serving_cost_per_registered_user_year_micros_upper_bound( annual_cost_of_revenue: gitlab_fy2026_cost_of_revenue, registered_users: gitlab_fy2026_registered_users, @@ -105,7 +105,7 @@ fn w_gitlab_fy2026_average_serving_cost_upper_bound() -> Bool { } } -fn w_gitlab_fy2023_average_serving_cost_upper_bound() -> Bool { +test fn w_gitlab_fy2023_average_serving_cost_upper_bound() -> Bool { match average_serving_cost_per_registered_user_year_micros_upper_bound( annual_cost_of_revenue: gitlab_fy2023_cost_of_revenue, registered_users: gitlab_fy2023_registered_users, @@ -116,7 +116,7 @@ fn w_gitlab_fy2023_average_serving_cost_upper_bound() -> Bool { } } -fn w_red_unknown_assumptions_refused() -> Bool { +test fn w_red_unknown_assumptions_refused() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsUnknown, @@ -126,7 +126,7 @@ fn w_red_unknown_assumptions_refused() -> Bool { } } -fn w_red_zero_user_count_refused() -> Bool { +test fn w_red_zero_user_count_refused() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsDeclared { @@ -143,7 +143,7 @@ fn w_red_zero_user_count_refused() -> Bool { } } -fn w_red_zero_storage_per_user_refused() -> Bool { +test fn w_red_zero_storage_per_user_refused() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsDeclared { @@ -159,7 +159,7 @@ fn w_red_zero_storage_per_user_refused() -> Bool { } } -fn w_red_zero_replica_count_refused() -> Bool { +test fn w_red_zero_replica_count_refused() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsDeclared { @@ -176,7 +176,7 @@ fn w_red_zero_replica_count_refused() -> Bool { } } -fn w_red_zero_egress_allowance_refused() -> Bool { +test fn w_red_zero_egress_allowance_refused() -> Bool { match derive_free_tier_serving_floor( box_row: hetzner_ax41_1_ltd_price, assumptions_input: FreeTierAssumptionsDeclared { @@ -193,7 +193,7 @@ fn w_red_zero_egress_allowance_refused() -> Bool { } } -fn w_red_zero_box_storage_refused() -> Bool { +test fn w_red_zero_box_storage_refused() -> Bool { match derive_free_tier_serving_floor( box_row: ax41_zero_storage_fixture, assumptions_input: FreeTierAssumptionsDeclared { @@ -206,7 +206,7 @@ fn w_red_zero_box_storage_refused() -> Bool { } } -fn w_red_zero_registered_user_floor_yields_no_bound() -> Bool { +test fn w_red_zero_registered_user_floor_yields_no_bound() -> Bool { match average_serving_cost_per_registered_user_year_micros_upper_bound( annual_cost_of_revenue: gitlab_fy2026_cost_of_revenue, registered_users: zero_floor_registered_users_fixture, @@ -216,16 +216,3 @@ fn w_red_zero_registered_user_floor_yields_no_bound() -> Bool { } } -test fn free_tier_serving_witness() -> Bool { - w_10k_users_floor_is_two_ax41_boxes() - && w_100k_users_floor_scales_to_nineteen_boxes() - && w_gitlab_fy2026_average_serving_cost_upper_bound() - && w_gitlab_fy2023_average_serving_cost_upper_bound() - && w_red_unknown_assumptions_refused() - && w_red_zero_user_count_refused() - && w_red_zero_storage_per_user_refused() - && w_red_zero_replica_count_refused() - && w_red_zero_egress_allowance_refused() - && w_red_zero_box_storage_refused() - && w_red_zero_registered_user_floor_yields_no_bound() -} diff --git a/dag/test/claim/generated_artifact_drift_test.dag b/dag/test/claim/generated_artifact_drift_test.dag index dd13c0122aa..ca35fb19a87 100644 --- a/dag/test/claim/generated_artifact_drift_test.dag +++ b/dag/test/claim/generated_artifact_drift_test.dag @@ -24,7 +24,7 @@ fn artifact_drifted(a: GeneratedArtifact, committed: String) -> Bool { !(committed == artifact_generate(a: a)) } -fn witness_per_artifact_red_receipts() -> Bool { +test fn witness_per_artifact_red_receipts() -> Bool { count(committed_generated_artifacts()) > 0 && all(committed_generated_artifacts(), a => !artifact_drifted(a: a, committed: artifact_generate(a: a)) @@ -38,19 +38,19 @@ fn artifact_committed_matches(a: GeneratedArtifact) -> Bool { committed.success && (committed.content == artifact_generate(a: a)) } -fn witness_committed_is_fixed_point() -> Bool { +test fn witness_committed_is_fixed_point() -> Bool { count(committed_generated_artifacts()) > 0 && all(committed_generated_artifacts(), a => artifact_committed_matches(a: a)) } -fn witness_committed_fixed_point_red_control() -> Bool { +test fn witness_committed_fixed_point_red_control() -> Bool { let a = CiYamlArtifact let committed = Filesystem.Read(path: artifact_path(a: a)) committed.success && !(concat(committed.content, perturb) == artifact_generate(a: a)) } -fn witness_all_known_committed() -> Bool { +test fn witness_all_known_committed() -> Bool { artifact_is_committed(a: CiYamlArtifact) && artifact_is_committed(a: FalsifierYamlArtifact) && artifact_is_committed(a: GitignoreArtifact) @@ -77,7 +77,7 @@ fn witness_all_known_committed() -> Bool { && !path_is_ignored(path: ".github/live-deploy-srv1-retract.sh") } -fn witness_ignored_paths_excluded() -> Bool { +test fn witness_ignored_paths_excluded() -> Bool { path_is_ignored(path: "target/release/gunbc") && path_is_ignored(path: "foo/.DS_Store") && path_is_ignored(path: "src/scratch.swp") @@ -87,7 +87,7 @@ fn witness_ignored_paths_excluded() -> Bool { && !path_is_ignored(path: "provisioning/srv3/dnsmasq.conf") } -fn witness_registry_complete() -> Bool { +test fn witness_registry_complete() -> Bool { count(generated_artifact_registry) == (13 + count(fleet_autoinstall_specs) + count(fleet_install_server_specs) + count(all_plans)) && registry_contains(a: CiYamlArtifact) && registry_contains(a: FalsifierYamlArtifact) @@ -135,7 +135,7 @@ fn consumer_is(a: GeneratedArtifact, expected: RepoConsumer) -> Bool { } } -fn witness_commit_policy_reasons() -> Bool { +test fn witness_commit_policy_reasons() -> Bool { consumer_is(a: GitignoreArtifact, expected: GitProtocol) && consumer_is(a: GithooksPrePushArtifact, expected: GitProtocol) && consumer_is(a: GithooksPreCommitArtifact, expected: GitProtocol) @@ -154,7 +154,7 @@ fn witness_commit_policy_reasons() -> Bool { && match artifact_commit_policy(a: ProxyDhcpDnsmasqArtifact { spec: srv3_install_server_spec }) { NotCommitted => true _ => false } } -fn witness_extra_validation_wired() -> Bool { +test fn witness_extra_validation_wired() -> Bool { artifact_extra_valid(a: GitignoreArtifact) && artifact_extra_valid(a: RoadmapArtifact) && artifact_extra_valid(a: DesignArtifact) @@ -164,13 +164,3 @@ fn witness_extra_validation_wired() -> Bool { && artifact_extra_valid(a: Stage0CrateLayoutGeneratedRsArtifact) } -test fn generated_artifact_drift_witnesses() -> Bool { - witness_per_artifact_red_receipts() - && witness_committed_is_fixed_point() - && witness_committed_fixed_point_red_control() - && witness_all_known_committed() - && witness_ignored_paths_excluded() - && witness_registry_complete() - && witness_commit_policy_reasons() - && witness_extra_validation_wired() -} diff --git a/dag/test/claim/gha_expression_roundtrip_test.dag b/dag/test/claim/gha_expression_roundtrip_test.dag index def2afcfa16..5d3c595978b 100644 --- a/dag/test/claim/gha_expression_roundtrip_test.dag +++ b/dag/test/claim/gha_expression_roundtrip_test.dag @@ -1,6 +1,5 @@ module test.claim.gha_expression_roundtrip - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn core_expr() -> Expression { @@ -27,14 +26,14 @@ fn core_template() -> ExpressionTemplate { } } -fn witness_roundtrip_expression() -> Bool { +test fn witness_roundtrip_expression() -> Bool { match ingest_expression(src: serialize_expression(expression: core_expr())) { Present { value: v } => v == core_expr() Absent => false } } -fn witness_roundtrip_template() -> Bool { +test fn witness_roundtrip_template() -> Bool { match ingest_template(src: serialize_template(template: core_template())) { Present { value: v } => v == core_template() Absent => false @@ -69,7 +68,7 @@ fn roundtrips_under(sp: ExpressionSpellings) -> Bool { } } -fn witness_roundtrip_under_perturbed_rows() -> Bool { +test fn witness_roundtrip_under_perturbed_rows() -> Bool { roundtrips_under(sp: perturbed_path_sep()) && roundtrips_under(sp: perturbed_or_op()) } @@ -80,7 +79,7 @@ fn ingest_reads(sp: ExpressionSpellings) -> Bool { } } -fn witness_ingest_reads_rows() -> Bool { +test fn witness_ingest_reads_rows() -> Bool { ingest_reads(sp: perturbed_path_sep()) && ingest_reads(sp: perturbed_or_op()) } @@ -104,7 +103,7 @@ fn right_nested_or() -> Expression { } } -fn witness_or_associativity_partition() -> Bool { +test fn witness_or_associativity_partition() -> Bool { match ingest_expression(src: serialize_expression(expression: left_nested_or())) { Present { value: left_v } => match ingest_expression(src: serialize_expression(expression: right_nested_or())) { @@ -136,7 +135,7 @@ fn frontier_nested_multiarg_call() -> Expression { } } -fn witness_frontier_not_roundtripped() -> Bool { +test fn witness_frontier_not_roundtripped() -> Bool { match ingest_expression(src: serialize_expression(expression: right_nested_or())) { Present { value: v1 } => match ingest_expression(src: serialize_expression(expression: frontier_string_with_or())) { @@ -154,7 +153,7 @@ fn witness_frontier_not_roundtripped() -> Bool { } } -fn witness_core_advertised_lossless() -> Bool { +test fn witness_core_advertised_lossless() -> Bool { match ingest_expression(src: serialize_expression(expression: core_expr())) { Present { value: v } => { let m = source_medium_carried(carried: v, fidelity: Lossless) @@ -167,7 +166,7 @@ fn witness_core_advertised_lossless() -> Bool { } } -fn witness_emit_non_regression() -> Bool { +test fn witness_emit_non_regression() -> Bool { let e = core_expr() let t = core_template() (serialize_expression(expression: e) == serialize_expression_with(expression: e, sp: default_expression_spellings)) @@ -176,13 +175,3 @@ fn witness_emit_non_regression() -> Bool { && (serialize_template(template: t) == "cargo-ci-${{ runner.os }}-${{ runner.arch }}") } -test fn gha_expression_roundtrip_keystone_holds() -> Bool { - witness_roundtrip_expression() - && witness_roundtrip_template() - && witness_roundtrip_under_perturbed_rows() - && witness_ingest_reads_rows() - && witness_or_associativity_partition() - && witness_frontier_not_roundtripped() - && witness_core_advertised_lossless() - && witness_emit_non_regression() -} diff --git a/dag/test/claim/githooks_pre_push_emit_test.dag b/dag/test/claim/githooks_pre_push_emit_test.dag index 606cd9e29cb..c23e3b3fb86 100644 --- a/dag/test/claim/githooks_pre_push_emit_test.dag +++ b/dag/test/claim/githooks_pre_push_emit_test.dag @@ -9,20 +9,20 @@ fn has(s: String, p: String) -> Bool { string_contains(s: s, pattern: p) } -fn witness_generated_header() -> Bool { +test fn witness_generated_header() -> Bool { let sh = expected_githooks_pre_push_sh() has(s: sh, p: "GENERATED by dag/gunbc/githooks_pre_push_emit.dag") && has(s: sh, p: "set -euo pipefail") } -fn witness_fmt_is_the_body() -> Bool { +test fn witness_fmt_is_the_body() -> Bool { let sh = expected_githooks_pre_push_sh() has(s: sh, p: "cargo fmt --all --check") && has(s: sh, p: "rustfmt drift") && has(s: sh, p: "exit 1") } -fn witness_no_claim_batch_dependency() -> Bool { +test fn witness_no_claim_batch_dependency() -> Bool { let sh = expected_githooks_pre_push_sh() !has(s: sh, p: "claim_batch") && !has(s: sh, p: "--pre-push") @@ -30,13 +30,13 @@ fn witness_no_claim_batch_dependency() -> Bool { && !has(s: sh, p: "CLAIM_BATCH") } -fn witness_no_in_hook_build() -> Bool { +test fn witness_no_in_hook_build() -> Bool { let sh = expected_githooks_pre_push_sh() !has(s: sh, p: "cargo build") && !has(s: sh, p: "CTRL_BUILD_WRAP_CARGO") } -fn witness_no_corpus_or_witness_run() -> Bool { +test fn witness_no_corpus_or_witness_run() -> Bool { let sh = expected_githooks_pre_push_sh() !has(s: sh, p: "gunbc_ci_witness_corpus_only_batches") && !has(s: sh, p: "doc_graph_has_no_orphan_docs") @@ -44,7 +44,7 @@ fn witness_no_corpus_or_witness_run() -> Bool { && !has(s: sh, p: "run_generated_artifact_drift_gate_body") } -fn witness_no_tree_mutation() -> Bool { +test fn witness_no_tree_mutation() -> Bool { let sh = expected_githooks_pre_push_sh() !has(s: sh, p: "chore: apply cargo fmt") && !has(s: sh, p: "chore: regenerate committed projections") @@ -52,17 +52,8 @@ fn witness_no_tree_mutation() -> Bool { && !has(s: sh, p: "git commit") } -fn witness_line_budget() -> Bool { +test fn witness_line_budget() -> Bool { let sh = expected_githooks_pre_push_sh() length(sh) < 700 } -test fn githooks_pre_push_emit_witnesses() -> Bool { - witness_generated_header() - && witness_fmt_is_the_body() - && witness_no_claim_batch_dependency() - && witness_no_in_hook_build() - && witness_no_corpus_or_witness_run() - && witness_no_tree_mutation() - && witness_line_budget() -} diff --git a/dag/test/claim/gitignore_gate_test.dag b/dag/test/claim/gitignore_gate_test.dag index 1738861d171..f54bf1df24c 100644 --- a/dag/test/claim/gitignore_gate_test.dag +++ b/dag/test/claim/gitignore_gate_test.dag @@ -1,41 +1,33 @@ module test.claim.gitignore_gate - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_has_cargo_patterns() -> Bool { +test fn witness_has_cargo_patterns() -> Bool { let eg = expected_gitignore() string_contains(s: eg, pattern: "/target/") && string_contains(s: eg, pattern: "/target-codex/") } -fn witness_has_editor_and_os_patterns() -> Bool { +test fn witness_has_editor_and_os_patterns() -> Bool { let eg = expected_gitignore() string_contains(s: eg, pattern: ".idea/") && string_contains(s: eg, pattern: ".DS_Store") && string_contains(s: eg, pattern: "node_modules/") } -fn witness_has_header() -> Bool { +test fn witness_has_header() -> Bool { let eg = expected_gitignore() string_contains(s: eg, pattern: "generated from dag/gunbc/gitignore_authority.dag") && string_contains(s: eg, pattern: "do not hand-edit") } -fn witness_clean_does_not_drift() -> Bool { +test fn witness_clean_does_not_drift() -> Bool { !(gitignore_drifted(committed: expected_gitignore())) } -fn witness_drift_receipt() -> Bool { +test fn witness_drift_receipt() -> Bool { let eg = expected_gitignore() !gitignore_drifted(committed: eg) && gitignore_drifted(committed: concat(eg, "\n# drift-receipt-perturb")) } -test fn gitignore_witnesses() -> Bool { - witness_has_cargo_patterns() - && witness_has_editor_and_os_patterns() - && witness_has_header() - && witness_clean_does_not_drift() - && witness_drift_receipt() -} diff --git a/dag/test/claim/gitlab_10k_income_series_witness_test.dag b/dag/test/claim/gitlab_10k_income_series_witness_test.dag index 4f9e3ffec63..4cc386d4c20 100644 --- a/dag/test/claim/gitlab_10k_income_series_witness_test.dag +++ b/dag/test/claim/gitlab_10k_income_series_witness_test.dag @@ -285,7 +285,7 @@ fn w_due_within_year_le_total(due: FiledMonetaryFact, total: FiledMonetaryFact) } } -fn w_all_seven_years_cross_foot() -> Bool { +test fn w_all_seven_years_cross_foot() -> Bool { w_year_cross_foots( revenue: gitlab_fy2020_revenue, cost_of_revenue: gitlab_fy2020_cost_of_revenue, @@ -358,7 +358,7 @@ fn w_all_seven_years_cross_foot() -> Bool { ) } -fn w_revenue_strictly_increases_every_year() -> Bool { +test fn w_revenue_strictly_increases_every_year() -> Bool { w_filed_count_increases(prev: gitlab_fy2020_revenue, next: gitlab_fy2021_revenue) && w_filed_count_increases(prev: gitlab_fy2021_revenue, next: gitlab_fy2022_revenue) && w_filed_count_increases(prev: gitlab_fy2022_revenue, next: gitlab_fy2023_revenue) @@ -367,7 +367,7 @@ fn w_revenue_strictly_increases_every_year() -> Bool { && w_filed_count_increases(prev: gitlab_fy2025_revenue, next: gitlab_fy2026_revenue) } -fn w_sales_and_marketing_share_declines_every_year() -> Bool { +test fn w_sales_and_marketing_share_declines_every_year() -> Bool { w_share_of_revenue_declines( numer_prev: gitlab_fy2020_selling_and_marketing, revenue_prev: gitlab_fy2020_revenue, @@ -406,7 +406,7 @@ fn w_sales_and_marketing_share_declines_every_year() -> Bool { ) } -fn w_gross_margin_high_80s_every_year() -> Bool { +test fn w_gross_margin_high_80s_every_year() -> Bool { w_gross_margin_in_series_band(revenue: gitlab_fy2020_revenue, gross_profit: gitlab_fy2020_gross_profit) && w_gross_margin_in_series_band(revenue: gitlab_fy2021_revenue, gross_profit: gitlab_fy2021_gross_profit) && w_gross_margin_in_series_band(revenue: gitlab_fy2022_revenue, gross_profit: gitlab_fy2022_gross_profit) @@ -416,7 +416,7 @@ fn w_gross_margin_high_80s_every_year() -> Bool { && w_gross_margin_in_series_band(revenue: gitlab_fy2026_revenue, gross_profit: gitlab_fy2026_gross_profit) } -fn w_operating_income_negative_all_seven_years() -> Bool { +test fn w_operating_income_negative_all_seven_years() -> Bool { w_filed_negative(fact: gitlab_fy2020_operating_income_loss) && w_filed_negative(fact: gitlab_fy2021_operating_income_loss) && w_filed_negative(fact: gitlab_fy2022_operating_income_loss) @@ -426,7 +426,7 @@ fn w_operating_income_negative_all_seven_years() -> Bool { && w_filed_negative(fact: gitlab_fy2026_operating_income_loss) } -fn w_net_income_negative_all_seven_years() -> Bool { +test fn w_net_income_negative_all_seven_years() -> Bool { w_filed_negative(fact: gitlab_fy2020_net_income_loss) && w_filed_negative(fact: gitlab_fy2021_net_income_loss) && w_filed_negative(fact: gitlab_fy2022_net_income_loss) @@ -436,13 +436,13 @@ fn w_net_income_negative_all_seven_years() -> Bool { && w_filed_negative(fact: gitlab_fy2026_net_income_loss) } -fn w_operating_loss_narrows_fy2023_to_fy2026() -> Bool { +test fn w_operating_loss_narrows_fy2023_to_fy2026() -> Bool { w_negative_magnitude_shrinks(prev: gitlab_fy2023_operating_income_loss, next: gitlab_fy2024_operating_income_loss) && w_negative_magnitude_shrinks(prev: gitlab_fy2024_operating_income_loss, next: gitlab_fy2025_operating_income_loss) && w_negative_magnitude_shrinks(prev: gitlab_fy2025_operating_income_loss, next: gitlab_fy2026_operating_income_loss) } -fn w_fy2024_net_loss_exceeds_operating_loss() -> Bool { +test fn w_fy2024_net_loss_exceeds_operating_loss() -> Bool { match filed_negative_magnitude(fact: gitlab_fy2024_net_income_loss) { Present { value: net } => match filed_negative_magnitude(fact: gitlab_fy2024_operating_income_loss) { @@ -453,14 +453,14 @@ fn w_fy2024_net_loss_exceeds_operating_loss() -> Bool { } } -fn w_fy2025_net_loss_below_ten_million() -> Bool { +test fn w_fy2025_net_loss_below_ten_million() -> Bool { match filed_negative_magnitude(fact: gitlab_fy2025_net_income_loss) { Present { value: net } => net < 10000000 _ => false } } -fn w_purchase_obligations_coherent() -> Bool { +test fn w_purchase_obligations_coherent() -> Bool { w_due_within_year_le_total(due: gitlab_fy2023_purchase_obligation_due_next_year, total: gitlab_fy2023_purchase_obligation) && w_due_within_year_le_total(due: gitlab_fy2024_purchase_obligation_due_next_year, total: gitlab_fy2024_purchase_obligation) && w_due_within_year_le_total(due: gitlab_fy2025_purchase_obligation_due_next_year, total: gitlab_fy2025_purchase_obligation) @@ -470,7 +470,7 @@ fn w_purchase_obligations_coherent() -> Bool { && w_filed_count_equals(fact: gitlab_sept_2020_hosting_commitment, expected: 97000000) } -fn w_dbnrr_at_least_100_every_disclosed_year() -> Bool { +test fn w_dbnrr_at_least_100_every_disclosed_year() -> Bool { disclosed_rate_at_least(rate: gitlab_fy2020_dbnrr.rate, threshold_percent: 100) && disclosed_rate_at_least(rate: gitlab_fy2021_dbnrr.rate, threshold_percent: 100) && disclosed_rate_at_least(rate: gitlab_fy2022_dbnrr.rate, threshold_percent: 100) @@ -480,7 +480,7 @@ fn w_dbnrr_at_least_100_every_disclosed_year() -> Bool { && disclosed_rate_at_least(rate: gitlab_fy2026_dbnrr.rate, threshold_percent: 100) } -fn w_dbnrr_exact_era_strictly_declines() -> Bool { +test fn w_dbnrr_exact_era_strictly_declines() -> Bool { match disclosed_rate_exact_percent(rate: gitlab_fy2024_dbnrr.rate) { Present { value: p24 } => match disclosed_rate_exact_percent(rate: gitlab_fy2025_dbnrr.rate) { @@ -495,14 +495,14 @@ fn w_dbnrr_exact_era_strictly_declines() -> Bool { } } -fn w_dbnrr_fy2022_disclosed_as_floor_152() -> Bool { +test fn w_dbnrr_fy2022_disclosed_as_floor_152() -> Bool { match gitlab_fy2022_dbnrr.rate { RateLowerBoundPercent { floor_percent: f } => f == 152 _ => false } } -fn w_customers_100k_strictly_increase() -> Bool { +test fn w_customers_100k_strictly_increase() -> Bool { (gitlab_fy2021_customers_100k_arr.customer_count < gitlab_fy2022_customers_100k_arr.customer_count) && (gitlab_fy2022_customers_100k_arr.customer_count < gitlab_fy2023_customers_100k_arr.customer_count) && (gitlab_fy2023_customers_100k_arr.customer_count < gitlab_fy2024_customers_100k_arr.customer_count) @@ -511,7 +511,7 @@ fn w_customers_100k_strictly_increase() -> Bool { && (gitlab_fy2026_customers_100k_arr.customer_count == 1456) } -fn w_premium_listed_29_usd_billed_annually() -> Bool { +test fn w_premium_listed_29_usd_billed_annually() -> Bool { match gitlab_premium_price.seat_pricing { ListedPerSeatMonth { per_seat_month: p, billed_annually: annual } => annual && (money_per_month_micros(q: p) == 29000000) @@ -519,25 +519,25 @@ fn w_premium_listed_29_usd_billed_annually() -> Bool { } } -fn w_ultimate_pricing_is_custom_negotiated() -> Bool { +test fn w_ultimate_pricing_is_custom_negotiated() -> Bool { match gitlab_ultimate_price.seat_pricing { CustomNegotiatedPricing => true _ => false } } -fn w_free_tier_is_free_of_charge() -> Bool { +test fn w_free_tier_is_free_of_charge() -> Bool { match gitlab_free_price.seat_pricing { FreeOfCharge => true _ => false } } -fn w_duo_credit_bundles_order_with_tier() -> Bool { +test fn w_duo_credit_bundles_order_with_tier() -> Bool { money_per_month_micros(q: gitlab_premium_price.included_duo_credits_per_seat_month) < money_per_month_micros(q: gitlab_ultimate_price.included_duo_credits_per_seat_month) } -fn w_premium_price_history_coheres_with_live_list_price() -> Bool { +test fn w_premium_price_history_coheres_with_live_list_price() -> Bool { match gitlab_premium_price.seat_pricing { ListedPerSeatMonth { per_seat_month: live, billed_annually: _ } => (money_per_month_micros(q: gitlab_premium_2023_price_increase.prior_per_seat_month) == 19000000) @@ -546,7 +546,7 @@ fn w_premium_price_history_coheres_with_live_list_price() -> Bool { } } -fn w_red_perturbed_operating_income_breaks_cross_foot() -> Bool { +test fn w_red_perturbed_operating_income_breaks_cross_foot() -> Bool { !w_year_cross_foots( revenue: gitlab_fy2026_revenue, cost_of_revenue: gitlab_fy2026_cost_of_revenue, @@ -563,11 +563,11 @@ fn w_red_perturbed_operating_income_breaks_cross_foot() -> Bool { ) } -fn w_red_reversed_revenue_pair_not_increasing() -> Bool { +test fn w_red_reversed_revenue_pair_not_increasing() -> Bool { !w_filed_count_increases(prev: gitlab_fy2026_revenue, next: gitlab_fy2025_revenue) } -fn w_red_reversed_share_pair_not_declining() -> Bool { +test fn w_red_reversed_share_pair_not_declining() -> Bool { !w_share_of_revenue_declines( numer_prev: gitlab_fy2026_selling_and_marketing, revenue_prev: gitlab_fy2026_revenue, @@ -576,7 +576,7 @@ fn w_red_reversed_share_pair_not_declining() -> Bool { ) } -fn w_red_perturbed_gross_profit_leaves_margin_band() -> Bool { +test fn w_red_perturbed_gross_profit_leaves_margin_band() -> Bool { !w_gross_margin_in_series_band( revenue: gitlab_fy2024_revenue, gross_profit: FiledMonetaryFact { @@ -587,36 +587,10 @@ fn w_red_perturbed_gross_profit_leaves_margin_band() -> Bool { ) } -fn w_red_floor_disclosure_has_no_exact_value() -> Bool { +test fn w_red_floor_disclosure_has_no_exact_value() -> Bool { match disclosed_rate_exact_percent(rate: gitlab_fy2023_dbnrr.rate) { Present { value: _ } => false _ => true } } -test fn gitlab_10k_income_series_witness() -> Bool { - w_all_seven_years_cross_foot() - && w_revenue_strictly_increases_every_year() - && w_sales_and_marketing_share_declines_every_year() - && w_gross_margin_high_80s_every_year() - && w_operating_income_negative_all_seven_years() - && w_net_income_negative_all_seven_years() - && w_operating_loss_narrows_fy2023_to_fy2026() - && w_fy2024_net_loss_exceeds_operating_loss() - && w_fy2025_net_loss_below_ten_million() - && w_purchase_obligations_coherent() - && w_dbnrr_at_least_100_every_disclosed_year() - && w_dbnrr_exact_era_strictly_declines() - && w_dbnrr_fy2022_disclosed_as_floor_152() - && w_customers_100k_strictly_increase() - && w_premium_listed_29_usd_billed_annually() - && w_ultimate_pricing_is_custom_negotiated() - && w_free_tier_is_free_of_charge() - && w_duo_credit_bundles_order_with_tier() - && w_premium_price_history_coheres_with_live_list_price() - && w_red_perturbed_operating_income_breaks_cross_foot() - && w_red_reversed_revenue_pair_not_increasing() - && w_red_reversed_share_pair_not_declining() - && w_red_perturbed_gross_profit_leaves_margin_band() - && w_red_floor_disclosure_has_no_exact_value() -} diff --git a/dag/test/claim/go_module_versioning_witness_test.dag b/dag/test/claim/go_module_versioning_witness_test.dag index 435f93cbbaf..52e587177f5 100644 --- a/dag/test/claim/go_module_versioning_witness_test.dag +++ b/dag/test/claim/go_module_versioning_witness_test.dag @@ -1,64 +1,63 @@ module test.claim.go_module_versioning_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_go_manifest_file() -> Bool { +test fn w_go_manifest_file() -> Bool { go_manifest_file == "go.mod" } -fn w_major_v0_or_v1_suffix_is_empty() -> Bool { +test fn w_major_v0_or_v1_suffix_is_empty() -> Bool { go_major_suffix_str(suffix: MajorV0OrV1) == "" } -fn w_major_v2_suffix() -> Bool { +test fn w_major_v2_suffix() -> Bool { go_major_suffix_str(suffix: MajorV2Plus { major: 2 }) == "/v2" } -fn w_major_v3_suffix() -> Bool { +test fn w_major_v3_suffix() -> Bool { go_major_suffix_str(suffix: MajorV2Plus { major: 3 }) == "/v3" } -fn w_suffixes_are_distinct() -> Bool { +test fn w_suffixes_are_distinct() -> Bool { go_major_suffix_str(suffix: MajorV2Plus { major: 2 }) != go_major_suffix_str(suffix: MajorV0OrV1) } -fn w_semver_release_label() -> Bool { +test fn w_semver_release_label() -> Bool { go_semver_label(v: GoSemVer { major: 1, minor: 2, patch: 3, prerelease: none, build: none }) == "v1.2.3" } -fn w_semver_v0_label() -> Bool { +test fn w_semver_v0_label() -> Bool { go_semver_label(v: GoSemVer { major: 0, minor: 1, patch: 0, prerelease: none, build: none }) == "v0.1.0" } -fn w_semver_prerelease_label() -> Bool { +test fn w_semver_prerelease_label() -> Bool { go_semver_label(v: GoSemVer { major: 1, minor: 0, patch: 0, prerelease: Present { value: "alpha.1" }, build: none }) == "v1.0.0-alpha.1" } -fn w_semver_build_label() -> Bool { +test fn w_semver_build_label() -> Bool { go_semver_label(v: GoSemVer { major: 1, minor: 0, patch: 0, prerelease: none, build: Present { value: "build.42" } }) == "v1.0.0+build.42" } -fn w_semver_prerelease_and_build_label() -> Bool { +test fn w_semver_prerelease_and_build_label() -> Bool { go_semver_label(v: GoSemVer { major: 2, minor: 0, patch: 0, prerelease: Present { value: "rc.1" }, build: Present { value: "exp" } }) == "v2.0.0-rc.1+exp" } -fn w_semver_labels_distinct() -> Bool { +test fn w_semver_labels_distinct() -> Bool { go_semver_label(v: GoSemVer { major: 1, minor: 2, patch: 3, prerelease: none, build: none @@ -72,17 +71,17 @@ fn mvs_property_count(ps: List) -> Int { fold(ps, init: 0, f: (acc, _p) => acc + 1) } -fn w_go_mvs_has_three_properties() -> Bool { +test fn w_go_mvs_has_three_properties() -> Bool { mvs_property_count(ps: go_mvs_properties) == 3 } -fn w_go_semver_to_version_identity() -> Bool { +test fn w_go_semver_to_version_identity() -> Bool { go_semver_to_version_identity(v: GoSemVer { major: 1, minor: 2, patch: 3, prerelease: none, build: none }) == "v1.2.3" } -fn w_go_semver_compare_major_less() -> Bool { +test fn w_go_semver_compare_major_less() -> Bool { match go_semver_compare( a: GoSemVer { major: 1, minor: 0, patch: 0, prerelease: none, build: none }, b: GoSemVer { major: 2, minor: 0, patch: 0, prerelease: none, build: none } @@ -93,7 +92,7 @@ fn w_go_semver_compare_major_less() -> Bool { } } -fn w_go_semver_compare_patch_greater() -> Bool { +test fn w_go_semver_compare_patch_greater() -> Bool { match go_semver_compare( a: GoSemVer { major: 1, minor: 0, patch: 5, prerelease: none, build: none }, b: GoSemVer { major: 1, minor: 0, patch: 2, prerelease: none, build: none } @@ -104,7 +103,7 @@ fn w_go_semver_compare_patch_greater() -> Bool { } } -fn w_go_semver_compare_equal() -> Bool { +test fn w_go_semver_compare_equal() -> Bool { match go_semver_compare( a: GoSemVer { major: 1, minor: 2, patch: 3, prerelease: none, build: none }, b: GoSemVer { major: 1, minor: 2, patch: 3, prerelease: none, build: none } @@ -115,7 +114,7 @@ fn w_go_semver_compare_equal() -> Bool { } } -fn w_go_semver_compare_no_pre_beats_pre() -> Bool { +test fn w_go_semver_compare_no_pre_beats_pre() -> Bool { match go_semver_compare( a: GoSemVer { major: 1, minor: 0, patch: 0, prerelease: none, build: none }, b: GoSemVer { major: 1, minor: 0, patch: 0, prerelease: Present { value: "alpha.1" }, build: none } @@ -126,32 +125,11 @@ fn w_go_semver_compare_no_pre_beats_pre() -> Bool { } } -fn w_emit_host_min_go_language_version() -> Bool { +test fn w_emit_host_min_go_language_version() -> Bool { emit_host_min_go_language_version == "1.22" } -fn w_emit_host_bootstrap_toolchain() -> Bool { +test fn w_emit_host_bootstrap_toolchain() -> Bool { emit_host_bootstrap_toolchain == "go1.22.5" } -test fn go_module_versioning_witnesses() -> Bool { - w_go_manifest_file() - && w_major_v0_or_v1_suffix_is_empty() - && w_major_v2_suffix() - && w_major_v3_suffix() - && w_suffixes_are_distinct() - && w_semver_release_label() - && w_semver_v0_label() - && w_semver_prerelease_label() - && w_semver_build_label() - && w_semver_prerelease_and_build_label() - && w_semver_labels_distinct() - && w_go_mvs_has_three_properties() - && w_go_semver_to_version_identity() - && w_go_semver_compare_major_less() - && w_go_semver_compare_patch_greater() - && w_go_semver_compare_equal() - && w_go_semver_compare_no_pre_beats_pre() - && w_emit_host_min_go_language_version() - && w_emit_host_bootstrap_toolchain() -} diff --git a/dag/test/claim/gpu_interconnect_and_sm_cache_witness_test.dag b/dag/test/claim/gpu_interconnect_and_sm_cache_witness_test.dag index bb2c3d5331c..843859cc7e9 100644 --- a/dag/test/claim/gpu_interconnect_and_sm_cache_witness_test.dag +++ b/dag/test/claim/gpu_interconnect_and_sm_cache_witness_test.dag @@ -21,7 +21,7 @@ data rtx_5090_pcie_lane_count: Nat = 16 data rtx_5090_sm_shared_memory_bytes: Nat = 102400 data rtx_5090_sm_register_file_bytes: Nat = 262144 -fn w_rtx_5090_interconnect_is_the_shared_pcie_authority() -> Bool { +test fn w_rtx_5090_interconnect_is_the_shared_pcie_authority() -> Bool { match nvidia_rtx_5090_catalog.interconnect { Present { value: link } => link.generation == Gen5 @@ -32,7 +32,7 @@ fn w_rtx_5090_interconnect_is_the_shared_pcie_authority() -> Bool { } } -fn w_rtx_5090_sm_cache_geometry_matches_cuda_docs() -> Bool { +test fn w_rtx_5090_sm_cache_geometry_matches_cuda_docs() -> Bool { match nvidia_rtx_5090_catalog.sm_cache { Present { value: geometry } => byte_size_count(b: geometry.shared_memory_per_sm) == rtx_5090_sm_shared_memory_bytes @@ -42,13 +42,13 @@ fn w_rtx_5090_sm_cache_geometry_matches_cuda_docs() -> Bool { } } -fn w_rtx_5090_sm_cache_citations_cover_both_fields() -> Bool { +test fn w_rtx_5090_sm_cache_citations_cover_both_fields() -> Bool { let citations = rtx_5090_sm_cache_citations list_length(items: citations) == 2 && citations.first().authority == cuda_compute_capabilities_authority } -fn w_apple_m5_gpu_leaves_unified_soc_facts_unfabricated() -> Bool { +test fn w_apple_m5_gpu_leaves_unified_soc_facts_unfabricated() -> Bool { match apple_m5_gpu_catalog.interconnect { Absent => true Present { value: _ } => false @@ -59,9 +59,3 @@ fn w_apple_m5_gpu_leaves_unified_soc_facts_unfabricated() -> Bool { } } -test fn gpu_interconnect_and_sm_cache_witnesses() -> Bool { - w_rtx_5090_interconnect_is_the_shared_pcie_authority() - && w_rtx_5090_sm_cache_geometry_matches_cuda_docs() - && w_rtx_5090_sm_cache_citations_cover_both_fields() - && w_apple_m5_gpu_leaves_unified_soc_facts_unfabricated() -} diff --git a/dag/test/claim/grounded_principal_witness_test.dag b/dag/test/claim/grounded_principal_witness_test.dag index 4dd7ff915b7..2256863dbe5 100644 --- a/dag/test/claim/grounded_principal_witness_test.dag +++ b/dag/test/claim/grounded_principal_witness_test.dag @@ -1,9 +1,8 @@ module test.claim.grounded_principal_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_runner_fiction_not_in_roster() -> Bool { +test fn witness_runner_fiction_not_in_roster() -> Bool { !fleet_posix_account_exists(name: "runner" as NonEmptyStr) && match fleet_posix_account_from_name(name: "runner" as NonEmptyStr) { Present { value: _ } => false @@ -11,19 +10,19 @@ fn witness_runner_fiction_not_in_roster() -> Bool { } } -fn witness_ghrunner_is_ci_deploy_principal() -> Bool { +test fn witness_ghrunner_is_ci_deploy_principal() -> Bool { let deploy_name = grounded_posix_principal_name(p: ci_deploy_srv1_access.principal) let roster_name = grounded_posix_principal_name(p: fleet_posix_principal(key: FleetAccountCiRunner)) deploy_name == "ghrunner" && deploy_name == roster_name } -fn witness_operator_is_manual_deploy_principal() -> Bool { +test fn witness_operator_is_manual_deploy_principal() -> Bool { let deploy_name = grounded_posix_principal_name(p: ci_deploy_srv1_operator_access.principal) let roster_name = grounded_posix_principal_name(p: fleet_posix_principal(key: FleetAccountOperator)) deploy_name == "briansrls" && deploy_name == roster_name } -fn witness_briansrls_fork_dissolved() -> Bool { +test fn witness_briansrls_fork_dissolved() -> Bool { host_identity_operator_principal_name() == "briansrls" && tailscale_acl_operator_email() == fleet_operator_email && operator_principal_member() == fleet_operator_gcp_iam_member() @@ -33,14 +32,14 @@ fn witness_briansrls_fork_dissolved() -> Bool { ) } -fn witness_declared_probe_names_principal() -> Bool { +test fn witness_declared_probe_names_principal() -> Bool { posix_declared_probe_names_principal(p: fleet_posix_principal(key: FleetAccountCiRunner)) && posix_declared_probe_names_principal(p: fleet_posix_principal(key: FleetAccountOperator)) && posix_declared_probe_names_principal(p: fleet_posix_principal(key: FleetAccountRoot)) && posix_declared_probe_names_principal(p: fleet_posix_principal(key: FleetAccountSrv3Host)) } -fn witness_declared_probe_mismatch_red() -> Bool { +test fn witness_declared_probe_mismatch_red() -> Bool { let p = fleet_posix_principal(key: FleetAccountCiRunner) let poisoned = GroundedPosixPrincipal { posix: p.posix, @@ -54,7 +53,7 @@ fn witness_declared_probe_mismatch_red() -> Bool { !posix_declared_probe_names_principal(p: poisoned) } -fn witness_ci_runner_sudo_grants_derive_privileged_commands() -> Bool { +test fn witness_ci_runner_sudo_grants_derive_privileged_commands() -> Bool { let principal = fleet_posix_principal(key: FleetAccountCiRunner) let grounded = grounded_principal_privileged_commands(p: principal) let composed = srv1_live_deploy_privileged_commands() @@ -65,17 +64,17 @@ fn witness_ci_runner_sudo_grants_derive_privileged_commands() -> Bool { && !any(grounded, c => c.path == "/usr/bin/bash") } -fn witness_preflight_shell_is_dash_safe() -> Bool { +test fn witness_preflight_shell_is_dash_safe() -> Bool { deploy_preflight_shell_header == "set -eu" && !string_contains(s: deploy_preflight_shell_header, pattern: "pipefail") } -fn witness_gha_runner_context_is_not_os_account() -> Bool { +test fn witness_gha_runner_context_is_not_os_account() -> Bool { context_name(context: Runner) == "runner" && !fleet_posix_account_exists(name: "runner" as NonEmptyStr) } -fn witness_operator_secret_binding_uses_fleet_gcp_member() -> Bool { +test fn witness_operator_secret_binding_uses_fleet_gcp_member() -> Bool { operator_tailscale_acl_secret_bindings.first().member == fleet_operator_gcp_iam_member() && operator_principal_member() == fleet_operator_gcp_iam_member() } @@ -87,7 +86,7 @@ fn srv1_host_observation() -> DeployTargetHostObservation { ) } -fn witness_ci_runner_grounded_access_gate_permits() -> Bool { +test fn witness_ci_runner_grounded_access_gate_permits() -> Bool { match deploy_mutation_gate( access: ci_deploy_srv1_access, fixture_actor: Present { @@ -100,7 +99,7 @@ fn witness_ci_runner_grounded_access_gate_permits() -> Bool { } } -fn witness_operator_grounded_access_gate_permits() -> Bool { +test fn witness_operator_grounded_access_gate_permits() -> Bool { match deploy_mutation_gate( access: ci_deploy_srv1_operator_access, fixture_actor: Present { @@ -113,24 +112,24 @@ fn witness_operator_grounded_access_gate_permits() -> Bool { } } -fn witness_deploy_authorization_query_grounds_expected_principal() -> Bool { +test fn witness_deploy_authorization_query_grounds_expected_principal() -> Bool { let query = deploy_access_authorization_query(access: ci_deploy_srv1_access) query.expected_principal == "ghrunner" && query.envelope.grants.count() == 6 } -fn witness_deploy_preflight_plan_has_whoami_plus_privileged_probes() -> Bool { +test fn witness_deploy_preflight_plan_has_whoami_plus_privileged_probes() -> Bool { let plan = deploy_access_preflight_plan(access: ci_deploy_srv1_access) plan.steps.count() == 7 } -fn witness_deploy_preflight_plan_uses_typed_probes() -> Bool { +test fn witness_deploy_preflight_plan_uses_typed_probes() -> Bool { deploy_access_preflight_plan_uses_typed_probes( plan: deploy_access_preflight_plan(access: ci_deploy_srv1_access) ) } -fn witness_deploy_preflight_plan_first_step_reads_principal() -> Bool { +test fn witness_deploy_preflight_plan_first_step_reads_principal() -> Bool { match deploy_access_preflight_plan_first_effect( plan: deploy_access_preflight_plan(access: ci_deploy_srv1_access) ) { @@ -143,7 +142,7 @@ fn witness_deploy_preflight_plan_first_step_reads_principal() -> Bool { } } -fn witness_deploy_preflight_plan_shell_command_red() -> Bool { +test fn witness_deploy_preflight_plan_shell_command_red() -> Bool { let poisoned = EffectPlan { steps: [Do { effect: ShellCommand { script: "whoami" } }], on_failure: FailFast, @@ -151,7 +150,7 @@ fn witness_deploy_preflight_plan_shell_command_red() -> Bool { !deploy_access_preflight_plan_uses_typed_probes(plan: poisoned) } -fn witness_deploy_grant_admits_apt_get_probe() -> Bool { +test fn witness_deploy_grant_admits_apt_get_probe() -> Bool { match deploy_access_grant_admits_probe( access: ci_deploy_srv1_access, cmd: deploy_access_apt_get_privileged_command() @@ -161,7 +160,7 @@ fn witness_deploy_grant_admits_apt_get_probe() -> Bool { } } -fn witness_deploy_grant_refuses_outside_envelope() -> Bool { +test fn witness_deploy_grant_refuses_outside_envelope() -> Bool { match deploy_access_grant_admits_probe( access: ci_deploy_srv1_access, cmd: PrivilegedCommand { path: "/usr/bin/bash" as NonEmptyStr, check: "--version" as NonEmptyStr } @@ -178,7 +177,7 @@ fn witness_srv1_job_principal_resolves_from_runner() -> Bool { } } -fn witness_deploy_job_principal_unresolved_refuses_not_maps_ghrunner() -> Bool { +test fn witness_deploy_job_principal_unresolved_refuses_not_maps_ghrunner() -> Bool { let poisoned = DeployRunnerPrincipal { unit_user: "root", job_user: "runner" as NonEmptyStr } match fleet_deploy_job_principal(runner: poisoned) { Present { value: _ } => false @@ -186,7 +185,7 @@ fn witness_deploy_job_principal_unresolved_refuses_not_maps_ghrunner() -> Bool { } } -fn witness_unknown_job_user_does_not_silent_map_ci_runner() -> Bool { +test fn witness_unknown_job_user_does_not_silent_map_ci_runner() -> Bool { let poisoned = DeployRunnerPrincipal { unit_user: "root", job_user: "runner" as NonEmptyStr } match deploy_access_or_refusal_for_runner( runner: poisoned, @@ -198,36 +197,36 @@ fn witness_unknown_job_user_does_not_silent_map_ci_runner() -> Bool { } } -fn witness_two_phase_principal_derives_job_user() -> Bool { +test fn witness_two_phase_principal_derives_job_user() -> Bool { witness_srv1_job_principal_resolves_from_runner() && srv1_ci_deploy_runner_principal.unit_user == "root" && srv1_ci_deploy_runner_principal.job_user == "ghrunner" && grounded_posix_principal_name(p: ci_deploy_srv1_access.principal) == srv1_ci_deploy_runner_principal.job_user } -fn witness_srv3_host_roster_row_exists() -> Bool { +test fn witness_srv3_host_roster_row_exists() -> Bool { fleet_posix_account_exists(name: "ubuntu" as NonEmptyStr) && grounded_posix_principal_name(p: fleet_posix_principal(key: FleetAccountSrv3Host)) == "ubuntu" } -fn witness_deploy_sudo_grants_refuse_generic_movers() -> Bool { +test fn witness_deploy_sudo_grants_refuse_generic_movers() -> Bool { deploy_access_sudo_grants_lint_ok(access: ci_deploy_srv1_access) } -fn witness_blessed_helper_grant_absent_from_roster() -> Bool { +test fn witness_blessed_helper_grant_absent_from_roster() -> Bool { !any( fleet_posix_ci_runner_sudo_grants(), g => g.command_path == gunbc_deploy_privileged_helper_path ) } -fn witness_unknown_sudo_grant_command_lint_red() -> Bool { +test fn witness_unknown_sudo_grant_command_lint_red() -> Bool { !posix_sudo_grant_generic_mover_lint_ok( g: PosixSudoGrant { command_path: "/usr/bin/bash" as NonEmptyStr, check_argv: "--version" } ) } -fn witness_posix_sudo_grant_materializes_execute_grant() -> Bool { +test fn witness_posix_sudo_grant_materializes_execute_grant() -> Bool { let projected = posix_sudo_grant_to_effect_grant( g: PosixSudoGrant { command_path: fleet_apt_get_binary_path, check_argv: "--help" } ) @@ -239,32 +238,3 @@ fn witness_posix_sudo_grant_materializes_execute_grant() -> Bool { && position_under(target: root, root: expected) } -test fn grounded_principal_witnesses() -> Bool { - witness_runner_fiction_not_in_roster() - && witness_ghrunner_is_ci_deploy_principal() - && witness_operator_is_manual_deploy_principal() - && witness_briansrls_fork_dissolved() - && witness_declared_probe_names_principal() - && witness_declared_probe_mismatch_red() - && witness_ci_runner_sudo_grants_derive_privileged_commands() - && witness_gha_runner_context_is_not_os_account() - && witness_preflight_shell_is_dash_safe() - && witness_operator_secret_binding_uses_fleet_gcp_member() - && witness_ci_runner_grounded_access_gate_permits() - && witness_operator_grounded_access_gate_permits() - && witness_deploy_authorization_query_grounds_expected_principal() - && witness_deploy_preflight_plan_has_whoami_plus_privileged_probes() - && witness_deploy_preflight_plan_uses_typed_probes() - && witness_deploy_preflight_plan_first_step_reads_principal() - && witness_deploy_preflight_plan_shell_command_red() - && witness_deploy_grant_admits_apt_get_probe() - && witness_deploy_grant_refuses_outside_envelope() - && witness_two_phase_principal_derives_job_user() - && witness_deploy_job_principal_unresolved_refuses_not_maps_ghrunner() - && witness_unknown_job_user_does_not_silent_map_ci_runner() - && witness_srv3_host_roster_row_exists() - && witness_deploy_sudo_grants_refuse_generic_movers() - && witness_blessed_helper_grant_absent_from_roster() - && witness_unknown_sudo_grant_command_lint_red() - && witness_posix_sudo_grant_materializes_execute_grant() -} diff --git a/dag/test/claim/hardware_selection_witness_test.dag b/dag/test/claim/hardware_selection_witness_test.dag index fae6a2a3fa5..5c7507e36a6 100644 --- a/dag/test/claim/hardware_selection_witness_test.dag +++ b/dag/test/claim/hardware_selection_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.hardware_selection - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data altra8: Platform = Platform { @@ -120,27 +119,27 @@ data cfg_b_axes: HardwareAxes = config_axes(cfg: sys(cpu: cpu_fast, mem: mem_2rx data cfg_c_axes: HardwareAxes = config_axes(cfg: sys(cpu: cpu_fast, mem: mem_1rx8_1dpc)) data cfg_slow_axes: HardwareAxes = config_axes(cfg: sys(cpu: cpu_slow, mem: mem_1rx8_2dpc)) -fn downclock_is_rank_dependent() -> Bool { +test fn downclock_is_rank_dependent() -> Bool { effective_data_rate_mts(platform: altra8, dimms_per_channel: 2, rank_count: 1) == 3200 && effective_data_rate_mts(platform: altra8, dimms_per_channel: 2, rank_count: 2) == 2933 && effective_data_rate_mts(platform: altra8, dimms_per_channel: 1, rank_count: 2) == 3200 } -fn psu_sizing_is_computed() -> Bool { +test fn psu_sizing_is_computed() -> Bool { psu_is_adequate(cfg: sys(cpu: cpu_fast, mem: mem_1rx8_2dpc)) && watt_count(w: wall_draw_watts(cfg: sys(cpu: cpu_fast, mem: mem_1rx8_2dpc))) == 281 } -fn rank_tradeoff_is_incomparable() -> Bool { +test fn rank_tradeoff_is_incomparable() -> Bool { verdict_is_incomparable(v: dominates(a: cfg_a_axes, b: cfg_b_axes)) && verdict_is_incomparable(v: dominates(a: cfg_b_axes, b: cfg_a_axes)) } -fn higher_throughput_dominates() -> Bool { +test fn higher_throughput_dominates() -> Bool { verdict_dominates(v: dominates(a: cfg_a_axes, b: cfg_slow_axes)) } -fn front_keeps_tradeoffs_strips_dominated() -> Bool { +test fn front_keeps_tradeoffs_strips_dominated() -> Bool { let pool = [cfg_a_axes, cfg_b_axes, cfg_c_axes, cfg_slow_axes] axes_on_front(candidate: cfg_a_axes, pool: pool) && axes_on_front(candidate: cfg_b_axes, pool: pool) @@ -148,29 +147,19 @@ fn front_keeps_tradeoffs_strips_dominated() -> Bool { && !axes_on_front(candidate: cfg_slow_axes, pool: pool) } -fn realizability_rejects_impossible_sku() -> Bool { +test fn realizability_rejects_impossible_sku() -> Bool { dram_module_is_realizable(module: mod_1rx8_16g, jedec: ddr4_generation_catalog) && dram_module_is_realizable(module: mod_2rx8_16g, jedec: ddr4_generation_catalog) && !dram_module_is_realizable(module: mod_1rx8_32g_impossible, jedec: ddr4_generation_catalog) && config_is_realizable(cfg: sys(cpu: cpu_fast, mem: mem_1rx8_2dpc)) } -fn real_part_computes_real_die_density() -> Bool { +test fn real_part_computes_real_die_density() -> Bool { byte_size_count(b: dram_module_required_die_density(module: mod_1rx4_16g)) == 1073741824 } -fn derived_ratios_are_computed() -> Bool { +test fn derived_ratios_are_computed() -> Bool { cost_micros_per_gib(a: cfg_a_axes) > 0 && bandwidth_per_watt(a: cfg_a_axes) > bandwidth_per_watt(a: cfg_b_axes) } -test fn hardware_selection_holds() -> Bool { - downclock_is_rank_dependent() - && psu_sizing_is_computed() - && rank_tradeoff_is_incomparable() - && higher_throughput_dominates() - && front_keeps_tradeoffs_strips_dominated() - && realizability_rejects_impossible_sku() - && real_part_computes_real_die_density() - && derived_ratios_are_computed() -} diff --git a/dag/test/claim/hermetic_fixture_realization_test.dag b/dag/test/claim/hermetic_fixture_realization_test.dag index 071e23108b9..0422427564b 100644 --- a/dag/test/claim/hermetic_fixture_realization_test.dag +++ b/dag/test/claim/hermetic_fixture_realization_test.dag @@ -1,11 +1,10 @@ module test.claim.hermetic_fixture_realization - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data shared_input_digest: ContentHash = "hermetic-fixture-witness-shared-input-digest" -fn witness_file_handler_is_content_addressed_reference() -> Bool { +test fn witness_file_handler_is_content_addressed_reference() -> Bool { let f = cache_interface_facts_from_catalog(row: hermetic_fixture_file_facts) (catalog_key_derivation_classification(kd: hermetic_fixture_file_facts.key_derivation) == ContentAddressedByValue) && f.key_derivation.content_verified_on_read @@ -13,7 +12,7 @@ fn witness_file_handler_is_content_addressed_reference() -> Bool { && (f.value_shape == StructuredArtifact) } -fn witness_in_process_handler_is_content_addressed_converged() -> Bool { +test fn witness_in_process_handler_is_content_addressed_converged() -> Bool { let m = cache_interface_facts_from_catalog(row: hermetic_fixture_in_process_facts) (catalog_key_derivation_classification(kd: hermetic_fixture_in_process_facts.key_derivation) == ContentAddressedByValue) && m.key_derivation.content_verified_on_read @@ -21,7 +20,7 @@ fn witness_in_process_handler_is_content_addressed_converged() -> Bool { && (m.value_shape == StructuredArtifact) } -fn witness_handlers_converged_on_key_derivation() -> Bool { +test fn witness_handlers_converged_on_key_derivation() -> Bool { let f = cache_interface_facts_from_catalog(row: hermetic_fixture_file_facts) let m = cache_interface_facts_from_catalog(row: hermetic_fixture_in_process_facts) let f_class = catalog_key_derivation_classification(kd: hermetic_fixture_file_facts.key_derivation) @@ -33,7 +32,7 @@ fn witness_handlers_converged_on_key_derivation() -> Bool { && !(f.locality == m.locality) } -fn witness_handlers_share_kernel_invariants() -> Bool { +test fn witness_handlers_share_kernel_invariants() -> Bool { let f = cache_interface_facts_from_catalog(row: hermetic_fixture_file_facts) let m = cache_interface_facts_from_catalog(row: hermetic_fixture_in_process_facts) (f.value_shape == m.value_shape) @@ -41,7 +40,7 @@ fn witness_handlers_share_kernel_invariants() -> Bool { && (m.miss_semantics == MissIsDiagnostic) } -fn witness_one_artifact_routes_to_both_backends() -> Bool { +test fn witness_one_artifact_routes_to_both_backends() -> Bool { let id = ArtifactIdentity { subject_digest: shared_input_digest, artifact_kind: hermetic_fixture_artifact_kind, @@ -53,10 +52,3 @@ fn witness_one_artifact_routes_to_both_backends() -> Bool { && !(file_key.store == mem_key.store) } -test fn hermetic_fixture_realization_witnesses() -> Bool { - witness_file_handler_is_content_addressed_reference() - && witness_in_process_handler_is_content_addressed_converged() - && witness_handlers_converged_on_key_derivation() - && witness_handlers_share_kernel_invariants() - && witness_one_artifact_routes_to_both_backends() -} diff --git a/dag/test/claim/hetzner_cost_quote_witness_test.dag b/dag/test/claim/hetzner_cost_quote_witness_test.dag index 607563bf803..f7f8137167b 100644 --- a/dag/test/claim/hetzner_cost_quote_witness_test.dag +++ b/dag/test/claim/hetzner_cost_quote_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.hetzner_cost_quote_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn hetzner_cax41_hourly_micros() -> std.nat.Nat { @@ -12,7 +11,7 @@ fn hetzner_cax41_hourly_micros() -> std.nat.Nat { ) } -fn hetzner_cax41_cost_class_is_per_second_billed() -> Bool { +test fn hetzner_cax41_cost_class_is_per_second_billed() -> Bool { let quote = per_second_billed_cost_quote( unit_price: cax41_catalog.hourly, currency: cax41_catalog.currency, @@ -25,19 +24,14 @@ fn hetzner_cax41_cost_class_is_per_second_billed() -> Bool { } } -fn hetzner_cax41_currency_is_eur() -> Bool { +test fn hetzner_cax41_currency_is_eur() -> Bool { match cax41_catalog.currency { Eur => true _ => false } } -fn hetzner_cax41_unit_price_matches_catalog() -> Bool { +test fn hetzner_cax41_unit_price_matches_catalog() -> Bool { hetzner_cax41_hourly_micros() == 50500 } -test fn hetzner_cost_quote_witness_holds() -> Bool { - hetzner_cax41_cost_class_is_per_second_billed() - && hetzner_cax41_currency_is_eur() - && hetzner_cax41_unit_price_matches_catalog() -} diff --git a/dag/test/claim/host_build_cache_provision_design_witness_test.dag b/dag/test/claim/host_build_cache_provision_design_witness_test.dag index bc4fe41a427..8af258ac1f1 100644 --- a/dag/test/claim/host_build_cache_provision_design_witness_test.dag +++ b/dag/test/claim/host_build_cache_provision_design_witness_test.dag @@ -1,13 +1,12 @@ module test.claim.host_build_cache_provision_design - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn design_witness_read_back_fails_closed_in_shell() -> Bool { +test fn design_witness_read_back_fails_closed_in_shell() -> Bool { build_cache_provision_read_back_fails_closed() } -fn design_witness_unknown_catalog_refuses_at_gate() -> Bool { +test fn design_witness_unknown_catalog_refuses_at_gate() -> Bool { match provision_build_cache_catalog_gate_verdict( catalog_id: provision_build_cache_unknown_catalog_fixture, ) { @@ -16,7 +15,7 @@ fn design_witness_unknown_catalog_refuses_at_gate() -> Bool { } } -fn design_witness_known_non_sccache_catalog_refuses_at_gate() -> Bool { +test fn design_witness_known_non_sccache_catalog_refuses_at_gate() -> Bool { match provision_build_cache_catalog_gate_verdict(catalog_id: gha_actions_cache_id) { ProvisionBuildCacheCatalogRefused { reason: reason } => string_contains(s: reason as String, pattern: "not yet realized") @@ -24,7 +23,7 @@ fn design_witness_known_non_sccache_catalog_refuses_at_gate() -> Bool { } } -fn design_witness_known_non_sccache_catalog_refuses_at_verdict() -> Bool { +test fn design_witness_known_non_sccache_catalog_refuses_at_verdict() -> Bool { match provision_build_cache_verdict( catalog_id: gha_actions_cache_id, observed: DaemonStatsOk { stats_line: "compile_requests=1" }, @@ -35,29 +34,29 @@ fn design_witness_known_non_sccache_catalog_refuses_at_verdict() -> Bool { } } -fn design_witness_sccache_catalog_passes_gate() -> Bool { +test fn design_witness_sccache_catalog_passes_gate() -> Bool { match provision_build_cache_catalog_gate_verdict(catalog_id: sccache_local_id) { ProvisionBuildCacheCatalogRealizable => true ProvisionBuildCacheCatalogRefused { reason: _ } => false } } -fn design_witness_routes_through_host_effect_apply() -> Bool { +test fn design_witness_routes_through_host_effect_apply() -> Bool { provision_build_cache_routes_through_host_effect_apply() } -fn design_witness_default_effect_pins_sccache_catalog() -> Bool { +test fn design_witness_default_effect_pins_sccache_catalog() -> Bool { match provision_build_cache_default_effect() { ProvisionBuildCache { catalog_id: id } => id == sccache_local_id _ => false } } -fn design_witness_absent_daemon_fail_closed() -> Bool { +test fn design_witness_absent_daemon_fail_closed() -> Bool { daemon_absent_refuses_fail_closed() } -fn design_witness_authority_gate_accepts_absent_refusal() -> Bool { +test fn design_witness_authority_gate_accepts_absent_refusal() -> Bool { build_cache_provision_gate_accepts( verdict: provision_build_cache_verdict( catalog_id: sccache_local_id, @@ -67,11 +66,11 @@ fn design_witness_authority_gate_accepts_absent_refusal() -> Bool { ) } -fn design_witness_cited_fatal_error_fragment() -> Bool { +test fn design_witness_cited_fatal_error_fragment() -> Bool { misconfigured_matches_cited_fragment() } -fn design_witness_converged_not_refused_on_ok_stats() -> Bool { +test fn design_witness_converged_not_refused_on_ok_stats() -> Bool { match provision_build_cache_verdict( catalog_id: sccache_local_id, observed: DaemonStatsOk { stats_line: "compile_requests=42" }, @@ -91,7 +90,7 @@ fn witness_widen_sketch_fabricates_converged_on_absent() -> Bool { } } -fn witness_red_control_widen_on_absent_rejected_by_gate() -> Bool { +test fn witness_red_control_widen_on_absent_rejected_by_gate() -> Bool { witness_widen_sketch_fabricates_converged_on_absent() && !build_cache_provision_gate_accepts( verdict: provision_build_cache_absorbing_fallback_widen_sketch( @@ -107,7 +106,7 @@ fn path_shadow_observation_fixture() -> BuildCacheDaemonObservation { DaemonPathShadowed { resolved: "/usr/bin/sccache", expected: "/usr/local/bin/sccache" } } -fn design_witness_path_shadow_refuses_fail_closed() -> Bool { +test fn design_witness_path_shadow_refuses_fail_closed() -> Bool { match provision_build_cache_verdict( catalog_id: sccache_local_id, observed: path_shadow_observation_fixture(), @@ -121,7 +120,7 @@ fn design_witness_path_shadow_refuses_fail_closed() -> Bool { } } -fn design_witness_red_control_widen_on_path_shadow_rejected_by_gate() -> Bool { +test fn design_witness_red_control_widen_on_path_shadow_rejected_by_gate() -> Bool { match provision_build_cache_absorbing_fallback_widen_sketch( catalog_id: sccache_local_id, observed: path_shadow_observation_fixture(), @@ -144,7 +143,7 @@ fn design_witness_red_control_widen_on_path_shadow_rejected_by_gate() -> Bool { ) } -fn design_witness_path_authority_observation_not_emitted_as_shell() -> Bool { +test fn design_witness_path_authority_observation_not_emitted_as_shell() -> Bool { !string_contains( s: build_cache_observe_stats_body(), pattern: "path_authority=SHADOWED", @@ -160,15 +159,15 @@ fn design_witness_path_authority_observation_not_emitted_as_shell() -> Bool { ) } -fn design_witness_install_is_cited_not_package_manager() -> Bool { +test fn design_witness_install_is_cited_not_package_manager() -> Bool { build_cache_install_is_cited_not_package_manager() } -fn design_witness_unit_execstart_matches_install_path() -> Bool { +test fn design_witness_unit_execstart_matches_install_path() -> Bool { build_cache_unit_execstart_matches_install_path() } -fn design_witness_unit_is_foreground_supervised() -> Bool { +test fn design_witness_unit_is_foreground_supervised() -> Bool { build_cache_unit_is_foreground_supervised() } @@ -193,7 +192,7 @@ fn unit_self_exiting_sketch_body() -> String { ], "\n") } -fn design_witness_unit_daemon_runs_until_stopped() -> Bool { +test fn design_witness_unit_daemon_runs_until_stopped() -> Bool { build_cache_unit_daemon_runs_until_stopped() && !build_cache_unit_body_runs_until_stopped(body: unit_self_exiting_sketch_body()) && build_cache_unit_body_runs_until_stopped(body: build_cache_systemd_user_unit_body()) @@ -203,7 +202,7 @@ fn unsupervised_observation_fixture() -> BuildCacheDaemonObservation { DaemonUnsupervised { unit: "sccache.service", unit_state: "inactive (dead)" } } -fn design_witness_unsupervised_refuses_fail_closed() -> Bool { +test fn design_witness_unsupervised_refuses_fail_closed() -> Bool { match provision_build_cache_verdict( catalog_id: sccache_local_id, observed: unsupervised_observation_fixture(), @@ -217,7 +216,7 @@ fn design_witness_unsupervised_refuses_fail_closed() -> Bool { } } -fn design_witness_red_control_widen_on_unsupervised_rejected_by_gate() -> Bool { +test fn design_witness_red_control_widen_on_unsupervised_rejected_by_gate() -> Bool { match provision_build_cache_absorbing_fallback_widen_sketch( catalog_id: sccache_local_id, observed: unsupervised_observation_fixture(), @@ -240,7 +239,7 @@ fn design_witness_red_control_widen_on_unsupervised_rejected_by_gate() -> Bool { ) } -fn design_witness_supervision_observation_not_emitted_as_shell() -> Bool { +test fn design_witness_supervision_observation_not_emitted_as_shell() -> Bool { !string_contains( s: build_cache_observe_stats_body(), pattern: "is-active", @@ -250,20 +249,20 @@ fn design_witness_supervision_observation_not_emitted_as_shell() -> Bool { ) } -fn design_witness_classifier_covers_every_cited_fragment() -> Bool { +test fn design_witness_classifier_covers_every_cited_fragment() -> Bool { build_cache_classifier_covers_every_cited_fragment() } -fn design_witness_classifier_is_a_fold_not_an_unrolled_chain() -> Bool { +test fn design_witness_classifier_is_a_fold_not_an_unrolled_chain() -> Bool { !string_contains(s: build_cache_classify_failure_body(), pattern: "elif") && string_contains(s: build_cache_classify_failure_body(), pattern: "for frag in ") } -fn design_witness_fragment_words_are_shell_safe() -> Bool { +test fn design_witness_fragment_words_are_shell_safe() -> Bool { build_cache_fragment_words_are_shell_safe() } -fn design_witness_release_arch_token_is_fail_closed() -> Bool { +test fn design_witness_release_arch_token_is_fail_closed() -> Bool { match sccache_release_arch_token(arch: Aarch64) { Present { value: token } => token as String == "aarch64" Absent => false @@ -279,7 +278,7 @@ fn design_witness_release_arch_token_is_fail_closed() -> Bool { } } -fn design_witness_release_digest_is_fail_closed() -> Bool { +test fn design_witness_release_digest_is_fail_closed() -> Bool { match sccache_release_digest(rel: sccache_release_0_15_0, arch: Aarch64) { Present { value: d } => d == sccache_release_0_15_0.digest_aarch64 Absent => false @@ -292,7 +291,7 @@ fn design_witness_release_digest_is_fail_closed() -> Bool { } } -fn design_witness_arch_unknown_host_refuses_realization() -> Bool { +test fn design_witness_arch_unknown_host_refuses_realization() -> Bool { match realize_provision_build_cache( effect_intent: provision_build_cache_arch_unknown_intent_fixture(), ) { @@ -303,7 +302,7 @@ fn design_witness_arch_unknown_host_refuses_realization() -> Bool { } } -fn design_witness_known_arch_host_does_not_refuse_for_arch() -> Bool { +test fn design_witness_known_arch_host_does_not_refuse_for_arch() -> Bool { match provision_build_cache_host_arch( effect_intent: provision_build_cache_witness_intent(), ) { @@ -316,34 +315,3 @@ fn design_witness_known_arch_host_does_not_refuse_for_arch() -> Bool { } } -test fn host_build_cache_provision_design_witnesses() -> Bool { - design_witness_read_back_fails_closed_in_shell() - && design_witness_path_shadow_refuses_fail_closed() - && design_witness_red_control_widen_on_path_shadow_rejected_by_gate() - && design_witness_path_authority_observation_not_emitted_as_shell() - && design_witness_install_is_cited_not_package_manager() - && design_witness_unit_execstart_matches_install_path() - && design_witness_unit_is_foreground_supervised() - && design_witness_unit_daemon_runs_until_stopped() - && design_witness_unsupervised_refuses_fail_closed() - && design_witness_red_control_widen_on_unsupervised_rejected_by_gate() - && design_witness_supervision_observation_not_emitted_as_shell() - && design_witness_classifier_covers_every_cited_fragment() - && design_witness_classifier_is_a_fold_not_an_unrolled_chain() - && design_witness_fragment_words_are_shell_safe() - && design_witness_release_arch_token_is_fail_closed() - && design_witness_release_digest_is_fail_closed() - && design_witness_arch_unknown_host_refuses_realization() - && design_witness_known_arch_host_does_not_refuse_for_arch() - && design_witness_unknown_catalog_refuses_at_gate() - && design_witness_known_non_sccache_catalog_refuses_at_gate() - && design_witness_known_non_sccache_catalog_refuses_at_verdict() - && design_witness_sccache_catalog_passes_gate() - && design_witness_routes_through_host_effect_apply() - && design_witness_default_effect_pins_sccache_catalog() - && design_witness_absent_daemon_fail_closed() - && design_witness_authority_gate_accepts_absent_refusal() - && design_witness_cited_fatal_error_fragment() - && design_witness_converged_not_refused_on_ok_stats() - && witness_red_control_widen_on_absent_rejected_by_gate() -} diff --git a/dag/test/claim/host_converge_delta_witness_test.dag b/dag/test/claim/host_converge_delta_witness_test.dag index 55a058cd110..d5e564c342b 100644 --- a/dag/test/claim/host_converge_delta_witness_test.dag +++ b/dag/test/claim/host_converge_delta_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.host_converge_delta_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn fixture_srv2_host() -> RunnerHostDeployment { @@ -66,7 +65,7 @@ fn swap_max_key() -> ConvergeKnobKey { ConvergeKnobKey { slice: RunnerSlice, name: "per_slot_memory_swap_max_bytes" } } -fn witness_two_key_collection_fold() -> Bool { +test fn witness_two_key_collection_fold() -> Bool { let patch = host_converge_three_way_patch( base: fixture_base_knobs(), observed: fixture_base_knobs(), @@ -77,7 +76,7 @@ fn witness_two_key_collection_fold() -> Bool { && list_length(items: patch.entries) == 2 } -fn witness_unchanged_knobs_absent_by_monoid_law() -> Bool { +test fn witness_unchanged_knobs_absent_by_monoid_law() -> Bool { let patch = host_converge_three_way_patch( base: fixture_base_knobs(), observed: fixture_base_knobs(), @@ -93,7 +92,7 @@ fn witness_unchanged_knobs_absent_by_monoid_law() -> Bool { ) } -fn witness_memory_swap_hunks_are_apply() -> Bool { +test fn witness_memory_swap_hunks_are_apply() -> Bool { let patch = host_converge_three_way_patch( base: fixture_base_knobs(), observed: fixture_base_knobs(), @@ -111,7 +110,7 @@ fn witness_memory_swap_hunks_are_apply() -> Bool { } } -fn witness_drifted_knob_is_conflict() -> Bool { +test fn witness_drifted_knob_is_conflict() -> Bool { let drift_observed = fold(fixture_base_knobs(), init: [], f: fn(acc, knob) { if knob.name == "per_slot_memory_max_bytes" { concat(acc, [ @@ -149,7 +148,7 @@ fn witness_drifted_knob_is_conflict() -> Bool { } } -fn witness_two_way_diff_modified_only() -> Bool { +test fn witness_two_way_diff_modified_only() -> Bool { host_converge_patch_hunk_count( patch: host_converge_two_way_diff( left: fixture_base_knobs(), @@ -158,7 +157,7 @@ fn witness_two_way_diff_modified_only() -> Bool { ) == 2 } -fn witness_already_applied_is_noop() -> Bool { +test fn witness_already_applied_is_noop() -> Bool { !host_converge_knob_in_patch( patch: host_converge_three_way_patch( base: fixture_base_knobs(), @@ -183,7 +182,7 @@ fn probe_effective_knob(ee: String) -> ConvergeKnob { ) } -fn witness_payload_drift_not_flattened() -> Bool { +test fn witness_payload_drift_not_flattened() -> Bool { !converge_knob_values_equal( a: probe_effective_knob(ee: "16000000000"), b: probe_effective_knob(ee: "9000000000"), @@ -194,12 +193,3 @@ fn witness_payload_drift_not_flattened() -> Bool { ) } -test fn host_converge_delta_keystone_holds() -> Bool { - witness_two_key_collection_fold() - && witness_unchanged_knobs_absent_by_monoid_law() - && witness_memory_swap_hunks_are_apply() - && witness_drifted_knob_is_conflict() - && witness_two_way_diff_modified_only() - && witness_already_applied_is_noop() - && witness_payload_drift_not_flattened() -} diff --git a/dag/test/claim/host_converge_realize_witness_test.dag b/dag/test/claim/host_converge_realize_witness_test.dag index edbeeeaa6fc..17621a68f9d 100644 --- a/dag/test/claim/host_converge_realize_witness_test.dag +++ b/dag/test/claim/host_converge_realize_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.host_converge_realize_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn fixture_slice_property_knob() -> ConvergeKnob { @@ -19,12 +18,12 @@ fn fixture_slice_property_knob() -> ConvergeKnob { } } -fn witness_every_knob_target_has_kind_label() -> Bool { +test fn witness_every_knob_target_has_kind_label() -> Bool { converge_target_kind_label(t: fixture_slice_property_knob().target) == "SliceProperty" && converge_target_kind_label(t: fixture_slice_property_knob().target) != "" } -fn witness_knob_interpreter_fail_closed_unimplemented() -> Bool { +test fn witness_knob_interpreter_fail_closed_unimplemented() -> Bool { match interpret_converge_knob(knob: fixture_slice_property_knob()) { KnobUnimplemented { knob_name: name, target_kind: kind, reason: why } => name == "fixture_slice_cap" @@ -34,7 +33,7 @@ fn witness_knob_interpreter_fail_closed_unimplemented() -> Bool { } } -fn witness_host_converge_refuses_on_first_knob() -> Bool { +test fn witness_host_converge_refuses_on_first_knob() -> Bool { match interpret_host_converge(host_converge: HostConverge { identity: operator_host_srv3, knobs: [fixture_slice_property_knob()], @@ -46,7 +45,7 @@ fn witness_host_converge_refuses_on_first_knob() -> Bool { } } -fn witness_empty_host_converge_refuses() -> Bool { +test fn witness_empty_host_converge_refuses() -> Bool { match interpret_host_converge(host_converge: HostConverge { identity: operator_host_srv3, knobs: [], @@ -58,9 +57,3 @@ fn witness_empty_host_converge_refuses() -> Bool { } } -test fn host_converge_realize_holds() -> Bool { - witness_every_knob_target_has_kind_label() - && witness_knob_interpreter_fail_closed_unimplemented() - && witness_host_converge_refuses_on_first_knob() - && witness_empty_host_converge_refuses() -} diff --git a/dag/test/claim/host_converge_slice1_witness_test.dag b/dag/test/claim/host_converge_slice1_witness_test.dag index 2c9d239fe7c..d8efafcae79 100644 --- a/dag/test/claim/host_converge_slice1_witness_test.dag +++ b/dag/test/claim/host_converge_slice1_witness_test.dag @@ -49,7 +49,7 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_slice1_knob_is_per_slot_memory_max_on_srv1() -> Bool { +test fn witness_slice1_knob_is_per_slot_memory_max_on_srv1() -> Bool { match host_converge_slice1_srv1_per_slot_memory_max_knob() { Present { value: knob } => knob.name == host_converge_slice1_knob_name @@ -62,7 +62,7 @@ fn witness_slice1_knob_is_per_slot_memory_max_on_srv1() -> Bool { } } -fn witness_fixture_infinity_drifts_against_model_desired() -> Bool { +test fn witness_fixture_infinity_drifts_against_model_desired() -> Bool { match host_converge_slice1_fixture_receipt() { Present { value: receipt } => receipt.host == operator_host_srv1 @@ -72,7 +72,7 @@ fn witness_fixture_infinity_drifts_against_model_desired() -> Bool { } } -fn witness_stdout_parse_grounds_memory_max() -> Bool { +test fn witness_stdout_parse_grounds_memory_max() -> Bool { match runner_unit_live_read_row_from_stdout( unit: host_converge_slice1_probe_unit, stdout: "infinity\n0\ninfinity\n", @@ -83,7 +83,7 @@ fn witness_stdout_parse_grounds_memory_max() -> Bool { } } -fn witness_short_stdout_is_read_absent() -> Bool { +test fn witness_short_stdout_is_read_absent() -> Bool { match runner_unit_memory_live_read_from_stdout( unit: host_converge_slice1_probe_unit, stdout: "infinity\n", @@ -94,7 +94,7 @@ fn witness_short_stdout_is_read_absent() -> Bool { } } -fn witness_verdict_uses_converge_target_not_string_flatten() -> Bool { +test fn witness_verdict_uses_converge_target_not_string_flatten() -> Bool { match host_converge_slice1_srv1_per_slot_memory_max_knob() { Present { value: knob } => match host_converge_slice1_memory_cap_verdict( @@ -122,7 +122,7 @@ fn witness_slice1_show_property_local_read_holds() -> Bool { } } -fn witness_transport_reads_use_show_property_authority() -> Bool { +test fn witness_transport_reads_use_show_property_authority() -> Bool { systemctl_show_property_operation_argv_matches_transport( unit: host_converge_slice1_probe_unit, property: MemoryMax, @@ -135,22 +135,13 @@ fn witness_transport_reads_use_show_property_authority() -> Bool { ) } -test fn host_converge_slice1_wires_srv1_memory_cap() -> Bool { - witness_slice1_knob_is_per_slot_memory_max_on_srv1() - && witness_fixture_infinity_drifts_against_model_desired() - && witness_stdout_parse_grounds_memory_max() - && witness_short_stdout_is_read_absent() - && witness_verdict_uses_converge_target_not_string_flatten() - && witness_transport_reads_use_show_property_authority() -} - -fn witness_list_units_line_parser_takes_first_field_only() -> Bool { +test fn witness_list_units_line_parser_takes_first_field_only() -> Bool { systemctl_list_units_line_as_unit( line: "actions-runner@srv3-01.service loaded active running GitHub Actions Runner", ) == "actions-runner@srv3-01.service" as NonEmptyStr } -fn witness_enumerate_units_uses_typed_list_units_op() -> Bool { +test fn witness_enumerate_units_uses_typed_list_units_op() -> Bool { match systemctl_list_units_active_services(instance_glob: "actions-runner@srv3-*.service" as NonEmptyStr) { Present { value: units } => length(units) == 2 @@ -160,7 +151,7 @@ fn witness_enumerate_units_uses_typed_list_units_op() -> Bool { } } -fn witness_cross_check_enumeration_none_iff_length_matches_declared() -> Bool { +test fn witness_cross_check_enumeration_none_iff_length_matches_declared() -> Bool { let declared = declared_runner_count() let empty_units: List = [] match host_converge_slice1_cross_check_enumeration(host: operator_host_srv3, units: empty_units) { @@ -173,7 +164,7 @@ fn witness_cross_check_enumeration_none_iff_length_matches_declared() -> Bool { } } -fn witness_usage_guard_refusal_routes_to_legacy_refused_with_retryable_reason() -> Bool { +test fn witness_usage_guard_refusal_routes_to_legacy_refused_with_retryable_reason() -> Bool { let outcome: HostConvergeSlice1UnitOutcome = HostConvergeSlice1UnitUsageGuardRefused { unit: host_converge_slice1_probe_unit, current_bytes: byte_size(count: 200), @@ -187,9 +178,3 @@ fn witness_usage_guard_refusal_routes_to_legacy_refused_with_retryable_reason() } } -test fn host_converge_slice1_wires_srv3_multi_unit_generalization() -> Bool { - witness_list_units_line_parser_takes_first_field_only() - && witness_enumerate_units_uses_typed_list_units_op() - && witness_cross_check_enumeration_none_iff_length_matches_declared() - && witness_usage_guard_refusal_routes_to_legacy_refused_with_retryable_reason() -} diff --git a/dag/test/claim/host_effect_apply_witness_test.dag b/dag/test/claim/host_effect_apply_witness_test.dag index 8c1bb4c2f0e..dbdbc42e275 100644 --- a/dag/test/claim/host_effect_apply_witness_test.dag +++ b/dag/test/claim/host_effect_apply_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.host_effect_apply_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn host_os_target() -> NodeControlPlane { @@ -35,7 +34,7 @@ fn directive_is_refused(d: ConvergeDirective) -> Bool { } } -fn witness_shell_on_host_success_converges() -> Bool { +test fn witness_shell_on_host_success_converges() -> Bool { reconciliation_converged(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "true" }, @@ -44,7 +43,7 @@ fn witness_shell_on_host_success_converges() -> Bool { )) } -fn witness_shell_on_host_failure_fails_closed() -> Bool { +test fn witness_shell_on_host_failure_fails_closed() -> Bool { !reconciliation_converged(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "exit 1" }, @@ -53,7 +52,7 @@ fn witness_shell_on_host_failure_fails_closed() -> Bool { )) } -fn witness_redfish_on_bmc_unimplemented_fails_closed() -> Bool { +test fn witness_redfish_on_bmc_unimplemented_fails_closed() -> Bool { !reconciliation_converged(r: host_effect_apply( target: bmc_target(), effect: RedfishAction { action: GetSystem }, @@ -62,7 +61,7 @@ fn witness_redfish_on_bmc_unimplemented_fails_closed() -> Bool { )) } -fn witness_redfish_on_hostos_typed_mismatch() -> Bool { +test fn witness_redfish_on_hostos_typed_mismatch() -> Bool { !reconciliation_converged(r: host_effect_apply( target: host_os_target(), effect: RedfishAction { action: GetSystem }, @@ -71,7 +70,7 @@ fn witness_redfish_on_hostos_typed_mismatch() -> Bool { )) } -fn witness_shell_on_bmc_typed_mismatch() -> Bool { +test fn witness_shell_on_bmc_typed_mismatch() -> Bool { !reconciliation_converged(r: host_effect_apply( target: bmc_target(), effect: ShellCommand { script: "true" }, @@ -80,7 +79,7 @@ fn witness_shell_on_bmc_typed_mismatch() -> Bool { )) } -fn witness_converge_policy_redrives_not_converged() -> Bool { +test fn witness_converge_policy_redrives_not_converged() -> Bool { directive_is_redrive(d: host_effect_drive_directive(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "exit 1" }, @@ -89,7 +88,7 @@ fn witness_converge_policy_redrives_not_converged() -> Bool { ))) } -fn witness_oneshot_policy_terminal_not_converged() -> Bool { +test fn witness_oneshot_policy_terminal_not_converged() -> Bool { directive_is_settled(d: host_effect_drive_directive(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "exit 1" }, @@ -98,7 +97,7 @@ fn witness_oneshot_policy_terminal_not_converged() -> Bool { ))) } -fn witness_incompatible_is_refused_terminal() -> Bool { +test fn witness_incompatible_is_refused_terminal() -> Bool { directive_is_refused(d: host_effect_drive_directive(r: host_effect_apply( target: host_os_target(), effect: RedfishAction { action: GetSystem }, @@ -107,7 +106,7 @@ fn witness_incompatible_is_refused_terminal() -> Bool { ))) } -fn witness_converged_is_settled() -> Bool { +test fn witness_converged_is_settled() -> Bool { directive_is_settled(d: host_effect_drive_directive(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "true" }, @@ -116,7 +115,7 @@ fn witness_converged_is_settled() -> Bool { ))) } -fn witness_ssh_shell_unreachable_fails_closed() -> Bool { +test fn witness_ssh_shell_unreachable_fails_closed() -> Bool { !reconciliation_converged(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "true" }, @@ -125,7 +124,7 @@ fn witness_ssh_shell_unreachable_fails_closed() -> Bool { )) } -fn witness_ssh_empty_script_fails_closed() -> Bool { +test fn witness_ssh_empty_script_fails_closed() -> Bool { !reconciliation_converged(r: host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "" }, @@ -134,7 +133,7 @@ fn witness_ssh_empty_script_fails_closed() -> Bool { )) } -fn witness_shell_failure_surfaces_captured_stdout() -> Bool { +test fn witness_shell_failure_surfaces_captured_stdout() -> Bool { match host_effect_apply( target: host_os_target(), effect: ShellCommand { script: "echo host-effect-preflight-marker && exit 1" }, @@ -148,11 +147,11 @@ fn witness_shell_failure_surfaces_captured_stdout() -> Bool { } } -fn witness_identity_evidence_derives_oneshot_drive() -> Bool { +test fn witness_identity_evidence_derives_oneshot_drive() -> Bool { host_effect_drive_from_evidence(evidence: host_effect_identity_evidence) == OneShot } -fn witness_converge_loop_evidence_derives_converge_drive() -> Bool { +test fn witness_converge_loop_evidence_derives_converge_drive() -> Bool { host_effect_drive_from_evidence(evidence: host_effect_converge_loop_evidence) == ConvergeLoop } @@ -161,11 +160,11 @@ data witness_arbitrary_non_idempotent_evidence: IdempotencyEvidence = NonIdempot reason: "breaking side effect — not a converge-loop authorization", } -fn witness_arbitrary_non_idempotent_derives_oneshot_not_redrive() -> Bool { +test fn witness_arbitrary_non_idempotent_derives_oneshot_not_redrive() -> Bool { host_effect_drive_from_evidence(evidence: witness_arbitrary_non_idempotent_evidence) == OneShot } -fn witness_lattice_breaking_shape_derives_oneshot_not_redrive() -> Bool { +test fn witness_lattice_breaking_shape_derives_oneshot_not_redrive() -> Bool { host_effect_drive_from_evidence(evidence: LatticeEffect { shape: AppendEffect }) == OneShot } @@ -195,7 +194,7 @@ fn fixture_srv1_host_converge() -> HostConverge { } } -fn witness_converge_plan_fail_closed_on_knob_frontier() -> Bool { +test fn witness_converge_plan_fail_closed_on_knob_frontier() -> Bool { !reconciliation_converged(r: host_effect_apply( target: host_os_target(), effect: ConvergePlan { policy: fixture_srv1_host_converge() }, @@ -204,7 +203,7 @@ fn witness_converge_plan_fail_closed_on_knob_frontier() -> Bool { )) } -fn witness_converge_plan_on_bmc_typed_mismatch() -> Bool { +test fn witness_converge_plan_on_bmc_typed_mismatch() -> Bool { !reconciliation_converged(r: host_effect_apply( target: bmc_target(), effect: ConvergePlan { policy: fixture_srv1_host_converge() }, @@ -213,7 +212,7 @@ fn witness_converge_plan_on_bmc_typed_mismatch() -> Bool { )) } -fn witness_converge_plan_redrives_on_frontier() -> Bool { +test fn witness_converge_plan_redrives_on_frontier() -> Bool { directive_is_redrive(d: host_effect_drive_directive(r: host_effect_apply( target: host_os_target(), effect: ConvergePlan { policy: fixture_srv1_host_converge() }, @@ -222,24 +221,3 @@ fn witness_converge_plan_redrives_on_frontier() -> Bool { ))) } -test fn host_effect_apply_holds() -> Bool { - witness_shell_on_host_success_converges() - && witness_shell_on_host_failure_fails_closed() - && witness_shell_failure_surfaces_captured_stdout() - && witness_ssh_shell_unreachable_fails_closed() - && witness_ssh_empty_script_fails_closed() - && witness_redfish_on_bmc_unimplemented_fails_closed() - && witness_redfish_on_hostos_typed_mismatch() - && witness_shell_on_bmc_typed_mismatch() - && witness_converge_policy_redrives_not_converged() - && witness_oneshot_policy_terminal_not_converged() - && witness_incompatible_is_refused_terminal() - && witness_converged_is_settled() - && witness_identity_evidence_derives_oneshot_drive() - && witness_converge_loop_evidence_derives_converge_drive() - && witness_arbitrary_non_idempotent_derives_oneshot_not_redrive() - && witness_lattice_breaking_shape_derives_oneshot_not_redrive() - && witness_converge_plan_fail_closed_on_knob_frontier() - && witness_converge_plan_on_bmc_typed_mismatch() - && witness_converge_plan_redrives_on_frontier() -} diff --git a/dag/test/claim/host_effect_plan_witness_test.dag b/dag/test/claim/host_effect_plan_witness_test.dag index 5a32d01db1d..2ce49cd50a7 100644 --- a/dag/test/claim/host_effect_plan_witness_test.dag +++ b/dag/test/claim/host_effect_plan_witness_test.dag @@ -61,37 +61,31 @@ fn witness_if_control_flow_plan() -> HostEffectPlan { } } -fn witness_empty_plan_refuses_fail_closed() -> Bool { +test fn witness_empty_plan_refuses_fail_closed() -> Bool { !reconciliation_converged(r: host_effect_plan_apply( plan: witness_empty_plan(), ctx: witness_plan_ctx(), )) } -fn witness_control_flow_step_refuses_fail_closed() -> Bool { +test fn witness_control_flow_step_refuses_fail_closed() -> Bool { !reconciliation_converged(r: host_effect_plan_apply( plan: witness_if_control_flow_plan(), ctx: witness_plan_ctx(), )) } -fn witness_orchestration_to_effect_plan_dissolve_on_present() -> Bool { +test fn witness_orchestration_to_effect_plan_dissolve_on_present() -> Bool { string_contains( s: orchestration_to_effect_plan_dissolve_on, pattern: "dissolve-on: v2.std.orchestration", ) } -fn witness_effect_plan_orchestration_succession_dissolve_on_present() -> Bool { +test fn witness_effect_plan_orchestration_succession_dissolve_on_present() -> Bool { string_contains( s: effect_plan_orchestration_succession_dissolve_on, pattern: "dissolve-on: v2.std.orchestration parallel", ) } -test fn host_effect_plan_witness_holds() -> Bool { - witness_empty_plan_refuses_fail_closed() - && witness_control_flow_step_refuses_fail_closed() - && witness_orchestration_to_effect_plan_dissolve_on_present() - && witness_effect_plan_orchestration_succession_dissolve_on_present() -} diff --git a/dag/test/claim/host_identity_observation_witness_test.dag b/dag/test/claim/host_identity_observation_witness_test.dag index 249e20e99b4..061d1704dfb 100644 --- a/dag/test/claim/host_identity_observation_witness_test.dag +++ b/dag/test/claim/host_identity_observation_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.host_identity_observation_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn srv1_os_target() -> NodeControlPlane { @@ -14,7 +13,7 @@ fn require_dns_label(raw: String) -> DnsLabel { } } -fn witness_hostname_read_argv_is_typed_not_concat() -> Bool { +test fn witness_hostname_read_argv_is_typed_not_concat() -> Bool { match hostname_short_read_operation_argv() { ArgvMaterialized { argv: argv } => hostname_short_read_operation_argv_matches_authority() && join(argv, " ") == "hostname -s" @@ -22,19 +21,19 @@ fn witness_hostname_read_argv_is_typed_not_concat() -> Bool { } } -fn witness_hostname_read_resolves_typed_cell_not_shell_script() -> Bool { +test fn witness_hostname_read_resolves_typed_cell_not_shell_script() -> Bool { match resolve_host_effect_cell(target: srv1_os_target(), effect: HostIdentityShortHostnameRead) { HostnameReadOnHost { node: _ } => true _ => false } } -fn witness_hostname_set_argv_is_typed_not_concat() -> Bool { +test fn witness_hostname_set_argv_is_typed_not_concat() -> Bool { hostname_set_operation_argv_matches_authority(desired: "srv9" as DnsLabel) && join(hostname_set_operation_argv(desired: "srv9" as DnsLabel), " ") == "hostnamectl set-hostname srv9" } -fn witness_hostname_set_resolves_typed_cell_not_shell_script() -> Bool { +test fn witness_hostname_set_resolves_typed_cell_not_shell_script() -> Bool { match resolve_host_effect_cell( target: srv1_os_target(), effect: SetHostnameCas { @@ -48,14 +47,14 @@ fn witness_hostname_set_resolves_typed_cell_not_shell_script() -> Bool { } } -fn witness_hostname_set_privileged_argv_matches_fleet_grant() -> Bool { +test fn witness_hostname_set_privileged_argv_matches_fleet_grant() -> Bool { hostname_set_privileged_operation_argv_matches_fleet_grant( hostnamectl_path: host_identity_hostnamectl_path, desired: "srv9" as DnsLabel, ) } -fn witness_hostname_set_cas_refuses_base_mismatch() -> Bool { +test fn witness_hostname_set_cas_refuses_base_mismatch() -> Bool { match hostname_set_cas( hostnamectl_path: host_identity_hostnamectl_path, transport: LocalShell, @@ -68,41 +67,41 @@ fn witness_hostname_set_cas_refuses_base_mismatch() -> Bool { } } -fn witness_fixture_observation_types_srv1_observed_hostname() -> Bool { +test fn witness_fixture_observation_types_srv1_observed_hostname() -> Bool { let obs = fixture_host_identity_observation() obs.short_hostname == "altrad8ud-1l2t-1" && obs.probed_at == "2026-07-02" && host_identity_observation_nonempty(obs: obs) } -fn witness_fixture_observation_types_srv2_observed_hostname() -> Bool { +test fn witness_fixture_observation_types_srv2_observed_hostname() -> Bool { let obs = fixture_host_identity_observation_srv2() obs.short_hostname == "alstrad8d-1l2t-2" && host_identity_observation_nonempty(obs: obs) } -fn witness_empty_stdout_is_absent() -> Bool { +test fn witness_empty_stdout_is_absent() -> Bool { match host_identity_observation_from_stdout(stdout: " \n", probed_at: "2026-07-02") { Absent => true Present { value: _ } => false } } -fn witness_trimmed_stdout_is_typed() -> Bool { +test fn witness_trimmed_stdout_is_typed() -> Bool { match host_identity_observation_from_stdout(stdout: " altrad8ud-1l2t-1\n", probed_at: "2026-07-02") { Present { value: obs } => obs.short_hostname == "altrad8ud-1l2t-1" Absent => false } } -fn witness_host_effect_apply_hostname_read_converges() -> Bool { +test fn witness_host_effect_apply_hostname_read_converges() -> Bool { reconciliation_converged(r: host_identity_observation_apply( target: srv1_os_target(), transport: LocalShell )) } -fn witness_host_effect_apply_failure_is_not_observation() -> Bool { +test fn witness_host_effect_apply_failure_is_not_observation() -> Bool { match host_identity_observation_from_apply( r: host_effect_apply( target: srv1_os_target(), @@ -117,7 +116,7 @@ fn witness_host_effect_apply_failure_is_not_observation() -> Bool { } } -fn witness_fixture_row_materializes_deployed_intent_v0() -> Bool { +test fn witness_fixture_row_materializes_deployed_intent_v0() -> Bool { let d = deployed_intent_v0_from_observation_row( fleet_slot: operator_host_srv1, target_host: srv1_host, @@ -127,21 +126,21 @@ fn witness_fixture_row_materializes_deployed_intent_v0() -> Bool { && deployed_intent_observed_differs_from_fleet_slot(d: d) } -fn witness_persisted_base_records_observed_not_design() -> Bool { +test fn witness_persisted_base_records_observed_not_design() -> Bool { let d = gunbc_srv1_deployed_intent_v0_persisted deployed_intent_observed_short_hostname(d: d) == "altrad8ud-1l2t-1" && d.fleet_slot == operator_host_srv1 && deployed_intent_observed_differs_from_fleet_slot(d: d) } -fn witness_srv2_persisted_base_records_typo_hostname() -> Bool { +test fn witness_srv2_persisted_base_records_typo_hostname() -> Bool { let d = gunbc_srv2_deployed_intent_v0_persisted deployed_intent_observed_short_hostname(d: d) == "alstrad8d-1l2t-2" && d.fleet_slot == operator_host_srv2 && deployed_intent_observed_differs_from_fleet_slot(d: d) } -fn witness_design_intent_conflation_red() -> Bool { +test fn witness_design_intent_conflation_red() -> Bool { let wrong_row = HostIdentityObservationRow { short_hostname_raw: operator_host_srv1, probed_at: "2026-07-02", @@ -155,7 +154,7 @@ fn witness_design_intent_conflation_red() -> Bool { && deployed_intent_observed_short_hostname(d: conflated) == operator_host_srv1 } -fn witness_srv1_ssh_transport_targets_operator_host() -> Bool { +test fn witness_srv1_ssh_transport_targets_operator_host() -> Bool { match srv1_host_identity_ssh_transport() { SshShell { ssh_host: h } => h == operator_host_srv1 LocalShell => false @@ -163,7 +162,7 @@ fn witness_srv1_ssh_transport_targets_operator_host() -> Bool { } } -fn witness_adopt_receipt_materializes_fixture_observation() -> Bool { +test fn witness_adopt_receipt_materializes_fixture_observation() -> Bool { let obs = fixture_host_identity_observation() let receipt = host_identity_adopt_receipt( fleet_slot: operator_host_srv1, @@ -178,7 +177,7 @@ fn witness_adopt_receipt_materializes_fixture_observation() -> Bool { && host_identity_transport_label(transport: srv1_host_identity_ssh_transport()) == "SshShell:srv1" } -fn witness_already_converged_host_receipt_is_valid() -> Bool { +test fn witness_already_converged_host_receipt_is_valid() -> Bool { let obs = host_identity_observation_from_stdout(stdout: operator_host_srv1, probed_at: "2026-07-02") match obs { Present { value: o } => { @@ -196,12 +195,12 @@ fn witness_already_converged_host_receipt_is_valid() -> Bool { } } -fn witness_adopt_model_hash_is_stable() -> Bool { +test fn witness_adopt_model_hash_is_stable() -> Bool { host_identity_knob_key(host: operator_host_srv1).host == operator_host_srv1 && host_identity_adopt_model_hash() == host_identity_adopt_model_hash() } -fn witness_desired_intent_from_modeled_fleet_slot() -> Bool { +test fn witness_desired_intent_from_modeled_fleet_slot() -> Bool { match gunbc_srv1_deployed_intent_v1 { Present { value: desired } => match deployed_intent_v1_desired_hostname_short(fleet_slot: operator_host_srv1) { @@ -212,7 +211,7 @@ fn witness_desired_intent_from_modeled_fleet_slot() -> Bool { } } -fn witness_patch_emits_exactly_one_modify_hunk() -> Bool { +test fn witness_patch_emits_exactly_one_modify_hunk() -> Bool { match host_identity_patch_from_intents( base_hostname: "altrad8ud-1l2t-1", observed_hostname: "altrad8ud-1l2t-1", @@ -224,7 +223,7 @@ fn witness_patch_emits_exactly_one_modify_hunk() -> Bool { } } -fn witness_patch_noop_when_already_converged() -> Bool { +test fn witness_patch_noop_when_already_converged() -> Bool { host_identity_precondition_is_noop( verdict: host_identity_patch_from_intents( base_hostname: operator_host_srv1, @@ -234,7 +233,7 @@ fn witness_patch_noop_when_already_converged() -> Bool { ) } -fn witness_drift_conflict_red_no_apply_arm() -> Bool { +test fn witness_drift_conflict_red_no_apply_arm() -> Bool { host_identity_precondition_is_conflict( verdict: host_identity_patch_from_intents( base_hostname: "altrad8ud-1l2t-1", @@ -251,7 +250,7 @@ fn witness_drift_conflict_red_no_apply_arm() -> Bool { ) } -fn witness_precondition_conflict_blocks_mutation() -> Bool { +test fn witness_precondition_conflict_blocks_mutation() -> Bool { let base = gunbc_srv1_deployed_intent_v0_persisted match gunbc_srv1_deployed_intent_v1 { Present { value: desired } => @@ -266,7 +265,7 @@ fn witness_precondition_conflict_blocks_mutation() -> Bool { } } -fn witness_conflict_plan_has_no_effect_script_structural_no_shell() -> Bool { +test fn witness_conflict_plan_has_no_effect_script_structural_no_shell() -> Bool { let base = gunbc_srv1_deployed_intent_v0_persisted match gunbc_srv1_deployed_intent_v1 { Present { value: desired } => @@ -295,7 +294,7 @@ fn witness_conflict_plan_has_no_effect_script_structural_no_shell() -> Bool { } } -fn witness_converge_from_base_conflict_is_none_red() -> Bool { +test fn witness_converge_from_base_conflict_is_none_red() -> Bool { let target = HostIdentityAssimilationTarget { fleet_slot: gunbc_srv1_deployed_intent_v0_persisted.fleet_slot, target_host: srv1_host, @@ -326,7 +325,7 @@ fn witness_converge_from_base_conflict_is_none_red() -> Bool { data host_identity_mutation_marker: String = "host-identity-mutation-marker-9c2e" -fn witness_unprivileged_refusal_no_shell() -> Bool { +test fn witness_unprivileged_refusal_no_shell() -> Bool { let plan = ApplyPlan { base: deployed_intent_observed_short_hostname(d: gunbc_srv1_deployed_intent_v0_persisted) as DnsLabel, desired: require_dns_label(raw: operator_host_srv1 as String), @@ -344,7 +343,7 @@ fn witness_unprivileged_refusal_no_shell() -> Bool { } } -fn witness_stale_readback_not_converged() -> Bool { +test fn witness_stale_readback_not_converged() -> Bool { match host_identity_observation_from_stdout( stdout: "altrad8ud-1l2t-1", probed_at: "2026-07-02" @@ -358,42 +357,10 @@ fn witness_stale_readback_not_converged() -> Bool { } } -fn witness_invalid_desired_hostname_unwritable() -> Bool { +test fn witness_invalid_desired_hostname_unwritable() -> Bool { match parse_dns_label_raw(raw: "") { Err { value: _ } => true Ok { value: _ } => false } } -test fn host_identity_observation_holds() -> Bool { - witness_hostname_read_argv_is_typed_not_concat() - && witness_hostname_read_resolves_typed_cell_not_shell_script() - && witness_hostname_set_argv_is_typed_not_concat() - && witness_hostname_set_privileged_argv_matches_fleet_grant() - && witness_hostname_set_resolves_typed_cell_not_shell_script() - && witness_hostname_set_cas_refuses_base_mismatch() - && witness_fixture_observation_types_srv1_observed_hostname() - && witness_fixture_observation_types_srv2_observed_hostname() - && witness_empty_stdout_is_absent() - && witness_trimmed_stdout_is_typed() - && witness_host_effect_apply_hostname_read_converges() - && witness_host_effect_apply_failure_is_not_observation() - && witness_fixture_row_materializes_deployed_intent_v0() - && witness_persisted_base_records_observed_not_design() - && witness_srv2_persisted_base_records_typo_hostname() - && witness_design_intent_conflation_red() - && witness_srv1_ssh_transport_targets_operator_host() - && witness_adopt_receipt_materializes_fixture_observation() - && witness_already_converged_host_receipt_is_valid() - && witness_adopt_model_hash_is_stable() - && witness_desired_intent_from_modeled_fleet_slot() - && witness_patch_emits_exactly_one_modify_hunk() - && witness_patch_noop_when_already_converged() - && witness_drift_conflict_red_no_apply_arm() - && witness_precondition_conflict_blocks_mutation() - && witness_conflict_plan_has_no_effect_script_structural_no_shell() - && witness_converge_from_base_conflict_is_none_red() - && witness_unprivileged_refusal_no_shell() - && witness_stale_readback_not_converged() - && witness_invalid_desired_hostname_unwritable() -} diff --git a/dag/test/claim/host_phase_status_witness_test.dag b/dag/test/claim/host_phase_status_witness_test.dag index 6e57b3645f6..61dddeea154 100644 --- a/dag/test/claim/host_phase_status_witness_test.dag +++ b/dag/test/claim/host_phase_status_witness_test.dag @@ -31,7 +31,7 @@ fn cell_fixture( data witness_no_producer_is_unknown_note: String = "THE fail-closed conjunct. A phase with no live observation producer must derive UnknownRefused — the arm that says 'we have no way to ask this host'. If it ever derives Converged, the status matrix reports a subsumption that was never observed, and every count built on it (remaining work, coverage) silently becomes fiction. This is the same defect class as a stats probe that auto-starts the server it is measuring (#7213 Finding 2): evidence manufactured by the act of looking." -fn witness_no_producer_derives_unknown_not_converged() -> Bool { +test fn witness_no_producer_derives_unknown_not_converged() -> Bool { match host_phase_verdict_from(observation: none) { UnknownRefused => true Converged => false @@ -44,7 +44,7 @@ fn witness_no_producer_derives_unknown_not_converged() -> Bool { data witness_orthogonality_note: String = "The two axes must stay independent, and this is the conjunct that CAUGHT them being fused. The cell type was first written as a sum (StatusUnmodeled | StatusObserved), so a DeclaredGap phase discarded its observation — and the one cell with a live producer today, (srv3, prefix:os-install-actuated), is a DeclaredGap phase, so coverage computed as zero with a real Converged verdict one branch away. Four combinations must all be representable and distinct: modeled+converged (done), modeled+inaccessible (srv1/srv2 build-cache — a finished model the host refuses to answer for), unmodeled+unknown (ordinary remaining work), and unmodeled+converged (the host is in the desired condition by means the model cannot reproduce — srv3's OS install). A fused enum has to round the middle two to something false." -fn witness_modeled_and_observed_axes_are_independent() -> Bool { +test fn witness_modeled_and_observed_axes_are_independent() -> Bool { let modeled_inaccessible = cell_fixture( label: "P1b:build-cache-provision", disposition: modeled_phase_fixture, @@ -73,7 +73,7 @@ fn witness_modeled_and_observed_axes_are_independent() -> Bool { data witness_producer_refusal_is_coverage_note: String = "A producer that RAN and honestly refused is coverage; no producer at all is not. The distinction is load-bearing because the two have different owners — a refusing producer is a reach or observation defect to fix, an absent producer is a model to build — and the first version of this module conflated them by reading coverage off the verdict instead of off the observation's presence." -fn witness_refusing_producer_still_counts_as_coverage() -> Bool { +test fn witness_refusing_producer_still_counts_as_coverage() -> Bool { let refused = cell_fixture( label: "prefix:os-install-actuated", disposition: unmodeled_phase_fixture, @@ -88,14 +88,14 @@ fn witness_refusing_producer_still_counts_as_coverage() -> Bool { && !host_phase_cell_has_live_producer(c: absent) } -fn witness_unreachable_and_unknown_stay_distinct() -> Bool { +test fn witness_unreachable_and_unknown_stay_distinct() -> Bool { !observation_verdict_eq(a: std.upsert_decision.Inaccessible, b: std.upsert_decision.UnknownRefused) && observation_verdict_eq(a: std.upsert_decision.Inaccessible, b: std.upsert_decision.Inaccessible) } data witness_widen_red_control_note: String = "The discriminating RED control, built on the PATH-shadow / DaemonUnsupervised precedent: the forbidden absorbing fallback is modeled as its own sketch (host_phase_verdict_absorbing_fallback_widen_sketch fabricates Converged when no observation exists), the gate REJECTS the sketch's output, and the authority's output PASSES the same gate. The perturbation is independent of the property checked, so this cannot pass tautologically — an authority that quietly acquired the widen arm would be rejected by the gate it currently satisfies." -fn witness_red_control_widen_on_absent_rejected_by_gate() -> Bool { +test fn witness_red_control_widen_on_absent_rejected_by_gate() -> Bool { let widened = host_phase_verdict_absorbing_fallback_widen_sketch(observation: none) let authority = host_phase_verdict_from(observation: none) observation_verdict_eq(a: widened, b: std.upsert_decision.Converged) @@ -107,7 +107,7 @@ data departed_host_fixture: HostIdentity = "srv-departed" as HostIdentity data witness_reconcile_non_vacuous_note: String = "The membership instantiation must be exercised on a NON-DEGENERATE diff, or it is an instantiation nobody has tested. The live fleet produces only Modified and Unchanged hunks today (no host has left), so the Removed arm — a cell observed for a host absent from fleet_intent — is supplied synthetically here. All three outcomes are asserted in one reconcile: a departed host's cell tears down (cells are Owned, so R5 permits it rather than refusing), an unconverged cell upserts, and a cell already at the desired state produces no hunk at all." -fn witness_reconcile_covers_upsert_teardown_and_noop() -> Bool { +test fn witness_reconcile_covers_upsert_teardown_and_noop() -> Bool { let at_desired = cell_fixture( label: "P3:green-place-readiness", disposition: modeled_phase_fixture, @@ -140,17 +140,17 @@ fn witness_reconcile_covers_upsert_teardown_and_noop() -> Bool { data witness_matrix_shape_note: String = "Shape assertions over the derived matrix, pinned to the spine and the enrolled fleet rather than to hand-copied numbers: the matrix is exactly (hosts x spine steps), so it cannot silently drop a phase or a host. The coverage count is the honest measure of the live-observation frontier — one cell has a real producer today, (srv3, prefix:os-install-actuated) — and that number is what items 2 and 3 of the lane exist to raise. Pinning it means adding a producer is a VISIBLE, counted event that must update this witness, never a silent improvement nobody can point at." -fn witness_matrix_is_hosts_times_spine() -> Bool { +test fn witness_matrix_is_hosts_times_spine() -> Bool { let cells = host_fleet_phase_matrix(hosts: fleet_subsumption_hosts).length() let expected = fleet_subsumption_hosts.length() * host_standup_spine.length() cells == expected } -fn witness_live_observation_frontier_is_one_cell() -> Bool { +test fn witness_live_observation_frontier_is_one_cell() -> Bool { host_phase_observation_coverage_count(hosts: fleet_subsumption_hosts) == 1 } -fn witness_unmodeled_cells_track_spine_gaps() -> Bool { +test fn witness_unmodeled_cells_track_spine_gaps() -> Bool { let unmodeled = host_phase_unmodeled_count(hosts: fleet_subsumption_hosts) let expected = fleet_subsumption_hosts.length() * host_standup_gap_phase_count() unmodeled == expected @@ -158,22 +158,10 @@ fn witness_unmodeled_cells_track_spine_gaps() -> Bool { data witness_remaining_work_note: String = "Remaining work is the reconcile's own upsert count, and it must equal every cell that is not already at the FULL desired state — modeled AND converged. Asserting it against an independently computed count is what stops the reconcile from silently retiring cells: if desired ever weakened to 'converged, disposition ignored', srv3's installed-but-unmodeled OS cell would drop out of the count and the lane would look one item closer to done than it is." -fn witness_remaining_work_counts_every_unfinished_cell() -> Bool { +test fn witness_remaining_work_counts_every_unfinished_cell() -> Bool { let remaining = host_phase_remaining_work_count(hosts: fleet_subsumption_hosts) let total = host_fleet_phase_matrix(hosts: fleet_subsumption_hosts).length() let finished = host_phase_finished_cell_count(hosts: fleet_subsumption_hosts) remaining == total - finished } -test fn host_phase_status_witnesses() -> Bool { - witness_no_producer_derives_unknown_not_converged() - && witness_modeled_and_observed_axes_are_independent() - && witness_refusing_producer_still_counts_as_coverage() - && witness_unreachable_and_unknown_stay_distinct() - && witness_red_control_widen_on_absent_rejected_by_gate() - && witness_reconcile_covers_upsert_teardown_and_noop() - && witness_matrix_is_hosts_times_spine() - && witness_live_observation_frontier_is_one_cell() - && witness_unmodeled_cells_track_spine_gaps() - && witness_remaining_work_counts_every_unfinished_cell() -} diff --git a/dag/test/claim/host_swap_backing_witness_test.dag b/dag/test/claim/host_swap_backing_witness_test.dag index 51d0a47c554..92a3390a4cc 100644 --- a/dag/test/claim/host_swap_backing_witness_test.dag +++ b/dag/test/claim/host_swap_backing_witness_test.dag @@ -12,7 +12,7 @@ fn stats_fixture(total_bytes: Int) -> SwapStats { data witness_requirement_derivation_note: String = "The requirement must come from the DECLARED cap, not from a number typed into this witness, or the module is asserting its own invention. So the assertion is a relationship: the derived min_total equals gunbc_runner_slot_desired().memory_swap_max exactly, which means editing that one declaration moves the requirement and this witness together, and a hand-written swap size anywhere would break it." -fn witness_requirement_is_derived_from_the_declared_cap() -> Bool { +test fn witness_requirement_is_derived_from_the_declared_cap() -> Bool { match host_swap_backing_requirement() { SwapBackingRequired { min_total: m, requiring_declaration: d } => byte_size_count(b: m) == byte_size_count(b: gunbc_runner_slot_desired().memory_swap_max) @@ -23,7 +23,7 @@ fn witness_requirement_is_derived_from_the_declared_cap() -> Bool { data witness_verdict_arms_note: String = "The four backing states must stay distinct, because each names a different piece of work: no producer (build one), zero total (provision backing), undersized total (resize), sufficient total (done). A fold that collapsed any pair would make one of those disappear from every count derived from it. Absent is asserted specifically against zero rather than against small, because zero is the state the whole module exists for — a cap over nothing." -fn witness_backing_verdict_separates_unknown_absent_drifted_converged() -> Bool { +test fn witness_backing_verdict_separates_unknown_absent_drifted_converged() -> Bool { let req = host_swap_backing_requirement() let cap_bytes = byte_size_count(b: gunbc_runner_slot_desired().memory_swap_max) let no_producer = host_swap_backing_verdict(req: req, observed: none) @@ -47,7 +47,7 @@ fn witness_backing_verdict_separates_unknown_absent_drifted_converged() -> Bool data witness_cap_qualification_note: String = "THE conjunct the module exists for. A per-slot MemorySwapMax read that says Converged is the input on every line here; only the backing term varies. With backing observed Converged the cap verdict passes through unchanged — the non-vacuity control, without which a qualifier that refused everything would look correct. With backing zero, unobserved, or unreachable, the same green cap must NOT survive as Converged, and each case must keep its own arm rather than rounding to a single 'not converged': absent backing is provisioning work, unobserved backing is producer work, unreachable backing is the A1 reach lane." -fn witness_green_cap_does_not_survive_missing_backing() -> Bool { +test fn witness_green_cap_does_not_survive_missing_backing() -> Bool { let green_cap = std.upsert_decision.Converged let with_backing = swap_cap_verdict_qualified_by_backing(cap: green_cap, backing: std.upsert_decision.Converged) let no_backing = swap_cap_verdict_qualified_by_backing( @@ -64,7 +64,7 @@ fn witness_green_cap_does_not_survive_missing_backing() -> Bool { data witness_qualification_is_not_a_lattice_meet_note: String = "The qualification is a presupposition check and not a meet over some verdict ordering, and this conjunct pins the asymmetry so a later refactor cannot quietly turn it into one. A DRIFTED cap under CONVERGED backing stays Drifted — the backing does not repair the cap — while a CONVERGED cap under DRIFTED backing becomes Drifted. Under a symmetric meet those two would be the same value by construction and the direction of the check would be lost." -fn witness_qualification_direction_is_asymmetric() -> Bool { +test fn witness_qualification_direction_is_asymmetric() -> Bool { let drifted_cap_good_backing = swap_cap_verdict_qualified_by_backing( cap: std.upsert_decision.Drifted, backing: std.upsert_decision.Converged, @@ -83,7 +83,7 @@ fn witness_qualification_direction_is_asymmetric() -> Bool { data witness_red_control_note: String = "The discriminating RED control, and its perturbation is the corpus's CURRENT behaviour rather than an invented one: reporting the cap verdict with no backing term at all. The gate rejects the sketch and accepts the authority on identical inputs. Both halves are required — rejection alone would pass for a gate that rejects everything, acceptance alone for a gate that accepts everything — and the gate's own decision is computed from the backing argument, not from which function produced the verdict, so it cannot be satisfied by relabelling." -fn witness_red_control_backing_blind_rejected_by_gate() -> Bool { +test fn witness_red_control_backing_blind_rejected_by_gate() -> Bool { let backing = std.upsert_decision.UnknownRefused let widened = swap_cap_verdict_backing_blind_widen_sketch(cap: std.upsert_decision.Converged, backing: backing) let authority = swap_cap_verdict_qualified_by_backing(cap: std.upsert_decision.Converged, backing: backing) @@ -92,23 +92,14 @@ fn witness_red_control_backing_blind_rejected_by_gate() -> Bool { && swap_cap_verdict_gate_accepts(verdict: authority, backing: backing) } -fn witness_gate_admits_a_green_cap_when_backing_is_present() -> Bool { +test fn witness_gate_admits_a_green_cap_when_backing_is_present() -> Bool { swap_cap_verdict_gate_accepts(verdict: std.upsert_decision.Converged, backing: std.upsert_decision.Converged) } data witness_frontier_count_note: String = "The observation frontier is a counted number, not a silence. All four enrolled hosts derive UnknownRefused today because no /proc/swaps or free(1) producer exists in the tree, and pinning the count to the full fleet size means landing a producer is a VISIBLE event that must update this witness. It also fails in the right direction: if someone were to add a fabricated per-host fixture to make the matrix look greener, this count would drop and the witness would red." -fn witness_every_enrolled_host_is_unobserved_today() -> Bool { +test fn witness_every_enrolled_host_is_unobserved_today() -> Bool { host_swap_backing_fleet_unobserved_count() == fleet_subsumption_hosts.length() && fleet_subsumption_hosts.length() > 0 } -test fn host_swap_backing_witnesses() -> Bool { - witness_requirement_is_derived_from_the_declared_cap() - && witness_backing_verdict_separates_unknown_absent_drifted_converged() - && witness_green_cap_does_not_survive_missing_backing() - && witness_qualification_direction_is_asymmetric() - && witness_red_control_backing_blind_rejected_by_gate() - && witness_gate_admits_a_green_cap_when_backing_is_present() - && witness_every_enrolled_host_is_unobserved_today() -} diff --git a/dag/test/claim/host_toolchain_components_witness_test.dag b/dag/test/claim/host_toolchain_components_witness_test.dag index c522bd1e239..48064c31637 100644 --- a/dag/test/claim/host_toolchain_components_witness_test.dag +++ b/dag/test/claim/host_toolchain_components_witness_test.dag @@ -4,7 +4,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_incident_hinge_note: String = "THE conjunct this module exists for, and it is the srv2 floor failure replayed on the toolchain state read live from the host. The pinned toolchain 1.93.0 carried rustfmt the entire time, so any check keyed on 'does this host have rustfmt' answered yes throughout. The toolchain the shim actually resolved — ghrunner's default, stable — did not, and the gate failed every run. The verdict on the resolving toolchain must be Absent, and the presence of rustfmt in the OTHER toolchain must not soften it: under that state the gate fails every time, so it is not a partial success." -fn witness_component_in_another_toolchain_does_not_satisfy() -> Bool { +test fn witness_component_in_another_toolchain_does_not_satisfy() -> Bool { let resolved_missing = toolchain_completeness_verdict( reqs: floor_gate_component_requirements, resolved: Present { value: srv2_ghrunner_toolchain_before_fix }, @@ -20,7 +20,7 @@ fn witness_component_in_another_toolchain_does_not_satisfy() -> Bool { data witness_fix_note: String = "The other direction, and the receipt for the operator-directed hand-install: the same principal and the same toolchain, with rustfmt added, converges. Without this the module would satisfy every other conjunct while being a verdict that never says yes." -fn witness_after_fix_converges() -> Bool { +test fn witness_after_fix_converges() -> Bool { observation_verdict_eq( a: toolchain_completeness_verdict( reqs: floor_gate_component_requirements, @@ -36,7 +36,7 @@ fn witness_after_fix_converges() -> Bool { data witness_no_probe_note: String = "No probe, no verdict. srv1, srv3 and srv4 have no toolchain reading — srv1 refuses every credential this session holds, and no component-listing producer runs anywhere in the tree — so their verdict is UnknownRefused and the module does not invent one. The count is pinned so that landing a probe, or fabricating a fixture to make the matrix look greener, both show up as a change to this witness." -fn witness_unobserved_hosts_are_unknown_not_converged() -> Bool { +test fn witness_unobserved_hosts_are_unknown_not_converged() -> Bool { let unobserved = toolchain_completeness_fleet_unobserved_count() observation_verdict_eq( a: host_toolchain_completeness_verdict(host: operator_host_srv1), @@ -48,7 +48,7 @@ fn witness_unobserved_hosts_are_unknown_not_converged() -> Bool { data witness_missing_set_note: String = "The refusal must be able to say WHICH component is missing and which gate wanted it, or the remedy is a search. The missing set is computed against the requirement rows, so it carries the DeclarationRef of the gate that required it rather than a bare label." -fn witness_missing_set_names_the_requiring_gate() -> Bool { +test fn witness_missing_set_names_the_requiring_gate() -> Bool { let missing = resolved_toolchain_missing( t: srv2_ghrunner_toolchain_before_fix, reqs: floor_gate_component_requirements, @@ -68,7 +68,7 @@ fn witness_missing_set_names_the_requiring_gate() -> Bool { data witness_red_control_note: String = "The discriminating RED control: a probe that installs the missing component before reporting. It is the shape an ensure lane reaches for by reflex — the check and the repair in one step — and it is exactly what the operator's hand-install did, which is why automating it as a PROBE would be wrong even though performing it as an ACT was right. The authority refuses on the classification, so a self-repairing probe can never certify completeness, and its Converged is not reachable. Asserted in both directions: the inert probe on the same inputs does yield Converged, so this is not a fold that refuses everything." -fn witness_red_control_self_repairing_probe_cannot_certify() -> Bool { +test fn witness_red_control_self_repairing_probe_cannot_certify() -> Bool { let repairing = toolchain_completeness_observed_verdict( probe: rustup_component_add_on_miss_probe_sketch, reqs: floor_gate_component_requirements, @@ -85,7 +85,7 @@ fn witness_red_control_self_repairing_probe_cannot_certify() -> Bool { data witness_component_naming_note: String = "The component vocabulary is cited to rustup and projects to the names rustup itself accepts, so a requirement row cannot drift from the string an ensure would pass to `rustup component add`." -fn witness_component_names_match_rustup() -> Bool { +test fn witness_component_names_match_rustup() -> Bool { (rustup_component_name(c: Rustfmt) as String) == "rustfmt" && (rustup_component_name(c: Clippy) as String) == "clippy" && !rustup_component_eq(a: Rustfmt, b: Clippy) @@ -94,7 +94,7 @@ fn witness_component_names_match_rustup() -> Bool { data witness_reachability_note: String = "The correction, pinned so it cannot quietly regress into the fused reading. Installing the component and the gate being able to FIND it are two conditions, and srv2 satisfies the first while the second is unobserved — the runner unit inherits a PATH with no cargo bin directory, and whether the gate's spawn sees that PATH or a login shell's is only answerable from inside a job. So the component cell is Converged, the combined 'will the gate find it' verdict is UnknownRefused, and they are DIFFERENT VALUES on the same host. A module that reported the first as the answer would be committing the error its own opening paragraph describes. The third conjunct is the RED direction: an observed-unreachable component is Absent even when the toolchain is complete, so a complete toolchain can never by itself produce a green combined verdict." -fn witness_completeness_does_not_imply_the_gate_finds_it() -> Bool { +test fn witness_completeness_does_not_imply_the_gate_finds_it() -> Bool { let completeness = host_toolchain_completeness_verdict(host: operator_host_srv2) let combined = host_gate_finds_component_verdict(host: operator_host_srv2) let unreachable_but_complete = gate_finds_component_verdict( @@ -115,13 +115,3 @@ fn witness_completeness_does_not_imply_the_gate_finds_it() -> Bool { && observation_verdict_eq(a: reachable_and_complete, b: std.upsert_decision.Converged) } -test fn host_toolchain_components_witnesses() -> Bool { - witness_completeness_does_not_imply_the_gate_finds_it() - && - witness_component_in_another_toolchain_does_not_satisfy() - && witness_after_fix_converges() - && witness_unobserved_hosts_are_unknown_not_converged() - && witness_missing_set_names_the_requiring_gate() - && witness_red_control_self_repairing_probe_cannot_certify() - && witness_component_names_match_rustup() -} diff --git a/dag/test/claim/html_emit_witness_test.dag b/dag/test/claim/html_emit_witness_test.dag index 8b5240d7e6c..6b8c8352da6 100644 --- a/dag/test/claim/html_emit_witness_test.dag +++ b/dag/test/claim/html_emit_witness_test.dag @@ -18,14 +18,14 @@ fn sample_button() -> Fragment { } } -fn witness_html_emit_reduces_and_serializes() -> Bool { +test fn witness_html_emit_reduces_and_serializes() -> Bool { match try_serialize_html_source(node: sample_button()) { EmitOk { html: h } => h == "" EmitRejected { reason: _ } => false } } -fn witness_html_emit_matches_markup_fold() -> Bool { +test fn witness_html_emit_matches_markup_fold() -> Bool { match try_serialize_html_source(node: sample_button()) { EmitOk { html: h } => h == serialize_html_source(node: sample_button()) EmitRejected { reason: _ } => false @@ -48,7 +48,7 @@ fn hostile_data_href() -> Fragment { } } -fn witness_javascript_reject_discriminates_from_char_escape() -> Bool { +test fn witness_javascript_reject_discriminates_from_char_escape() -> Bool { match try_serialize_html_source(node: hostile_javascript_href()) { EmitRejected { reason: _ } => { let unchecked = serialize_html_source(node: hostile_javascript_href()) @@ -58,7 +58,7 @@ fn witness_javascript_reject_discriminates_from_char_escape() -> Bool { } } -fn witness_data_reject_discriminates_from_char_escape() -> Bool { +test fn witness_data_reject_discriminates_from_char_escape() -> Bool { match try_serialize_html_source(node: hostile_data_href()) { EmitRejected { reason: _ } => { let unchecked = serialize_html_source(node: hostile_data_href()) @@ -68,7 +68,7 @@ fn witness_data_reject_discriminates_from_char_escape() -> Bool { } } -fn witness_serialize_rejects_javascript_href() -> Bool { +test fn witness_serialize_rejects_javascript_href() -> Bool { match try_serialize_html_source(node: hostile_javascript_href()) { EmitRejected { reason: u } => u == "javascript:alert(1)" @@ -76,7 +76,7 @@ fn witness_serialize_rejects_javascript_href() -> Bool { } } -fn witness_serialize_rejects_data_href() -> Bool { +test fn witness_serialize_rejects_data_href() -> Bool { match try_serialize_html_source(node: hostile_data_href()) { EmitRejected { reason: u } => u.starts_with(prefix: "data:") @@ -84,7 +84,7 @@ fn witness_serialize_rejects_data_href() -> Bool { } } -fn witness_http_href_serializes() -> Bool { +test fn witness_http_href_serializes() -> Bool { match try_serialize_html_source( node: Element { tag: "a", @@ -113,14 +113,14 @@ fn req_a_hostile_but_trusted_scheme() -> Fragment { } } -fn witness_trusted_href_serializes() -> Bool { +test fn witness_trusted_href_serializes() -> Bool { match try_serialize_html_source(node: trusted_relative_link()) { EmitOk { html: h } => h == "dag" EmitRejected { reason: _ } => false } } -fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { +test fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { match try_serialize_html_source(node: req_a_hostile_but_trusted_scheme()) { EmitOk { html: h } => h == "" @@ -128,14 +128,3 @@ fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { } } -test fn html_emit_keystone_holds() -> Bool { - witness_html_emit_reduces_and_serializes() - && witness_html_emit_matches_markup_fold() - && witness_javascript_reject_discriminates_from_char_escape() - && witness_data_reject_discriminates_from_char_escape() - && witness_serialize_rejects_javascript_href() - && witness_serialize_rejects_data_href() - && witness_http_href_serializes() - && witness_trusted_href_serializes() - && witness_req_a_hostile_href_still_emits_with_escaping() -} diff --git a/dag/test/claim/html_markup_xss_witness_test.dag b/dag/test/claim/html_markup_xss_witness_test.dag index 0081205957e..2c93da49786 100644 --- a/dag/test/claim/html_markup_xss_witness_test.dag +++ b/dag/test/claim/html_markup_xss_witness_test.dag @@ -14,63 +14,63 @@ import extdeps.languages.html { try_serialize_html_source, EmitOk, EmitRejected data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_javascript_href_rejects() -> Bool { +test fn witness_javascript_href_rejects() -> Bool { match validate_href(url: "javascript:alert(1)") { RejectedHref { reason: DangerousScheme { scheme: JavascriptScheme } } => true _ => false } } -fn witness_javascript_href_case_insensitive_rejects() -> Bool { +test fn witness_javascript_href_case_insensitive_rejects() -> Bool { match validate_href(url: " JAVASCRIPT:alert(1)") { RejectedHref { reason: DangerousScheme { scheme: JavascriptScheme } } => true _ => false } } -fn witness_data_href_rejects() -> Bool { +test fn witness_data_href_rejects() -> Bool { match validate_href(url: "data:text/html,") { RejectedHref { reason: DangerousScheme { scheme: DataScheme } } => true _ => false } } -fn witness_protocol_relative_rejects() -> Bool { +test fn witness_protocol_relative_rejects() -> Bool { match validate_href(url: "//evil.example/x") { RejectedHref { reason: SchemeNotAllowlisted } => true _ => false } } -fn witness_mixed_case_javascript_rejects_fail_closed() -> Bool { +test fn witness_mixed_case_javascript_rejects_fail_closed() -> Bool { match validate_href(url: "JaVaScRiPt:alert(1)") { RejectedHref { reason: SchemeNotAllowlisted } => true _ => false } } -fn witness_relative_href_accepted() -> Bool { +test fn witness_relative_href_accepted() -> Bool { match validate_href(url: "/safe/path") { SafeHref { url: u } => u == "/safe/path" _ => false } } -fn witness_https_href_accepted() -> Bool { +test fn witness_https_href_accepted() -> Bool { match validate_href(url: "https://example.com") { SafeHref { url: u } => u == "https://example.com" _ => false } } -fn witness_http_href_accepted() -> Bool { +test fn witness_http_href_accepted() -> Bool { match validate_href(url: "http://example.com") { SafeHref { url: u } => u == "http://example.com" _ => false } } -fn witness_mailto_href_accepted() -> Bool { +test fn witness_mailto_href_accepted() -> Bool { match validate_href(url: "mailto:user@example.com") { SafeHref { url: u } => u == "mailto:user@example.com" _ => false @@ -96,21 +96,9 @@ fn witness_escape_url_passes_javascript_scheme() -> Bool { escape_url(s: "javascript:alert(1)") == "javascript:alert(1)" } -fn witness_allowlist_rejects_what_escape_url_passes() -> Bool { +test fn witness_allowlist_rejects_what_escape_url_passes() -> Bool { witness_escape_url_passes_javascript_scheme() && witness_javascript_href_rejects() && witness_unsafe_href_blocks_serialization() } -test fn html_markup_xss_keystone_holds() -> Bool { - witness_javascript_href_rejects() - && witness_javascript_href_case_insensitive_rejects() - && witness_data_href_rejects() - && witness_protocol_relative_rejects() - && witness_mixed_case_javascript_rejects_fail_closed() - && witness_relative_href_accepted() - && witness_https_href_accepted() - && witness_http_href_accepted() - && witness_mailto_href_accepted() - && witness_allowlist_rejects_what_escape_url_passes() -} diff --git a/dag/test/claim/html_roundtrip_test.dag b/dag/test/claim/html_roundtrip_test.dag index 8af4996ad1e..1b3849bac38 100644 --- a/dag/test/claim/html_roundtrip_test.dag +++ b/dag/test/claim/html_roundtrip_test.dag @@ -34,7 +34,7 @@ fn roundtrip_core_node() -> Fragment { } } -fn witness_roundtrip_core() -> Bool { +test fn witness_roundtrip_core() -> Bool { match ingest_html_source(src: serialize_html_source(node: roundtrip_core_node())) { IngestedNode { node } => node == roundtrip_core_node() IngestRejected { reason: _ } => false @@ -60,7 +60,7 @@ fn perturbed_node() -> Fragment { } } -fn witness_roundtrip_under_perturbed_rows() -> Bool { +test fn witness_roundtrip_under_perturbed_rows() -> Bool { let sp = perturbed_spellings() match ingest_html_source_with(src: serialize_html_source_with(node: perturbed_node(), sp: sp), sp: sp) { IngestedNode { node } => node == perturbed_node() @@ -76,7 +76,7 @@ fn attr_node() -> Fragment { } } -fn witness_ingest_reads_attr_assign_row() -> Bool { +test fn witness_ingest_reads_attr_assign_row() -> Bool { let emitted_perturbed = serialize_html_source_with(node: attr_node(), sp: perturbed_spellings()) match ingest_html_source(src: emitted_perturbed) { IngestedNode { node } => !(node == attr_node()) @@ -84,7 +84,7 @@ fn witness_ingest_reads_attr_assign_row() -> Bool { } } -fn witness_core_advertised_lossless() -> Bool { +test fn witness_core_advertised_lossless() -> Bool { let node = roundtrip_core_node() let m = html_medium_lossless(node: node) match m.fidelity { @@ -93,7 +93,7 @@ fn witness_core_advertised_lossless() -> Bool { } } -fn witness_frontier_unsafe_href_rejected() -> Bool { +test fn witness_frontier_unsafe_href_rejected() -> Bool { let serialized = serialize_html_source(node: Element { tag: "a", attributes: [attr(name: "href", value: "javascript:alert(1)" )], @@ -116,18 +116,10 @@ fn adjacent_text_node() -> Fragment { } } -fn witness_frontier_not_roundtripped() -> Bool { +test fn witness_frontier_not_roundtripped() -> Bool { match ingest_html_source(src: serialize_html_source(node: adjacent_text_node())) { IngestedNode { node } => !(node == adjacent_text_node()) IngestRejected { reason: _ } => false } } -test fn html_roundtrip_keystone_holds() -> Bool { - witness_roundtrip_core() - && witness_roundtrip_under_perturbed_rows() - && witness_ingest_reads_attr_assign_row() - && witness_core_advertised_lossless() - && witness_frontier_unsafe_href_rejected() - && witness_frontier_not_roundtripped() -} diff --git a/dag/test/claim/http_serve_route_witness_test.dag b/dag/test/claim/http_serve_route_witness_test.dag index cda4eff0abf..1c056653c5f 100644 --- a/dag/test/claim/http_serve_route_witness_test.dag +++ b/dag/test/claim/http_serve_route_witness_test.dag @@ -67,11 +67,11 @@ fn selection_param(sel: RouteSelection, name: String) -> String { } } -fn witness_root_selects_page_handler() -> Bool { +test fn witness_root_selects_page_handler() -> Bool { selected_dynamic_is(sel: serve_select_route(table: probe_table(), method: GET, path: "/"), want_dispatch: false) } -fn witness_static_row_selects_static() -> Bool { +test fn witness_static_row_selects_static() -> Bool { match serve_select_route(table: probe_table(), method: GET, path: "/healthz") { SelectedStatic { route: r } => r.body == "ok" && r.status_on_hit == 200 SelectedDynamic { handler: _, params: _ } => false @@ -80,13 +80,13 @@ fn witness_static_row_selects_static() -> Bool { } } -fn witness_dispatch_post_binds_param() -> Bool { +test fn witness_dispatch_post_binds_param() -> Bool { let sel = serve_select_route(table: probe_table(), method: POST, path: "/dispatch/2-cd-transport") selected_dynamic_is(sel: sel, want_dispatch: true) && selection_param(sel: sel, name: "node_id") == "2-cd-transport" } -fn witness_wrong_method_folds_405_with_allowed() -> Bool { +test fn witness_wrong_method_folds_405_with_allowed() -> Bool { match serve_select_route(table: probe_table(), method: GET, path: "/dispatch/x") { MethodNotAllowed { allowed: ms } => count(ms) == 1 && any(ms, m => m == POST) @@ -96,7 +96,7 @@ fn witness_wrong_method_folds_405_with_allowed() -> Bool { } } -fn witness_unknown_path_folds_404() -> Bool { +test fn witness_unknown_path_folds_404() -> Bool { match serve_select_route(table: probe_table(), method: GET, path: "/nope") { NoRouteMatched => true SelectedStatic { route: _ } => false @@ -105,7 +105,7 @@ fn witness_unknown_path_folds_404() -> Bool { } } -fn witness_first_match_wins_on_overlap() -> Bool { +test fn witness_first_match_wins_on_overlap() -> Bool { let overlap = ServedRouteTable { routes: [ DynamicRoute { method: GET, path_pattern: tpl(raw: "/a/\{x\}"), handler: ProbePage }, @@ -212,19 +212,10 @@ fn parity_on_template(raw: String) -> Bool { ) } -fn witness_forward_backward_agreement() -> Bool { +test fn witness_forward_backward_agreement() -> Bool { parity_on_template(raw: "/") && parity_on_template(raw: "/roadmap") && parity_on_template(raw: "/healthz") && parity_on_template(raw: "/dispatch/\{node_id\}") } -test fn http_serve_route_witnesses() -> Bool { - witness_root_selects_page_handler() - && witness_static_row_selects_static() - && witness_dispatch_post_binds_param() - && witness_wrong_method_folds_405_with_allowed() - && witness_unknown_path_folds_404() - && witness_first_match_wins_on_overlap() - && witness_forward_backward_agreement() -} diff --git a/dag/test/claim/interpreter_kernel_model_witness_test.dag b/dag/test/claim/interpreter_kernel_model_witness_test.dag index 14f2f806d2a..d4210d3b6b4 100644 --- a/dag/test/claim/interpreter_kernel_model_witness_test.dag +++ b/dag/test/claim/interpreter_kernel_model_witness_test.dag @@ -1,9 +1,8 @@ module test.claim.interpreter_kernel_model_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_pure_eval_authority_modules() -> Bool { +test fn w_pure_eval_authority_modules() -> Bool { is_pure_eval_authority_module(path: "src/v2/compiler/05_eval.dag") && is_pure_eval_authority_module(path: "src/v2/compiler/emit_host.dag") && is_pure_eval_authority_module(path: "src/v2/extdeps/runtimes/v2_evaluator.dag") && @@ -12,7 +11,7 @@ fn w_pure_eval_authority_modules() -> Bool { !is_pure_eval_authority_module(path: "src/v1/stage0/src/v1_interpreter.rs") } -fn w_pinned_host_physics_roster() -> Bool { +test fn w_pinned_host_physics_roster() -> Bool { is_pinned_host_physics_stage0_file(basename: "recorded_fixture.rs") && is_pinned_host_physics_stage0_file(basename: "resolved_graph_cache.rs") && !is_pinned_host_physics_stage0_file(basename: "cache_purity_oracle.rs") && @@ -21,16 +20,16 @@ fn w_pinned_host_physics_roster() -> Bool { !is_pinned_host_physics_stage0_file(basename: "wire_value_serialize.rs") } -fn w_hybrid_interpreter_file_boundary() -> Bool { +test fn w_hybrid_interpreter_file_boundary() -> Bool { v1_interpreter_hybrid_seed_file == "v1_interpreter.rs" && v1_interpreter_not_classified_as_pinned_host_physics() } -fn w_kernel_d_phase_pure_eval_emit_wired() -> Bool { +test fn w_kernel_d_phase_pure_eval_emit_wired() -> Bool { interpreter_kernel_d_phase_is_pure_eval_emit_wired() } -fn w_seam_class_authority_modules() -> Bool { +test fn w_seam_class_authority_modules() -> Bool { match seam_class_for_authority_module(path: "src/v2/compiler/05_eval.dag") { Present { value: PureEvalAuthority } => true _ => false @@ -45,7 +44,7 @@ fn w_seam_class_authority_modules() -> Bool { } } -fn w_hybrid_seed_seam_unclassified() -> Bool { +test fn w_hybrid_seed_seam_unclassified() -> Bool { hybrid_seed_file_is_seam_unclassified() && match seam_class_for_pinned_basename(basename: v1_interpreter_hybrid_seed_file) { Absent => true @@ -53,11 +52,3 @@ fn w_hybrid_seed_seam_unclassified() -> Bool { } } -test fn interpreter_kernel_model_witnesses() -> Bool { - w_pure_eval_authority_modules() && - w_pinned_host_physics_roster() && - w_hybrid_interpreter_file_boundary() && - w_kernel_d_phase_pure_eval_emit_wired() && - w_seam_class_authority_modules() && - w_hybrid_seed_seam_unclassified() -} diff --git a/dag/test/claim/jedec_ddr_generation_witness_test.dag b/dag/test/claim/jedec_ddr_generation_witness_test.dag index 3efbc0557ae..85a24abc824 100644 --- a/dag/test/claim/jedec_ddr_generation_witness_test.dag +++ b/dag/test/claim/jedec_ddr_generation_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.jedec_ddr_generation - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data mod_ddr4_32g_1rx8: DramModuleCatalogRow = DramModuleCatalogRow { @@ -27,22 +26,22 @@ data mod_ddr5_32g_1rx8: DramModuleCatalogRow = DramModuleCatalogRow { rank_count: 1, } -fn generation_axis_is_decomposed() -> Bool { +test fn generation_axis_is_decomposed() -> Bool { dram_generation_ddr4.signaling_family == DoubleDataRate && dram_generation_ddr4.generation_number == 4 && dram_generation_ddr5.signaling_family == DoubleDataRate && dram_generation_ddr5.generation_number == 5 } -fn ddr4_ceiling_is_2_gib() -> Bool { +test fn ddr4_ceiling_is_2_gib() -> Bool { byte_size_count(b: ddr4_generation_catalog.max_monolithic_die_density) == 2147483648 } -fn ddr5_ceiling_is_8_gib() -> Bool { +test fn ddr5_ceiling_is_8_gib() -> Bool { byte_size_count(b: ddr5_generation_catalog.max_monolithic_die_density) == 8589934592 } -fn dispatch_selects_matching_generation() -> Bool { +test fn dispatch_selects_matching_generation() -> Bool { dram_generation_eq( a: jedec_ddr_generation_catalog_row(dram_generation_ddr4).generation, b: dram_generation_ddr4, @@ -53,20 +52,12 @@ fn dispatch_selects_matching_generation() -> Bool { ) } -fn per_generation_ceiling_discriminates() -> Bool { +test fn per_generation_ceiling_discriminates() -> Bool { !dram_module_is_realizable(module: mod_ddr4_32g_1rx8, jedec: ddr4_generation_catalog) && dram_module_is_realizable(module: mod_ddr5_32g_1rx8, jedec: ddr5_generation_catalog) } -fn generation_mismatch_fails_closed() -> Bool { +test fn generation_mismatch_fails_closed() -> Bool { !dram_module_is_realizable(module: mod_ddr4_32g_1rx8, jedec: ddr5_generation_catalog) } -test fn jedec_ddr_generation_holds() -> Bool { - generation_axis_is_decomposed() - && ddr4_ceiling_is_2_gib() - && ddr5_ceiling_is_8_gib() - && dispatch_selects_matching_generation() - && per_generation_ceiling_discriminates() - && generation_mismatch_fails_closed() -} diff --git a/dag/test/claim/js_site_emit_test.dag b/dag/test/claim/js_site_emit_test.dag index 65f387cfb29..774bc4eed2b 100644 --- a/dag/test/claim/js_site_emit_test.dag +++ b/dag/test/claim/js_site_emit_test.dag @@ -1,6 +1,5 @@ module test.claim.js_site_emit - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn js_site_hostile_page() -> JsSitePage { @@ -12,14 +11,14 @@ fn js_site_hostile_page() -> JsSitePage { } } -fn witness_hostile_html_rejected() -> Bool { +test fn witness_hostile_html_rejected() -> Bool { match js_site_emit_html(page: js_site_hostile_page()) { EmitRejected { reason: _ } => true EmitOk { html: _ } => false } } -fn witness_hostile_tsx_rejected() -> Bool { +test fn witness_hostile_tsx_rejected() -> Bool { match js_site_emit_tsx(page: js_site_hostile_page()) { JsxRejected { reason: _ } => true JsxOk { tsx: _ } => false @@ -38,31 +37,31 @@ data expected_browse_tsx: String = "export function JsSiteBrowsePage(): JSX.Elem data expected_about_tsx: String = "export function JsSiteAboutPage(): JSX.Element { return gunbc — About

gunbc

gunbc models programs as dependency graphs. Rust is bootstrap seed.

; }" -fn witness_three_page_source() -> Bool { +test fn witness_three_page_source() -> Bool { js_site_page_count() == 3 } -fn witness_home_html_emit() -> Bool { +test fn witness_home_html_emit() -> Bool { js_site_page_html(page: js_site_pages().first()) == expected_home_html } -fn witness_browse_html_emit() -> Bool { +test fn witness_browse_html_emit() -> Bool { js_site_page_html(page: js_site_pages().skip(n: 1).first()) == expected_browse_html } -fn witness_about_html_emit() -> Bool { +test fn witness_about_html_emit() -> Bool { js_site_page_html(page: js_site_pages().skip(n: 2).first()) == expected_about_html } -fn witness_home_tsx_emit() -> Bool { +test fn witness_home_tsx_emit() -> Bool { js_site_page_tsx(page: js_site_pages().first()) == expected_home_tsx } -fn witness_browse_tsx_emit() -> Bool { +test fn witness_browse_tsx_emit() -> Bool { js_site_page_tsx(page: js_site_pages().skip(n: 1).first()) == expected_browse_tsx } -fn witness_about_tsx_emit() -> Bool { +test fn witness_about_tsx_emit() -> Bool { js_site_page_tsx(page: js_site_pages().skip(n: 2).first()) == expected_about_tsx } @@ -71,44 +70,27 @@ fn artifact_matches_emit(path: String, expected: String) -> Bool { r.success && r.content == expected } -fn witness_committed_home_html() -> Bool { +test fn witness_committed_home_html() -> Bool { artifact_matches_emit(path: js_site_html_artifact_path(id: Home), expected: expected_home_html) } -fn witness_committed_browse_html() -> Bool { +test fn witness_committed_browse_html() -> Bool { artifact_matches_emit(path: js_site_html_artifact_path(id: Browse), expected: expected_browse_html) } -fn witness_committed_about_html() -> Bool { +test fn witness_committed_about_html() -> Bool { artifact_matches_emit(path: js_site_html_artifact_path(id: About), expected: expected_about_html) } -fn witness_committed_home_tsx() -> Bool { +test fn witness_committed_home_tsx() -> Bool { artifact_matches_emit(path: js_site_tsx_artifact_path(id: Home), expected: expected_home_tsx) } -fn witness_committed_browse_tsx() -> Bool { +test fn witness_committed_browse_tsx() -> Bool { artifact_matches_emit(path: js_site_tsx_artifact_path(id: Browse), expected: expected_browse_tsx) } -fn witness_committed_about_tsx() -> Bool { +test fn witness_committed_about_tsx() -> Bool { artifact_matches_emit(path: js_site_tsx_artifact_path(id: About), expected: expected_about_tsx) } -test fn js_site_emit_keystone_holds() -> Bool { - witness_three_page_source() - && witness_home_html_emit() - && witness_browse_html_emit() - && witness_about_html_emit() - && witness_home_tsx_emit() - && witness_browse_tsx_emit() - && witness_about_tsx_emit() - && witness_committed_home_html() - && witness_committed_browse_html() - && witness_committed_about_html() - && witness_committed_home_tsx() - && witness_committed_browse_tsx() - && witness_committed_about_tsx() - && witness_hostile_html_rejected() - && witness_hostile_tsx_rejected() -} diff --git a/dag/test/claim/json_emit_witness_test.dag b/dag/test/claim/json_emit_witness_test.dag index c086cc03a8e..9beac7a0d05 100644 --- a/dag/test/claim/json_emit_witness_test.dag +++ b/dag/test/claim/json_emit_witness_test.dag @@ -1,101 +1,100 @@ module test.claim.json_emit_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_json_cites_rfc8259() -> Bool { +test fn witness_json_cites_rfc8259() -> Bool { match extdeps.languages.json.emit.extdeps_external_authority_anchor { ExternalAuthority { uri } => uri.locator == "www.rfc-editor.org/rfc/rfc8259" } } -fn witness_escape_backslash_and_quote() -> Bool { +test fn witness_escape_backslash_and_quote() -> Bool { escape_json_string(s: "a\"b\\c") == "a\\\"b\\\\c" } -fn witness_escape_newline() -> Bool { +test fn witness_escape_newline() -> Bool { escape_json_string(s: "line one\nline two") == "line one\\nline two" } -fn witness_escape_tab() -> Bool { +test fn witness_escape_tab() -> Bool { escape_json_string(s: concat("a", concat(from_code_point(cp: 9), "b"))) == "a\\tb" } -fn witness_escape_carriage_return() -> Bool { +test fn witness_escape_carriage_return() -> Bool { escape_json_string(s: concat("x", concat(from_code_point(cp: 13), "y"))) == "x\\ry" } -fn witness_escape_control_u0001() -> Bool { +test fn witness_escape_control_u0001() -> Bool { escape_json_string(s: from_code_point(cp: 1)) == "\\u0001" } -fn witness_quote_json_string() -> Bool { +test fn witness_quote_json_string() -> Bool { quote_json_string(s: "hello") == "\"hello\"" && quote_json_string(s: "a\"b") == "\"a\\\"b\"" } -fn witness_serialize_null() -> Bool { +test fn witness_serialize_null() -> Bool { serialize_json(v: json_null()) == "null" } -fn witness_serialize_bool() -> Bool { +test fn witness_serialize_bool() -> Bool { serialize_json(v: json_bool(b: true)) == "true" && serialize_json(v: json_bool(b: false)) == "false" } -fn witness_serialize_int() -> Bool { +test fn witness_serialize_int() -> Bool { serialize_json(v: json_int(n: 42)) == "42" } -fn witness_serialize_object() -> Bool { +test fn witness_serialize_object() -> Bool { serialize_json(v: json_object(members: [ json_kv(key: "host", value: json_string(s: "srv1")), json_kv(key: "runner_count", value: json_int(n: 4)), ])) == "{\"host\": \"srv1\", \"runner_count\": 4}" } -fn witness_serialize_nested_object() -> Bool { +test fn witness_serialize_nested_object() -> Bool { serialize_json(v: json_object(members: [ json_kv(key: "Password", value: json_string(s: "secret")), ])) == "{\"Password\": \"secret\"}" } -fn witness_serialize_array() -> Bool { +test fn witness_serialize_array() -> Bool { serialize_json(v: json_array(elements: [json_string(s: "a"), json_string(s: "b")])) == "[\"a\", \"b\"]" } -fn witness_int_list_helper() -> Bool { +test fn witness_int_list_helper() -> Bool { json_int_list(nums: [1, 2, 3]) == "[1, 2, 3]" } -fn witness_str_list_helper() -> Bool { +test fn witness_str_list_helper() -> Bool { json_str_list(items: ["x", "y"]) == "[\"x\", \"y\"]" } -fn witness_grammar_rows_cover_json_value_variants() -> Bool { +test fn witness_grammar_rows_cover_json_value_variants() -> Bool { length(xs: json_production_rows) >= 8 } -fn witness_invalid_number_lexeme_rejected() -> Bool { +test fn witness_invalid_number_lexeme_rejected() -> Bool { !json_number_lexeme_valid(s: "not-a-number") && !json_number_lexeme_valid(s: "12abc") && !json_number_lexeme_valid(s: "") && !json_number_lexeme_valid(s: "01") } -fn witness_json_int_lexeme_always_valid() -> Bool { +test fn witness_json_int_lexeme_always_valid() -> Bool { json_number_lexeme_valid(s: json_int_lexeme(n: 42) as String) && json_number_lexeme_valid(s: json_int_lexeme(n: -7) as String) && json_number_lexeme_valid(s: json_int_lexeme(n: 0) as String) } -fn witness_json_number_lexeme_valid_accepts_fraction_and_exp() -> Bool { +test fn witness_json_number_lexeme_valid_accepts_fraction_and_exp() -> Bool { json_number_lexeme_valid(s: "12.34") && json_number_lexeme_valid(s: "1e10") && json_number_lexeme_valid(s: "-0.5e+2") } -fn witness_json_number_lexeme_refuses_invalid_at_construction() -> Bool { +test fn witness_json_number_lexeme_refuses_invalid_at_construction() -> Bool { match json_number_lexeme(s: "not-a-number") { none => true Present { value: _ } => false @@ -110,7 +109,7 @@ fn witness_json_number_lexeme_refuses_invalid_at_construction() -> Bool { } } -fn witness_json_number_lexeme_accepts_valid_at_construction() -> Bool { +test fn witness_json_number_lexeme_accepts_valid_at_construction() -> Bool { match json_number_lexeme(s: "12.34") { Present { value: l } => (l as String) == "12.34" none => false @@ -121,44 +120,18 @@ fn witness_json_number_lexeme_accepts_valid_at_construction() -> Bool { } } -fn witness_json_number_from_lexeme_string_refuses_invalid() -> Bool { +test fn witness_json_number_from_lexeme_string_refuses_invalid() -> Bool { match json_number_from_lexeme_string(s: "01") { Absent => true Present { value: _ } => false } } -fn witness_unicode_escape_hex4_boundary_0fff() -> Bool { +test fn witness_unicode_escape_hex4_boundary_0fff() -> Bool { json_unicode_escape_hex4(cp: 4095) == "0FFF" } -fn witness_unicode_escape_hex4_boundary_ffff() -> Bool { +test fn witness_unicode_escape_hex4_boundary_ffff() -> Bool { json_unicode_escape_hex4(cp: 65535) == "FFFF" } -test fn json_emit_witnesses() -> Bool { - witness_json_cites_rfc8259() - && witness_escape_backslash_and_quote() - && witness_escape_newline() - && witness_escape_tab() - && witness_escape_carriage_return() - && witness_escape_control_u0001() - && witness_quote_json_string() - && witness_serialize_null() - && witness_serialize_bool() - && witness_serialize_int() - && witness_serialize_object() - && witness_serialize_nested_object() - && witness_serialize_array() - && witness_int_list_helper() - && witness_str_list_helper() - && witness_grammar_rows_cover_json_value_variants() - && witness_invalid_number_lexeme_rejected() - && witness_json_int_lexeme_always_valid() - && witness_json_number_lexeme_valid_accepts_fraction_and_exp() - && witness_json_number_lexeme_refuses_invalid_at_construction() - && witness_json_number_lexeme_accepts_valid_at_construction() - && witness_json_number_from_lexeme_string_refuses_invalid() - && witness_unicode_escape_hex4_boundary_0fff() - && witness_unicode_escape_hex4_boundary_ffff() -} diff --git a/dag/test/claim/keyed_delta_fold_witness_test.dag b/dag/test/claim/keyed_delta_fold_witness_test.dag index 2a0f594964a..44f9ae279c2 100644 --- a/dag/test/claim/keyed_delta_fold_witness_test.dag +++ b/dag/test/claim/keyed_delta_fold_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.keyed_delta_fold_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly type FixtureVal { @@ -82,7 +81,7 @@ fn fixture_removed_hunk() -> KeyedPatch { ) } -fn witness_patch_monoid_left_identity() -> Bool { +test fn witness_patch_monoid_left_identity() -> Bool { let monoid = keyed_patch_monoid() keyed_patches_equal( left: keyed_patch_append(left: monoid.identity, right: fixture_modified_hunk()), @@ -92,7 +91,7 @@ fn witness_patch_monoid_left_identity() -> Bool { ) } -fn witness_patch_monoid_right_identity() -> Bool { +test fn witness_patch_monoid_right_identity() -> Bool { let monoid = keyed_patch_monoid() keyed_patches_equal( left: keyed_patch_append(left: fixture_modified_hunk(), right: monoid.identity), @@ -102,7 +101,7 @@ fn witness_patch_monoid_right_identity() -> Bool { ) } -fn witness_patch_monoid_associativity() -> Bool { +test fn witness_patch_monoid_associativity() -> Bool { let a = fixture_modified_hunk() let b = fixture_added_hunk() let c = fixture_removed_hunk() @@ -114,7 +113,7 @@ fn witness_patch_monoid_associativity() -> Bool { ) } -fn witness_patch_fold_matches_diff() -> Bool { +test fn witness_patch_fold_matches_diff() -> Bool { keyed_patches_equal( left: keyed_patch_fold( contributions: [ @@ -137,7 +136,7 @@ fn witness_patch_fold_matches_diff() -> Bool { ) } -fn witness_three_way_patch_monoid_identity() -> Bool { +test fn witness_three_way_patch_monoid_identity() -> Bool { let monoid = keyed_three_way_patch_monoid(key_eq: fixture_key_eq, value_eq: fixture_val_eq) let patch = keyed_three_way_fold( base: fixture_rows_a(), @@ -154,7 +153,7 @@ fn witness_three_way_patch_monoid_identity() -> Bool { ).entries) == list_length(items: patch.entries) } -fn witness_leaf_verdict_join_bottom() -> Bool { +test fn witness_leaf_verdict_join_bottom() -> Bool { match keyed_leaf_verdict_join( a: KeyedUnchanged, b: KeyedUnchanged, @@ -189,7 +188,7 @@ fn witness_leaf_verdict_join_bottom() -> Bool { } } -fn witness_leaf_verdict_join_added_idempotent() -> Bool { +test fn witness_leaf_verdict_join_added_idempotent() -> Bool { let added = fixture_verdict_added(label: "new") match keyed_leaf_verdict_join(a: added, b: added, equal: fixture_val_eq) { KeyedVerdictAdded { value: v } => v.payload == "new" @@ -197,7 +196,7 @@ fn witness_leaf_verdict_join_added_idempotent() -> Bool { } } -fn witness_leaf_verdict_join_removed_idempotent() -> Bool { +test fn witness_leaf_verdict_join_removed_idempotent() -> Bool { let removed = fixture_verdict_removed(label: "old") match keyed_leaf_verdict_join(a: removed, b: removed, equal: fixture_val_eq) { KeyedVerdictRemoved { value: v } => v.payload == "old" @@ -205,7 +204,7 @@ fn witness_leaf_verdict_join_removed_idempotent() -> Bool { } } -fn witness_leaf_verdict_join_added_disagree_is_conflict() -> Bool { +test fn witness_leaf_verdict_join_added_disagree_is_conflict() -> Bool { match keyed_leaf_verdict_join( a: fixture_verdict_added(label: "one"), b: fixture_verdict_added(label: "two"), @@ -216,7 +215,7 @@ fn witness_leaf_verdict_join_added_disagree_is_conflict() -> Bool { } } -fn witness_diff_identity_law() -> Bool { +test fn witness_diff_identity_law() -> Bool { keyed_patches_equal( left: keyed_two_way_diff( left: fixture_rows_a(), @@ -230,7 +229,7 @@ fn witness_diff_identity_law() -> Bool { ) } -fn witness_apply_diff_law_modified() -> Bool { +test fn witness_apply_diff_law_modified() -> Bool { keyed_rows_snapshot_equal( left: keyed_apply_two_way_diff( left: fixture_rows_a(), @@ -244,7 +243,7 @@ fn witness_apply_diff_law_modified() -> Bool { ) } -fn witness_apply_added_is_upsert() -> Bool { +test fn witness_apply_added_is_upsert() -> Bool { let patch = fixture_added_hunk() let once = keyed_apply_patch( rows: fixture_rows_a(), @@ -265,7 +264,7 @@ fn witness_apply_added_is_upsert() -> Bool { ) } -fn witness_apply_diff_law_added() -> Bool { +test fn witness_apply_diff_law_added() -> Bool { keyed_rows_snapshot_equal( left: keyed_apply_two_way_diff( left: fixture_rows_a(), @@ -279,7 +278,7 @@ fn witness_apply_diff_law_added() -> Bool { ) } -fn witness_apply_diff_law_removed() -> Bool { +test fn witness_apply_diff_law_removed() -> Bool { keyed_rows_snapshot_equal( left: keyed_apply_two_way_diff( left: fixture_rows_a(), @@ -293,7 +292,7 @@ fn witness_apply_diff_law_removed() -> Bool { ) } -fn witness_inverse_retract_law_modified() -> Bool { +test fn witness_inverse_retract_law_modified() -> Bool { keyed_rows_snapshot_equal( left: keyed_retract_two_way_diff( left: fixture_rows_a(), @@ -307,7 +306,7 @@ fn witness_inverse_retract_law_modified() -> Bool { ) } -fn witness_inverse_retract_law_added() -> Bool { +test fn witness_inverse_retract_law_added() -> Bool { keyed_rows_snapshot_equal( left: keyed_retract_two_way_diff( left: fixture_rows_a(), @@ -321,7 +320,7 @@ fn witness_inverse_retract_law_added() -> Bool { ) } -fn witness_inverse_retract_law_removed() -> Bool { +test fn witness_inverse_retract_law_removed() -> Bool { keyed_rows_snapshot_equal( left: keyed_retract_two_way_diff( left: fixture_rows_a(), @@ -335,7 +334,7 @@ fn witness_inverse_retract_law_removed() -> Bool { ) } -fn witness_unchanged_rows_emit_no_hunk() -> Bool { +test fn witness_unchanged_rows_emit_no_hunk() -> Bool { keyed_patch_hunk_count( patch: keyed_two_way_diff( left: fixture_rows_a(), @@ -346,7 +345,7 @@ fn witness_unchanged_rows_emit_no_hunk() -> Bool { ) == 0 } -fn witness_reorder_invariance() -> Bool { +test fn witness_reorder_invariance() -> Bool { keyed_patches_equal( left: keyed_two_way_diff( left: fixture_rows_a(), @@ -365,7 +364,7 @@ fn witness_reorder_invariance() -> Bool { ) } -fn witness_added_hunk() -> Bool { +test fn witness_added_hunk() -> Bool { let patch = fixture_added_hunk() keyed_patch_hunk_count(patch: patch) == 1 && fold(patch.hunks, init: false, f: fn(found, hunk) { @@ -376,7 +375,7 @@ fn witness_added_hunk() -> Bool { }) } -fn witness_removed_hunk() -> Bool { +test fn witness_removed_hunk() -> Bool { let patch = fixture_removed_hunk() keyed_patch_hunk_count(patch: patch) == 1 && fold(patch.hunks, init: false, f: fn(found, hunk) { @@ -387,7 +386,7 @@ fn witness_removed_hunk() -> Bool { }) } -fn witness_modified_hunk() -> Bool { +test fn witness_modified_hunk() -> Bool { let patch = fixture_modified_hunk() keyed_patch_hunk_count(patch: patch) == 1 && fold(patch.hunks, init: false, f: fn(found, hunk) { @@ -398,7 +397,7 @@ fn witness_modified_hunk() -> Bool { }) } -fn witness_three_way_apply_hunk() -> Bool { +test fn witness_three_way_apply_hunk() -> Bool { match keyed_three_way_leaf( base: fixture_val(payload: "one"), observed: fixture_val(payload: "one"), @@ -411,7 +410,7 @@ fn witness_three_way_apply_hunk() -> Bool { } } -fn witness_three_way_noop() -> Bool { +test fn witness_three_way_noop() -> Bool { match keyed_three_way_leaf( base: fixture_val(payload: "one"), observed: fixture_val(payload: "two"), @@ -423,7 +422,7 @@ fn witness_three_way_noop() -> Bool { } } -fn witness_three_way_conflict() -> Bool { +test fn witness_three_way_conflict() -> Bool { match keyed_three_way_leaf( base: fixture_val(payload: "one"), observed: fixture_val(payload: "drift"), @@ -438,7 +437,7 @@ fn witness_three_way_conflict() -> Bool { } } -fn witness_conflict_has_no_mutation_arm() -> Bool { +test fn witness_conflict_has_no_mutation_arm() -> Bool { let blocked = KeyedConflict match blocked { KeyedConflict => true @@ -456,7 +455,7 @@ fn fixture_apply_verdict(from_label: String, to_label: String) -> KeyedLeafVerdi } } -fn witness_apply_verdict_has_mutation_arm() -> Bool { +test fn witness_apply_verdict_has_mutation_arm() -> Bool { match fixture_apply_verdict(from_label: "a", to_label: "b") { KeyedApplyHunk { from: f, to: t } => f.payload == "a" && t.payload == "b" @@ -472,7 +471,7 @@ fn fixture_verdict_removed(label: String) -> KeyedLeafVerdict { KeyedVerdictRemoved { value: fixture_val(payload: label) } } -fn witness_verdict_add_is_not_remove() -> Bool { +test fn witness_verdict_add_is_not_remove() -> Bool { match fixture_verdict_added(label: "new") { KeyedVerdictAdded { value: v } => v.payload == "new" _ => false @@ -483,7 +482,7 @@ fn witness_verdict_add_is_not_remove() -> Bool { } } -fn witness_three_way_fold_omits_unchanged() -> Bool { +test fn witness_three_way_fold_omits_unchanged() -> Bool { let patch = keyed_three_way_fold( base: fixture_rows_a(), observed: fixture_rows_a(), @@ -497,7 +496,7 @@ fn witness_three_way_fold_omits_unchanged() -> Bool { }) } -fn witness_identity_law_red_control() -> Bool { +test fn witness_identity_law_red_control() -> Bool { keyed_patch_hunk_count( patch: keyed_two_way_diff( left: fixture_rows_a(), @@ -508,35 +507,3 @@ fn witness_identity_law_red_control() -> Bool { ) != 0 } -test fn keyed_delta_fold_keystone_holds() -> Bool { - witness_patch_monoid_left_identity() - && witness_patch_monoid_right_identity() - && witness_patch_monoid_associativity() - && witness_patch_fold_matches_diff() - && witness_three_way_patch_monoid_identity() - && witness_leaf_verdict_join_bottom() - && witness_leaf_verdict_join_added_idempotent() - && witness_leaf_verdict_join_removed_idempotent() - && witness_leaf_verdict_join_added_disagree_is_conflict() - && witness_diff_identity_law() - && witness_apply_diff_law_modified() - && witness_apply_added_is_upsert() - && witness_apply_diff_law_added() - && witness_apply_diff_law_removed() - && witness_inverse_retract_law_modified() - && witness_inverse_retract_law_added() - && witness_inverse_retract_law_removed() - && witness_unchanged_rows_emit_no_hunk() - && witness_reorder_invariance() - && witness_added_hunk() - && witness_removed_hunk() - && witness_modified_hunk() - && witness_three_way_apply_hunk() - && witness_three_way_noop() - && witness_three_way_conflict() - && witness_conflict_has_no_mutation_arm() - && witness_apply_verdict_has_mutation_arm() - && witness_verdict_add_is_not_remove() - && witness_three_way_fold_omits_unchanged() - && witness_identity_law_red_control() -} diff --git a/dag/test/claim/layout_render_witness_test.dag b/dag/test/claim/layout_render_witness_test.dag index 109212fe900..7bc4ce182d8 100644 --- a/dag/test/claim/layout_render_witness_test.dag +++ b/dag/test/claim/layout_render_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.layout_render_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data flat_proto: LayoutProtocol = LayoutProtocol { indent_unit: "" } @@ -18,35 +17,35 @@ fn nested_doc(levels: Int) -> Doc { ]) } -fn witness_flat_lines() -> Bool { +test fn witness_flat_lines() -> Bool { render(doc: flat_doc(), proto: flat_proto) == "a\nb\n" } -fn witness_nesting_applies_indent() -> Bool { +test fn witness_nesting_applies_indent() -> Bool { render(doc: nested_doc(levels: 1), proto: yaml_proto) == "root:\n child\n" } -fn witness_nest_level_discriminates() -> Bool { +test fn witness_nest_level_discriminates() -> Bool { render(doc: nested_doc(levels: 1), proto: yaml_proto) != render(doc: nested_doc(levels: 2), proto: yaml_proto) } -fn witness_indent_unit_discriminates() -> Bool { +test fn witness_indent_unit_discriminates() -> Bool { render(doc: nested_doc(levels: 1), proto: yaml_proto) != render(doc: nested_doc(levels: 1), proto: flat_proto) } -fn witness_blank_line_carries_no_indent() -> Bool { +test fn witness_blank_line_carries_no_indent() -> Bool { let d = doc_concat(parts: [doc_text(text: "k:"), DocLine, doc_blank(), doc_nest(levels: 3, body: doc_concat(parts: [doc_text(text: "x"), DocLine]))]) render(doc: d, proto: yaml_proto) == "k:\n\n x\n" } -fn witness_trailing_line_no_trailing_indent() -> Bool { +test fn witness_trailing_line_no_trailing_indent() -> Bool { let d = doc_nest(levels: 2, body: doc_concat(parts: [doc_text(text: "deep"), DocLine])) render(doc: d, proto: yaml_proto) == " deep\n" } -fn witness_dash_nest_alignment() -> Bool { +test fn witness_dash_nest_alignment() -> Bool { let item = doc_concat(parts: [ doc_text(text: "- "), doc_nest(levels: 1, body: doc_concat(parts: [doc_text(text: "name: a"), DocLine, doc_text(text: "run: x"), DocLine])) @@ -54,19 +53,9 @@ fn witness_dash_nest_alignment() -> Bool { render(doc: item, proto: yaml_proto) == "- name: a\n run: x\n" } -fn witness_render_is_format_agnostic() -> Bool { +test fn witness_render_is_format_agnostic() -> Bool { let flat = render(doc: flat_doc(), proto: flat_proto) let nested = render(doc: nested_doc(levels: 1), proto: yaml_proto) (flat == "a\nb\n") && (nested == "root:\n child\n") } -test fn layout_render_keystone_holds() -> Bool { - witness_flat_lines() && - witness_nesting_applies_indent() && - witness_nest_level_discriminates() && - witness_indent_unit_discriminates() && - witness_blank_line_carries_no_indent() && - witness_trailing_line_no_trailing_indent() && - witness_dash_nest_alignment() && - witness_render_is_format_agnostic() -} diff --git a/dag/test/claim/lens_verdict_witness_test.dag b/dag/test/claim/lens_verdict_witness_test.dag index c64e77fe425..3cc7fb12472 100644 --- a/dag/test/claim/lens_verdict_witness_test.dag +++ b/dag/test/claim/lens_verdict_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.lens_verdict_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_module: String = "test.claim.lens_verdict_witness" @@ -23,35 +22,35 @@ fn sample_holds() -> v2.std.lens_verdict.LensVerdict { Holds } -fn witness_fail_closed_green_on_unrealized() -> Bool { +test fn witness_fail_closed_green_on_unrealized() -> Bool { match sample_unrealized() { Unrealized { diagnostic: _ } => true _ => false } } -fn witness_fail_closed_red_on_holds() -> Bool { +test fn witness_fail_closed_red_on_holds() -> Bool { match sample_holds() { Unrealized { diagnostic: _ } => false _ => true } } -fn witness_is_violation_green_on_violation() -> Bool { +test fn witness_is_violation_green_on_violation() -> Bool { match sample_violation() { Violation { diagnostic: _ } => true _ => false } } -fn witness_is_violation_red_on_holds() -> Bool { +test fn witness_is_violation_red_on_holds() -> Bool { match sample_holds() { Violation { diagnostic: _ } => false _ => true } } -fn witness_locus_green_on_violation() -> Bool { +test fn witness_locus_green_on_violation() -> Bool { match sample_violation() { Violation { diagnostic: d } => v2.std.lens_verdict.lens_verdict_diagnostic_locus_module(d: d) == witness_module @@ -59,7 +58,7 @@ fn witness_locus_green_on_violation() -> Bool { } } -fn witness_locus_red_on_perturbed_module() -> Bool { +test fn witness_locus_red_on_perturbed_module() -> Bool { let perturbed = v2.std.lens_verdict.lens_verdict_module_violation( reason: ^lens_verdict_witness_perturbed, module_name: "test.claim.lens_verdict_witness_wrong_module" @@ -71,11 +70,3 @@ fn witness_locus_red_on_perturbed_module() -> Bool { } } -test fn lens_verdict_witnesses() -> Bool { - witness_fail_closed_green_on_unrealized() - && witness_fail_closed_red_on_holds() - && witness_is_violation_green_on_violation() - && witness_is_violation_red_on_holds() - && witness_locus_green_on_violation() - && witness_locus_red_on_perturbed_module() -} diff --git a/dag/test/claim/live_deploy/apply_witness_test.dag b/dag/test/claim/live_deploy/apply_witness_test.dag index 10922ac297a..2fdb2f63369 100644 --- a/dag/test/claim/live_deploy/apply_witness_test.dag +++ b/dag/test/claim/live_deploy/apply_witness_test.dag @@ -72,7 +72,7 @@ fn fixture_service_not_ready_readiness() -> Reconciliation Bool { +test fn witness_red_control_mutation_without_readiness_cannot_converge() -> Bool { !reconciliation_converged( r: live_deploy_apply_readiness_gate_with_readiness( mutation: fixture_converged_mutation(), @@ -81,7 +81,7 @@ fn witness_red_control_mutation_without_readiness_cannot_converge() -> Bool { ) } -fn witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() -> Bool { +test fn witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() -> Bool { match live_deploy_apply_readiness_gate_with_readiness( mutation: fixture_converged_mutation(), readiness: fixture_service_not_ready_readiness(), @@ -93,7 +93,7 @@ fn witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() -> B } } -fn witness_digest_readback_script_is_bounded_and_post_mutation() -> Bool { +test fn witness_digest_readback_script_is_bounded_and_post_mutation() -> Bool { let port = deployment_plan_listen_port(spec: deployment_spec_srv1()) let script = roadmap_site_digest_readback_script(port: port) string_contains(s: script, pattern: roadmap_site_roadmap_url_path) @@ -104,8 +104,3 @@ fn witness_digest_readback_script_is_bounded_and_post_mutation() -> Bool { && !string_contains(s: script, pattern: "healthz json parse failed") } -test fn live_deploy_apply_witnesses() -> Bool { - witness_red_control_mutation_without_readiness_cannot_converge() - && witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() - && witness_digest_readback_script_is_bounded_and_post_mutation() -} diff --git a/dag/test/claim/live_deploy/emit_test.dag b/dag/test/claim/live_deploy/emit_test.dag index 118dc4ff322..b4077d7df01 100644 --- a/dag/test/claim/live_deploy/emit_test.dag +++ b/dag/test/claim/live_deploy/emit_test.dag @@ -52,22 +52,22 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_spec_targets_srv1() -> Bool { +test fn witness_spec_targets_srv1() -> Bool { deployment_plan_host_identity(spec: deployment_spec_srv1()) == "srv1" } -fn witness_spec_uses_apt_package_manager() -> Bool { +test fn witness_spec_uses_apt_package_manager() -> Bool { match deployment_spec_srv1().target.os_package_manager { Apt => true _ => false } } -fn witness_spec_listen_port_is_8080() -> Bool { +test fn witness_spec_listen_port_is_8080() -> Bool { deployment_plan_listen_port(spec: deployment_spec_srv1()) == 8080 } -fn witness_owned_vs_ensured_typed() -> Bool { +test fn witness_owned_vs_ensured_typed() -> Bool { let spec = deployment_spec_srv1() let has_owned = fold(spec.steps, init: false, f: (acc, s) => match s { @@ -84,25 +84,25 @@ fn witness_owned_vs_ensured_typed() -> Bool { has_owned && has_ensured } -fn witness_retract_owned_only() -> Bool { +test fn witness_retract_owned_only() -> Bool { count(deployment_owned_steps_retract_order()) == 5 } -fn witness_tailnet_domain_propagates_optional() -> Bool { +test fn witness_tailnet_domain_propagates_optional() -> Bool { match deployment_spec_srv1().target.tailnet_domain { Present { value: d } => d == "tailecbe08.ts.net" Absent => false } } -fn witness_tailnet_url_absent_not_fabricated() -> Bool { +test fn witness_tailnet_url_absent_not_fabricated() -> Bool { match deployment_tailnet_url(spec: deployment_spec_srv1()) { Present { value: url } => string_contains(s: url, pattern: "https://srv1.tailecbe08.ts.net") Absent => false } } -fn witness_dependency_ensure_is_idempotent() -> Bool { +test fn witness_dependency_ensure_is_idempotent() -> Bool { let tailscale = deployment_ensure_dependency_script( dep: DeploymentDependencyStep { kind: TailscalePackage, package: package_tailscale } ) @@ -115,7 +115,7 @@ fn witness_dependency_ensure_is_idempotent() -> Bool { && string_contains(s: tmux, pattern: "apt-get install --yes tmux") } -fn witness_apply_script_contains_preflight_and_sudoers() -> Bool { +test fn witness_apply_script_contains_preflight_and_sudoers() -> Bool { let sh = expected_live_deploy_apply_script() string_contains(s: sh, pattern: "deploy-access-bootstrap-preflight") && string_contains(s: sh, pattern: "whoami") @@ -129,13 +129,13 @@ fn witness_apply_script_contains_preflight_and_sudoers() -> Bool { && !string_contains(s: sh, pattern: "gunbc-deploy-privileged") } -fn witness_retract_preamble_acknowledges_shared_sudoers_install() -> Bool { +test fn witness_retract_preamble_acknowledges_shared_sudoers_install() -> Bool { let sh = expected_live_deploy_retract_script() string_contains(s: sh, pattern: "first retract-after-flip may be the dropin install") && string_contains(s: sh, pattern: "sudo -n -l /usr/bin/tailscale >/dev/null 2>&1") } -fn witness_apply_script_contains_systemd_and_tailscale() -> Bool { +test fn witness_apply_script_contains_systemd_and_tailscale() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "sudo bash") && string_contains(s: sh, pattern: "sudo -n install -d -m 0755 -o briansrls -g briansrls /opt/gunbc/gunbc") @@ -155,7 +155,7 @@ fn witness_apply_script_contains_systemd_and_tailscale() -> Bool { data unprivileged_principal_witness_note: String = "Discriminating RED for the run-29822498755 regression class: the ci-runner principal (fleet_posix_accounts FleetAccountCiRunner) holds NO rsync/chown/rmdir grant and no write on the service-user-owned tree, so a bare rsync/chown/rmdir in either script is a deploy that fails on the host again. The tree sync must instead ride the service-user oneshot unit (both rsync directions live INSIDE gunbc-tree-sync.service, principal User=briansrls), and every mutation outside it must be one of the five granted sudo -n commands. Post-hoc admission of each sudo -n command against the ci_deploy_access grant envelope is the named residue (emit_deploy_principal_note)." -fn witness_scripts_stay_within_ci_runner_grants() -> Bool { +test fn witness_scripts_stay_within_ci_runner_grants() -> Bool { let apply = expected_live_deploy_apply_script() let retract = expected_live_deploy_retract_script() let unit = live_deploy_tree_sync_unit_for(spec: deployment_spec_srv1()) @@ -179,12 +179,12 @@ fn witness_scripts_stay_within_ci_runner_grants() -> Bool { data tree_sync_restart_diagnosis_witness_note: String = "Discriminating RED for #7011/receipt 29928424523: the tree-sync restart is synchronous and precedes the poll-based unit_diagnosis capture, so a bare restart failure carries no WHY. The apply script must fall through to the same unit-status-tail authority the roadmap-unit diagnosis already uses (never a second format), append it to stderr, and still fail the step — never proceed as if the restart had succeeded." -fn witness_tree_sync_restart_diagnoses_on_failure() -> Bool { +test fn witness_tree_sync_restart_diagnoses_on_failure() -> Bool { let sh = expected_live_deploy_apply_script() string_contains(s: sh, pattern: "sudo -n systemctl restart gunbc-tree-sync.service || { echo '--- gunbc-tree-sync.service control-process diagnosis ---' >&2; systemctl status --no-pager --full gunbc-tree-sync.service 2>&1 | tail -n 40 >&2; exit 1; }") } -fn witness_retract_script_owned_only() -> Bool { +test fn witness_retract_script_owned_only() -> Bool { let sh = expected_live_deploy_retract_script() !string_contains(s: sh, pattern: "sudo bash") && string_contains(s: sh, pattern: "sudo -n tailscale serve reset") @@ -202,20 +202,20 @@ fn witness_retract_script_owned_only() -> Bool { data apply_no_frozen_page_note: String = "The belt-B section-3 fix made executable: the apply script ships NO emitted node server and NO deploy-frozen page snapshot — the service renders the live roadmap per request. These two witnesses red if either ever creeps back into the apply script." -fn witness_apply_script_has_no_node_server() -> Bool { +test fn witness_apply_script_has_no_node_server() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "require('http').createServer") && !string_contains(s: sh, pattern: "server.js") && string_contains(s: sh, pattern: "gunbc serve") } -fn witness_apply_script_has_no_frozen_page() -> Bool { +test fn witness_apply_script_has_no_frozen_page() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "roadmap-section") && !string_contains(s: sh, pattern: " Bool { +test fn witness_apply_script_excludes_readback_curls() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "roadmap-site-readback") && !string_contains(s: sh, pattern: "roadmap-site-receipt") @@ -224,7 +224,7 @@ fn witness_apply_script_excludes_readback_curls() -> Bool { && !string_contains(s: sh, pattern: "--connect-timeout") } -fn witness_retract_owned_process_removes_serve_service() -> Bool { +test fn witness_retract_owned_process_removes_serve_service() -> Bool { let sh = expected_live_deploy_retract_script() string_contains(s: sh, pattern: "/opt/gunbc/bin/gunbc") && string_contains(s: sh, pattern: gunbc_roadmap_unit_name) @@ -234,7 +234,7 @@ fn witness_retract_owned_process_removes_serve_service() -> Bool { && !string_contains(s: sh, pattern: "roadmap-site-readback") } -fn witness_systemd_unit_emitted() -> Bool { +test fn witness_systemd_unit_emitted() -> Bool { let unit = live_deploy_systemd_unit_for(spec: deployment_spec_srv1()) string_contains(s: unit, pattern: "ExecStart=/opt/gunbc/bin/gunbc serve --source-root dag --source-root src/v2 --entry dag/gunbc/roadmap_serve.dag --function roadmap_serve_handle --host 0.0.0.0 --port 8080") && string_contains(s: unit, pattern: "User=briansrls") @@ -243,7 +243,7 @@ fn witness_systemd_unit_emitted() -> Bool { && !string_contains(s: unit, pattern: "node") } -fn witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis() -> Bool { +test fn witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis() -> Bool { match live_deploy_remote_mutation_service_op_realization_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -255,14 +255,14 @@ fn witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis( } } -fn witness_emit_shell_dissolution_trigger_is_scaffold() -> Bool { +test fn witness_emit_shell_dissolution_trigger_is_scaffold() -> Bool { match live_deploy_emit_shell_dissolution_trigger { Scaffold { dissolves_to: _, bind: _ } => true Terminal { reason: _ } => false } } -fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { +test fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { match live_deploy_intent_dependency_graph_emit_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -273,7 +273,7 @@ fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { } } -fn witness_apply_script_matches_committed_golden() -> Bool { +test fn witness_apply_script_matches_committed_golden() -> Bool { let r = Filesystem.Read(path: artifact_path(a: LiveDeployApplyScriptArtifact)) let expected = expected_live_deploy_apply_script() r.success @@ -281,7 +281,7 @@ fn witness_apply_script_matches_committed_golden() -> Bool { && !(concat(r.content, "x") == expected) } -fn witness_retract_script_matches_committed_golden() -> Bool { +test fn witness_retract_script_matches_committed_golden() -> Bool { let r = Filesystem.Read(path: artifact_path(a: LiveDeployRetractScriptArtifact)) let expected = expected_live_deploy_retract_script() r.success @@ -291,7 +291,7 @@ fn witness_retract_script_matches_committed_golden() -> Bool { data emit_poison_backstop_witness_note: String = "GOLDEN-INDEPENDENT backstop (calm-ferret pass-2 flag 2): the emit-level poison markers (teardown-dependency-unreachable, wholesale-refused) are the defense-in-depth backstop to the PRIMARY typed refusal (the EffectsOrRefusal SUM, proven golden-independent by w_effects_refuses_wholesale_on_any_refusal in the spine test). But the poison backstops are golden-DEPENDENT — a regen while a refusal was buggily active could commit a poisoned golden and the drift gate would then pass. These two witnesses call the refusal producers directly and assert the marker is present, golden-INDEPENDENT, so a golden-absorption can never hide that the arm still refuses loudly." -fn witness_teardown_dependency_arm_refuses_golden_independent() -> Bool { +test fn witness_teardown_dependency_arm_refuses_golden_independent() -> Bool { let steps = emit_deploy_teardown_dependency_refusal(dep: DeploymentDependencyStep { kind: TmuxPackage, package: package_tmux }) count(steps) == 1 && any(steps, s => match s { @@ -300,13 +300,13 @@ fn witness_teardown_dependency_arm_refuses_golden_independent() -> Bool { }) } -fn witness_wholesale_refused_poison_carries_marker() -> Bool { +test fn witness_wholesale_refused_poison_carries_marker() -> Bool { let poison = live_deploy_wholesale_refused_poison(refusals: [], fold_label: "APPLY") string_contains(s: poison, pattern: "__GUNBC_DEPLOY_REFUSED__") && string_contains(s: poison, pattern: "APPLY refused-member-count=0") } -fn witness_deploy_access_job_principal_refused_poison_golden_independent() -> Bool { +test fn witness_deploy_access_job_principal_refused_poison_golden_independent() -> Bool { let poison = deploy_access_job_principal_refused_emit_poison( refusal: DeployAccessJobPrincipalRefusal { job_user: "runner" as NonEmptyStr, @@ -317,38 +317,8 @@ fn witness_deploy_access_job_principal_refused_poison_golden_independent() -> Bo && string_contains(s: poison, pattern: "job_user=runner") } -fn witness_apply_script_access_ready_not_deploy_access_poison() -> Bool { +test fn witness_apply_script_access_ready_not_deploy_access_poison() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "__GUNBC_DEPLOY_ACCESS_REFUSED__") } -test fn live_deploy_emit_holds() -> Bool { - witness_spec_targets_srv1() - && witness_spec_uses_apt_package_manager() - && witness_spec_listen_port_is_8080() - && witness_owned_vs_ensured_typed() - && witness_retract_owned_only() - && witness_tailnet_domain_propagates_optional() - && witness_tailnet_url_absent_not_fabricated() - && witness_dependency_ensure_is_idempotent() - && witness_apply_script_contains_preflight_and_sudoers() - && witness_retract_preamble_acknowledges_shared_sudoers_install() - && witness_apply_script_contains_systemd_and_tailscale() - && witness_scripts_stay_within_ci_runner_grants() - && witness_tree_sync_restart_diagnoses_on_failure() - && witness_retract_script_owned_only() - && witness_apply_script_has_no_node_server() - && witness_apply_script_has_no_frozen_page() - && witness_apply_script_excludes_readback_curls() - && witness_retract_owned_process_removes_serve_service() - && witness_systemd_unit_emitted() - && witness_apply_script_matches_committed_golden() - && witness_retract_script_matches_committed_golden() - && witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis() - && witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() - && witness_emit_shell_dissolution_trigger_is_scaffold() - && witness_teardown_dependency_arm_refuses_golden_independent() - && witness_wholesale_refused_poison_carries_marker() - && witness_deploy_access_job_principal_refused_poison_golden_independent() - && witness_apply_script_access_ready_not_deploy_access_poison() -} diff --git a/dag/test/claim/live_deploy/intent_witness_test.dag b/dag/test/claim/live_deploy/intent_witness_test.dag index 27e4340d53d..def6bbd1051 100644 --- a/dag/test/claim/live_deploy/intent_witness_test.dag +++ b/dag/test/claim/live_deploy/intent_witness_test.dag @@ -18,24 +18,24 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_readback_requires_service_ready_gate() -> Bool { +test fn witness_readback_requires_service_ready_gate() -> Bool { let rb = live_deploy_readback_for_spec(spec: deployment_spec_srv1()) second_count(s: rb.after.timeout) == 120 && rb.after.probe.health_url == live_deploy_health_url_for_port(port: 8080) } -fn witness_health_url_is_localhost_on_srv1() -> Bool { +test fn witness_health_url_is_localhost_on_srv1() -> Bool { let url = live_deploy_health_url_for_port(port: 8080) starts_with(s: url as String, prefix: "http://127.0.0.1:8080") && ends_with(s: url as String, suffix: roadmap_site_health_path) } -fn witness_service_ready_gate_is_required_on_readback() -> Bool { +test fn witness_service_ready_gate_is_required_on_readback() -> Bool { let gate = live_deploy_service_ready_gate_for_spec(spec: deployment_spec_srv1()) gate.probe.health_url != "" as NonEmptyStr } -fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { +test fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { match live_deploy_intent_dependency_graph_emit_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -46,9 +46,3 @@ fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { } } -test fn live_deploy_intent_witnesses() -> Bool { - witness_readback_requires_service_ready_gate() - && witness_health_url_is_localhost_on_srv1() - && witness_service_ready_gate_is_required_on_readback() - && witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -} diff --git a/dag/test/claim/live_deploy/operations_witness_test.dag b/dag/test/claim/live_deploy/operations_witness_test.dag index 9346c492e83..e1427496c6e 100644 --- a/dag/test/claim/live_deploy/operations_witness_test.dag +++ b/dag/test/claim/live_deploy/operations_witness_test.dag @@ -36,7 +36,7 @@ fn argv_join(argv: List) -> String { join(argv, " ") } -fn witness_dpkg_status_argv_matches_transport_row() -> Bool { +test fn witness_dpkg_status_argv_matches_transport_row() -> Bool { let helper = dpkg_status_argv(package: package_tailscale) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -51,7 +51,7 @@ fn witness_dpkg_status_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -fn witness_apt_install_argv_matches_transport_row() -> Bool { +test fn witness_apt_install_argv_matches_transport_row() -> Bool { let helper = apt_install_argv(package: package_nodejs) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -66,7 +66,7 @@ fn witness_apt_install_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -fn witness_systemctl_restart_argv_matches_transport_row() -> Bool { +test fn witness_systemctl_restart_argv_matches_transport_row() -> Bool { let helper = systemctl_restart_argv(unit: gunbc_roadmap_unit_name) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -81,7 +81,7 @@ fn witness_systemctl_restart_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -fn witness_systemctl_disable_now_argv_matches_transport_row() -> Bool { +test fn witness_systemctl_disable_now_argv_matches_transport_row() -> Bool { let helper = systemctl_disable_now_argv(unit: gunbc_roadmap_unit_name) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -96,7 +96,7 @@ fn witness_systemctl_disable_now_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -fn witness_systemctl_daemon_reload_argv_matches_transport_row() -> Bool { +test fn witness_systemctl_daemon_reload_argv_matches_transport_row() -> Bool { let helper = systemctl_daemon_reload_argv() let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -109,7 +109,7 @@ fn witness_systemctl_daemon_reload_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -fn witness_systemctl_enable_argv_matches_transport_row() -> Bool { +test fn witness_systemctl_enable_argv_matches_transport_row() -> Bool { let helper = systemctl_enable_argv(unit: gunbc_roadmap_unit_name) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -124,55 +124,38 @@ fn witness_systemctl_enable_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -fn witness_dpkg_status_command_matches_transport() -> Bool { +test fn witness_dpkg_status_command_matches_transport() -> Bool { dpkg_status_command(package: package_tailscale) == "dpkg -s tailscale" } -fn witness_apt_install_command_matches_transport() -> Bool { +test fn witness_apt_install_command_matches_transport() -> Bool { apt_install_command(package: package_nodejs, privileged: false) == "apt-get install --yes nodejs" } -fn witness_privileged_apt_install_command() -> Bool { +test fn witness_privileged_apt_install_command() -> Bool { apt_install_command(package: package_tailscale, privileged: true) == "sudo -n apt-get install --yes tailscale" } -fn witness_systemctl_restart_command_matches_transport() -> Bool { +test fn witness_systemctl_restart_command_matches_transport() -> Bool { systemctl_restart_command(unit: gunbc_roadmap_unit_name, privileged: true) == "sudo -n systemctl restart gunbc-roadmap.service" } -fn witness_systemctl_enable_command_matches_transport() -> Bool { +test fn witness_systemctl_enable_command_matches_transport() -> Bool { systemctl_enable_command(unit: gunbc_roadmap_unit_name, privileged: true) == "sudo -n systemctl enable gunbc-roadmap.service" } -fn witness_systemctl_disable_now_command_matches_transport() -> Bool { +test fn witness_systemctl_disable_now_command_matches_transport() -> Bool { systemctl_disable_now_command(unit: gunbc_roadmap_unit_name, privileged: true) == "sudo -n systemctl disable --now gunbc-roadmap.service" } -fn witness_privileged_command_prefixes_sudo_n() -> Bool { +test fn witness_privileged_command_prefixes_sudo_n() -> Bool { privileged_command(argv: systemctl_daemon_reload_argv()) == "sudo -n systemctl daemon-reload" } -fn witness_systemctl_daemon_reload_command_privileged() -> Bool { +test fn witness_systemctl_daemon_reload_command_privileged() -> Bool { systemctl_daemon_reload_command(privileged: true) == "sudo -n systemctl daemon-reload" } -test fn live_deploy_operations_holds() -> Bool { - witness_dpkg_status_argv_matches_transport_row() - && witness_apt_install_argv_matches_transport_row() - && witness_systemctl_restart_argv_matches_transport_row() - && witness_systemctl_disable_now_argv_matches_transport_row() - && witness_systemctl_daemon_reload_argv_matches_transport_row() - && witness_systemctl_enable_argv_matches_transport_row() - && witness_dpkg_status_command_matches_transport() - && witness_apt_install_command_matches_transport() - && witness_privileged_apt_install_command() - && witness_systemctl_restart_command_matches_transport() - && witness_systemctl_enable_command_matches_transport() - && witness_systemctl_disable_now_command_matches_transport() - && witness_privileged_command_prefixes_sudo_n() - && witness_systemctl_daemon_reload_command_privileged() -} - test fn live_deploy_operations_RED_apt_install_wrong_package_golden() -> Bool { apt_install_command(package: package_tailscale, privileged: false) != "apt-get install --yes nodejs" } diff --git a/dag/test/claim/live_deploy/readiness_witness_test.dag b/dag/test/claim/live_deploy/readiness_witness_test.dag index 05b0daac672..360dfc1a914 100644 --- a/dag/test/claim/live_deploy/readiness_witness_test.dag +++ b/dag/test/claim/live_deploy/readiness_witness_test.dag @@ -68,23 +68,23 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_ssh_mock_stdout: String = "mock ssh stdin script executed" -fn witness_healthz_mock_body_groundable() -> Bool { +test fn witness_healthz_mock_body_groundable() -> Bool { healthz_body_groundable(body: "{\"status\":\"ok\"}") } -fn witness_healthz_trailing_lf_body_groundable() -> Bool { +test fn witness_healthz_trailing_lf_body_groundable() -> Bool { healthz_body_groundable(body: concat("{\"status\":\"ok\"}", "\n")) } -fn witness_healthz_malformed_extension_not_groundable() -> Bool { +test fn witness_healthz_malformed_extension_not_groundable() -> Bool { !healthz_body_groundable(body: concat(roadmap_site_healthz_body(), "}")) } -fn witness_healthz_bad_body_not_groundable() -> Bool { +test fn witness_healthz_bad_body_not_groundable() -> Bool { !healthz_body_groundable(body: "") } -fn witness_ssh_mock_stdout_is_discriminating_red() -> Bool { +test fn witness_ssh_mock_stdout_is_discriminating_red() -> Bool { !healthz_body_groundable(body: witness_ssh_mock_stdout) && match ground_service_ready_from_healthz( read: HealthzEffectiveRead { @@ -105,7 +105,7 @@ fn witness_argv_join(argv: List) -> String { ) } -fn witness_transport_probe_targets_localhost_healthz() -> Bool { +test fn witness_transport_probe_targets_localhost_healthz() -> Bool { let port = deployment_plan_listen_port(spec: deployment_spec_srv1()) let url = live_deploy_health_url_for_port(port: port) let argv = http_client_get_argv(url: url) @@ -119,7 +119,7 @@ fn witness_transport_probe_targets_localhost_healthz() -> Bool { && string_contains(s: url as String, pattern: "/healthz") } -fn witness_accept_no_response_probe_fails_fast_not_hangs() -> Bool { +test fn witness_accept_no_response_probe_fails_fast_not_hangs() -> Bool { match ground_service_ready_from_healthz( read: HealthzEffectiveRead { body: "", @@ -131,18 +131,18 @@ fn witness_accept_no_response_probe_fails_fast_not_hangs() -> Bool { } } -fn witness_transport_status_probe_uses_typed_systemctl_argv() -> Bool { +test fn witness_transport_status_probe_uses_typed_systemctl_argv() -> Bool { systemctl_status_operation_argv_matches_authority( unit: live_deploy_service_ready_unit_authority ) } -fn witness_transport_status_probe_realizes_hermetically() -> Bool { +test fn witness_transport_status_probe_realizes_hermetically() -> Bool { let r = systemd.Systemctl.Status(unit: live_deploy_service_ready_unit_authority) r.stdout != "" } -fn witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() -> Bool { +test fn witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() -> Bool { let port = deployment_plan_listen_port(spec: deployment_spec_srv1()) let read = live_deploy_healthz_get_for_port( port: port, @@ -155,21 +155,21 @@ fn witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() -> Bool { ) } -fn witness_service_ready_once_converges_on_healthy_fixture() -> Bool { +test fn witness_service_ready_once_converges_on_healthy_fixture() -> Bool { reconciliation_converged(r: live_deploy_service_ready_once()) } -fn witness_reconcile_grounds_healthy_fixture_read() -> Bool { +test fn witness_reconcile_grounds_healthy_fixture_read() -> Bool { reconciliation_converged( r: reconcile_service_ready_read(read: show_healthz_read_fixture_healthy()) ) } -fn witness_sleep_second_carrier_projection_paces_poll() -> Bool { +test fn witness_sleep_second_carrier_projection_paces_poll() -> Bool { sleep_delay_seconds_second_carrier_projection(duration: live_deploy_service_ready_poll_cadence_seconds()) } -fn witness_sleep_flat_scalar_dissolution_trigger_tracked() -> Bool { +test fn witness_sleep_flat_scalar_dissolution_trigger_tracked() -> Bool { match sleep_delay_seconds_flat_scalar_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -180,7 +180,7 @@ fn witness_sleep_flat_scalar_dissolution_trigger_tracked() -> Bool { } } -fn witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() -> Bool { +test fn witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() -> Bool { let spec = deployment_spec_srv1() let probe = live_deploy_service_ready_once_for_deploy( spec: spec, @@ -191,13 +191,13 @@ fn witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() -> Bool !reconciliation_converged(r: probe) && delay } -fn witness_bounded_poll_early_exit_on_grounded_read() -> Bool { +test fn witness_bounded_poll_early_exit_on_grounded_read() -> Bool { reconciliation_converged( r: reconcile_service_ready_read(read: show_healthz_read_fixture_healthy()) ) } -fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { +test fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { let max_attempts = live_deploy_service_ready_poll_max_attempts() let r = live_deploy_poll_service_ready_after_attempts( spec: deployment_spec_srv1(), @@ -216,11 +216,11 @@ fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { } } -fn witness_bounded_poll_max_attempts_derived_from_bound_over_cadence() -> Bool { +test fn witness_bounded_poll_max_attempts_derived_from_bound_over_cadence() -> Bool { live_deploy_service_ready_poll_max_attempts() == measure_fit_count_floor(capacity: live_deploy_service_ready_poll_bound, each: live_deploy_service_ready_poll_cadence_seconds()) } -fn witness_fresh_surface_read_grounds() -> Bool { +test fn witness_fresh_surface_read_grounds() -> Bool { match ground_service_ready_from_healthz( read: HealthzEffectiveRead { body: roadmap_site_healthz_body(), probe_error: "" } ) { @@ -229,7 +229,7 @@ fn witness_fresh_surface_read_grounds() -> Bool { } } -fn witness_stale_surface_read_does_not_ground() -> Bool { +test fn witness_stale_surface_read_does_not_ground() -> Bool { let stale = "{\"status\":\"ok\",\"service\":\"gunbc-roadmap\",\"artifacts\":{\"/roadmap\":\"stale-digest\"}}" roadmap_site_healthz_json_string_parses(body: stale) && !roadmap_site_healthz_surface_is_current(observed_body: stale) @@ -244,11 +244,11 @@ fn witness_stale_surface_read_does_not_ground() -> Bool { } } -fn witness_healthz_surface_tolerates_transport_trailing_lf() -> Bool { +test fn witness_healthz_surface_tolerates_transport_trailing_lf() -> Bool { roadmap_site_healthz_surface_is_current(observed_body: concat(roadmap_site_healthz_body(), "\n")) } -fn witness_healthz_publishes_every_served_surface_digest() -> Bool { +test fn witness_healthz_publishes_every_served_surface_digest() -> Bool { let body = roadmap_site_healthz_body() string_contains(s: body, pattern: "\"/ROADMAP.md\":") && string_contains(s: body, pattern: "\"/target/roadmap-dispatch.json\":") @@ -257,7 +257,7 @@ fn witness_healthz_publishes_every_served_surface_digest() -> Bool { && string_contains(s: body, pattern: "\"/assets/roadmap-dispatch.js\":") } -fn witness_served_surface_digest_tracks_the_page() -> Bool { +test fn witness_served_surface_digest_tracks_the_page() -> Bool { let published = roadmap_site_healthz_body() let page_digest = site_artifact_digest(body: served_page_body(page: roadmap_page_for_authority())) as String let js_digest = site_artifact_digest(body: dispatch_client_js_source()) as String @@ -266,7 +266,7 @@ fn witness_served_surface_digest_tracks_the_page() -> Bool { && !(page_digest == js_digest) } -fn witness_service_not_ready_refusal_shape_matches_contract() -> Bool { +test fn witness_service_not_ready_refusal_shape_matches_contract() -> Bool { let reason = service_not_ready_reason(refusal: ServiceNotReady { unit: live_deploy_service_ready_unit_authority, endpoint: live_deploy_service_ready_endpoint_authority, @@ -279,29 +279,3 @@ fn witness_service_not_ready_refusal_shape_matches_contract() -> Bool { && string_contains(s: reason, pattern: "Active: failed (Result: exit-code)") } -test fn live_deploy_readiness_witnesses() -> Bool { - witness_healthz_mock_body_groundable() - && witness_healthz_trailing_lf_body_groundable() - && witness_healthz_malformed_extension_not_groundable() - && witness_healthz_bad_body_not_groundable() - && witness_ssh_mock_stdout_is_discriminating_red() - && witness_transport_probe_targets_localhost_healthz() - && witness_transport_status_probe_uses_typed_systemctl_argv() - && witness_transport_status_probe_realizes_hermetically() - && witness_accept_no_response_probe_fails_fast_not_hangs() - && witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() - && witness_service_ready_once_converges_on_healthy_fixture() - && witness_reconcile_grounds_healthy_fixture_read() - && witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() - && witness_sleep_second_carrier_projection_paces_poll() - && witness_sleep_flat_scalar_dissolution_trigger_tracked() - && witness_bounded_poll_early_exit_on_grounded_read() - && witness_bounded_poll_max_attempts_derived_from_bound_over_cadence() - && witness_red_control_never_ready_refuses_at_poll_bound() - && witness_service_not_ready_refusal_shape_matches_contract() - && witness_fresh_surface_read_grounds() - && witness_stale_surface_read_does_not_ground() - && witness_healthz_surface_tolerates_transport_trailing_lf() - && witness_healthz_publishes_every_served_surface_digest() - && witness_served_surface_digest_tracks_the_page() -} diff --git a/dag/test/claim/live_deploy/service_ready_witness_test.dag b/dag/test/claim/live_deploy/service_ready_witness_test.dag index 01df81112dd..898c6585192 100644 --- a/dag/test/claim/live_deploy/service_ready_witness_test.dag +++ b/dag/test/claim/live_deploy/service_ready_witness_test.dag @@ -29,15 +29,15 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_service_ready_unit_authority() -> Bool { +test fn witness_service_ready_unit_authority() -> Bool { live_deploy_service_ready_unit_authority == gunbc_roadmap_unit_name } -fn witness_service_ready_endpoint_authority() -> Bool { +test fn witness_service_ready_endpoint_authority() -> Bool { live_deploy_service_ready_endpoint_authority == roadmap_site_health_path } -fn witness_service_not_ready_reason_is_located() -> Bool { +test fn witness_service_not_ready_reason_is_located() -> Bool { let reason = service_not_ready_reason(refusal: ServiceNotReady { unit: gunbc_roadmap_unit_name, endpoint: roadmap_site_health_path, @@ -52,7 +52,7 @@ fn witness_service_not_ready_reason_is_located() -> Bool { && string_contains(s: reason, pattern: "Active: failed (Result: exit-code)") } -fn witness_readiness_poll_bound_grounded_on_std_measure_second() -> Bool { +test fn witness_readiness_poll_bound_grounded_on_std_measure_second() -> Bool { live_deploy_readiness_poll_bound_is_positive() && second_count(s: live_deploy_readiness_poll_bound_seconds()) == 120 } @@ -70,11 +70,11 @@ fn witness_expected_startup_covers_measured_srv1_observations() -> Bool { expected >= 39 } -fn witness_health_probe_path_matches_service_ready_endpoint() -> Bool { +test fn witness_health_probe_path_matches_service_ready_endpoint() -> Bool { live_deploy_service_ready_endpoint_authority == roadmap_site_health_path } -fn witness_scaffold_dissolution_trigger_binds_readiness_poll() -> Bool { +test fn witness_scaffold_dissolution_trigger_binds_readiness_poll() -> Bool { match live_deploy_service_ready_scaffold_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -85,7 +85,7 @@ fn witness_scaffold_dissolution_trigger_binds_readiness_poll() -> Bool { } } -fn witness_scaffold_carries_named_dissolution_trigger() -> Bool { +test fn witness_scaffold_carries_named_dissolution_trigger() -> Bool { match live_deploy_service_ready_scaffold { Scaffold { dissolves_to: RealizationDispatch, @@ -97,7 +97,7 @@ fn witness_scaffold_carries_named_dissolution_trigger() -> Bool { } } -fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { +test fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { let refusal = service_not_ready_refusal_at_poll_bound( last_probe: "health probe never succeeded", unit_diagnosis: UnitDiagnosisCaptured { text: "Active: failed (Result: exit-code) Main PID: 4242 (code=exited, status=1/FAILURE)" } @@ -111,7 +111,7 @@ fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { && !string_contains(s: reason, pattern: "proceed anyway") } -fn witness_refusal_locates_unit_state_distinctly_from_probe() -> Bool { +test fn witness_refusal_locates_unit_state_distinctly_from_probe() -> Bool { let probe_only = service_not_ready_refusal_at_poll_bound( last_probe: "connection refused", unit_diagnosis: UnitDiagnosisUnavailable @@ -129,7 +129,7 @@ fn witness_refusal_locates_unit_state_distinctly_from_probe() -> Bool { && probe_only_reason != located_reason } -fn witness_host_sleep_frontier_trigger_binds_srv3_consumer() -> Bool { +test fn witness_host_sleep_frontier_trigger_binds_srv3_consumer() -> Bool { match live_deploy_host_sleep_generalization_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -140,25 +140,11 @@ fn witness_host_sleep_frontier_trigger_binds_srv3_consumer() -> Bool { } } -fn witness_poll_max_attempts_is_thirty() -> Bool { +test fn witness_poll_max_attempts_is_thirty() -> Bool { live_deploy_service_ready_poll_max_attempts() == 120 } -fn witness_poll_max_attempts_tracks_cadence() -> Bool { +test fn witness_poll_max_attempts_tracks_cadence() -> Bool { live_deploy_service_ready_poll_max_attempts() == measure_fit_count_floor(capacity: live_deploy_service_ready_poll_bound, each: live_deploy_service_ready_poll_cadence) } -test fn live_deploy_service_ready_witnesses() -> Bool { - witness_service_ready_unit_authority() - && witness_service_ready_endpoint_authority() - && witness_service_not_ready_reason_is_located() - && witness_readiness_poll_bound_grounded_on_std_measure_second() - && witness_health_probe_path_matches_service_ready_endpoint() - && witness_scaffold_carries_named_dissolution_trigger() - && witness_scaffold_dissolution_trigger_binds_readiness_poll() - && witness_host_sleep_frontier_trigger_binds_srv3_consumer() - && witness_poll_max_attempts_is_thirty() - && witness_poll_max_attempts_tracks_cadence() - && witness_red_control_never_ready_refuses_at_poll_bound() - && witness_refusal_locates_unit_state_distinctly_from_probe() -} diff --git a/dag/test/claim/machine_shape_catalog_integration_witness_test.dag b/dag/test/claim/machine_shape_catalog_integration_witness_test.dag index 96fd4f24ba5..1db8242590f 100644 --- a/dag/test/claim/machine_shape_catalog_integration_witness_test.dag +++ b/dag/test/claim/machine_shape_catalog_integration_witness_test.dag @@ -43,7 +43,7 @@ fn cpu_catalog_shape() -> MachineShape { } } -fn w_cpu_cache_levels_integrated_into_memory_shape() -> Bool { +test fn w_cpu_cache_levels_integrated_into_memory_shape() -> Bool { let memory = cpu_catalog_shape().domains.first().memory list_length(items: memory) == 3 && memory.first().id == ampere_l1_level @@ -58,7 +58,7 @@ fn w_cpu_cache_levels_integrated_into_memory_shape() -> Bool { && byte_size_count(b: memory.skip(n: 2).first().capacity) == ampere_l3_bytes } -fn w_cpu_catalog_lane_count_matches_threads() -> Bool { +test fn w_cpu_catalog_lane_count_matches_threads() -> Bool { match machine_shape_domain_lane_count(shape: cpu_catalog_shape()) { Present { value: lanes } => hardware_thread_count_value(t: lanes) == hardware_thread_count_value(t: altra_max_m12830_catalog.threads) @@ -66,7 +66,3 @@ fn w_cpu_catalog_lane_count_matches_threads() -> Bool { } } -test fn machine_shape_catalog_integration_witnesses() -> Bool { - w_cpu_cache_levels_integrated_into_memory_shape() - && w_cpu_catalog_lane_count_matches_threads() -} diff --git a/dag/test/claim/machine_shape_witness_test.dag b/dag/test/claim/machine_shape_witness_test.dag index a7b0e04da15..a4e61c2027b 100644 --- a/dag/test/claim/machine_shape_witness_test.dag +++ b/dag/test/claim/machine_shape_witness_test.dag @@ -71,7 +71,7 @@ fn shape_from_rtx5090_catalog() -> MachineShape { } } -fn catalog_derivation_matches_row() -> Bool { +test fn catalog_derivation_matches_row() -> Bool { let shape = shape_from_rtx5090_catalog() let memory = shape.domains.first().memory let device = memory.skip(n: list_length(items: memory) - 1).first() @@ -88,7 +88,7 @@ fn catalog_derivation_matches_row() -> Bool { } } -fn minimal_grant_is_single_domain() -> Bool { +test fn minimal_grant_is_single_domain() -> Bool { machine_shape_is_single_domain(shape: shape_from_rtx5090_catalog()) } @@ -105,26 +105,26 @@ fn shape_from_m5_catalog() -> MachineShape { } } -fn gpu_sm_cache_levels_integrated_when_cited() -> Bool { +test fn gpu_sm_cache_levels_integrated_when_cited() -> Bool { let memory = shape_from_rtx5090_catalog().domains.first().memory list_length(items: memory) == 3 && byte_size_count(b: memory.first().capacity) == rtx5090_sm_register_bytes && byte_size_count(b: memory.skip(n: 1).first().capacity) == rtx5090_sm_shared_bytes } -fn gpu_sm_cache_absent_when_ungranted() -> Bool { +test fn gpu_sm_cache_absent_when_ungranted() -> Bool { list_length(items: shape_from_m5_catalog().domains.first().memory) == 1 } -fn energy_derived_not_stored() -> Bool { +test fn energy_derived_not_stored() -> Bool { joule_count(j: energy_from_power_and_time(power: watt(count: 100), time: second(count: 5))) == 500 } -fn pcie_interconnect_link_derives_bandwidth() -> Bool { +test fn pcie_interconnect_link_derives_bandwidth() -> Bool { bandwidth_count(b: pcie_interconnect_link(link: rtx5090_pcie_link).bandwidth) == bandwidth_count(b: pcie_link_bandwidth(link: rtx5090_pcie_link)) } -fn red_dangling_domain_refuses() -> Bool { +test fn red_dangling_domain_refuses() -> Bool { let good = shape_from_rtx5090_catalog() let bad = MachineShape { domains: good.domains @@ -143,7 +143,7 @@ fn red_dangling_domain_refuses() -> Bool { } } -fn red_dangling_level_refuses() -> Bool { +test fn red_dangling_level_refuses() -> Bool { let bad_level: LevelId = "missing-level" as LevelId let bad = MachineShape { domains: shape_from_rtx5090_catalog().domains @@ -163,13 +163,3 @@ fn red_dangling_level_refuses() -> Bool { } } -test fn machine_shape_witnesses() -> Bool { - catalog_derivation_matches_row() - && minimal_grant_is_single_domain() - && gpu_sm_cache_levels_integrated_when_cited() - && gpu_sm_cache_absent_when_ungranted() - && energy_derived_not_stored() - && pcie_interconnect_link_derives_bandwidth() - && red_dangling_domain_refuses() - && red_dangling_level_refuses() -} diff --git a/dag/test/claim/markdown_inline_render_test.dag b/dag/test/claim/markdown_inline_render_test.dag index 1ea99334b32..e890df6312a 100644 --- a/dag/test/claim/markdown_inline_render_test.dag +++ b/dag/test/claim/markdown_inline_render_test.dag @@ -16,17 +16,17 @@ fn parse_and_render(text: String) -> List { ) } -fn witness_bold_renders_to_strong_node() -> Bool { +test fn witness_bold_renders_to_strong_node() -> Bool { parse_and_render(text: "**bold text**") == [ Element { tag: "strong", attributes: [], children: [ FragmentText { content: "bold text" } ] } ] } -fn witness_code_renders_to_code_node() -> Bool { +test fn witness_code_renders_to_code_node() -> Bool { parse_and_render(text: "`inline code`") == [ Element { tag: "code", attributes: [], children: [ FragmentText { content: "inline code" } ] } ] } -fn witness_link_renders_to_anchor_node() -> Bool { +test fn witness_link_renders_to_anchor_node() -> Bool { parse_and_render(text: "[label](/docs/plan.md)") == [ Element { tag: "a", @@ -36,12 +36,12 @@ fn witness_link_renders_to_anchor_node() -> Bool { ] } -fn witness_em_renders_to_em_node() -> Bool { +test fn witness_em_renders_to_em_node() -> Bool { parse_and_render(text: "*emphasis*") == [ Element { tag: "em", attributes: [], children: [ FragmentText { content: "emphasis" } ] } ] } -fn witness_mixed_inline_renders_to_nodes() -> Bool { +test fn witness_mixed_inline_renders_to_nodes() -> Bool { parse_and_render(text: "**bold** and `code`") == [ Element { tag: "strong", attributes: [], children: [ FragmentText { content: "bold" } ] }, @@ -50,15 +50,15 @@ fn witness_mixed_inline_renders_to_nodes() -> Bool { ] } -fn witness_plain_text_stays_text_node() -> Bool { +test fn witness_plain_text_stays_text_node() -> Bool { parse_and_render(text: "plain text no markup") == [ FragmentText { content: "plain text no markup" } ] } -fn witness_markup_bold_differs_from_plain() -> Bool { +test fn witness_markup_bold_differs_from_plain() -> Bool { !(parse_and_render(text: "**bold**") == parse_and_render(text: "bold")) } -fn witness_image_inline_renders_to_img_node() -> Bool { +test fn witness_image_inline_renders_to_img_node() -> Bool { markdown_inline_to_fragments(inline: ImageInline { alt: "description", url: "/img.png" }) == [ Element { tag: "img", @@ -71,13 +71,3 @@ fn witness_image_inline_renders_to_img_node() -> Bool { ] } -test fn markdown_inline_render_keystone_holds() -> Bool { - witness_bold_renders_to_strong_node() - && witness_code_renders_to_code_node() - && witness_link_renders_to_anchor_node() - && witness_em_renders_to_em_node() - && witness_mixed_inline_renders_to_nodes() - && witness_plain_text_stays_text_node() - && witness_markup_bold_differs_from_plain() - && witness_image_inline_renders_to_img_node() -} diff --git a/dag/test/claim/markdown_markup_xss_witness_test.dag b/dag/test/claim/markdown_markup_xss_witness_test.dag index e7050e75eed..3dab790e579 100644 --- a/dag/test/claim/markdown_markup_xss_witness_test.dag +++ b/dag/test/claim/markdown_markup_xss_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.markdown_markup_xss_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn sample_readme_doc() -> MarkdownDocument { @@ -54,7 +53,7 @@ fn sample_readme_doc() -> MarkdownDocument { } } -fn witness_markdown_reduces_and_serializes() -> Bool { +test fn witness_markdown_reduces_and_serializes() -> Bool { match try_serialize_markdown_document(doc: sample_readme_doc()) { Serialized { html: h } => h == concat( @@ -74,7 +73,7 @@ fn witness_markdown_reduces_and_serializes() -> Bool { } } -fn witness_markdown_uses_one_serialize_fragment_fold() -> Bool { +test fn witness_markdown_uses_one_serialize_fragment_fold() -> Bool { let via_consumer = serialize_markdown_document(doc: sample_readme_doc()) let via_fold = serialize_fragment( frag: markdown_document_to_fragment(doc: sample_readme_doc()) @@ -82,7 +81,7 @@ fn witness_markdown_uses_one_serialize_fragment_fold() -> Bool { via_consumer == via_fold } -fn witness_ordered_list_serializes() -> Bool { +test fn witness_ordered_list_serializes() -> Bool { let doc = MarkdownDocument { blocks: [ OrderedListBlock { @@ -111,7 +110,7 @@ fn witness_ordered_list_serializes() -> Bool { } } -fn witness_image_serializes() -> Bool { +test fn witness_image_serializes() -> Bool { let doc = MarkdownDocument { blocks: [ ParagraphBlock { @@ -128,7 +127,7 @@ fn witness_image_serializes() -> Bool { } } -fn witness_heading_levels_map_to_tags() -> Bool { +test fn witness_heading_levels_map_to_tags() -> Bool { let doc = MarkdownDocument { blocks: [ HeadingBlock { level: H2, inlines: [ TextInline { text: "sub" } ] }, @@ -170,14 +169,14 @@ fn data_image_doc() -> MarkdownDocument { } } -fn witness_javascript_link_rejects() -> Bool { +test fn witness_javascript_link_rejects() -> Bool { match try_serialize_markdown_document(doc: javascript_link_doc()) { Rejected { reason: _ } => true Serialized { html: _ } => false } } -fn witness_data_image_rejects() -> Bool { +test fn witness_data_image_rejects() -> Bool { match try_serialize_markdown_document(doc: data_image_doc()) { Rejected { reason: _ } => true Serialized { html: _ } => false @@ -188,14 +187,14 @@ fn witness_escape_url_passes_javascript_scheme() -> Bool { escape_url(s: "javascript:alert(1)") == "javascript:alert(1)" } -fn witness_javascript_link_reject_discriminates_from_char_escape() -> Bool { +test fn witness_javascript_link_reject_discriminates_from_char_escape() -> Bool { let unchecked = serialize_markdown_document(doc: javascript_link_doc()) witness_javascript_link_rejects() && witness_escape_url_passes_javascript_scheme() && unchecked == "" } -fn witness_data_image_reject_discriminates_from_char_escape() -> Bool { +test fn witness_data_image_reject_discriminates_from_char_escape() -> Bool { witness_data_image_rejects() && starts_with( s: serialize_markdown_document(doc: data_image_doc()), @@ -203,28 +202,28 @@ fn witness_data_image_reject_discriminates_from_char_escape() -> Bool { ) } -fn witness_validate_href_javascript_rejects() -> Bool { +test fn witness_validate_href_javascript_rejects() -> Bool { match validate_href(url: "javascript:alert(1)") { RejectedHref { reason: DangerousScheme { scheme: JavascriptScheme } } => true _ => false } } -fn witness_validate_href_data_rejects() -> Bool { +test fn witness_validate_href_data_rejects() -> Bool { match validate_href(url: "data:text/html,x") { RejectedHref { reason: DangerousScheme { scheme: DataScheme } } => true _ => false } } -fn witness_relative_link_accepted() -> Bool { +test fn witness_relative_link_accepted() -> Bool { match validate_href(url: "/safe/path") { SafeHref { url: u } => u == "/safe/path" _ => false } } -fn witness_https_link_serializes() -> Bool { +test fn witness_https_link_serializes() -> Bool { let doc = MarkdownDocument { blocks: [ ParagraphBlock { @@ -244,7 +243,7 @@ fn witness_https_link_serializes() -> Bool { } } -fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { +test fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { let doc = MarkdownDocument { blocks: [ ParagraphBlock { @@ -264,19 +263,3 @@ fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { } } -test fn markdown_markup_xss_keystone_holds() -> Bool { - witness_markdown_reduces_and_serializes() - && witness_markdown_uses_one_serialize_fragment_fold() - && witness_ordered_list_serializes() - && witness_image_serializes() - && witness_heading_levels_map_to_tags() - && witness_javascript_link_rejects() - && witness_data_image_rejects() - && witness_javascript_link_reject_discriminates_from_char_escape() - && witness_data_image_reject_discriminates_from_char_escape() - && witness_validate_href_javascript_rejects() - && witness_validate_href_data_rejects() - && witness_relative_link_accepted() - && witness_https_link_serializes() - && witness_req_a_hostile_href_still_emits_with_escaping() -} diff --git a/dag/test/claim/markdown_roundtrip_test.dag b/dag/test/claim/markdown_roundtrip_test.dag index 23f45758c8c..4b7ee4cc14a 100644 --- a/dag/test/claim/markdown_roundtrip_test.dag +++ b/dag/test/claim/markdown_roundtrip_test.dag @@ -1,6 +1,5 @@ module test.claim.markdown_roundtrip - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn roundtrip_core_doc() -> MarkdownDocument { @@ -38,7 +37,7 @@ fn roundtrip_core_doc() -> MarkdownDocument { } } -fn witness_roundtrip_core() -> Bool { +test fn witness_roundtrip_core() -> Bool { ingest_markdown_source(src: serialize_markdown_source(doc: roundtrip_core_doc())) == roundtrip_core_doc() } @@ -80,7 +79,7 @@ fn perturbed_separator_spellings() -> MarkdownSpellings { spellings_override(bullet: commonmark_gfm_spellings.unordered_bullet, separator: "\n---\n") } -fn witness_roundtrip_under_perturbed_rows() -> Bool { +test fn witness_roundtrip_under_perturbed_rows() -> Bool { let spb = perturbed_bullet_spellings() let restored_b = ingest_markdown_source_with(src: serialize_markdown_source_with(doc: roundtrip_core_doc(), sp: spb), sp: spb) let sps = perturbed_separator_spellings() @@ -88,14 +87,14 @@ fn witness_roundtrip_under_perturbed_rows() -> Bool { (restored_b == roundtrip_core_doc()) && (restored_s == roundtrip_core_doc()) } -fn witness_ingest_reads_bullet_row() -> Bool { +test fn witness_ingest_reads_bullet_row() -> Bool { let emitted_b = serialize_markdown_source_with(doc: roundtrip_core_doc(), sp: perturbed_bullet_spellings()) let emitted_s = serialize_markdown_source_with(doc: roundtrip_core_doc(), sp: perturbed_separator_spellings()) !(ingest_markdown_source(src: emitted_b) == roundtrip_core_doc()) && !(ingest_markdown_source(src: emitted_s) == roundtrip_core_doc()) } -fn witness_core_advertised_lossless() -> Bool { +test fn witness_core_advertised_lossless() -> Bool { let recovered = ingest_markdown_source(src: serialize_markdown_source(doc: roundtrip_core_doc())) let m = markdown_medium_lossless(doc: recovered) match m.fidelity { @@ -117,14 +116,7 @@ fn frontier_emphasis_doc() -> MarkdownDocument { } } -fn witness_frontier_not_roundtripped() -> Bool { +test fn witness_frontier_not_roundtripped() -> Bool { !(ingest_markdown_source(src: serialize_markdown_source(doc: frontier_emphasis_doc())) == frontier_emphasis_doc()) } -test fn markdown_roundtrip_keystone_holds() -> Bool { - witness_roundtrip_core() - && witness_roundtrip_under_perturbed_rows() - && witness_ingest_reads_bullet_row() - && witness_core_advertised_lossless() - && witness_frontier_not_roundtripped() -} diff --git a/dag/test/claim/markdown_source_emit_test.dag b/dag/test/claim/markdown_source_emit_test.dag index 6421e759157..63ecee84677 100644 --- a/dag/test/claim/markdown_source_emit_test.dag +++ b/dag/test/claim/markdown_source_emit_test.dag @@ -1,6 +1,5 @@ module test.claim.markdown_source_emit - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn sample_doc() -> MarkdownDocument { @@ -118,7 +117,7 @@ fn expected_markdown() -> String { ], "") } -fn witness_exact_bytes() -> Bool { +test fn witness_exact_bytes() -> Bool { serialize_markdown_source(doc: sample_doc()) == expected_markdown() } @@ -126,7 +125,7 @@ fn code_only_doc(code: String) -> MarkdownDocument { MarkdownDocument { blocks: [ CodeBlock { code: code } ] } } -fn witness_code_block_closing_fence_on_own_line() -> Bool { +test fn witness_code_block_closing_fence_on_own_line() -> Bool { let no_nl = serialize_markdown_source(doc: code_only_doc(code: "let x = 1;")) let with_nl = serialize_markdown_source(doc: code_only_doc(code: "let x = 1;\n")) (no_nl == "```\nlet x = 1;\n```\n") && (no_nl == with_nl) @@ -174,14 +173,9 @@ fn tiny_list_doc() -> MarkdownDocument { } } -fn witness_row_driven_bullet() -> Bool { +test fn witness_row_driven_bullet() -> Bool { let canonical = serialize_markdown_source_with(doc: tiny_list_doc(), sp: commonmark_gfm_spellings) let perturbed = serialize_markdown_source_with(doc: tiny_list_doc(), sp: perturbed_bullet_spellings()) (canonical == "- x\n") && (perturbed == "+ x\n") && !(canonical == perturbed) } -test fn markdown_source_emit_keystone_holds() -> Bool { - witness_exact_bytes() - && witness_row_driven_bullet() - && witness_code_block_closing_fence_on_own_line() -} diff --git a/dag/test/claim/markup_medium_convergence_test.dag b/dag/test/claim/markup_medium_convergence_test.dag index 9de7637f0d7..a7e83efa625 100644 --- a/dag/test/claim/markup_medium_convergence_test.dag +++ b/dag/test/claim/markup_medium_convergence_test.dag @@ -44,7 +44,7 @@ fn md_medium() -> MarkupMedium { markdown_markup_medium(sp: commonmark_gfm_spellings) } -fn witness_same_fold_html_vs_md() -> Bool { +test fn witness_same_fold_html_vs_md() -> Bool { let html = serialize_fragment_with(frag: em_hi(), medium: html_markup_medium()) let md = serialize_fragment_with(frag: em_hi(), medium: md_medium()) (html == "hi") && (md == "*hi*") && (html != md) @@ -61,7 +61,7 @@ fn md_medium_underscore() -> MarkupMedium { } } -fn witness_perturb_row_flips_output() -> Bool { +test fn witness_perturb_row_flips_output() -> Bool { let base = serialize_fragment_with(frag: em_hi(), medium: md_medium()) let perturbed = serialize_fragment_with(frag: em_hi(), medium: md_medium_underscore()) (base == "*hi*") && (perturbed == "_hi_") && (base != perturbed) @@ -93,7 +93,7 @@ fn single_quote_medium() -> MarkupMedium { } } -fn witness_third_medium_is_one_row() -> Bool { +test fn witness_third_medium_is_one_row() -> Bool { let html = serialize_fragment_with(frag: button_node(), medium: html_markup_medium()) let single_quote = serialize_fragment_with(frag: button_node(), medium: single_quote_medium()) (html == "") @@ -115,7 +115,7 @@ fn md_mixed_doc() -> MarkdownDocument { } } -fn witness_md_inline_emission_bytes() -> Bool { +test fn witness_md_inline_emission_bytes() -> Bool { let out = serialize_markdown_source_with(doc: md_mixed_doc(), sp: commonmark_gfm_spellings) out == "**bold** and *em*\n" } @@ -132,7 +132,7 @@ fn md_link_doc() -> MarkdownDocument { } } -fn witness_md_link_named_arm_bytes() -> Bool { +test fn witness_md_link_named_arm_bytes() -> Bool { let out = serialize_markdown_source_with(doc: md_link_doc(), sp: commonmark_gfm_spellings) out == "[text](https://x.com)\n" } @@ -145,18 +145,10 @@ fn hostile_href_node() -> Fragment { } } -fn witness_xss_still_rejected_through_fold() -> Bool { +test fn witness_xss_still_rejected_through_fold() -> Bool { match try_serialize_html_source(node: hostile_href_node()) { EmitRejected { reason: _ } => true EmitOk { html: _ } => false } } -test fn markup_medium_convergence_holds() -> Bool { - witness_same_fold_html_vs_md() - && witness_perturb_row_flips_output() - && witness_third_medium_is_one_row() - && witness_md_inline_emission_bytes() - && witness_md_link_named_arm_bytes() - && witness_xss_still_rejected_through_fold() -} diff --git a/dag/test/claim/markup_serializer_witness_test.dag b/dag/test/claim/markup_serializer_witness_test.dag index 3b45b17c832..7300006bbb4 100644 --- a/dag/test/claim/markup_serializer_witness_test.dag +++ b/dag/test/claim/markup_serializer_witness_test.dag @@ -18,15 +18,15 @@ import extdeps.languages.html_fragment { serialize_fragment } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_text_escaping_by_execution() -> Bool { +test fn witness_text_escaping_by_execution() -> Bool { escape_text(s: "a & c") == "a <b> & c" } -fn witness_attribute_escaping_by_execution() -> Bool { +test fn witness_attribute_escaping_by_execution() -> Bool { escape_attribute(s: "a \"q\" <&>") == "a "q" <&>" } -fn witness_url_escaping_by_execution() -> Bool { +test fn witness_url_escaping_by_execution() -> Bool { escape_url(s: "/p?x=a b&y=\"z\"<") == "/p?x=a%20b&y=%22z%22%3C" } @@ -41,7 +41,7 @@ fn sample_fragment() -> Fragment { } } -fn witness_serialize_fragment_full() -> Bool { +test fn witness_serialize_fragment_full() -> Bool { serialize_fragment(frag: sample_fragment()) == "hi <b> & \"q\">end" } @@ -62,25 +62,25 @@ fn react_consumer_button() -> Fragment { } } -fn witness_one_fold_serves_html_and_react() -> Bool { +test fn witness_one_fold_serves_html_and_react() -> Bool { let html = serialize_fragment(frag: html_consumer_button()) let react = serialize_fragment(frag: react_consumer_button()) (html == react) && (html == "") } -fn witness_round_trip_text() -> Bool { +test fn witness_round_trip_text() -> Bool { unescape_text(s: escape_text(s: "x & \"q\" y")) == "x & \"q\" y" } -fn witness_round_trip_attribute() -> Bool { +test fn witness_round_trip_attribute() -> Bool { unescape_attribute(s: escape_attribute(s: "x & \"q\" y")) == "x & \"q\" y" } -fn witness_round_trip_url() -> Bool { +test fn witness_round_trip_url() -> Bool { unescape_url(s: escape_url(s: "x & \"q\" y")) == "x & \"q\" y" } -fn witness_round_trip_url_literal_percent() -> Bool { +test fn witness_round_trip_url_literal_percent() -> Bool { unescape_url(s: escape_url(s: "a %3C %22 %25 ")) == "a %3C %22 %25 " } @@ -92,7 +92,7 @@ fn req_a_breakout_fragment() -> Fragment { } } -fn witness_url_within_attribute_composition() -> Bool { +test fn witness_url_within_attribute_composition() -> Bool { serialize_fragment(frag: req_a_breakout_fragment()) == "" } @@ -101,22 +101,9 @@ fn escape_text_drop_lt(s: String) -> String { replace(replace(s, "&", "&"), ">", ">") } -fn witness_perturb_break_escape_goes_red() -> Bool { +test fn witness_perturb_break_escape_goes_red() -> Bool { (escape_text(s: "a ") != escape_text_drop_lt(s: "a ")) && (escape_text(s: "a ") == "a <b>") && (escape_text_drop_lt(s: "a ") == "a Bool { - witness_text_escaping_by_execution() && - witness_attribute_escaping_by_execution() && - witness_url_escaping_by_execution() && - witness_serialize_fragment_full() && - witness_one_fold_serves_html_and_react() && - witness_round_trip_text() && - witness_round_trip_attribute() && - witness_round_trip_url() && - witness_round_trip_url_literal_percent() && - witness_url_within_attribute_composition() && - witness_perturb_break_escape_goes_red() -} diff --git a/dag/test/claim/materialized_secret_witness_test.dag b/dag/test/claim/materialized_secret_witness_test.dag index 9d383a6f482..0ca69a65709 100644 --- a/dag/test/claim/materialized_secret_witness_test.dag +++ b/dag/test/claim/materialized_secret_witness_test.dag @@ -14,7 +14,7 @@ fn use_marker(m: MaterializedSecret) -> Int { data witness_a3_hinge_note: String = "THE conjunct A3 exists for, and it is the srv4 incident replayed. Secret Manager says SmEnabled — every existence check the model can perform is green, and it stayed green through the entire incident — while NO liveness observation exists. The materialization must REFUSE. If it completes, the model has certified a credential on the strength of the store's opinion about its own contents, which is exactly the state that produced the 401, and it would do so on the same inputs that produced it." -fn witness_enabled_but_unprobed_refuses() -> Bool { +test fn witness_enabled_but_unprobed_refuses() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -38,7 +38,7 @@ fn witness_enabled_but_unprobed_refuses() -> Bool { data witness_revoked_note: String = "The incident's other half: the store is enabled AND a probe ran AND the upstream rejected the key. The refusal must carry the probe's own verdict rather than collapsing to a generic failure, because 'GitHub does not accept this key' and 'nobody asked GitHub' are different pieces of work — reconcile the credential versus build the probe — and this lane already paid for conflating them once." -fn witness_enabled_but_revoked_refuses() -> Bool { +test fn witness_enabled_but_revoked_refuses() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -62,7 +62,7 @@ fn witness_enabled_but_revoked_refuses() -> Bool { data witness_non_vacuity_note: String = "The non-vacuity control, without which every conjunct above is satisfied by a bracket that refuses unconditionally. Store enabled AND upstream accepts: the materialization completes AND the use function actually RAN — proven by its return value travelling out through MaterializationCompleted, not merely by the outcome's tag. That distinction matters because a bracket that returned Completed with a fabricated value would look identical at the tag." -fn witness_live_secret_materializes_and_runs_the_use() -> Bool { +test fn witness_live_secret_materializes_and_runs_the_use() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -103,7 +103,7 @@ fn refusal_cause_is_upstream_axis(outcome: MaterializationOutcome) -> Bool } } -fn witness_destroyed_version_refuses_even_when_probe_says_live() -> Bool { +test fn witness_destroyed_version_refuses_even_when_probe_says_live() -> Bool { let destroyed = with_materialized_secret( ref: incident_secret_ref(), binding: EnvVar { name: "GH_APP_PEM" }, @@ -136,7 +136,7 @@ fn witness_destroyed_version_refuses_even_when_probe_says_live() -> Bool { data witness_self_repairing_probe_note: String = "A probe that repairs what it tests cannot certify it. The self-repairing sketch is the automation of the exact hand reconciliation the A3 gap row describes — mint, and on failure add a fresh key version — so its Converged may be reporting the version the probe itself just wrote. The bracket refuses on the probe's CLASSIFICATION before it ever looks at the verdict, and the refusal names the probe so the remedy is 'replace this probe' rather than 'the credential is bad'." -fn witness_self_repairing_probe_is_refused_by_classification() -> Bool { +test fn witness_self_repairing_probe_is_refused_by_classification() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -159,7 +159,7 @@ fn witness_self_repairing_probe_is_refused_by_classification() -> Bool { data witness_red_control_note: String = "The discriminating RED control. The perturbation is materializing on store existence alone — what every hand-run credential step in the srv4 session effectively did, and the behaviour that produced the 401 — and it is executed rather than described. On the incident's own inputs (SmEnabled, no liveness observation) the sketch COMPLETES where the authority REFUSES, the gate rejects the sketch and accepts the authority, and the gate's decision is computed from the liveness argument rather than from which function produced the outcome, so relabelling cannot satisfy it. The final conjunct is the other direction: with liveness Converged the gate accepts a completion, so this is not an always-reject gate." -fn witness_red_control_existence_only_rejected_by_gate() -> Bool { +test fn witness_red_control_existence_only_rejected_by_gate() -> Bool { let widened = materialize_existence_only_widen_sketch( ref: incident_secret_ref(), binding: SshKeyFile, @@ -192,7 +192,7 @@ fn witness_red_control_existence_only_rejected_by_gate() -> Bool { data witness_qualification_asymmetry_note: String = "Liveness qualification is a presupposition check and not a meet, pinned the same way the swap axis pins its own. A DISABLED store version under a live probe stays Drifted — the probe does not repair the store — while an ENABLED version under an absent probe becomes UnknownRefused. Under a symmetric meet those two would be indistinguishable and the direction of the check would be lost." -fn witness_liveness_qualification_is_asymmetric() -> Bool { +test fn witness_liveness_qualification_is_asymmetric() -> Bool { let store_drifted = secret_liveness_qualified_verdict( existence: secret_existence_verdict(state: SmDisabled), liveness: std.upsert_decision.Converged, @@ -209,12 +209,3 @@ fn witness_liveness_qualification_is_asymmetric() -> Bool { ) } -test fn materialized_secret_witnesses() -> Bool { - witness_enabled_but_unprobed_refuses() - && witness_enabled_but_revoked_refuses() - && witness_live_secret_materializes_and_runs_the_use() - && witness_destroyed_version_refuses_even_when_probe_says_live() - && witness_self_repairing_probe_is_refused_by_classification() - && witness_red_control_existence_only_rejected_by_gate() - && witness_liveness_qualification_is_asymmetric() -} diff --git a/dag/test/claim/measure_lifted_algebra_test.dag b/dag/test/claim/measure_lifted_algebra_test.dag index 1f16bc1d8bb..b7a8ad675c6 100644 --- a/dag/test/claim/measure_lifted_algebra_test.dag +++ b/dag/test/claim/measure_lifted_algebra_test.dag @@ -1,73 +1,57 @@ module test.claim.measure_lifted_algebra - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn scale_fraction_exact_holds() -> Bool { +test fn scale_fraction_exact_holds() -> Bool { byte_size_count(b: measure_scale_fraction_floor(m: byte_size(10), num: 4, den: 5)) == 8 } -fn scale_fraction_floors_not_rounds_holds() -> Bool { +test fn scale_fraction_floors_not_rounds_holds() -> Bool { byte_size_count(b: measure_scale_fraction_floor(m: byte_size(7), num: 1, den: 2)) == 3 } -fn scale_fraction_zero_den_is_zero_holds() -> Bool { +test fn scale_fraction_zero_den_is_zero_holds() -> Bool { byte_size_count(b: measure_scale_fraction_floor(m: byte_size(100), num: 4, den: 0)) == 0 } -fn fit_count_exact_holds() -> Bool { +test fn fit_count_exact_holds() -> Bool { measure_fit_count_floor(capacity: byte_size(10), each: byte_size(5)) == 2 } -fn fit_count_floors_not_rounds_holds() -> Bool { +test fn fit_count_floors_not_rounds_holds() -> Bool { measure_fit_count_floor(capacity: byte_size(7), each: byte_size(2)) == 3 } -fn fit_count_zero_divisor_is_zero_holds() -> Bool { +test fn fit_count_zero_divisor_is_zero_holds() -> Bool { measure_fit_count_floor(capacity: byte_size(7), each: byte_size(0)) == 0 } -fn scale_fraction_generic_over_quantity_holds() -> Bool { +test fn scale_fraction_generic_over_quantity_holds() -> Bool { hertz_count(h: measure_scale_fraction_floor(m: hertz(9), num: 2, den: 4)) == 4 } -fn fit_count_generic_over_quantity_holds() -> Bool { +test fn fit_count_generic_over_quantity_holds() -> Bool { measure_fit_count_floor(capacity: hertz(9), each: hertz(4)) == 2 } -fn scale_fraction_ceil_exact_holds() -> Bool { +test fn scale_fraction_ceil_exact_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(8), num: 1, den: 4)) == 2 } -fn scale_fraction_ceil_rounds_up_holds() -> Bool { +test fn scale_fraction_ceil_rounds_up_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(7), num: 1, den: 2)) == 4 && byte_size_count(b: measure_scale_fraction_floor(m: byte_size(7), num: 1, den: 2)) == 3 } -fn scale_fraction_ceil_remainder_to_one_holds() -> Bool { +test fn scale_fraction_ceil_remainder_to_one_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(10), num: 1, den: 4)) == 3 } -fn scale_fraction_ceil_zero_den_is_whole_holds() -> Bool { +test fn scale_fraction_ceil_zero_den_is_whole_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(100), num: 4, den: 0)) == 400 } -fn scale_fraction_ceil_generic_over_quantity_holds() -> Bool { +test fn scale_fraction_ceil_generic_over_quantity_holds() -> Bool { hertz_count(h: measure_scale_fraction_ceil(m: hertz(9), num: 1, den: 2)) == 5 } -test fn measure_lifted_algebra_witnesses() -> Bool { - scale_fraction_exact_holds() - && scale_fraction_floors_not_rounds_holds() - && scale_fraction_zero_den_is_zero_holds() - && fit_count_exact_holds() - && fit_count_floors_not_rounds_holds() - && fit_count_zero_divisor_is_zero_holds() - && scale_fraction_generic_over_quantity_holds() - && fit_count_generic_over_quantity_holds() - && scale_fraction_ceil_exact_holds() - && scale_fraction_ceil_rounds_up_holds() - && scale_fraction_ceil_remainder_to_one_holds() - && scale_fraction_ceil_zero_den_is_whole_holds() - && scale_fraction_ceil_generic_over_quantity_holds() -} diff --git a/dag/test/claim/media_type_witness_test.dag b/dag/test/claim/media_type_witness_test.dag index 3f0d70e779c..5f8c7b017d6 100644 --- a/dag/test/claim/media_type_witness_test.dag +++ b/dag/test/claim/media_type_witness_test.dag @@ -12,7 +12,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data media_type_witness_note: String = "D1 keystone: the served stack's Content-Type wire strings are a SERIALIZATION of the modeled MediaType (RFC 9110 section 8.3 type/subtype/parameters), not hand-composed strings hiding the structure. The five preset labels are pinned byte-exact (browsers are the consumer — these must NEVER drift), and the RED controls perturb a parameter value and a subtype so the wire string changes and the pin reds, proving the pin discriminates. ApplicationOctetStream's charset-less form falls out of an EMPTY parameter list, not a special variant." -fn witness_preset_wire_strings_byte_exact() -> Bool { +test fn witness_preset_wire_strings_byte_exact() -> Bool { media_type_wire_label(m: text_html_utf8) == "text/html; charset=utf-8" && media_type_wire_label(m: text_plain_utf8) == "text/plain; charset=utf-8" && media_type_wire_label(m: application_json_utf8) == "application/json; charset=utf-8" @@ -20,14 +20,14 @@ fn witness_preset_wire_strings_byte_exact() -> Bool { && media_type_wire_label(m: application_octet_stream) == "application/octet-stream" } -fn witness_octet_stream_has_no_charset() -> Bool { +test fn witness_octet_stream_has_no_charset() -> Bool { count(application_octet_stream.parameters) == 0 && !string_contains(s: media_type_wire_label(m: application_octet_stream), pattern: "charset") && count(text_html_utf8.parameters) == 1 && string_contains(s: media_type_wire_label(m: text_html_utf8), pattern: "; charset=utf-8") } -fn witness_structure_projects() -> Bool { +test fn witness_structure_projects() -> Bool { text_html_utf8.top_level == TopLevelText && text_html_utf8.subtype == "html" && application_json_utf8.top_level == TopLevelApplication @@ -45,21 +45,14 @@ fn perturbed_charset_media_type() -> MediaType { data perturbed_parameter_red_note: String = "RED control: perturb the charset parameter value; the wire string changes, so the byte-exact pin above no longer holds — a silent drift would go red here." -fn witness_perturbed_parameter_reds() -> Bool { +test fn witness_perturbed_parameter_reds() -> Bool { media_type_wire_label(m: perturbed_charset_media_type()) != "text/html; charset=utf-8" && media_type_wire_label(m: perturbed_charset_media_type()) == "text/html; charset=utf-16" } -fn witness_perturbed_subtype_reds() -> Bool { +test fn witness_perturbed_subtype_reds() -> Bool { let bad = MediaType { top_level: TopLevelText, subtype: "xml", parameters: [charset_utf8] } media_type_wire_label(m: bad) != media_type_wire_label(m: text_html_utf8) && media_type_wire_label(m: bad) == "text/xml; charset=utf-8" } -test fn media_type_witnesses() -> Bool { - witness_preset_wire_strings_byte_exact() - && witness_octet_stream_has_no_charset() - && witness_structure_projects() - && witness_perturbed_parameter_reds() - && witness_perturbed_subtype_reds() -} diff --git a/dag/test/claim/medium_fidelity_witness_test.dag b/dag/test/claim/medium_fidelity_witness_test.dag index 1365c94d236..98afabde260 100644 --- a/dag/test/claim/medium_fidelity_witness_test.dag +++ b/dag/test/claim/medium_fidelity_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.medium_fidelity - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly type ProbeVerdict = Dominates | Incomparable @@ -37,7 +36,7 @@ fn mis_tagged_prose_medium() -> extdeps.communication.medium.Medium { } } -fn text_medium_tag_is_lossless() -> Bool { +test fn text_medium_tag_is_lossless() -> Bool { let m = text_medium_lossless() match m.fidelity { Lossless => true @@ -45,7 +44,7 @@ fn text_medium_tag_is_lossless() -> Bool { } } -fn probe_medium_tag_is_lossless() -> Bool { +test fn probe_medium_tag_is_lossless() -> Bool { let m = probe_medium_lossless() match m.fidelity { Lossless => true @@ -53,7 +52,7 @@ fn probe_medium_tag_is_lossless() -> Bool { } } -fn probe_carried_is_non_text() -> Bool { +test fn probe_carried_is_non_text() -> Bool { let m = probe_medium_lossless() match m.carried { Dominates => true @@ -61,7 +60,7 @@ fn probe_carried_is_non_text() -> Bool { } } -fn prose_medium_tag_is_lossy() -> Bool { +test fn prose_medium_tag_is_lossy() -> Bool { let m = prose_medium() match m.fidelity { Lossy => true @@ -69,19 +68,11 @@ fn prose_medium_tag_is_lossy() -> Bool { } } -fn lossy_prose_not_advertised_lossless() -> Bool { +test fn lossy_prose_not_advertised_lossless() -> Bool { !is_lossless(prose_medium().fidelity) } -fn red_mistag_certifies_lossless_by_tag_alone() -> Bool { +test fn red_mistag_certifies_lossless_by_tag_alone() -> Bool { is_lossless(mis_tagged_prose_medium().fidelity) } -test fn medium_fidelity_holds() -> Bool { - text_medium_tag_is_lossless() - && probe_medium_tag_is_lossless() - && probe_carried_is_non_text() - && prose_medium_tag_is_lossy() - && lossy_prose_not_advertised_lossless() - && red_mistag_certifies_lossless_by_tag_alone() -} diff --git a/dag/test/claim/membership_reconcile_witness_test.dag b/dag/test/claim/membership_reconcile_witness_test.dag index 1336dc53ee7..6f559825437 100644 --- a/dag/test/claim/membership_reconcile_witness_test.dag +++ b/dag/test/claim/membership_reconcile_witness_test.dag @@ -76,21 +76,21 @@ fn plan_has_refused_unknown(plan: MembershipPlan, mid: String) -> Bool ) } -fn w_added_upserts() -> Bool { +test fn w_added_upserts() -> Bool { let plan = t_reconcile(desired: [tm_owned(mid: "a", ver: "1")], observed: []) plan_has_upsert(plan: plan, mid: "a") && membership_upsert_count(plan: plan) == 1 && membership_teardown_count(plan: plan) == 0 } -fn w_removed_owned_tears_down() -> Bool { +test fn w_removed_owned_tears_down() -> Bool { let plan = t_reconcile(desired: [], observed: [tm_owned(mid: "a", ver: "1")]) plan_has_teardown(plan: plan, mid: "a") && membership_teardown_count(plan: plan) == 1 && membership_refusal_count(plan: plan) == 0 } -fn w_unchanged_noop() -> Bool { +test fn w_unchanged_noop() -> Bool { let m = tm_owned(mid: "a", ver: "1") let plan = t_reconcile(desired: [m], observed: [m]) membership_upsert_count(plan: plan) == 0 @@ -98,7 +98,7 @@ fn w_unchanged_noop() -> Bool { && membership_refusal_count(plan: plan) == 0 } -fn w_modified_reupserts() -> Bool { +test fn w_modified_reupserts() -> Bool { let plan = t_reconcile( desired: [tm_owned(mid: "a", ver: "2")], observed: [tm_owned(mid: "a", ver: "1")], @@ -108,7 +108,7 @@ fn w_modified_reupserts() -> Bool { && membership_teardown_count(plan: plan) == 0 } -fn w_r5_owned_only_teardown_synthetic() -> Bool { +test fn w_r5_owned_only_teardown_synthetic() -> Bool { let plan = t_reconcile( desired: [], observed: [ @@ -132,7 +132,7 @@ fn effects_has_teardown(es: List>, mid: String) -> Bool { data w_effects_wholesale_refuse_note: String = "DISCRIMINATING (§5): a plan carrying any Refused MUST refuse WHOLESALE — membership_effects returns ApplyRefused (o's owned teardown NOT surfaced as an effect), never EffectsReady with the refused sibling silently filtered out. If membership_effects is ever broken to drop-the-refused and return the effects, this hits the EffectsReady arm and returns false = RED. The degenerate apply/retract poles never produce a Refused, so only this synthetic mixed observed set exercises the wall." -fn w_effects_refuses_wholesale_on_any_refusal() -> Bool { +test fn w_effects_refuses_wholesale_on_any_refusal() -> Bool { let plan = t_reconcile( desired: [], observed: [tm_owned(mid: "o", ver: "1"), tm_ensured(mid: "e", ver: "1")], @@ -147,7 +147,7 @@ fn w_effects_refuses_wholesale_on_any_refusal() -> Bool { } } -fn w_effects_ready_when_no_refusal() -> Bool { +test fn w_effects_ready_when_no_refusal() -> Bool { let plan = t_reconcile(desired: [], observed: [tm_owned(mid: "o", ver: "1")]) match membership_effects(plan: plan) { EffectsReady { effects: es } => @@ -156,7 +156,7 @@ fn w_effects_ready_when_no_refusal() -> Bool { } } -fn w_tally_matches_counts() -> Bool { +test fn w_tally_matches_counts() -> Bool { let plan = t_reconcile( desired: [tm_owned(mid: "a", ver: "1")], observed: [tm_owned(mid: "b", ver: "1"), tm_ensured(mid: "c", ver: "1")], @@ -168,13 +168,3 @@ fn w_tally_matches_counts() -> Bool { && t.refusals == membership_refusal_count(plan: plan) } -test fn membership_reconcile_witnesses() -> Bool { - w_added_upserts() - && w_removed_owned_tears_down() - && w_unchanged_noop() - && w_modified_reupserts() - && w_r5_owned_only_teardown_synthetic() - && w_effects_refuses_wholesale_on_any_refusal() - && w_effects_ready_when_no_refusal() - && w_tally_matches_counts() -} diff --git a/dag/test/claim/nested_fold_generic_param_emit_test.dag b/dag/test/claim/nested_fold_generic_param_emit_test.dag index ac562c91140..590406cc421 100644 --- a/dag/test/claim/nested_fold_generic_param_emit_test.dag +++ b/dag/test/claim/nested_fold_generic_param_emit_test.dag @@ -7,12 +7,12 @@ import std.realization_measurement { schedule_critical_path_time, } -fn witness_flat_fold_resolves_generic_scale() -> Bool { +test fn witness_flat_fold_resolves_generic_scale() -> Bool { let batch = [time_measure(count: 10)] measure_count(m: schedule_batch_critical_path(batch_times: batch)) == 10 } -fn witness_nested_fold_resolves_generic_scale() -> Bool { +test fn witness_nested_fold_resolves_generic_scale() -> Bool { let batches = [ [time_measure(count: 40), time_measure(count: 5)], [time_measure(count: 20)], @@ -20,7 +20,3 @@ fn witness_nested_fold_resolves_generic_scale() -> Bool { measure_count(m: schedule_critical_path_time(batch_times: batches)) == 60 } -test fn nested_fold_generic_param_emit_test() -> Bool { - witness_flat_fold_resolves_generic_scale() - && witness_nested_fold_resolves_generic_scale() -} diff --git a/dag/test/claim/observation_ci_render_witness_test.dag b/dag/test/claim/observation_ci_render_witness_test.dag index 0c810411cc8..12a8dadc6f7 100644 --- a/dag/test/claim/observation_ci_render_witness_test.dag +++ b/dag/test/claim/observation_ci_render_witness_test.dag @@ -109,14 +109,14 @@ fn crawl_basis() -> AttentionBasis { AttentionBasis { average: millisecond(count: 1000), maximum: millisecond(count: 5000) } } -fn w_human_units_replace_raw_byte_dumps() -> Bool { +test fn w_human_units_replace_raw_byte_dumps() -> Bool { ci_human_bytes(b: byte_size(crawl_heartbeat_rss_bytes)) == "15.0 GiB" && ci_human_bytes(b: byte_size(crawl_heartbeat_swap_bytes)) == "32.0 GiB" && ci_human_percent(bp: basis_point(count: crawl_heartbeat_pressure_bp)) == "9.0%" && ci_human_duration(d: millisecond(count: crawl_module_wall_ms)) == "10 minutes" } -fn w_heartbeat_names_its_subject_where_the_capture_was_silent() -> Bool { +test fn w_heartbeat_names_its_subject_where_the_capture_was_silent() -> Bool { let line = ci_heartbeat_line(sample: crawl_heartbeat()) string_contains(s: line.text, pattern: crawl_quiet_module) && string_contains(s: line.text, pattern: "entry 214 of 602") && @@ -124,18 +124,18 @@ fn w_heartbeat_names_its_subject_where_the_capture_was_silent() -> Bool { !string_contains(s: line.text, pattern: to_string(crawl_heartbeat_rss_bytes)) } -fn w_heartbeat_puts_identity_before_vitals() -> Bool { +test fn w_heartbeat_puts_identity_before_vitals() -> Bool { let line = ci_heartbeat_line(sample: crawl_heartbeat()) starts_with(s: line.text, prefix: "33 minutes in — still in witness discovery") && string_contains(s: line.text, pattern: "memory 15.0 GiB") } -fn w_heartbeat_uses_the_clock_pulse_glyph() -> Bool { +test fn w_heartbeat_uses_the_clock_pulse_glyph() -> Bool { let line = ci_heartbeat_line(sample: crawl_heartbeat()) ci_render_line(line: line, tier: Emoji) == concat("🕐 ", line.text) } -fn w_escalation_surfaces_the_quiet_module_at_one_threshold() -> Bool { +test fn w_escalation_surfaces_the_quiet_module_at_one_threshold() -> Bool { let line = ci_escalation_line( quiet_subject: crawl_entry_subject(), active_leaf: crawl_leaf_subject(), @@ -147,7 +147,7 @@ fn w_escalation_surfaces_the_quiet_module_at_one_threshold() -> Bool { line.attention == Notable } -fn w_escalation_surfaces_the_cause_at_the_deeper_threshold() -> Bool { +test fn w_escalation_surfaces_the_cause_at_the_deeper_threshold() -> Bool { let line = ci_escalation_blocked_line( quiet_subject: crawl_entry_subject(), active_leaf: crawl_leaf_subject(), @@ -160,12 +160,12 @@ fn w_escalation_surfaces_the_cause_at_the_deeper_threshold() -> Bool { line.attention == Anomaly } -fn w_escalation_is_recursive_over_the_captured_window() -> Bool { +test fn w_escalation_is_recursive_over_the_captured_window() -> Bool { observation_escalation_depth(quiet: millisecond(count: 600000), t: observation_dwell_threshold) == 10 && observation_escalation_depth(quiet: millisecond(count: 120000), t: observation_dwell_threshold) == 2 } -fn w_outcome_lines_carry_durations() -> Bool { +test fn w_outcome_lines_carry_durations() -> Bool { let event = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Done }, @@ -175,7 +175,7 @@ fn w_outcome_lines_carry_durations() -> Bool { string_contains(s: ci_event_line(event: event, basis: crawl_basis()).text, pattern: "in 230ms") } -fn w_refusal_never_renders_inside_a_collapsed_group() -> Bool { +test fn w_refusal_never_renders_inside_a_collapsed_group() -> Bool { let refusal = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Refused { diagnostic: "FLOOR-BATCH-OVER-BUDGET" as NonEmptyStr } }, @@ -187,7 +187,7 @@ fn w_refusal_never_renders_inside_a_collapsed_group() -> Bool { ci_line_placement(attention: line.attention) == OutsideGroup } -fn w_routine_green_collapses_inside_a_group() -> Bool { +test fn w_routine_green_collapses_inside_a_group() -> Bool { let green = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Done }, @@ -200,7 +200,7 @@ fn w_routine_green_collapses_inside_a_group() -> Bool { ci_collapsed_summary(green_count: 213) == "… 213 more finished cleanly" } -fn w_failure_and_refusal_are_restated_at_the_end() -> Bool { +test fn w_failure_and_refusal_are_restated_at_the_end() -> Bool { let summary = ci_run_summary_line(summary: FloorRunSummary { entries_complete: 213, entries_total: 602, @@ -215,7 +215,7 @@ fn w_failure_and_refusal_are_restated_at_the_end() -> Bool { string_contains(s: restate.text, pattern: "FLOOR-BATCH-OVER-BUDGET") } -fn w_relayed_diagnostic_cannot_mint_workflow_commands() -> Bool { +test fn w_relayed_diagnostic_cannot_mint_workflow_commands() -> Bool { let restate = ci_refusal_restate_line( subject: crawl_entry_subject(), diagnostic: "budget exceeded\n::error::a child process said this" as NonEmptyStr @@ -224,27 +224,27 @@ fn w_relayed_diagnostic_cannot_mint_workflow_commands() -> Bool { !string_contains(s: restate.text, pattern: "\n::error::") } -fn w_group_markers_come_from_the_github_authority() -> Bool { +test fn w_group_markers_come_from_the_github_authority() -> Bool { ci_group_open(title: "witness discovery") == "::group::witness discovery" && ci_group_close() == "::endgroup::" } -fn w_captured_window_would_have_spoken_four_times() -> Bool { +test fn w_captured_window_would_have_spoken_four_times() -> Bool { ci_escalation_emission_count(quiet: millisecond(count: 600000), t: observation_dwell_threshold) == 4 && ci_escalation_emission_count(quiet: millisecond(count: 120000), t: observation_dwell_threshold) == 2 && ci_escalation_emission_count(quiet: millisecond(count: 30000), t: observation_dwell_threshold) == 0 } -fn w_a_silent_phase_past_the_threshold_is_not_responsive() -> Bool { +test fn w_a_silent_phase_past_the_threshold_is_not_responsive() -> Bool { ci_window_is_responsive(quiet: millisecond(count: 30000), t: observation_dwell_threshold) && ci_window_is_responsive(quiet: millisecond(count: 600000), t: observation_dwell_threshold) } -fn w_escalation_emission_stays_bounded_under_unbounded_silence() -> Bool { +test fn w_escalation_emission_stays_bounded_under_unbounded_silence() -> Bool { ci_escalation_emission_count(quiet: millisecond(count: 999999999), t: observation_dwell_threshold) <= 13 } -fn w_run_summary_keeps_refused_and_failed_apart() -> Bool { +test fn w_run_summary_keeps_refused_and_failed_apart() -> Bool { let refused_only = FloorRunSummary { entries_complete: 213, entries_total: 602, refusals: 1, failures: 0, wall: millisecond(count: 2472000) } let failed_only = FloorRunSummary { entries_complete: 601, entries_total: 602, refusals: 0, failures: 1, wall: millisecond(count: 600000) } let both = FloorRunSummary { entries_complete: 200, entries_total: 602, refusals: 2, failures: 3, wall: millisecond(count: 600000) } @@ -256,7 +256,7 @@ fn w_run_summary_keeps_refused_and_failed_apart() -> Bool { string_contains(s: ci_run_summary_line(summary: both).text, pattern: "2 refused and 3 failed") } -fn w_unmeasured_duration_names_its_cause_rather_than_vanishing() -> Bool { +test fn w_unmeasured_duration_names_its_cause_rather_than_vanishing() -> Bool { let event = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Done }, @@ -267,23 +267,3 @@ fn w_unmeasured_duration_names_its_cause_rather_than_vanishing() -> Bool { string_contains(s: line.text, pattern: "duration unmeasured: clock unavailable in this leg") } -test fn observation_ci_render_witnesses() -> Bool { - w_run_summary_keeps_refused_and_failed_apart() && - w_unmeasured_duration_names_its_cause_rather_than_vanishing() && - w_captured_window_would_have_spoken_four_times() && - w_a_silent_phase_past_the_threshold_is_not_responsive() && - w_escalation_emission_stays_bounded_under_unbounded_silence() && - w_human_units_replace_raw_byte_dumps() && - w_heartbeat_names_its_subject_where_the_capture_was_silent() && - w_heartbeat_puts_identity_before_vitals() && - w_heartbeat_uses_the_clock_pulse_glyph() && - w_escalation_surfaces_the_quiet_module_at_one_threshold() && - w_escalation_surfaces_the_cause_at_the_deeper_threshold() && - w_escalation_is_recursive_over_the_captured_window() && - w_outcome_lines_carry_durations() && - w_refusal_never_renders_inside_a_collapsed_group() && - w_routine_green_collapses_inside_a_group() && - w_failure_and_refusal_are_restated_at_the_end() && - w_relayed_diagnostic_cannot_mint_workflow_commands() && - w_group_markers_come_from_the_github_authority() -} diff --git a/dag/test/claim/observation_crawl_replay_test.dag b/dag/test/claim/observation_crawl_replay_test.dag index c12fdd07f3f..53ddff74288 100644 --- a/dag/test/claim/observation_crawl_replay_test.dag +++ b/dag/test/claim/observation_crawl_replay_test.dag @@ -105,29 +105,24 @@ fn observation_crawl_after_block() -> String { join(lines, "\n") } -fn w_replay_names_the_module_where_the_capture_was_silent() -> Bool { +test fn w_replay_names_the_module_where_the_capture_was_silent() -> Bool { let block = observation_crawl_after_block() string_contains(s: block, pattern: "still in witness discovery: entry 214 of 602, now typecheck v2.compiler.normalized_tree") && string_contains(s: block, pattern: "quiet for 2 minutes — still working") && string_contains(s: block, pattern: "quiet for 4 minutes — blocked on memory reclaim (pressure 9.0%)") } -fn w_replay_uses_human_units_not_raw_bytes() -> Bool { +test fn w_replay_uses_human_units_not_raw_bytes() -> Bool { let block = observation_crawl_after_block() string_contains(s: block, pattern: "memory 15.0 GiB, swap 32.0 GiB, pressure 9.0%") && !string_contains(s: block, pattern: "16107200512") && !string_contains(s: block, pattern: "current=") } -fn w_replay_ends_in_a_refusal_summary_not_a_silent_timeout() -> Bool { +test fn w_replay_ends_in_a_refusal_summary_not_a_silent_timeout() -> Bool { let block = observation_crawl_after_block() string_contains(s: block, pattern: "213 of 602 entries finished") && string_contains(s: block, pattern: "1 refused and 0 failed") && string_contains(s: block, pattern: "FLOOR-BATCH-OVER-BUDGET") } -test fn observation_crawl_replay_witnesses() -> Bool { - w_replay_names_the_module_where_the_capture_was_silent() && - w_replay_uses_human_units_not_raw_bytes() && - w_replay_ends_in_a_refusal_summary_not_a_silent_timeout() -} diff --git a/dag/test/claim/observation_emit_census_witness_test.dag b/dag/test/claim/observation_emit_census_witness_test.dag index fff29c35804..28d9f86061c 100644 --- a/dag/test/claim/observation_emit_census_witness_test.dag +++ b/dag/test/claim/observation_emit_census_witness_test.dag @@ -40,12 +40,12 @@ fn census_marker_present(site: CensusedEmitSite) -> Bool { string_contains(s: census_source(path: site.source_file), pattern: site.marker) } -fn w_every_rostered_marker_still_exists_in_the_seed() -> Bool { +test fn w_every_rostered_marker_still_exists_in_the_seed() -> Bool { fold(observation_emit_roster, init: true, f: (acc, site) => acc && census_marker_present(site: site)) } -fn w_roster_staleness_check_discriminates() -> Bool { +test fn w_roster_staleness_check_discriminates() -> Bool { let bogus = CensusedEmitSite { marker: "[this-marker-does-not-exist-in-the-seed]" as NonEmptyStr, source_file: "src/v1/stage0/src/bin/claim_executor.rs" as NonEmptyStr, @@ -57,7 +57,7 @@ fn w_roster_staleness_check_discriminates() -> Bool { !census_marker_present(site: bogus) } -fn w_every_frontier_row_carries_a_real_dissolve_on() -> Bool { +test fn w_every_frontier_row_carries_a_real_dissolve_on() -> Bool { fold(observation_emit_roster, init: true, f: (acc, site) => if emit_site_is_frontier(site: site) { acc && emit_site_dissolve_on(site: site) != "" @@ -66,14 +66,14 @@ fn w_every_frontier_row_carries_a_real_dissolve_on() -> Bool { }) } -fn w_the_named_negative_example_has_migrated() -> Bool { +test fn w_the_named_negative_example_has_migrated() -> Bool { census_marker_present(site: floor_memory_site) && !emit_site_is_frontier(site: floor_memory_site) && string_contains(s: floor_memory_site.marker, pattern: "floor-memory") && string_contains(s: emit_site_dissolve_on(site: floor_memory_site), pattern: "ci_heartbeat_line") } -fn w_gantt_has_migrated() -> Bool { +test fn w_gantt_has_migrated() -> Bool { census_marker_present(site: gantt_site) && !emit_site_is_frontier(site: gantt_site) && string_contains(s: gantt_site.marker, pattern: "gantt") && @@ -81,7 +81,7 @@ fn w_gantt_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: gantt_site), pattern: "phase_begin_line") } -fn w_governor_has_migrated() -> Bool { +test fn w_governor_has_migrated() -> Bool { census_marker_present(site: governor_site) && !emit_site_is_frontier(site: governor_site) && string_contains(s: governor_site.marker, pattern: "governor") && @@ -89,7 +89,7 @@ fn w_governor_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: governor_site), pattern: "render_governor_hold_line_mirror") } -fn w_typecheck_attribution_has_migrated() -> Bool { +test fn w_typecheck_attribution_has_migrated() -> Bool { census_marker_present(site: typecheck_attribution_site) && !emit_site_is_frontier(site: typecheck_attribution_site) && string_contains(s: typecheck_attribution_site.marker, pattern: "typecheck-attribution") && @@ -97,7 +97,7 @@ fn w_typecheck_attribution_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: typecheck_attribution_site), pattern: "typecheck_concluded_line") } -fn w_measurement_has_migrated() -> Bool { +test fn w_measurement_has_migrated() -> Bool { census_marker_present(site: measurement_site) && !emit_site_is_frontier(site: measurement_site) && string_contains(s: measurement_site.marker, pattern: "measurement") && @@ -105,7 +105,7 @@ fn w_measurement_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: measurement_site), pattern: "render_peak_rss_line_mirror") } -fn w_shell_has_migrated() -> Bool { +test fn w_shell_has_migrated() -> Bool { census_marker_present(site: shell_site) && !emit_site_is_frontier(site: shell_site) && string_contains(s: shell_site.marker, pattern: "shell") && @@ -113,14 +113,14 @@ fn w_shell_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: shell_site), pattern: "render_shell_effect_") } -fn w_the_census_states_post_snapshot_frontier_count() -> Bool { +test fn w_the_census_states_post_snapshot_frontier_count() -> Bool { observation_emit_frontier_count() == 6 && count(observation_emit_roster) == 12 } data w_post_snapshot_live_tags_are_rostered_bidirectional_note: String = "Operator finding 3 (run 30142403230): hygiene is bidirectional — growth tags born after the initial census snapshot must appear on the roster, not only the reverse (rostered markers still exist). Extended for #7205 resolve/assembly split tags." -fn w_post_snapshot_live_tags_are_rostered_bidirectional() -> Bool { +test fn w_post_snapshot_live_tags_are_rostered_bidirectional() -> Bool { census_marker_present(site: floor_drain_site) && emit_site_is_frontier(site: floor_drain_site) && census_marker_present(site: gate_warm_cost_site) && @@ -135,14 +135,14 @@ fn w_post_snapshot_live_tags_are_rostered_bidirectional() -> Bool { emit_site_is_frontier(site: assembly_split_site) } -fn w_the_raw_byte_dump_shape_is_gone_from_the_seed() -> Bool { +test fn w_the_raw_byte_dump_shape_is_gone_from_the_seed() -> Bool { let executor = census_source(path: "src/v1/stage0/src/bin/claim_executor.rs") !string_contains(s: executor, pattern: "[floor-memory] t=") && !string_contains(s: executor, pattern: "current={}") && string_contains(s: executor, pattern: "render_heartbeat_line_mirror") } -fn w_the_raw_gantt_shape_is_gone_from_the_seed() -> Bool { +test fn w_the_raw_gantt_shape_is_gone_from_the_seed() -> Bool { let rt = census_source(path: "src/v1/stage0/src/v1_rt.rs") let executor = census_source(path: "src/v1/stage0/src/bin/claim_executor.rs") !string_contains(s: rt, pattern: "t_ms=") && @@ -153,7 +153,7 @@ fn w_the_raw_gantt_shape_is_gone_from_the_seed() -> Bool { string_contains(s: executor, pattern: "render_phase_concluded_line_mirror") } -fn w_the_raw_governor_shape_is_gone_from_the_seed() -> Bool { +test fn w_the_raw_governor_shape_is_gone_from_the_seed() -> Bool { let gov = census_source(path: "src/v1/stage0/src/memory_governor.rs") !string_contains(s: gov, pattern: "[governor] hard back-off:") && !string_contains(s: gov, pattern: "[governor] creep back-off:") && @@ -163,14 +163,14 @@ fn w_the_raw_governor_shape_is_gone_from_the_seed() -> Bool { string_contains(s: gov, pattern: "GOVERNOR_CENSUS_MARKER") } -fn w_the_raw_typecheck_attribution_shape_is_gone_from_the_seed() -> Bool { +test fn w_the_raw_typecheck_attribution_shape_is_gone_from_the_seed() -> Bool { let cli = census_source(path: "src/v1/stage0/src/cli_run.rs") !string_contains(s: cli, pattern: "[typecheck-attribution] module=") && string_contains(s: cli, pattern: "render_typecheck_concluded_line_mirror") && string_contains(s: cli, pattern: "TYPECHECK_ATTRIBUTION_CENSUS_MARKER") } -fn w_the_raw_measurement_shape_is_gone_from_the_seed() -> Bool { +test fn w_the_raw_measurement_shape_is_gone_from_the_seed() -> Bool { let executor = census_source(path: "src/v1/stage0/src/bin/claim_executor.rs") let cli = census_source(path: "src/v1/stage0/src/cli_run.rs") !string_contains(s: executor, pattern: "bytes (VmHWM)") && @@ -180,7 +180,7 @@ fn w_the_raw_measurement_shape_is_gone_from_the_seed() -> Bool { string_contains(s: cli, pattern: "MEASUREMENT_CENSUS_MARKER") } -fn w_the_raw_shell_shape_is_gone_from_the_seed() -> Bool { +test fn w_the_raw_shell_shape_is_gone_from_the_seed() -> Bool { let interp = census_source(path: "src/v1/stage0/src/v1_interpreter.rs") !string_contains(s: interp, pattern: "[shell] done exit=") && !string_contains(s: interp, pattern: "[shell] stderr (exit=") && @@ -188,22 +188,3 @@ fn w_the_raw_shell_shape_is_gone_from_the_seed() -> Bool { string_contains(s: interp, pattern: "SHELL_CENSUS_MARKER") } -test fn observation_emit_census_witnesses() -> Bool { - w_every_rostered_marker_still_exists_in_the_seed() && - w_roster_staleness_check_discriminates() && - w_every_frontier_row_carries_a_real_dissolve_on() && - w_the_named_negative_example_has_migrated() && - w_gantt_has_migrated() && - w_governor_has_migrated() && - w_typecheck_attribution_has_migrated() && - w_measurement_has_migrated() && - w_shell_has_migrated() && - w_the_census_states_post_snapshot_frontier_count() && - w_post_snapshot_live_tags_are_rostered_bidirectional() && - w_the_raw_byte_dump_shape_is_gone_from_the_seed() && - w_the_raw_gantt_shape_is_gone_from_the_seed() && - w_the_raw_governor_shape_is_gone_from_the_seed() && - w_the_raw_typecheck_attribution_shape_is_gone_from_the_seed() && - w_the_raw_measurement_shape_is_gone_from_the_seed() && - w_the_raw_shell_shape_is_gone_from_the_seed() -} diff --git a/dag/test/claim/observation_lockstep_witness_test.dag b/dag/test/claim/observation_lockstep_witness_test.dag index 0bd63f7f752..ad2f26e2ec6 100644 --- a/dag/test/claim/observation_lockstep_witness_test.dag +++ b/dag/test/claim/observation_lockstep_witness_test.dag @@ -23,14 +23,14 @@ fn lockstep_has(path: String, needle: String) -> Bool { string_contains(s: lockstep_source(path: path), pattern: needle) } -fn w_every_law_names_a_declaration_that_exists() -> Bool { +test fn w_every_law_names_a_declaration_that_exists() -> Bool { let src = lockstep_source(path: observation_module_path) fold(observation_laws, init: true, f: (acc, l) => acc && string_contains(s: src, pattern: concat("fn ", concat(l.enforced_by.decl_name, "("))) ) } -fn w_orphan_law_check_discriminates() -> Bool { +test fn w_orphan_law_check_discriminates() -> Bool { let src = lockstep_source(path: observation_module_path) !string_contains(s: src, pattern: "fn observation_law_with_no_enforcer(") } @@ -45,7 +45,7 @@ data governor_hold_variants: List = [ "AdmissionCeiling" ] -fn w_scheduler_hold_is_in_lockstep_with_the_seed_governor() -> Bool { +test fn w_scheduler_hold_is_in_lockstep_with_the_seed_governor() -> Bool { let governor = lockstep_source(path: governor_source_path) let model = lockstep_source(path: observation_module_path) fold(governor_hold_variants, init: true, f: (acc, v) => @@ -55,30 +55,22 @@ fn w_scheduler_hold_is_in_lockstep_with_the_seed_governor() -> Bool { ) } -fn w_lockstep_check_discriminates() -> Bool { +test fn w_lockstep_check_discriminates() -> Bool { let governor = lockstep_source(path: governor_source_path) let model = lockstep_source(path: observation_module_path) !string_contains(s: governor, pattern: "HoldReason::DiskPressure") && !string_contains(s: model, pattern: "DiskPressure") } -fn w_heartbeat_period_matches_the_seed_cadence() -> Bool { +test fn w_heartbeat_period_matches_the_seed_cadence() -> Bool { millisecond_count(m: observation_heartbeat_period) == 60000 && lockstep_has(path: executor_source_path, needle: "from_secs(60)") && lockstep_has(path: executor_source_path, needle: "floor-memory-heartbeat") } -fn w_heartbeat_source_still_refuses_to_fabricate() -> Bool { +test fn w_heartbeat_source_still_refuses_to_fabricate() -> Bool { lockstep_has(path: executor_source_path, needle: "refusing to fabricate") && lockstep_has(path: executor_source_path, needle: "render_heartbeat_line_mirror") && lockstep_has(path: executor_source_path, needle: "heartbeat_feed_snapshot") } -test fn observation_lockstep_witnesses() -> Bool { - w_every_law_names_a_declaration_that_exists() && - w_orphan_law_check_discriminates() && - w_scheduler_hold_is_in_lockstep_with_the_seed_governor() && - w_lockstep_check_discriminates() && - w_heartbeat_period_matches_the_seed_cadence() && - w_heartbeat_source_still_refuses_to_fabricate() -} diff --git a/dag/test/claim/observation_model_witness_test.dag b/dag/test/claim/observation_model_witness_test.dag index db270fe484b..0bac8b66bec 100644 --- a/dag/test/claim/observation_model_witness_test.dag +++ b/dag/test/claim/observation_model_witness_test.dag @@ -191,13 +191,13 @@ fn obs_glyph_resolves_all_tiers(c: ObservationEventClass) -> Bool { } } -fn w_presentation_is_total_over_class_roster() -> Bool { +test fn w_presentation_is_total_over_class_roster() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => acc && obs_glyph_resolves_all_tiers(c: c) ) } -fn w_class_roster_covers_every_constructed_class() -> Bool { +test fn w_class_roster_covers_every_constructed_class() -> Bool { count(observation_event_classes) == 10 && observation_event_class(event: obs_event(transition: Begin, wall_ms: 1)) == ClassBegin && observation_event_class(event: obs_event(transition: Step { k: 34, n: 61 }, wall_ms: 1)) == ClassStep && @@ -208,7 +208,7 @@ fn w_class_roster_covers_every_constructed_class() -> Bool { observation_event_class(event: obs_event(transition: Concluded { outcome: Final { shown_failures: 0 } }, wall_ms: 1)) == ClassFinal } -fn w_refused_is_distinct_from_failed() -> Bool { +test fn w_refused_is_distinct_from_failed() -> Bool { let refused = observation_presentation(c: ClassRefused) let failed = observation_presentation(c: ClassFailed) let timed_out = observation_presentation(c: ClassTimedOut) @@ -226,7 +226,7 @@ fn w_refused_is_distinct_from_failed() -> Bool { } } -fn w_anomaly_classes_never_collapse() -> Bool { +test fn w_anomaly_classes_never_collapse() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => { let p = observation_presentation(c: c) if observation_class_is_intrinsic_anomaly(c: c) { @@ -237,7 +237,7 @@ fn w_anomaly_classes_never_collapse() -> Bool { }) } -fn w_density_is_the_single_display_authority() -> Bool { +test fn w_density_is_the_single_display_authority() -> Bool { observation_class_density(c: ClassRefused) == AnomalyExpanded && observation_class_density(c: ClassFailed) == AnomalyExpanded && observation_class_density(c: ClassTimedOut) == AnomalyExpanded && @@ -250,7 +250,7 @@ fn w_density_is_the_single_display_authority() -> Bool { observation_class_density(c: ClassSkipped) == RoutineCollapsible } -fn w_presentation_projects_density_rather_than_restating_it() -> Bool { +test fn w_presentation_projects_density_rather_than_restating_it() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => { let p = observation_presentation(c: c) let d = observation_class_density(c: c) @@ -261,7 +261,7 @@ fn w_presentation_projects_density_rather_than_restating_it() -> Bool { }) } -fn w_routine_progress_collapses_but_the_summary_always_shows() -> Bool { +test fn w_routine_progress_collapses_but_the_summary_always_shows() -> Bool { observation_presentation(c: ClassBegin).collapsible && observation_presentation(c: ClassStep).collapsible && observation_presentation(c: ClassDone).collapsible && @@ -270,14 +270,14 @@ fn w_routine_progress_collapses_but_the_summary_always_shows() -> Bool { !observation_class_is_intrinsic_anomaly(c: ClassFinal) } -fn w_refusal_is_anomaly_on_any_basis() -> Bool { +test fn w_refusal_is_anomaly_on_any_basis() -> Bool { let refused = obs_event(transition: Concluded { outcome: Refused { diagnostic: "budget" as NonEmptyStr } }, wall_ms: 1) let generous = AttentionBasis { average: millisecond(count: 999999), maximum: millisecond(count: 999999) } observation_attention(event: refused, basis: generous) == Anomaly && observation_attention(event: refused, basis: obs_basis()) == Anomaly } -fn w_attention_grounds_on_supplied_basis() -> Bool { +test fn w_attention_grounds_on_supplied_basis() -> Bool { let quick = obs_event(transition: Concluded { outcome: Done }, wall_ms: 500) let over_average = obs_event(transition: Concluded { outcome: Done }, wall_ms: 2000) let over_maximum = obs_event(transition: Concluded { outcome: Done }, wall_ms: 9000) @@ -286,7 +286,7 @@ fn w_attention_grounds_on_supplied_basis() -> Bool { observation_attention(event: over_maximum, basis: obs_basis()) == Anomaly } -fn w_attention_moves_with_the_basis_not_a_local_constant() -> Bool { +test fn w_attention_moves_with_the_basis_not_a_local_constant() -> Bool { let event = obs_event(transition: Concluded { outcome: Done }, wall_ms: 2000) let strict = AttentionBasis { average: millisecond(count: 100), maximum: millisecond(count: 200) } let loose = AttentionBasis { average: millisecond(count: 10000), maximum: millisecond(count: 20000) } @@ -296,7 +296,7 @@ fn w_attention_moves_with_the_basis_not_a_local_constant() -> Bool { ) } -fn w_unavailable_measurement_carries_a_cause() -> Bool { +test fn w_unavailable_measurement_carries_a_cause() -> Bool { let event = obs_event(transition: Concluded { outcome: Done }, wall_ms: 1) match event.rss { MeasuredValue { value: _ } => false @@ -304,7 +304,7 @@ fn w_unavailable_measurement_carries_a_cause() -> Bool { } } -fn w_blocked_on_resource_is_derived_for_every_hold() -> Bool { +test fn w_blocked_on_resource_is_derived_for_every_hold() -> Bool { observation_hold_resource(hold: WindowFull { active: 4, target: 4 }) == AdmissionWindow && observation_hold_resource(hold: CurrentHighWater { current: byte_size(1), high_water: byte_size(2) }) == MemoryBudget && observation_hold_resource(hold: PsiPressure { avg10: basis_point(count: 900) }) == MemoryBudget && @@ -314,7 +314,7 @@ fn w_blocked_on_resource_is_derived_for_every_hold() -> Bool { observation_hold_resource(hold: AdmissionCeiling { current: byte_size(1), ceiling: byte_size(2) }) == MaturationReserve } -fn w_blocked_on_carries_holders_and_named_remaining() -> Bool { +test fn w_blocked_on_carries_holders_and_named_remaining() -> Bool { let b = observation_blocked_on( hold: PsiPressure { avg10: basis_point(count: 900) }, holders: [obs_leaf_subject()], @@ -328,7 +328,7 @@ fn w_blocked_on_carries_holders_and_named_remaining() -> Bool { } } -fn w_escalation_depth_is_recursive_not_one_level() -> Bool { +test fn w_escalation_depth_is_recursive_not_one_level() -> Bool { let t = observation_dwell_threshold observation_escalation_depth(quiet: millisecond(count: 0), t: t) == 0 && observation_escalation_depth(quiet: millisecond(count: 60000), t: t) == 1 && @@ -336,7 +336,7 @@ fn w_escalation_depth_is_recursive_not_one_level() -> Bool { observation_escalation_depth(quiet: millisecond(count: 240000), t: t) == 4 } -fn w_escalation_surfaces_deeper_subject_over_time() -> Bool { +test fn w_escalation_surfaces_deeper_subject_over_time() -> Bool { let t = observation_dwell_threshold let quiet = obs_entry_subject() let leaf = obs_leaf_subject() @@ -347,7 +347,7 @@ fn w_escalation_surfaces_deeper_subject_over_time() -> Bool { observation_subject_contains(ancestor: at_t, descendant: at_2t) } -fn w_escalation_refuses_to_surface_an_unrelated_subject() -> Bool { +test fn w_escalation_refuses_to_surface_an_unrelated_subject() -> Bool { let t = observation_dwell_threshold let unrelated = ObservationSubject { segments: [RunSegment { id: "other-run" as NonEmptyStr }] } let surfaced = observation_escalation_subject( @@ -359,7 +359,7 @@ fn w_escalation_refuses_to_surface_an_unrelated_subject() -> Bool { count(surfaced.segments) == 3 } -fn w_watchdog_converts_quiet_past_budget_into_a_typed_line() -> Bool { +test fn w_watchdog_converts_quiet_past_budget_into_a_typed_line() -> Bool { let within = observation_watchdog(subject: obs_entry_subject(), elapsed: millisecond(count: 1000), budget: millisecond(count: 5000)) let past = observation_watchdog(subject: obs_entry_subject(), elapsed: millisecond(count: 607000), budget: millisecond(count: 60000)) observation_watchdog_attention(v: within) == Ambient && @@ -370,7 +370,7 @@ fn w_watchdog_converts_quiet_past_budget_into_a_typed_line() -> Bool { } } -fn w_subject_identity_is_rendered_not_anonymous() -> Bool { +test fn w_subject_identity_is_rendered_not_anonymous() -> Bool { let rendered = observation_subject_render(subject: obs_leaf_subject()) string_contains(s: rendered, pattern: "module=v2.compiler.normalized_tree") && string_contains(s: rendered, pattern: "phase=typecheck") && @@ -378,13 +378,13 @@ fn w_subject_identity_is_rendered_not_anonymous() -> Bool { string_contains(s: rendered, pattern: "batch=") } -fn w_containment_holds_along_the_path() -> Bool { +test fn w_containment_holds_along_the_path() -> Bool { observation_subject_contains(ancestor: obs_run_subject(), descendant: obs_leaf_subject()) && observation_subject_contains(ancestor: obs_entry_subject(), descendant: obs_leaf_subject()) && !observation_subject_contains(ancestor: obs_leaf_subject(), descendant: obs_run_subject()) } -fn w_grain_orders_the_containment_tree() -> Bool { +test fn w_grain_orders_the_containment_tree() -> Bool { observation_subject_grain(subject: obs_run_subject()) == RunGrain && observation_subject_grain(subject: obs_entry_subject()) == EntryGrain && observation_subject_grain(subject: obs_leaf_subject()) == PhaseGrain && @@ -393,7 +393,7 @@ fn w_grain_orders_the_containment_tree() -> Bool { !observation_grain_at_or_above_entry(g: PhaseGrain) } -fn w_presentation_glyph_reads_the_table_not_a_hardcoded_string() -> Bool { +test fn w_presentation_glyph_reads_the_table_not_a_hardcoded_string() -> Bool { let p = observation_presentation(c: ClassRefused) match resolve_symbol(id: p.glyph, tier: Unicode) { Present { value: u } => @@ -407,7 +407,7 @@ fn w_presentation_glyph_reads_the_table_not_a_hardcoded_string() -> Bool { } } -fn w_presentation_colour_comes_from_the_glyph_authority() -> Bool { +test fn w_presentation_colour_comes_from_the_glyph_authority() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => { let p = observation_presentation(c: c) acc && match symbol_color(id: p.glyph) { @@ -417,7 +417,7 @@ fn w_presentation_colour_comes_from_the_glyph_authority() -> Bool { }) } -fn w_reward_animal_selection_is_deterministic_and_wraps() -> Bool { +test fn w_reward_animal_selection_is_deterministic_and_wraps() -> Bool { let n = count(reward_animals) n > 0 && match reward_animal_at(index: 3, tier: Ascii) { @@ -434,14 +434,14 @@ fn w_reward_animal_selection_is_deterministic_and_wraps() -> Bool { } } -fn w_every_law_is_stated_and_bound_to_an_enforcer() -> Bool { +test fn w_every_law_is_stated_and_bound_to_an_enforcer() -> Bool { count(observation_laws) == 5 && fold(observation_laws, init: true, f: (acc, l) => acc && l.id != "" && l.statement != "" && l.enforced_by.module_path == "std.observation" && l.enforced_by.decl_name != "" ) } -fn w_change_kind_projects_from_the_one_diff_carrier() -> Bool { +test fn w_change_kind_projects_from_the_one_diff_carrier() -> Bool { let added = observation_change_presentation(hunk: KeyedDiffAddedHunk { hunk_key: "a", to: 1 }) let removed = observation_change_presentation(hunk: KeyedDiffRemovedHunk { hunk_key: "a", from: 1 }) let modified = observation_change_presentation(hunk: KeyedDiffModifiedHunk { hunk_key: "a", from: 1, to: 2 }) @@ -453,7 +453,7 @@ fn w_change_kind_projects_from_the_one_diff_carrier() -> Bool { modified.symbol == ChangeModified } -fn w_change_kind_colour_follows_git_diff_convention() -> Bool { +test fn w_change_kind_colour_follows_git_diff_convention() -> Bool { match symbol_color(id: ChangeAdded) { Present { value: a } => match symbol_color(id: ChangeModified) { @@ -468,7 +468,7 @@ fn w_change_kind_colour_follows_git_diff_convention() -> Bool { } } -fn w_change_kind_degrades_losslessly_without_colour() -> Bool { +test fn w_change_kind_degrades_losslessly_without_colour() -> Bool { let added = observation_change_presentation(hunk: KeyedDiffAddedHunk { hunk_key: "a", to: 1 }) let removed = observation_change_presentation(hunk: KeyedDiffRemovedHunk { hunk_key: "a", from: 1 }) let modified = observation_change_presentation(hunk: KeyedDiffModifiedHunk { hunk_key: "a", from: 1, to: 2 }) @@ -476,7 +476,7 @@ fn w_change_kind_degrades_losslessly_without_colour() -> Bool { added.tag != removed.tag && added.tag != modified.tag && removed.tag != modified.tag } -fn w_no_op_kinds_each_explain_themselves() -> Bool { +test fn w_no_op_kinds_each_explain_themselves() -> Bool { let kinds = [ DocsPolicy, Uncovered { declaration: "std.observation.observation_attention" as NonEmptyStr }, @@ -495,13 +495,13 @@ fn w_no_op_kinds_each_explain_themselves() -> Bool { }) } -fn w_uncovered_is_a_nudge_not_a_comfort() -> Bool { +test fn w_uncovered_is_a_nudge_not_a_comfort() -> Bool { observation_no_op_attention(n: Uncovered { declaration: "std.observation.observation_watchdog" as NonEmptyStr }) == Notable && observation_no_op_attention(n: DocsPolicy) == Ambient && observation_no_op_symbol(n: Uncovered { declaration: "x" as NonEmptyStr }) == StatusWarning } -fn w_departed_path_is_not_a_no_op() -> Bool { +test fn w_departed_path_is_not_a_no_op() -> Bool { observation_no_op_is_actually_a_widen(n: DepartedPath { cause: "deleted module" as NonEmptyStr }) && !observation_no_op_is_actually_a_widen(n: DocsPolicy) && !observation_no_op_is_actually_a_widen(n: NoDeclsTouched) && @@ -510,7 +510,7 @@ fn w_departed_path_is_not_a_no_op() -> Bool { observation_no_op_attention(n: DepartedPath { cause: "deleted module" as NonEmptyStr }) == Notable } -fn w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() -> Bool { +test fn w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() -> Bool { let hold = PsiPressure { avg10: basis_point(count: 3750) } match hold { PsiPressure { avg10: r } => basis_point_count(bp: r) == 3750 @@ -518,44 +518,10 @@ fn w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() -> Bool { } } -fn w_status_pulse_glyph_is_available_to_the_heartbeat() -> Bool { +test fn w_status_pulse_glyph_is_available_to_the_heartbeat() -> Bool { match resolve_symbol(id: StatusPulse, tier: Emoji) { Present { value: e } => e == "🕐" Absent => false } } -test fn observation_model_witnesses() -> Bool { - w_presentation_is_total_over_class_roster() && - w_class_roster_covers_every_constructed_class() && - w_refused_is_distinct_from_failed() && - w_anomaly_classes_never_collapse() && - w_density_is_the_single_display_authority() && - w_presentation_projects_density_rather_than_restating_it() && - w_routine_progress_collapses_but_the_summary_always_shows() && - w_refusal_is_anomaly_on_any_basis() && - w_attention_grounds_on_supplied_basis() && - w_attention_moves_with_the_basis_not_a_local_constant() && - w_unavailable_measurement_carries_a_cause() && - w_blocked_on_resource_is_derived_for_every_hold() && - w_blocked_on_carries_holders_and_named_remaining() && - w_escalation_depth_is_recursive_not_one_level() && - w_escalation_surfaces_deeper_subject_over_time() && - w_escalation_refuses_to_surface_an_unrelated_subject() && - w_watchdog_converts_quiet_past_budget_into_a_typed_line() && - w_subject_identity_is_rendered_not_anonymous() && - w_containment_holds_along_the_path() && - w_grain_orders_the_containment_tree() && - w_presentation_glyph_reads_the_table_not_a_hardcoded_string() && - w_presentation_colour_comes_from_the_glyph_authority() && - w_reward_animal_selection_is_deterministic_and_wraps() && - w_every_law_is_stated_and_bound_to_an_enforcer() && - w_change_kind_projects_from_the_one_diff_carrier() && - w_change_kind_colour_follows_git_diff_convention() && - w_change_kind_degrades_losslessly_without_colour() && - w_no_op_kinds_each_explain_themselves() && - w_uncovered_is_a_nudge_not_a_comfort() && - w_departed_path_is_not_a_no_op() && - w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() && - w_status_pulse_glyph_is_available_to_the_heartbeat() -} diff --git a/dag/test/claim/observation_tty_render_witness_test.dag b/dag/test/claim/observation_tty_render_witness_test.dag index ff99d37909f..236c9da4722 100644 --- a/dag/test/claim/observation_tty_render_witness_test.dag +++ b/dag/test/claim/observation_tty_render_witness_test.dag @@ -69,7 +69,7 @@ fn tty_basis() -> AttentionBasis { AttentionBasis { average: millisecond(count: 1000), maximum: millisecond(count: 5000) } } -fn w_preamble_names_what_why_and_how_much() -> Bool { +test fn w_preamble_names_what_why_and_how_much() -> Bool { let line = tty_preamble_line(fields: PreambleFields { run_id: "30044816605" as NonEmptyStr, trigger: "pull_request" as NonEmptyStr, @@ -82,18 +82,18 @@ fn w_preamble_names_what_why_and_how_much() -> Bool { string_contains(s: line.text, pattern: "602 entries") } -fn w_routine_repaints_in_place_but_anomaly_scrolls() -> Bool { +test fn w_routine_repaints_in_place_but_anomaly_scrolls() -> Bool { tty_cursor_action(attention: Ambient, cap: tty_cap()) == Overwrite && tty_cursor_action(attention: Notable, cap: tty_cap()) == Append && tty_cursor_action(attention: Anomaly, cap: tty_cap()) == Append } -fn w_non_addressable_terminal_always_appends() -> Bool { +test fn w_non_addressable_terminal_always_appends() -> Bool { tty_cursor_action(attention: Ambient, cap: pipe_cap()) == Append && tty_cursor_action(attention: Anomaly, cap: pipe_cap()) == Append } -fn w_refusal_never_repaints_away() -> Bool { +test fn w_refusal_never_repaints_away() -> Bool { let refusal = ObservationEvent { subject: tty_entry_subject(), transition: Concluded { outcome: Refused { diagnostic: "FLOOR-BATCH-OVER-BUDGET" as NonEmptyStr } }, @@ -105,7 +105,7 @@ fn w_refusal_never_repaints_away() -> Bool { emission.cursor == Append } -fn w_same_event_drives_both_surfaces() -> Bool { +test fn w_same_event_drives_both_surfaces() -> Bool { let event = ObservationEvent { subject: tty_entry_subject(), transition: Concluded { outcome: Done }, @@ -116,14 +116,14 @@ fn w_same_event_drives_both_surfaces() -> Bool { string_contains(s: tty_render_emission(emission: emission, tier: Emoji), pattern: "in 230ms") } -fn w_group_line_names_the_current_entry() -> Bool { +test fn w_group_line_names_the_current_entry() -> Bool { let line = tty_group_line(active: tty_entry_subject(), k: 214, n: 602, spinner: Spinner0) string_contains(s: line.text, pattern: "214 of 602") && string_contains(s: line.text, pattern: "v2.compiler.normalized_tree") && line.attention == Ambient } -fn w_blocked_line_carries_holder_and_bounded_remaining() -> Bool { +test fn w_blocked_line_carries_holder_and_bounded_remaining() -> Bool { let bounded = tty_blocked_line(blocked: BlockedOn { resource: MemoryBudget, holders: [tty_entry_subject()], @@ -134,7 +134,7 @@ fn w_blocked_line_carries_holder_and_bounded_remaining() -> Bool { bounded.attention == Anomaly } -fn w_blocked_line_names_why_remaining_is_unknown() -> Bool { +test fn w_blocked_line_names_why_remaining_is_unknown() -> Bool { let unknown = tty_blocked_line(blocked: BlockedOn { resource: MemoryBudget, holders: [tty_entry_subject()], @@ -144,7 +144,7 @@ fn w_blocked_line_names_why_remaining_is_unknown() -> Bool { !string_contains(s: unknown.text, pattern: "remaining") } -fn w_reward_animal_is_deterministic_and_degrades_to_a_word() -> Bool { +test fn w_reward_animal_is_deterministic_and_degrades_to_a_word() -> Bool { let emoji_clean = tty_final_line(shown_failures: 0, run_index: 3, tier: Emoji) let emoji_again = tty_final_line(shown_failures: 0, run_index: 3, tier: Emoji) let ascii_clean = tty_final_line(shown_failures: 0, run_index: 3, tier: Ascii) @@ -154,21 +154,9 @@ fn w_reward_animal_is_deterministic_and_degrades_to_a_word() -> Bool { !string_contains(s: ascii_clean.text, pattern: "🦦") } -fn w_final_with_failures_names_them_and_is_anomaly() -> Bool { +test fn w_final_with_failures_names_them_and_is_anomaly() -> Bool { let line = tty_final_line(shown_failures: 3, run_index: 3, tier: Emoji) string_contains(s: line.text, pattern: "3 problems shown") && line.attention == Anomaly } -test fn observation_tty_render_witnesses() -> Bool { - w_preamble_names_what_why_and_how_much() && - w_routine_repaints_in_place_but_anomaly_scrolls() && - w_non_addressable_terminal_always_appends() && - w_refusal_never_repaints_away() && - w_same_event_drives_both_surfaces() && - w_group_line_names_the_current_entry() && - w_blocked_line_carries_holder_and_bounded_remaining() && - w_blocked_line_names_why_remaining_is_unknown() && - w_reward_animal_is_deterministic_and_degrades_to_a_word() && - w_final_with_failures_names_them_and_is_anomaly() -} diff --git a/dag/test/claim/oomd_install_grounding_witness_test.dag b/dag/test/claim/oomd_install_grounding_witness_test.dag index e5f177642d9..2d72b4f7a9c 100644 --- a/dag/test/claim/oomd_install_grounding_witness_test.dag +++ b/dag/test/claim/oomd_install_grounding_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.oomd_install_grounding_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn test_thresholds() -> OomdGroundingThresholds { @@ -239,21 +238,21 @@ fn grounds(read: OomdEffectiveRead) -> Bool { grounding_is_enforced(g: ground_oomd_from_read(read: read, req: test_thresholds())) } -fn witness_full_conjunction_grounds_enforced() -> Bool { +test fn witness_full_conjunction_grounds_enforced() -> Bool { grounds(read: good_read()) } -fn witness_slice_absent_fails_closed() -> Bool { !grounds(read: slice_absent_read()) } -fn witness_inactive_fails_closed() -> Bool { !grounds(read: inactive_read()) } -fn witness_disabled_fails_closed() -> Bool { !grounds(read: disabled_read()) } -fn witness_auto_pressure_fails_closed() -> Bool { !grounds(read: auto_pressure_read()) } -fn witness_wrong_per_session_cap_fails_closed() -> Bool { !grounds(read: wrong_per_session_cap_read()) } -fn witness_unbounded_per_session_cap_fails_closed() -> Bool { !grounds(read: unbounded_per_session_cap_read()) } -fn witness_wrong_parent_slice_cap_fails_closed() -> Bool { !grounds(read: wrong_parent_slice_cap_read()) } -fn witness_wrong_pressure_limit_fails_closed() -> Bool { !grounds(read: wrong_pressure_limit_read()) } -fn witness_oomctl_unmanaged_fails_closed() -> Bool { !grounds(read: oomctl_unmanaged_read()) } +test fn witness_slice_absent_fails_closed() -> Bool { !grounds(read: slice_absent_read()) } +test fn witness_inactive_fails_closed() -> Bool { !grounds(read: inactive_read()) } +test fn witness_disabled_fails_closed() -> Bool { !grounds(read: disabled_read()) } +test fn witness_auto_pressure_fails_closed() -> Bool { !grounds(read: auto_pressure_read()) } +test fn witness_wrong_per_session_cap_fails_closed() -> Bool { !grounds(read: wrong_per_session_cap_read()) } +test fn witness_unbounded_per_session_cap_fails_closed() -> Bool { !grounds(read: unbounded_per_session_cap_read()) } +test fn witness_wrong_parent_slice_cap_fails_closed() -> Bool { !grounds(read: wrong_parent_slice_cap_read()) } +test fn witness_wrong_pressure_limit_fails_closed() -> Bool { !grounds(read: wrong_pressure_limit_read()) } +test fn witness_oomctl_unmanaged_fails_closed() -> Bool { !grounds(read: oomctl_unmanaged_read()) } -fn witness_unmeasured_aggregate_fails_closed() -> Bool { +test fn witness_unmeasured_aggregate_fails_closed() -> Bool { !grounding_is_enforced(g: ground_oomd_from_read(read: good_read(), req: unmeasured_aggregate_thresholds())) } @@ -268,63 +267,39 @@ fn is_enforced(e: OomdEnforcementEvidence) -> Bool { } } -fn witness_reconcile_good_read_enforces() -> Bool { +test fn witness_reconcile_good_read_enforces() -> Bool { is_enforced(e: oomd_evidence_from_reconciliation(r: reconcile_oomd(read: managed_observed_read(), req: test_thresholds()))) } -fn witness_reconcile_good_read_converges() -> Bool { +test fn witness_reconcile_good_read_converges() -> Bool { reconciliation_converged(r: reconcile_oomd(read: managed_observed_read(), req: test_thresholds())) } -fn witness_absent_read_is_fail_closed() -> Bool { +test fn witness_absent_read_is_fail_closed() -> Bool { !is_enforced(e: gunbc_oomd_install_evidence()) } -fn witness_fleet_evidence_seam_fail_closed() -> Bool { +test fn witness_fleet_evidence_seam_fail_closed() -> Bool { !is_enforced(e: gunbc_oomd_fleet_evidence(req: test_thresholds())) } -fn witness_membership_check_contract_passes_with_sessions_in_slice() -> Bool { +test fn witness_membership_check_contract_passes_with_sessions_in_slice() -> Bool { membership_check_passes(m: good_membership()) } -fn witness_membership_check_contract_passes_partial_migration() -> Bool { +test fn witness_membership_check_contract_passes_partial_migration() -> Bool { membership_check_passes(m: partial_migration_membership()) } -fn witness_membership_check_contract_fails_all_legacy() -> Bool { +test fn witness_membership_check_contract_fails_all_legacy() -> Bool { !membership_check_passes(m: all_legacy_membership()) } -fn witness_membership_check_contract_fails_empty_host() -> Bool { +test fn witness_membership_check_contract_fails_empty_host() -> Bool { !membership_check_passes(m: empty_host_membership()) } -fn witness_all_legacy_read_fails_closed() -> Bool { !grounds(read: all_legacy_read()) } -fn witness_empty_host_read_fails_closed() -> Bool { !grounds(read: empty_host_read()) } -fn witness_partial_migration_grounds() -> Bool { grounds(read: partial_migration_read()) } - -test fn oomd_install_grounding_holds() -> Bool { - witness_full_conjunction_grounds_enforced() - && witness_slice_absent_fails_closed() - && witness_inactive_fails_closed() - && witness_disabled_fails_closed() - && witness_auto_pressure_fails_closed() - && witness_wrong_per_session_cap_fails_closed() - && witness_unbounded_per_session_cap_fails_closed() - && witness_wrong_parent_slice_cap_fails_closed() - && witness_wrong_pressure_limit_fails_closed() - && witness_oomctl_unmanaged_fails_closed() - && witness_unmeasured_aggregate_fails_closed() - && witness_reconcile_good_read_enforces() - && witness_reconcile_good_read_converges() - && witness_absent_read_is_fail_closed() - && witness_fleet_evidence_seam_fail_closed() - && witness_membership_check_contract_passes_with_sessions_in_slice() - && witness_membership_check_contract_passes_partial_migration() - && witness_membership_check_contract_fails_all_legacy() - && witness_membership_check_contract_fails_empty_host() - && witness_all_legacy_read_fails_closed() - && witness_empty_host_read_fails_closed() - && witness_partial_migration_grounds() -} +test fn witness_all_legacy_read_fails_closed() -> Bool { !grounds(read: all_legacy_read()) } +test fn witness_empty_host_read_fails_closed() -> Bool { !grounds(read: empty_host_read()) } +test fn witness_partial_migration_grounds() -> Bool { grounds(read: partial_migration_read()) } + diff --git a/dag/test/claim/output_policy_witness_test.dag b/dag/test/claim/output_policy_witness_test.dag index 9be94b8ad37..af450ce9e2a 100644 --- a/dag/test/claim/output_policy_witness_test.dag +++ b/dag/test/claim/output_policy_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.output_policy_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn dec_is(d: OutputDecision, suppressed: Bool, condensed: Bool, full: Bool) -> Bool { @@ -23,50 +22,50 @@ fn verbosity_is_normal(v: Verbosity) -> Bool { match v { Normal => true, _ => false } } -fn w_diagnostic_never_hidden() -> Bool { +test fn w_diagnostic_never_hidden() -> Bool { dec_is(d: channel_decision(channel: gunbc.output_policy.Diagnostic, verbosity: Quiet), suppressed: false, condensed: false, full: true) && dec_is(d: channel_decision(channel: gunbc.output_policy.Diagnostic, verbosity: Normal), suppressed: false, condensed: false, full: true) && dec_is(d: channel_decision(channel: gunbc.output_policy.Diagnostic, verbosity: Verbose), suppressed: false, condensed: false, full: true) } -fn w_instrumentation_is_debug_only() -> Bool { +test fn w_instrumentation_is_debug_only() -> Bool { dec_is(d: channel_decision(channel: Instrumentation, verbosity: Normal), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: Instrumentation, verbosity: Quiet), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: Instrumentation, verbosity: Verbose), suppressed: false, condensed: false, full: true) } -fn w_shell_trace_is_debug_only_at_normal() -> Bool { +test fn w_shell_trace_is_debug_only_at_normal() -> Bool { dec_is(d: channel_decision(channel: ShellTrace, verbosity: Normal), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: ShellTrace, verbosity: Quiet), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: ShellTrace, verbosity: Verbose), suppressed: false, condensed: false, full: true) } -fn w_claim_result_shown_at_normal_hidden_at_quiet() -> Bool { +test fn w_claim_result_shown_at_normal_hidden_at_quiet() -> Bool { dec_is(d: channel_decision(channel: ClaimResult, verbosity: Normal), suppressed: false, condensed: false, full: true) && dec_is(d: channel_decision(channel: ClaimResult, verbosity: Quiet), suppressed: true, condensed: false, full: false) } -fn w_progress_condenses_at_normal() -> Bool { +test fn w_progress_condenses_at_normal() -> Bool { dec_is(d: channel_decision(channel: Progress, verbosity: Normal), suppressed: false, condensed: true, full: false) && dec_is(d: channel_decision(channel: Progress, verbosity: Quiet), suppressed: true, condensed: false, full: false) } -fn w_verbose_wins_over_quiet() -> Bool { +test fn w_verbose_wins_over_quiet() -> Bool { verbosity_is_verbose(v: resolve_verbosity(env: VerbosityEnv { verbose: true, quiet: true })) && verbosity_is_quiet(v: resolve_verbosity(env: VerbosityEnv { verbose: false, quiet: true })) && verbosity_is_normal(v: resolve_verbosity(env: VerbosityEnv { verbose: false, quiet: false })) } -fn w_env_var_dispatch_names_grounded() -> Bool { +test fn w_env_var_dispatch_names_grounded() -> Bool { env_var_for(v: Verbose) == "GUNBC_VERBOSE" && env_var_for(v: Quiet) == "GUNBC_QUIET" } -fn w_shell_trace_cap_is_authority() -> Bool { +test fn w_shell_trace_cap_is_authority() -> Bool { shell_trace_summary_max_columns == 100 } -fn w_resolve_channel_policy_normal_bundles_decisions() -> Bool { +test fn w_resolve_channel_policy_normal_bundles_decisions() -> Bool { let p = resolve_channel_policy(verbose: false, quiet: false) dec_is(d: p.diagnostic, suppressed: false, condensed: false, full: true) && dec_is(d: p.claim_result, suppressed: false, condensed: false, full: true) && @@ -75,7 +74,7 @@ fn w_resolve_channel_policy_normal_bundles_decisions() -> Bool { dec_is(d: p.instrumentation, suppressed: true, condensed: false, full: false) } -fn w_resolve_channel_policy_verbose_all_full() -> Bool { +test fn w_resolve_channel_policy_verbose_all_full() -> Bool { let p = resolve_channel_policy(verbose: true, quiet: false) dec_is(d: p.shell_trace, suppressed: false, condensed: false, full: true) && dec_is(d: p.instrumentation, suppressed: false, condensed: false, full: true) && @@ -101,7 +100,7 @@ fn surfaced_text_or_marker(d: StreamDisposition, text: String) -> String { } } -fn w_divergence_surfaces_agreement_counts_at_normal() -> Bool { +test fn w_divergence_surfaces_agreement_counts_at_normal() -> Bool { disp_is(d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)), surface: true, counts: false, suppressed: false) && disp_is(d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: ObservedSuccess), @@ -112,35 +111,35 @@ fn w_divergence_surfaces_agreement_counts_at_normal() -> Bool { surface: true, counts: false, suppressed: false) } -fn w_red_control_failing_as_declared_does_not_replay_content() -> Bool { +test fn w_red_control_failing_as_declared_does_not_replay_content() -> Bool { surfaced_text_or_marker( d: shell_stream(verbosity: Normal, expected: ExpectFailure, observed: observed_outcome_from_exit(exit: 1)), text: "::error::build verification: declared artifact absent" ) == "" } -fn w_red_control_that_unexpectedly_succeeds_surfaces() -> Bool { +test fn w_red_control_that_unexpectedly_succeeds_surfaces() -> Bool { surfaced_text_or_marker( d: shell_stream(verbosity: Normal, expected: ExpectFailure, observed: ObservedSuccess), text: "wall did not fire" ) == "| wall did not fire" } -fn w_surfaced_subject_text_cannot_mint_annotations() -> Bool { +test fn w_surfaced_subject_text_cannot_mint_annotations() -> Bool { surfaced_text_or_marker( d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)), text: "::error::boom\n::warning::next" ) == "| ::error::boom\n| ::warning::next" } -fn w_neutralization_is_the_only_route_to_surfaced_text() -> Bool { +test fn w_neutralization_is_the_only_route_to_surfaced_text() -> Bool { neutralize_workflow_commands(text: "::endgroup::") == "| ::endgroup::" && subject_text_line_guard == "| " } data w_quiet_ambient_silent_but_divergence_still_surfaces_note: String = "Observation dissolve: Quiet suppresses Ambient ShellTrace scaffolding, but stream disposition follows divergence — Anomaly is never silenced by channel Suppressed (DESIGN section 5). Verbose still surfaces every stream (Full)." -fn w_quiet_ambient_silent_but_divergence_still_surfaces() -> Bool { +test fn w_quiet_ambient_silent_but_divergence_still_surfaces() -> Bool { disp_is(d: shell_stream(verbosity: Quiet, expected: ExpectFailure, observed: ObservedSuccess), surface: true, counts: false, suppressed: false) && disp_is(d: shell_stream(verbosity: Quiet, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)), @@ -153,21 +152,21 @@ fn w_quiet_ambient_silent_but_divergence_still_surfaces() -> Bool { surface: true, counts: false, suppressed: false) } -fn w_effect_stream_disposition_is_exit_invariant() -> Bool { +test fn w_effect_stream_disposition_is_exit_invariant() -> Bool { disp_is(d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 137)), surface: true, counts: false, suppressed: false) && disp_is(d: shell_stream(verbosity: Normal, expected: ExpectFailure, observed: observed_outcome_from_exit(exit: 137)), surface: false, counts: true, suppressed: false) } -fn w_expectation_axis_is_load_bearing_red_control() -> Bool { +test fn w_expectation_axis_is_load_bearing_red_control() -> Bool { let agree = shell_stream(verbosity: Normal, expected: ExpectFailure, observed: observed_outcome_from_exit(exit: 1)) let diverge = shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)) disp_is(d: agree, surface: true, counts: false, suppressed: false) == false && disp_is(d: diverge, surface: false, counts: true, suppressed: false) == false } -fn w_shell_trace_stream_policy_projects_the_four_corners() -> Bool { +test fn w_shell_trace_stream_policy_projects_the_four_corners() -> Bool { let p = resolve_shell_trace_stream_policy(verbose: false, quiet: false) disp_is(d: p.expect_success_observed_success, surface: false, counts: true, suppressed: false) && disp_is(d: p.expect_success_observed_failure, surface: true, counts: false, suppressed: false) && @@ -184,7 +183,7 @@ fn disp_surfaces(d: StreamDisposition) -> Bool { disp_is(d: d, surface: true, counts: false, suppressed: false) } -fn w_outcome_is_data_is_exit_invariant() -> Bool { +test fn w_outcome_is_data_is_exit_invariant() -> Bool { let p = resolve_shell_trace_stream_policy(verbose: false, quiet: false) let es_flips = disp_surfaces(d: p.expect_success_observed_failure) && !disp_surfaces(d: p.expect_success_observed_success) let ef_flips = disp_surfaces(d: p.expect_failure_observed_success) && !disp_surfaces(d: p.expect_failure_observed_failure) @@ -192,28 +191,3 @@ fn w_outcome_is_data_is_exit_invariant() -> Bool { es_flips && ef_flips && oid_still } -test fn output_policy_effect_stream_witnesses() -> Bool { - w_divergence_surfaces_agreement_counts_at_normal() && - w_red_control_failing_as_declared_does_not_replay_content() && - w_red_control_that_unexpectedly_succeeds_surfaces() && - w_surfaced_subject_text_cannot_mint_annotations() && - w_neutralization_is_the_only_route_to_surfaced_text() && - w_quiet_ambient_silent_but_divergence_still_surfaces() && - w_effect_stream_disposition_is_exit_invariant() && - w_expectation_axis_is_load_bearing_red_control() && - w_shell_trace_stream_policy_projects_the_four_corners() && - w_outcome_is_data_is_exit_invariant() -} - -test fn output_policy_witnesses() -> Bool { - w_diagnostic_never_hidden() && - w_instrumentation_is_debug_only() && - w_shell_trace_is_debug_only_at_normal() && - w_claim_result_shown_at_normal_hidden_at_quiet() && - w_progress_condenses_at_normal() && - w_verbose_wins_over_quiet() && - w_env_var_dispatch_names_grounded() && - w_shell_trace_cap_is_authority() && - w_resolve_channel_policy_normal_bundles_decisions() && - w_resolve_channel_policy_verbose_all_full() -} diff --git a/dag/test/claim/pareto_dominance_witness_test.dag b/dag/test/claim/pareto_dominance_witness_test.dag index 63ef5fe06e0..3d7864bb8fc 100644 --- a/dag/test/claim/pareto_dominance_witness_test.dag +++ b/dag/test/claim/pareto_dominance_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.pareto_dominance - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn compare_axes(a_cap: Int, a_cost: Int, b_cap: Int, b_cost: Int) -> List { @@ -14,24 +13,24 @@ fn verdict_of(a_cap: Int, a_cost: Int, b_cap: Int, b_cost: Int) -> DominanceVerd dominance_of_comparisons(comparisons: compare_axes(a_cap: a_cap, a_cost: a_cost, b_cap: b_cap, b_cost: b_cost)) } -fn dominates_when_better_on_all_axes() -> Bool { +test fn dominates_when_better_on_all_axes() -> Bool { verdict_dominates(v: verdict_of(a_cap: 64, a_cost: 100, b_cap: 32, b_cost: 200)) } -fn dominated_is_the_mirror() -> Bool { +test fn dominated_is_the_mirror() -> Bool { verdict_is_dominated(v: verdict_of(a_cap: 32, a_cost: 200, b_cap: 64, b_cost: 100)) } -fn equivalent_when_identical() -> Bool { +test fn equivalent_when_identical() -> Bool { verdict_is_equivalent(v: verdict_of(a_cap: 48, a_cost: 150, b_cap: 48, b_cost: 150)) } -fn incomparable_is_not_a_tie() -> Bool { +test fn incomparable_is_not_a_tie() -> Bool { let v = verdict_of(a_cap: 64, a_cost: 200, b_cap: 32, b_cost: 100) verdict_is_incomparable(v: v) && !verdict_is_equivalent(v: v) } -fn dominated_candidate_is_off_front() -> Bool { +test fn dominated_candidate_is_off_front() -> Bool { let pool = [ verdict_of(a_cap: 64, a_cost: 100, b_cap: 32, b_cost: 200), @@ -40,7 +39,7 @@ fn dominated_candidate_is_off_front() -> Bool { any_dominates(verdicts: pool) && !on_pareto_front(verdicts: pool) } -fn undominated_candidate_stays_on_front() -> Bool { +test fn undominated_candidate_stays_on_front() -> Bool { let pool = [ verdict_of(a_cap: 32, a_cost: 50, b_cap: 64, b_cost: 100), @@ -49,11 +48,3 @@ fn undominated_candidate_stays_on_front() -> Bool { on_pareto_front(verdicts: pool) && !any_dominates(verdicts: pool) } -test fn pareto_dominance_holds() -> Bool { - dominates_when_better_on_all_axes() - && dominated_is_the_mirror() - && equivalent_when_identical() - && incomparable_is_not_a_tie() - && dominated_candidate_is_off_front() - && undominated_candidate_stays_on_front() -} diff --git a/dag/test/claim/perturbation_kernel_test.dag b/dag/test/claim/perturbation_kernel_test.dag index a8e2ec60b74..8963232f1b0 100644 --- a/dag/test/claim/perturbation_kernel_test.dag +++ b/dag/test/claim/perturbation_kernel_test.dag @@ -1,6 +1,5 @@ module test.claim.perturbation_kernel - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn is_consistent(reading: PerturbationReading, responded: Bool) -> Bool { @@ -10,33 +9,26 @@ fn is_consistent(reading: PerturbationReading, responded: Bool) -> Bool { } } -fn witness_forward_silent_is_consistent() -> Bool { +test fn witness_forward_silent_is_consistent() -> Bool { is_consistent(reading: ForwardSameInSameOut, responded: false) } -fn witness_forward_responded_is_violation() -> Bool { +test fn witness_forward_responded_is_violation() -> Bool { perturbation_is_violation(reading: ForwardSameInSameOut, output_responded: true) } -fn witness_backward_responded_is_consistent() -> Bool { +test fn witness_backward_responded_is_consistent() -> Bool { perturbation_consistent(reading: BackwardDiffInDiffOut, output_responded: true) } -fn witness_backward_silent_is_violation() -> Bool { +test fn witness_backward_silent_is_violation() -> Bool { perturbation_is_violation(reading: BackwardDiffInDiffOut, output_responded: false) } -fn witness_readings_are_dual() -> Bool { +test fn witness_readings_are_dual() -> Bool { (is_consistent(reading: ForwardSameInSameOut, responded: false) && (is_consistent(reading: BackwardDiffInDiffOut, responded: false) == false)) && (is_consistent(reading: BackwardDiffInDiffOut, responded: true) && (is_consistent(reading: ForwardSameInSameOut, responded: true) == false)) } -test fn perturbation_kernel_witnesses() -> Bool { - witness_forward_silent_is_consistent() - && witness_forward_responded_is_violation() - && witness_backward_responded_is_consistent() - && witness_backward_silent_is_violation() - && witness_readings_are_dual() -} diff --git a/dag/test/claim/power_watt_witness_test.dag b/dag/test/claim/power_watt_witness_test.dag index 525677ed676..168b70537c4 100644 --- a/dag/test/claim/power_watt_witness_test.dag +++ b/dag/test/claim/power_watt_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.power_watt - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn total_power_watts(components: List) -> Watt { @@ -14,20 +13,15 @@ data example_component_draws: List = [ watt(count: 30) ] -fn total_power_is_computed_sum() -> Bool { +test fn total_power_is_computed_sum() -> Bool { watt_count(w: total_power_watts(components: example_component_draws)) == 220 } -fn empty_budget_is_zero_watts() -> Bool { +test fn empty_budget_is_zero_watts() -> Bool { watt_count(w: total_power_watts(components: [])) == 0 } -fn watt_roundtrips() -> Bool { +test fn watt_roundtrips() -> Bool { watt_count(w: watt(count: 183)) == 183 } -test fn power_watt_witnesses() -> Bool { - watt_roundtrips() - && empty_budget_is_zero_watts() - && total_power_is_computed_sum() -} diff --git a/dag/test/claim/pricing_surface_witness_test.dag b/dag/test/claim/pricing_surface_witness_test.dag index 681ac06996e..fee6a8ed1f6 100644 --- a/dag/test/claim/pricing_surface_witness_test.dag +++ b/dag/test/claim/pricing_surface_witness_test.dag @@ -22,12 +22,12 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_github_2core_per_hour_derived_not_stored() -> Bool { +test fn witness_github_2core_per_hour_derived_not_stored() -> Bool { let derived = per_hour_equivalent_from_per_minute(q: github_actions_linux_2core_price.per_minute) money_per_hour_micros(q: derived) == 360000 } -fn witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() -> Bool { +test fn witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() -> Bool { let github_hourly = per_hour_equivalent_from_per_minute(q: github_actions_linux_2core_price.per_minute) let aws_hourly = aws_ec2_m7a_large_us_east_1.per_hour money_per_hour_micros(q: github_hourly) > money_per_hour_micros(q: aws_hourly) @@ -35,18 +35,18 @@ fn witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() -> Bool { && money_per_hour_micros(q: aws_hourly) == 115920 } -fn witness_ubicloud_premium_2core_undercuts_github_2core_per_minute() -> Bool { +test fn witness_ubicloud_premium_2core_undercuts_github_2core_per_minute() -> Bool { money_per_minute_micros(q: github_actions_linux_2core_price.per_minute) > money_per_minute_micros(q: ubicloud_premium_standard_2_price.per_minute) && money_per_minute_micros(q: ubicloud_premium_standard_2_price.per_minute) == 1600 && money_per_minute_micros(q: github_actions_linux_2core_price.per_minute) == 6000 } -fn witness_hetzner_ax41_monthly_matches_cited_price() -> Bool { +test fn witness_hetzner_ax41_monthly_matches_cited_price() -> Bool { money_per_month_micros(q: hetzner_ax41_1_ltd_price.monthly) == 57300000 && hetzner_dedicated_setup_fee_micros(row: hetzner_ax41_1_ltd_price) == 0 } -fn witness_hetzner_ax41_hourly_equivalent_derived() -> Bool { +test fn witness_hetzner_ax41_hourly_equivalent_derived() -> Bool { let derived = per_hour_equivalent_from_per_month(q: hetzner_ax41_1_ltd_price.monthly) money_per_hour_micros(q: derived) == 57300000 / billing_month_as_hour_count() } @@ -56,16 +56,8 @@ data wrong_github_2core_per_minute_fixture: MoneyPerMinute = MoneyPerMinute { currency: Usd, } -fn witness_wrong_github_per_minute_red_control() -> Bool { +test fn witness_wrong_github_per_minute_red_control() -> Bool { let derived = per_hour_equivalent_from_per_minute(q: wrong_github_2core_per_minute_fixture) money_per_hour_micros(q: derived) != 360000 } -test fn pricing_surface_witness_holds() -> Bool { - witness_github_2core_per_hour_derived_not_stored() - && witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() - && witness_ubicloud_premium_2core_undercuts_github_2core_per_minute() - && witness_hetzner_ax41_monthly_matches_cited_price() - && witness_hetzner_ax41_hourly_equivalent_derived() - && witness_wrong_github_per_minute_red_control() -} diff --git a/dag/test/claim/python_pep440_version_witness_test.dag b/dag/test/claim/python_pep440_version_witness_test.dag index 7433e6a5f20..9e317d41f19 100644 --- a/dag/test/claim/python_pep440_version_witness_test.dag +++ b/dag/test/claim/python_pep440_version_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.python_pep440_version_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn release_1() -> Pep440ReleaseSegments { @@ -102,36 +101,36 @@ fn v_local_1_0_abc_5() -> Pep440Version { } } -fn w_final_release_label() -> Bool { +test fn w_final_release_label() -> Bool { pep440_version_label(v: v_final_1_0()) == "1.0" } -fn w_alpha_pre_release_label() -> Bool { +test fn w_alpha_pre_release_label() -> Bool { pep440_version_label(v: v_alpha_1_0a1()) == "1.0a1" } -fn w_epoch_prefix_label() -> Bool { +test fn w_epoch_prefix_label() -> Bool { pep440_version_label(v: v_epoch_1_2_0()) == "1!2.0" } -fn w_post_release_label() -> Bool { +test fn w_post_release_label() -> Bool { pep440_version_label(v: v_post_1_0_post1()) == "1.0.post1" } -fn w_dev_release_label() -> Bool { +test fn w_dev_release_label() -> Bool { pep440_version_label(v: v_dev_1_0_dev456()) == "1.0.dev456" } -fn w_local_version_label() -> Bool { +test fn w_local_version_label() -> Bool { pep440_version_label(v: v_local_1_0_abc_5()) == "1.0+abc.5" } -fn w_spec_citation_present() -> Bool { +test fn w_spec_citation_present() -> Bool { string_contains(s: pep440_spec_url, pattern: "packaging.python.org") && string_contains(s: pep440_spec_label, pattern: "PEP 440") } -fn w_version_specifier_clause_label() -> Bool { +test fn w_version_specifier_clause_label() -> Bool { pep440_version_specifier_label(spec: [ { op: Pep440CompatibleRelease, @@ -156,7 +155,7 @@ fn w_version_specifier_clause_label() -> Bool { ]) == "~= 2.2, >= 1.0" } -fn w_discriminates_pre_release_numbers() -> Bool { +test fn w_discriminates_pre_release_numbers() -> Bool { let a1 = pep440_version_label(v: v_alpha_1_0a1()) let a2 = pep440_version_label(v: Pep440Version { public: Pep440PublicVersion { @@ -173,11 +172,11 @@ fn w_discriminates_pre_release_numbers() -> Bool { a1 == "1.0a1" && a2 == "1.0a2" && a1 != a2 } -fn w_version_identity_projection() -> Bool { +test fn w_version_identity_projection() -> Bool { pep440_version_identity(v: v_final_1_0()) == "1.0" } -fn w_version_specifier_constraint_projection() -> Bool { +test fn w_version_specifier_constraint_projection() -> Bool { pep440_version_specifier_constraint(spec: [ { op: Pep440InclusiveAtLeast, @@ -192,7 +191,7 @@ fn w_version_specifier_constraint_projection() -> Bool { ]) == ">= 1.0" } -fn w_release_segments_zero_pad_equal() -> Bool { +test fn w_release_segments_zero_pad_equal() -> Bool { pep440_compare_public( a: Pep440PublicVersion { epoch: 0, @@ -211,14 +210,14 @@ fn w_release_segments_zero_pad_equal() -> Bool { ) == Equal } -fn w_structural_alpha_before_final() -> Bool { +test fn w_structural_alpha_before_final() -> Bool { pep440_compare_public( a: v_alpha_1_0a1().public, b: v_final_1_0().public ) == Less } -fn w_a2_dev1_greater_than_a1() -> Bool { +test fn w_a2_dev1_greater_than_a1() -> Bool { pep440_compare_public( a: Pep440PublicVersion { epoch: 0, @@ -233,14 +232,14 @@ fn w_a2_dev1_greater_than_a1() -> Bool { ) == Greater } -fn w_bare_dev_before_alpha() -> Bool { +test fn w_bare_dev_before_alpha() -> Bool { pep440_compare_public( a: v_dev_1_0_dev456().public, b: v_alpha_1_0a1().public ) == Less } -fn w_dev_on_pre_before_same_pre() -> Bool { +test fn w_dev_on_pre_before_same_pre() -> Bool { pep440_compare_public( a: Pep440PublicVersion { epoch: 0, @@ -255,26 +254,7 @@ fn w_dev_on_pre_before_same_pre() -> Bool { ) == Less } -fn w_min_python_interpreter_grounded() -> Bool { +test fn w_min_python_interpreter_grounded() -> Bool { min_python_interpreter == ">= 3.11" } -test fn python_pep440_version_witnesses() -> Bool { - w_final_release_label() - && w_alpha_pre_release_label() - && w_epoch_prefix_label() - && w_post_release_label() - && w_dev_release_label() - && w_local_version_label() - && w_spec_citation_present() - && w_version_specifier_clause_label() - && w_discriminates_pre_release_numbers() - && w_version_identity_projection() - && w_version_specifier_constraint_projection() - && w_release_segments_zero_pad_equal() - && w_structural_alpha_before_final() - && w_a2_dev1_greater_than_a1() - && w_bare_dev_before_alpha() - && w_dev_on_pre_before_same_pre() - && w_min_python_interpreter_grounded() -} diff --git a/dag/test/claim/react_jsx_emit_test.dag b/dag/test/claim/react_jsx_emit_test.dag index 951082a5cc9..86ae476e52e 100644 --- a/dag/test/claim/react_jsx_emit_test.dag +++ b/dag/test/claim/react_jsx_emit_test.dag @@ -1,18 +1,17 @@ module test.claim.react_jsx_emit - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn browse_page_jsx() -> String { serialize_jsx_component(fn_name: "GunbhubBrowsePage", node: gunbhub_browse_page()) } -fn witness_browse_page_jsx_exact_bytes() -> Bool { +test fn witness_browse_page_jsx_exact_bytes() -> Bool { browse_page_jsx() == "export function GunbhubBrowsePage(): JSX.Element { return gunbc

gunbc

; }" } -fn witness_fn_name_in_output() -> Bool { +test fn witness_fn_name_in_output() -> Bool { let a = serialize_jsx_component(fn_name: "PageA", node: gunbhub_browse_page()) let b = serialize_jsx_component(fn_name: "PageB", node: gunbhub_browse_page()) a.starts_with(prefix: "export function PageA():") && @@ -20,23 +19,17 @@ fn witness_fn_name_in_output() -> Bool { !(a == b) } -fn witness_hostile_href_rejected() -> Bool { +test fn witness_hostile_href_rejected() -> Bool { match try_serialize_jsx_component(fn_name: "HostilePage", node: gunbhub_hostile_page()) { JsxRejected { reason: _ } => true JsxOk { tsx: _ } => false } } -fn witness_safe_page_emits_ok() -> Bool { +test fn witness_safe_page_emits_ok() -> Bool { match try_serialize_jsx_component(fn_name: "GunbhubBrowsePage", node: gunbhub_browse_page()) { JsxOk { tsx: s } => s.starts_with(prefix: "export function GunbhubBrowsePage():") JsxRejected { reason: _ } => false } } -test fn react_jsx_emit_keystone_holds() -> Bool { - witness_browse_page_jsx_exact_bytes() - && witness_fn_name_in_output() - && witness_hostile_href_rejected() - && witness_safe_page_emits_ok() -} diff --git a/dag/test/claim/readback_independence_witness_test.dag b/dag/test/claim/readback_independence_witness_test.dag index 464877bdfa2..1e74c4b17f4 100644 --- a/dag/test/claim/readback_independence_witness_test.dag +++ b/dag/test/claim/readback_independence_witness_test.dag @@ -4,7 +4,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_cited_incident_note: String = "The conjunct is the incident itself, replayed through the criterion. On srv3 2026-07-25 `sccache --show-stats` returned a full stats table — a Converged read — over a host whose modeled unit had been dead for six hours. The criterion must turn that exact input into UnknownRefused, and it must do so because of what the PROBE can do, not because of anything about the value it returned." -fn witness_self_establishing_probe_cannot_report_converged() -> Bool { +test fn witness_self_establishing_probe_cannot_report_converged() -> Bool { observation_verdict_eq( a: readback_evidence_verdict( p: sccache_show_stats_probe, @@ -16,7 +16,7 @@ fn witness_self_establishing_probe_cannot_report_converged() -> Bool { data witness_negatives_survive_note: String = "The asymmetry, and it is the conjunct that stops the criterion from being a blunt discard. A self-establishing probe that reports a NEGATIVE is still telling the truth: it had every opportunity to bring the subject into existence and still could not report it, so Absent stays Absent, Drifted stays Drifted, Inaccessible stays Inaccessible. Only the positive is rewritten. A fold that returned UnknownRefused for every verdict from a non-independent probe would pass the conjunct above and destroy real evidence here." -fn witness_negative_results_from_a_tainted_probe_survive() -> Bool { +test fn witness_negative_results_from_a_tainted_probe_survive() -> Bool { observation_verdict_eq( a: readback_evidence_verdict(p: sccache_show_stats_probe, observed: std.upsert_decision.Absent), b: std.upsert_decision.Absent, @@ -39,7 +39,7 @@ fn witness_negative_results_from_a_tainted_probe_survive() -> Bool { data witness_inert_probe_note: String = "The non-vacuity control in the other direction. `systemctl show` and `systemctl --user is-active` read the manager's recorded state and start nothing, so their Converged results must survive untouched. Without this, a criterion that refused every probe would satisfy every other conjunct in this file while making read-back worthless — the absorbing fallback wearing a safety badge, which is precisely the failure this lane keeps catching." -fn witness_inert_probes_keep_their_evidence() -> Bool { +test fn witness_inert_probes_keep_their_evidence() -> Bool { observation_verdict_eq( a: readback_evidence_verdict( p: systemd_is_active_probe, @@ -59,7 +59,7 @@ fn witness_inert_probes_keep_their_evidence() -> Bool { data witness_unknown_effect_note: String = "An unaudited transport must be treated as tainted, not as clean. This is the fail-closed default and it is where the criterion earns most of its value, because the classified probes are a handful and the unclassified ones are everything else." -fn witness_unclassified_probe_is_treated_as_tainted() -> Bool { +test fn witness_unclassified_probe_is_treated_as_tainted() -> Bool { let unaudited = ReadBackProbe { label: "hypothetical unaudited transport", subject: "some subject", @@ -74,7 +74,7 @@ fn witness_unclassified_probe_is_treated_as_tainted() -> Bool { data witness_red_control_note: String = "The discriminating RED control. The perturbation is trusting the probe's own answer regardless of transport — the corpus's behaviour everywhere the criterion has not been applied — and the gate rejects it on the srv3 inputs while accepting the authority on the same inputs. Both directions are asserted so neither an always-reject nor an always-accept gate could pass." -fn witness_red_control_trusting_probe_rejected_by_gate() -> Bool { +test fn witness_red_control_trusting_probe_rejected_by_gate() -> Bool { let p = sccache_show_stats_probe let widened = readback_evidence_trusting_widen_sketch( p: p, @@ -89,7 +89,7 @@ fn witness_red_control_trusting_probe_rejected_by_gate() -> Bool { data witness_live_consumer_note: String = "The criterion has a live consumer, or it is an inert lens — a thing DESIGN §6 calls a lie in its own right. gunbc.host_swap_backing routes every host verdict through it. The routing is a no-op today because /proc/swaps is inert, so the conjunct proves it by SUBSTITUTION: the same swap verdict carried by the sccache probe instead would be refused. That is what makes the classification load-bearing rather than decorative — swapping the transport for an ensure-shaped one changes the answer." -fn witness_swap_axis_consumes_the_criterion() -> Bool { +test fn witness_swap_axis_consumes_the_criterion() -> Bool { let inert_route = readback_evidence_verdict( p: proc_swaps_read_probe, observed: std.upsert_decision.Converged, @@ -106,17 +106,8 @@ fn witness_swap_axis_consumes_the_criterion() -> Bool { ) } -fn witness_roster_names_the_cited_incident() -> Bool { +test fn witness_roster_names_the_cited_incident() -> Bool { readback_non_independent_probe_count() == 1 && readback_probe_roster.length() == 4 } -test fn readback_independence_witnesses() -> Bool { - witness_self_establishing_probe_cannot_report_converged() - && witness_negative_results_from_a_tainted_probe_survive() - && witness_inert_probes_keep_their_evidence() - && witness_unclassified_probe_is_treated_as_tainted() - && witness_red_control_trusting_probe_rejected_by_gate() - && witness_swap_axis_consumes_the_criterion() - && witness_roster_names_the_cited_incident() -} diff --git a/dag/test/claim/realization_reconcile_witness_test.dag b/dag/test/claim/realization_reconcile_witness_test.dag index 10f508ac130..37d4c1868cd 100644 --- a/dag/test/claim/realization_reconcile_witness_test.dag +++ b/dag/test/claim/realization_reconcile_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.realization_reconcile_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn is_share(m: Materialization) -> Bool { @@ -37,7 +36,7 @@ fn has_no_share(steps: List>) -> Bool { (steps |> filter(e => is_share(m: e.materialization)) |> length) == 0 } -fn witness_same_keysource_collapses_to_share() -> Bool { +test fn witness_same_keysource_collapses_to_share() -> Bool { let out = std.realization.reconcile(steps: [ step_create_if_absent(field: "id"), step_create_if_absent(field: "id") @@ -45,7 +44,7 @@ fn witness_same_keysource_collapses_to_share() -> Bool { (out |> length) == 1 && has_exactly_one_share(steps: out) } -fn witness_different_keysource_does_not_collapse() -> Bool { +test fn witness_different_keysource_does_not_collapse() -> Bool { let out = std.realization.reconcile(steps: [ step_create_if_absent(field: "id"), step_create_if_absent(field: "other") @@ -53,13 +52,8 @@ fn witness_different_keysource_does_not_collapse() -> Bool { (out |> length) == 2 && has_no_share(steps: out) } -fn witness_post_always_never_collapses() -> Bool { +test fn witness_post_always_never_collapses() -> Bool { let out = std.realization.reconcile(steps: [ step_post_always(), step_post_always() ]) (out |> length) == 2 && has_no_share(steps: out) } -test fn reconcile_share_collapse_witnesses() -> Bool { - witness_same_keysource_collapses_to_share() - && witness_different_keysource_does_not_collapse() - && witness_post_always_never_collapses() -} diff --git a/dag/test/claim/realization_scale_agnostic_test.dag b/dag/test/claim/realization_scale_agnostic_test.dag index 51c39429ced..9432fc5ba7b 100644 --- a/dag/test/claim/realization_scale_agnostic_test.dag +++ b/dag/test/claim/realization_scale_agnostic_test.dag @@ -1,37 +1,30 @@ module test.claim.realization_scale_agnostic - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn milli(count: std.nat.Nat) -> Measure { time_measure(count: count) } -fn witness_milli_seq_and_par() -> Bool { +test fn witness_milli_seq_and_par() -> Bool { let a = milli(count: 30) let b = milli(count: 12) (measure_count(m: time_measure_seq(a: a, b: b)) == 42) && (measure_count(m: time_measure_par(a: a, b: b)) == 30) } -fn witness_milli_critical_path() -> Bool { +test fn witness_milli_critical_path() -> Bool { let batches = [[milli(count: 10), milli(count: 40)], [milli(count: 5)]] measure_count(m: schedule_critical_path_time(batch_times: batches)) == 45 } -fn witness_milli_cost_account() -> Bool { +test fn witness_milli_cost_account() -> Bool { let batches = [[milli(count: 7)], [milli(count: 8)]] let account = cost_account_measured_from_schedule_critical_path(batch_times: batches) cost_account_time_count(account: account) == 15 } -fn witness_milli_rollup_discriminates() -> Bool { +test fn witness_milli_rollup_discriminates() -> Bool { witness_measured_rollup_differs_from_predicted_zero(wall_time: milli(count: 99)) } -test fn realization_scale_agnostic_witnesses() -> Bool { - witness_milli_seq_and_par() - && witness_milli_critical_path() - && witness_milli_cost_account() - && witness_milli_rollup_discriminates() -} diff --git a/dag/test/claim/realization_schedule_critical_path_test.dag b/dag/test/claim/realization_schedule_critical_path_test.dag index 700f75c31ac..44cd42f63fa 100644 --- a/dag/test/claim/realization_schedule_critical_path_test.dag +++ b/dag/test/claim/realization_schedule_critical_path_test.dag @@ -1,9 +1,8 @@ module test.claim.realization_schedule_critical_path - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_parallel_batch_takes_max_not_sum() -> Bool { +test fn witness_parallel_batch_takes_max_not_sum() -> Bool { let batch = [ nanosecond_duration(count: 100), nanosecond_duration(count: 5), @@ -15,7 +14,7 @@ fn witness_parallel_batch_takes_max_not_sum() -> Bool { && nanosecond_duration_count(d: critical) != nanosecond_duration_count(d: summed) } -fn witness_sequential_batches_add_critical_paths() -> Bool { +test fn witness_sequential_batches_add_critical_paths() -> Bool { let batches = [ [nanosecond_duration(count: 50)], [ @@ -26,7 +25,7 @@ fn witness_sequential_batches_add_critical_paths() -> Bool { nanosecond_duration_count(d: schedule_critical_path_time(batch_times: batches)) == 150 } -fn witness_measured_total_uses_critical_path_basis() -> Bool { +test fn witness_measured_total_uses_critical_path_basis() -> Bool { let batches = [ [ nanosecond_duration(count: 200), @@ -41,16 +40,10 @@ fn witness_measured_total_uses_critical_path_basis() -> Bool { } } -fn witness_nat_ordering_supports_max() -> Bool { +test fn witness_nat_ordering_supports_max() -> Bool { match std.nat.nat_compare(a: 7, b: 3) { Greater => nat_max(a: 7, b: 3) == 7 _ => false } } -test fn realization_schedule_critical_path_witnesses() -> Bool { - witness_parallel_batch_takes_max_not_sum() - && witness_sequential_batches_add_critical_paths() - && witness_measured_total_uses_critical_path_basis() - && witness_nat_ordering_supports_max() -} diff --git a/dag/test/claim/realization_schedule_witness_test.dag b/dag/test/claim/realization_schedule_witness_test.dag index 570b6ce26da..ff3e1ad6aac 100644 --- a/dag/test/claim/realization_schedule_witness_test.dag +++ b/dag/test/claim/realization_schedule_witness_test.dag @@ -2,7 +2,6 @@ module test.claim.realization_schedule_witness import v2.workflow.ci_floor_plan { cheap_floor_gate_step_labels } - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data synthetic_target: ContentHash = "realization-schedule-witness-v1" @@ -48,7 +47,7 @@ fn perturbed_schedule_wrong_order(correct: List>) -> List Bool { +test fn witness_schedule_lens_green_on_synthetic_plan() -> Bool { match v2.lens.schedule_lens.schedule_lens_verdict_for_ci_floor( plan: synthetic_correct_plan(), compile_gate_fn: compile_gate_fn, @@ -61,7 +60,7 @@ fn witness_schedule_lens_green_on_synthetic_plan() -> Bool { } } -fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool { +test fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool { let perturbed = RealizationPlan { target: synthetic_target objective: RealizationObjective { goals: [] } @@ -80,7 +79,3 @@ fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool { } } -test fn realization_schedule_witnesses() -> Bool { - witness_schedule_lens_green_on_synthetic_plan() - && witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -} diff --git a/dag/test/claim/realization_witness_test.dag b/dag/test/claim/realization_witness_test.dag index 2a209fe6230..48a4364706e 100644 --- a/dag/test/claim/realization_witness_test.dag +++ b/dag/test/claim/realization_witness_test.dag @@ -1,9 +1,8 @@ module test.claim.realization_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn witness_unknown_independence_never_reorders() -> Bool { +test fn witness_unknown_independence_never_reorders() -> Bool { let indep = std.realization.Unknown match indep { Independent => false @@ -12,11 +11,11 @@ fn witness_unknown_independence_never_reorders() -> Bool { } } -fn witness_read_read_independent() -> Bool { +test fn witness_read_read_independent() -> Bool { independence_from_effect_shapes(left: ReadEffect, right: ReadEffect) == Independent } -fn witness_create_unknown_not_independent() -> Bool { +test fn witness_create_unknown_not_independent() -> Bool { match independence_from_effect_shapes( left: CreateEffect { cause: PostAlways }, right: ReadEffect @@ -27,24 +26,17 @@ fn witness_create_unknown_not_independent() -> Bool { } } -fn witness_upsert_same_key_dependent() -> Bool { +test fn witness_upsert_same_key_dependent() -> Bool { independence_from_effect_shapes( left: UpsertEffect { key_source: PathParam { param: "id" } }, right: UpsertEffect { key_source: PathParam { param: "id" } } ) == Dependent } -fn witness_upsert_different_keys_independent() -> Bool { +test fn witness_upsert_different_keys_independent() -> Bool { independence_from_effect_shapes( left: UpsertEffect { key_source: InputField { field: "a" } }, right: UpsertEffect { key_source: InputField { field: "b" } } ) == Independent } -test fn realization_witnesses() -> Bool { - witness_unknown_independence_never_reorders() - && witness_read_read_independent() - && witness_create_unknown_not_independent() - && witness_upsert_same_key_dependent() - && witness_upsert_different_keys_independent() -} diff --git a/dag/test/claim/realize_kernel_test.dag b/dag/test/claim/realize_kernel_test.dag index 427ca7bafaf..6c814105483 100644 --- a/dag/test/claim/realize_kernel_test.dag +++ b/dag/test/claim/realize_kernel_test.dag @@ -1,6 +1,5 @@ module test.claim.realize_kernel - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_store_id: CacheInterfaceId = "realize-kernel-witness-store" @@ -26,7 +25,7 @@ fn mk_receipt(content: ContentHash) -> CachedArtifactReceipt { } } -fn witness_verified_hit_reuses() -> Bool { +test fn witness_verified_hit_reuses() -> Bool { let r = mk_receipt(content: content_v1) match realize_route(lookup: Hit { receipt: r }) { Reuse { receipt: _ } => true @@ -34,28 +33,28 @@ fn witness_verified_hit_reuses() -> Bool { } } -fn witness_miss_recomputes() -> Bool { +test fn witness_miss_recomputes() -> Bool { match realize_route(lookup: Miss) { Recompute { reason: SubjectAbsent } => true _ => false } } -fn witness_refused_hit_never_reused() -> Bool { +test fn witness_refused_hit_never_reused() -> Bool { match realize_route(lookup: RejectedHit { reason: ContentDigestMismatch }) { Recompute { reason: _ } => true Reuse { receipt: _ } => false } } -fn witness_refused_hit_surfaces_reason() -> Bool { +test fn witness_refused_hit_surfaces_reason() -> Bool { match realize_route(lookup: RejectedHit { reason: ContentDigestMismatch }) { Recompute { reason: HitRefused { reason: ContentDigestMismatch } } => true _ => false } } -fn witness_fresh_subject_written() -> Bool { +test fn witness_fresh_subject_written() -> Bool { let fresh = mk_receipt(content: content_v1) match classify_write(existing: Miss, offered_content: content_v1, fresh_receipt: fresh) { Written { receipt: _ } => true @@ -63,7 +62,7 @@ fn witness_fresh_subject_written() -> Bool { } } -fn witness_idempotent_same_content() -> Bool { +test fn witness_idempotent_same_content() -> Bool { let existing = mk_receipt(content: content_v1) let fresh = mk_receipt(content: content_v1) match classify_write(existing: Hit { receipt: existing }, offered_content: content_v1, fresh_receipt: fresh) { @@ -72,7 +71,7 @@ fn witness_idempotent_same_content() -> Bool { } } -fn witness_purity_conflict_rejects_overwrite() -> Bool { +test fn witness_purity_conflict_rejects_overwrite() -> Bool { let existing = mk_receipt(content: content_v1) let fresh = mk_receipt(content: content_v2) match classify_write(existing: Hit { receipt: existing }, offered_content: content_v2, fresh_receipt: fresh) { @@ -81,7 +80,7 @@ fn witness_purity_conflict_rejects_overwrite() -> Bool { } } -fn witness_write_over_rejected_hit_composes_reason() -> Bool { +test fn witness_write_over_rejected_hit_composes_reason() -> Bool { let fresh = mk_receipt(content: content_v1) match classify_write( existing: RejectedHit { reason: ContentDigestMismatch }, @@ -93,13 +92,3 @@ fn witness_write_over_rejected_hit_composes_reason() -> Bool { } } -test fn realize_kernel_witnesses() -> Bool { - witness_verified_hit_reuses() - && witness_miss_recomputes() - && witness_refused_hit_never_reused() - && witness_refused_hit_surfaces_reason() - && witness_fresh_subject_written() - && witness_idempotent_same_content() - && witness_purity_conflict_rejects_overwrite() - && witness_write_over_rejected_hit_composes_reason() -} diff --git a/dag/test/claim/reconcile_in_process_cache_test.dag b/dag/test/claim/reconcile_in_process_cache_test.dag index 14e59371e32..a3dd33f3dc7 100644 --- a/dag/test/claim/reconcile_in_process_cache_test.dag +++ b/dag/test/claim/reconcile_in_process_cache_test.dag @@ -1,11 +1,10 @@ module test.claim.reconcile_in_process_cache - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data shared_subject_digest: ContentHash = "reconcile-in-process-witness-shared-subject-digest" -fn witness_parse_cache_is_in_process_hand_authored() -> Bool { +test fn witness_parse_cache_is_in_process_hand_authored() -> Bool { let row = cache_interface_facts_from_catalog(row: parse_cache_facts) (catalog_key_derivation_classification(kd: parse_cache_facts.key_derivation) == HandAuthoredString) && !row.key_derivation.content_verified_on_read @@ -14,7 +13,7 @@ fn witness_parse_cache_is_in_process_hand_authored() -> Bool { && (row.miss_semantics == MissThenCreate) } -fn witness_typed_module_cache_is_in_process_native_internal() -> Bool { +test fn witness_typed_module_cache_is_in_process_native_internal() -> Bool { let row = cache_interface_facts_from_catalog(row: typed_module_cache_facts) (catalog_key_derivation_classification(kd: typed_module_cache_facts.key_derivation) == NativeInternalHash) && !row.key_derivation.content_verified_on_read @@ -23,14 +22,14 @@ fn witness_typed_module_cache_is_in_process_native_internal() -> Bool { && (row.miss_semantics == MissThenCreate) } -fn witness_disk_sibling_is_content_addressed() -> Bool { +test fn witness_disk_sibling_is_content_addressed() -> Bool { let disk = cache_interface_facts_from_catalog(row: resolved_graph_cache_facts) (catalog_key_derivation_classification(kd: resolved_graph_cache_facts.key_derivation) == ContentAddressedByValue) && disk.key_derivation.content_verified_on_read && (disk.locality == PerHostFilesystem) } -fn witness_in_process_siblings_share_locality_not_key_class() -> Bool { +test fn witness_in_process_siblings_share_locality_not_key_class() -> Bool { let parse = cache_interface_facts_from_catalog(row: parse_cache_facts) let typed = cache_interface_facts_from_catalog(row: typed_module_cache_facts) let disk = cache_interface_facts_from_catalog(row: resolved_graph_cache_facts) @@ -42,7 +41,7 @@ fn witness_in_process_siblings_share_locality_not_key_class() -> Bool { && (catalog_key_derivation_classification(kd: resolved_graph_cache_facts.key_derivation) == ContentAddressedByValue) } -fn witness_parse_source_routes_to_parse_cache_backend() -> Bool { +test fn witness_parse_source_routes_to_parse_cache_backend() -> Bool { let id = ArtifactIdentity { subject_digest: shared_subject_digest, artifact_kind: parse_source_artifact_kind, @@ -51,7 +50,7 @@ fn witness_parse_source_routes_to_parse_cache_backend() -> Bool { key.store == parse_cache_id } -fn witness_typed_module_routes_to_typed_module_cache_backend() -> Bool { +test fn witness_typed_module_routes_to_typed_module_cache_backend() -> Bool { let id = ArtifactIdentity { subject_digest: shared_subject_digest, artifact_kind: typed_module_artifact_kind, @@ -60,7 +59,7 @@ fn witness_typed_module_routes_to_typed_module_cache_backend() -> Bool { key.store == typed_module_cache_id } -fn witness_resolved_graph_routes_to_disk_backend() -> Bool { +test fn witness_resolved_graph_routes_to_disk_backend() -> Bool { let id = ArtifactIdentity { subject_digest: shared_subject_digest, artifact_kind: resolved_graph_artifact_kind, @@ -69,19 +68,9 @@ fn witness_resolved_graph_routes_to_disk_backend() -> Bool { key.store == resolved_graph_cache_id } -fn witness_reconcile_family_backends_are_distinct() -> Bool { +test fn witness_reconcile_family_backends_are_distinct() -> Bool { !(parse_cache_id == typed_module_cache_id) && !(parse_cache_id == resolved_graph_cache_id) && !(typed_module_cache_id == resolved_graph_cache_id) } -test fn reconcile_in_process_cache_witnesses() -> Bool { - witness_parse_cache_is_in_process_hand_authored() - && witness_typed_module_cache_is_in_process_native_internal() - && witness_disk_sibling_is_content_addressed() - && witness_in_process_siblings_share_locality_not_key_class() - && witness_parse_source_routes_to_parse_cache_backend() - && witness_typed_module_routes_to_typed_module_cache_backend() - && witness_resolved_graph_routes_to_disk_backend() - && witness_reconcile_family_backends_are_distinct() -} diff --git a/dag/test/claim/regional_compute_witness_test.dag b/dag/test/claim/regional_compute_witness_test.dag index 51fd7222299..4a5cc124ebf 100644 --- a/dag/test/claim/regional_compute_witness_test.dag +++ b/dag/test/claim/regional_compute_witness_test.dag @@ -67,7 +67,7 @@ fn w_premium_equals(baseline: RegionalComputeRow, region: RegionalComputeRow, ex } } -fn w_no_aws_region_is_cheaper_than_us_east() -> Bool { +test fn w_no_aws_region_is_cheaper_than_us_east() -> Bool { w_premium_at_least(baseline: aws_us_east_1, region: aws_ap_south_1, floor_bp: 1) && w_premium_at_least(baseline: aws_us_east_1, region: aws_eu_central_1, floor_bp: 1) && w_premium_at_least(baseline: aws_us_east_1, region: aws_me_central_1, floor_bp: 1) @@ -79,7 +79,7 @@ fn w_no_aws_region_is_cheaper_than_us_east() -> Bool { && w_premium_at_least(baseline: aws_us_east_1, region: aws_sa_east_1, floor_bp: 1) } -fn w_no_azure_region_is_cheaper_than_east_us() -> Bool { +test fn w_no_azure_region_is_cheaper_than_east_us() -> Bool { w_premium_at_least(baseline: azure_eastus, region: azure_centralindia, floor_bp: 1) && w_premium_at_least(baseline: azure_eastus, region: azure_southindia, floor_bp: 1) && w_premium_at_least(baseline: azure_eastus, region: azure_uaenorth, floor_bp: 1) @@ -87,7 +87,7 @@ fn w_no_azure_region_is_cheaper_than_east_us() -> Bool { && w_premium_at_least(baseline: azure_eastus, region: azure_brazilsouth, floor_bp: 1) } -fn w_brazil_premium_agrees_across_two_independent_providers() -> Bool { +test fn w_brazil_premium_agrees_across_two_independent_providers() -> Bool { match premium_bp_of(baseline: aws_us_east_1, region: aws_sa_east_1) { Present { value: aws_bp } => match premium_bp_of(baseline: azure_eastus, region: azure_brazilsouth) { @@ -99,7 +99,7 @@ fn w_brazil_premium_agrees_across_two_independent_providers() -> Bool { } } -fn w_india_is_the_smallest_premium_and_south_america_the_largest() -> Bool { +test fn w_india_is_the_smallest_premium_and_south_america_the_largest() -> Bool { match premium_bp_of(baseline: aws_us_east_1, region: aws_ap_south_1) { Present { value: mumbai } => match premium_bp_of(baseline: aws_us_east_1, region: aws_sa_east_1) { @@ -115,7 +115,7 @@ fn w_india_is_the_smallest_premium_and_south_america_the_largest() -> Bool { } } -fn w_geography_axis_is_populated_across_all_requested_regions() -> Bool { +test fn w_geography_axis_is_populated_across_all_requested_regions() -> Bool { geography_eq(a: aws_ap_south_1.geography, b: SouthAsia) && geography_eq(a: aws_af_south_1.geography, b: Africa) && geography_eq(a: aws_sa_east_1.geography, b: SouthAmerica) @@ -124,7 +124,7 @@ fn w_geography_axis_is_populated_across_all_requested_regions() -> Bool { && geography_eq(a: azure_brazilsouth.geography, b: SouthAmerica) } -fn w_per_vcpu_month_is_derived_within_one_currency() -> Bool { +test fn w_per_vcpu_month_is_derived_within_one_currency() -> Bool { match per_vcpu_month_micros(row: aws_us_east_1) { Present { value: virginia } => match per_vcpu_month_micros(row: aws_sa_east_1) { @@ -136,14 +136,14 @@ fn w_per_vcpu_month_is_derived_within_one_currency() -> Bool { } } -fn w_red_cross_provider_premium_refuses() -> Bool { +test fn w_red_cross_provider_premium_refuses() -> Bool { match derive_regional_premium(baseline: aws_us_east_1, region: azure_brazilsouth) { RegionalPremiumRefused { cause: ProviderMismatch } => true _ => false } } -fn w_red_unreadable_local_provider_rates_refuse() -> Bool { +test fn w_red_unreadable_local_provider_rates_refuse() -> Bool { match hourly_micros(row: e2e_networks_india) { Present { value: _ } => false _ => @@ -166,7 +166,7 @@ fn w_red_unreadable_local_provider_rates_refuse() -> Bool { } } -fn w_red_unrepresentable_currency_refuses_distinctly() -> Bool { +test fn w_red_unrepresentable_currency_refuses_distinctly() -> Bool { match hourly_micros(row: sakura_japan_vps) { Present { value: _ } => false _ => @@ -177,7 +177,7 @@ fn w_red_unrepresentable_currency_refuses_distinctly() -> Bool { } } -fn w_red_premium_against_an_unpriced_region_refuses() -> Bool { +test fn w_red_premium_against_an_unpriced_region_refuses() -> Bool { match derive_regional_premium(baseline: aws_us_east_1, region: aws_us_east_1) { RegionalPremiumDerived { premium_bp: bp } => (basis_point_count(bp: bp) == 0) @@ -189,15 +189,3 @@ fn w_red_premium_against_an_unpriced_region_refuses() -> Bool { } } -test fn regional_compute_witness() -> Bool { - w_no_aws_region_is_cheaper_than_us_east() - && w_no_azure_region_is_cheaper_than_east_us() - && w_brazil_premium_agrees_across_two_independent_providers() - && w_india_is_the_smallest_premium_and_south_america_the_largest() - && w_geography_axis_is_populated_across_all_requested_regions() - && w_per_vcpu_month_is_derived_within_one_currency() - && w_red_cross_provider_premium_refuses() - && w_red_unreadable_local_provider_rates_refuse() - && w_red_unrepresentable_currency_refuses_distinctly() - && w_red_premium_against_an_unpriced_region_refuses() -} diff --git a/dag/test/claim/render_glyphs_ansi_witness_test.dag b/dag/test/claim/render_glyphs_ansi_witness_test.dag index efbdb87c2d2..8d4a029b4d1 100644 --- a/dag/test/claim/render_glyphs_ansi_witness_test.dag +++ b/dag/test/claim/render_glyphs_ansi_witness_test.dag @@ -1,16 +1,15 @@ module test.claim.render_glyphs_ansi_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -fn w_completed_ascii() -> Bool { +test fn w_completed_ascii() -> Bool { match resolve_symbol(id: NodeCompleted, tier: Ascii) { Present { value: s } => s == "[x]" Absent => false } } -fn w_completed_unicode_differs_from_ascii() -> Bool { +test fn w_completed_unicode_differs_from_ascii() -> Bool { match resolve_symbol(id: NodeCompleted, tier: Unicode) { Present { value: u } => match resolve_symbol(id: NodeCompleted, tier: Ascii) { @@ -21,7 +20,7 @@ fn w_completed_unicode_differs_from_ascii() -> Bool { } } -fn w_glyph_at_selects_matching_tier_text() -> Bool { +test fn w_glyph_at_selects_matching_tier_text() -> Bool { let g = glyphs_for_tiers( emoji: glyph(text: "E"), unicode: glyph(text: "U"), @@ -32,7 +31,7 @@ fn w_glyph_at_selects_matching_tier_text() -> Bool { glyph_at(glyphs: g, tier: Emoji) == "E" } -fn w_failed_color_is_error() -> Bool { +test fn w_failed_color_is_error() -> Bool { match symbol_color(id: NodeFailed) { Present { value: c } => match c { @@ -43,7 +42,7 @@ fn w_failed_color_is_error() -> Bool { } } -fn w_success_ansi_is_256_green() -> Bool { +test fn w_success_ansi_is_256_green() -> Bool { match ansi_code(c: Success) { Present { value: code } => code == "\x1b[38;5;34m" Absent => false @@ -52,26 +51,17 @@ fn w_success_ansi_is_256_green() -> Bool { data ansi_escape_is_a_real_byte_note: String = "w_success_ansi_is_256_green above compares one \\x1b literal against another, so it agreed with itself for as long as the tokenizer left BOTH undecoded — it passed throughout the period when every colour this repo authored rendered as the literal text backslash-x-1-b (seen in CI run 30167957464's TOP SLOWEST WITNESSES table). Equality against a same-source literal can never discriminate a decode defect. The two witnesses below do: they read the CODE POINT of the first character (27 = ESC, never 92 = backslash) and pin the decoded length, both of which are properties of the decode rather than of the spelling." -fn w_ansi_first_char_is_escape_byte() -> Bool { +test fn w_ansi_first_char_is_escape_byte() -> Bool { match ansi_code(c: Success) { Present { value: code } => code_point(char_at(s: code, pos: 0)) == 27 Absent => false } } -fn w_ansi_code_has_no_literal_backslash() -> Bool { +test fn w_ansi_code_has_no_literal_backslash() -> Bool { match ansi_code(c: Success) { Present { value: code } => !string_contains(s: code, pattern: "\\") Absent => false } } -test fn render_glyphs_ansi_witnesses() -> Bool { - w_completed_ascii() && - w_completed_unicode_differs_from_ascii() && - w_glyph_at_selects_matching_tier_text() && - w_failed_color_is_error() && - w_success_ansi_is_256_green() && - w_ansi_first_char_is_escape_byte() && - w_ansi_code_has_no_literal_backslash() -} diff --git a/dag/test/claim/render_surface_witness_test.dag b/dag/test/claim/render_surface_witness_test.dag index 88e0d22fc23..ea696d86668 100644 --- a/dag/test/claim/render_surface_witness_test.dag +++ b/dag/test/claim/render_surface_witness_test.dag @@ -1,6 +1,5 @@ module test.claim.render_surface_witness - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data plain_cap: RenderCapability = RenderCapability { @@ -25,21 +24,21 @@ data sample_doc: Document = Document { ] } -fn w_detect_github() -> Bool { +test fn w_detect_github() -> Bool { match detect_target(env: SurfaceEnv { github_actions: true }) { GithubActions => true PlainTerminal => false } } -fn w_detect_plain() -> Bool { +test fn w_detect_plain() -> Bool { match detect_target(env: SurfaceEnv { github_actions: false }) { PlainTerminal => true GithubActions => false } } -fn w_github_wraps_group_in_workflow_commands() -> Bool { +test fn w_github_wraps_group_in_workflow_commands() -> Bool { let out = serialize_document(doc: sample_doc, target: GithubActions, cap: plain_cap) string_contains(s: out, pattern: "::group::host effects") && string_contains(s: out, pattern: "[file] read foo.dag") && @@ -47,7 +46,7 @@ fn w_github_wraps_group_in_workflow_commands() -> Bool { string_contains(s: out, pattern: "PASS some_witness") } -fn w_plain_terminal_uses_header_not_commands() -> Bool { +test fn w_plain_terminal_uses_header_not_commands() -> Bool { let out = serialize_document(doc: sample_doc, target: PlainTerminal, cap: plain_cap) string_contains(s: out, pattern: "── host effects ──") && string_contains(s: out, pattern: "[file] read foo.dag") && @@ -55,7 +54,7 @@ fn w_plain_terminal_uses_header_not_commands() -> Bool { !string_contains(s: out, pattern: "::endgroup::") } -fn w_close_line_is_explicit_only_on_github() -> Bool { +test fn w_close_line_is_explicit_only_on_github() -> Bool { let gha = group_syntax(target: GithubActions) let term = group_syntax(target: PlainTerminal) match gha.close_line { @@ -68,18 +67,10 @@ fn w_close_line_is_explicit_only_on_github() -> Bool { } } -fn w_resolve_group_syntax_keys_off_github_flag() -> Bool { +test fn w_resolve_group_syntax_keys_off_github_flag() -> Bool { let gha = resolve_group_syntax(github_actions: true) let term = resolve_group_syntax(github_actions: false) gha.open_prefix == "::group::" && term.open_prefix == "── " } -test fn render_surface_witnesses() -> Bool { - w_detect_github() && - w_detect_plain() && - w_github_wraps_group_in_workflow_commands() && - w_plain_terminal_uses_header_not_commands() && - w_close_line_is_explicit_only_on_github() && - w_resolve_group_syntax_keys_off_github_flag() -} diff --git a/dag/test/claim/retained_shell_script_witness_test.dag b/dag/test/claim/retained_shell_script_witness_test.dag index cbf014f138d..3b5407e9283 100644 --- a/dag/test/claim/retained_shell_script_witness_test.dag +++ b/dag/test/claim/retained_shell_script_witness_test.dag @@ -14,7 +14,7 @@ data srvn_takeover_ref: DeclarationRef = DeclarationRef { field: WholeDeclaration, } -fn witness_retained_transport_mints_from_record() -> Bool { +test fn witness_retained_transport_mints_from_record() -> Bool { let t = retained_transport( body: "echo hi", reason: "witness: cross-module as TransportScript mint", @@ -23,7 +23,7 @@ fn witness_retained_transport_mints_from_record() -> Bool { (t as String) == "echo hi" } -fn witness_converter_preserves_body() -> Bool { +test fn witness_converter_preserves_body() -> Bool { let rss = RetainedShellScript { body: "systemctl daemon-reload", reason: "witness: record -> transport", @@ -32,7 +32,3 @@ fn witness_converter_preserves_body() -> Bool { (retained_shell_script_to_transport(rss: rss) as String) == "systemctl daemon-reload" } -test fn retained_shell_script_holds() -> Bool { - witness_retained_transport_mints_from_record() - && witness_converter_preserves_body() -} diff --git a/dag/test/claim/roadmap_authority_test.dag b/dag/test/claim/roadmap_authority_test.dag index ca10af5b9b8..41d2a9c69e9 100644 --- a/dag/test/claim/roadmap_authority_test.dag +++ b/dag/test/claim/roadmap_authority_test.dag @@ -1,6 +1,5 @@ module test.claim.roadmap_authority - data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn merged() -> List { authored_merged_prs() } @@ -10,7 +9,7 @@ fn emit_with(m: List) -> String { } fn out() -> String { emit_with(m: merged()) } -fn witness_frame_all_sections() -> Bool { +test fn witness_frame_all_sections() -> Bool { let o = out() string_contains(s: o, pattern: "# gunbc — Roadmap") && string_contains(s: o, pattern: "## 1. Get off v1 — v2 self-hosts (TERMINAL: `src/v1` deleted)") @@ -19,13 +18,13 @@ fn witness_frame_all_sections() -> Bool { && string_contains(s: o, pattern: "## 4. Shelved (parked 2026-07-01 — not deleted)") } -fn witness_reset_marker() -> Bool { +test fn witness_reset_marker() -> Bool { let o = out() string_contains(s: o, pattern: "**Reset 2026-07-01 (operator-directed).**") && string_contains(s: o, pattern: "The prior roadmap with full detail is in git history.") } -fn witness_subgroup_labels() -> Bool { +test fn witness_subgroup_labels() -> Bool { let o = out() string_contains(s: o, pattern: "**Now — correctness of the current posture:**") && string_contains(s: o, pattern: "**Floor throughput — reduce work, then schedule it (26m → <1min on a typical PR):**") @@ -34,7 +33,7 @@ fn witness_subgroup_labels() -> Bool { && string_contains(s: o, pattern: "**Fleet hardening — make our metal safe for the load it carries:**") } -fn witness_fabric_design_rule() -> Bool { +test fn witness_fabric_design_rule() -> Bool { let o = out() string_contains(s: o, pattern: "provider-specific power is earned behind a `ProviderOffer` adapter") && string_contains(s: o, pattern: "oversubscription is an optimization proven by receipts, never assumed by placement") @@ -44,14 +43,14 @@ fn witness_fabric_design_rule() -> Bool { && string_contains(s: o, pattern: "**Ordering (operator-signed):**") } -fn witness_emit_refs_from_binding() -> Bool { +test fn witness_emit_refs_from_binding() -> Bool { let o = out() string_contains(s: o, pattern: "**provenance ingest live at floor runtime** (#6105)") && string_contains(s: o, pattern: "**orchestration emission → agnostic registry dispatch** (#6106)") && string_contains(s: o, pattern: "**no-dual-representation-test lens rebuilt pure-v2** (#6104)") } -fn witness_pillar1_no_overclaim() -> Bool { +test fn witness_pillar1_no_overclaim() -> Bool { let o = out() string_contains(s: o, pattern: "interim fixpoint gate, 2-of-92 roster ✓ (#6009)") && string_contains(s: o, pattern: "**TERMINAL: `src/v1` deleted**") @@ -59,7 +58,7 @@ fn witness_pillar1_no_overclaim() -> Bool { && !string_contains(s: o, pattern: "- [x] **real fixed point**") } -fn witness_pillar2_posture() -> Bool { +test fn witness_pillar2_posture() -> Bool { let o = out() string_contains(s: o, pattern: "required CI is back on the fleet") && string_contains(s: o, pattern: "#6107, reverted #6111") @@ -67,12 +66,12 @@ fn witness_pillar2_posture() -> Bool { && string_contains(s: o, pattern: "the re-land is an architecture change, not a rebase") } -fn witness_a_prose_verbatim() -> Bool { +test fn witness_a_prose_verbatim() -> Bool { string_contains(s: out(), pattern: "**◆ Milestones:** front-end ✓ · emit-rust well-typed ✓ · cross-tree import ✓ (#5473)") } -fn witness_b_ordered_interleaving() -> Bool { +test fn witness_b_ordered_interleaving() -> Bool { let o = out() string_contains(s: o, pattern: "[seed census](docs/plans/seed-shrink-census.md)\n\nGround truth (2026-07-05):") && string_contains(s: o, pattern: "so the walls are CI-proven now.\n\n**◆ Milestones:** front-end ✓") @@ -80,11 +79,11 @@ fn witness_b_ordered_interleaving() -> Bool { && string_contains(s: o, pattern: "Phase 2, earned by receipts.\n\n**◆ Milestones:** OOM root-caused") } -fn witness_b_order_discriminator() -> Bool { +test fn witness_b_order_discriminator() -> Bool { !string_contains(s: out(), pattern: "**◆ Milestones:** front-end ✓ · emit-rust well-typed ✓ · cross-tree import ✓ (#5473)\n\nGround truth (2026-07-05):") } -fn witness_merge_perturb_does_not_flip_boxes() -> Bool { +test fn witness_merge_perturb_does_not_flip_boxes() -> Bool { let full = out() let flipped = emit_with(m: [6104, 6105, 6106]) let pat = "- [ ] **provenance ingest live at floor runtime** (#6105)" @@ -94,13 +93,13 @@ fn witness_merge_perturb_does_not_flip_boxes() -> Bool { && !string_contains(s: flipped, pattern: "- [x] **provenance ingest live at floor runtime** (#6105)") } -fn witness_shelf_is_uncheckboxed() -> Bool { +test fn witness_shelf_is_uncheckboxed() -> Bool { let o = out() string_contains(s: o, pattern: "- **fold-ergonomics lane** —") && !string_contains(s: o, pattern: "- [ ] **fold-ergonomics lane** —") } -fn witness_audit_lane_present() -> Bool { +test fn witness_audit_lane_present() -> Bool { let o = out() string_contains(s: o, pattern: "**Audit — green by execution, red by perturbation:**") && string_contains(s: o, pattern: "**affected-set lens — discharged by a standing mechanism**") @@ -109,18 +108,3 @@ fn witness_audit_lane_present() -> Bool { && string_contains(s: o, pattern: "**one tree, one verdict**") } -test fn roadmap_authority_witnesses() -> Bool { - witness_frame_all_sections() - && witness_reset_marker() - && witness_subgroup_labels() - && witness_fabric_design_rule() - && witness_emit_refs_from_binding() - && witness_pillar1_no_overclaim() - && witness_pillar2_posture() - && witness_a_prose_verbatim() - && witness_b_ordered_interleaving() - && witness_b_order_discriminator() - && witness_merge_perturb_does_not_flip_boxes() - && witness_shelf_is_uncheckboxed() - && witness_audit_lane_present() -} diff --git a/dag/test/claim/roadmap_belt_actuate_witness_test.dag b/dag/test/claim/roadmap_belt_actuate_witness_test.dag index f57757eaecb..bf4df4a743e 100644 --- a/dag/test/claim/roadmap_belt_actuate_witness_test.dag +++ b/dag/test/claim/roadmap_belt_actuate_witness_test.dag @@ -113,12 +113,12 @@ fn is_teardown_failed(o: BeltTeardownOutcome) -> Bool { } } -fn witness_exec_ok_runs_echo() -> Bool { +test fn witness_exec_ok_runs_echo() -> Bool { let o = belt_exec(cmd: host_exec_argv(program: "echo", args: ["belt-ok"]), workdir: "/") is_exec_ok(o: o) && exec_ok_stdout_contains(o: o, pattern: "belt-ok") } -fn witness_exec_refuses_missing_program() -> Bool { +test fn witness_exec_refuses_missing_program() -> Bool { let o = belt_exec( cmd: host_exec_argv(program: "belt-nonexistent-program-xyz", args: []), workdir: "/", @@ -126,12 +126,12 @@ fn witness_exec_refuses_missing_program() -> Bool { is_exec_refused(o: o) } -fn witness_exec_fails_on_nonzero_exit() -> Bool { +test fn witness_exec_fails_on_nonzero_exit() -> Bool { let o = belt_exec(cmd: host_exec_argv(program: "false", args: []), workdir: "/") is_exec_failed(o: o) } -fn witness_exec_all_runs_every_step_when_ok() -> Bool { +test fn witness_exec_all_runs_every_step_when_ok() -> Bool { let o = belt_exec_all( cmds: [ host_exec_argv(program: "echo", args: ["first"]), @@ -142,7 +142,7 @@ fn witness_exec_all_runs_every_step_when_ok() -> Bool { is_exec_ok(o: o) && exec_ok_stdout_contains(o: o, pattern: "second") } -fn witness_exec_all_short_circuits_after_failure() -> Bool { +test fn witness_exec_all_short_circuits_after_failure() -> Bool { let o = belt_exec_all( cmds: [ host_exec_argv(program: "false", args: []), @@ -153,7 +153,7 @@ fn witness_exec_all_short_circuits_after_failure() -> Bool { is_exec_failed(o: o) && !exec_ok_stdout_contains(o: o, pattern: "should-not-run") } -fn witness_exec_all_fails_on_later_step() -> Bool { +test fn witness_exec_all_fails_on_later_step() -> Bool { let o = belt_exec_all( cmds: [ host_exec_argv(program: "echo", args: ["ok"]), @@ -164,12 +164,12 @@ fn witness_exec_all_fails_on_later_step() -> Bool { is_exec_failed(o: o) } -fn witness_spawn_member_refuses_observed_shape() -> Bool { +test fn witness_spawn_member_refuses_observed_shape() -> Bool { let m = ObservedMember { node_id: "z", session: live_session(node_id: "z", verdict: Converged) } is_spawn_failed(o: belt_actuate_spawn_member(m: m, workdir: "/")) } -fn witness_teardown_member_refuses_desired_shape() -> Bool { +test fn witness_teardown_member_refuses_desired_shape() -> Bool { let m = DesiredMember { node_id: "a", node: ready_node(id: "a") } is_teardown_failed(o: belt_actuate_teardown_member(m: m)) } @@ -188,7 +188,7 @@ fn is_observe_refused(o: BeltObserve) -> Bool { } } -fn witness_observe_parses_live_on_success() -> Bool { +test fn witness_observe_parses_live_on_success() -> Bool { observe_live_count(o: belt_observe_from_result( success: true, stdout: "gunbc-dispatch-a: 1 windows", @@ -196,7 +196,7 @@ fn witness_observe_parses_live_on_success() -> Bool { )) == 1 } -fn witness_observe_empty_on_no_server() -> Bool { +test fn witness_observe_empty_on_no_server() -> Bool { observe_live_count(o: belt_observe_from_result( success: false, stdout: "", @@ -204,7 +204,7 @@ fn witness_observe_empty_on_no_server() -> Bool { )) == 0 } -fn witness_observe_empty_on_no_sessions() -> Bool { +test fn witness_observe_empty_on_no_sessions() -> Bool { observe_live_count(o: belt_observe_from_result( success: false, stdout: "", @@ -212,7 +212,7 @@ fn witness_observe_empty_on_no_sessions() -> Bool { )) == 0 } -fn witness_observe_refuses_permission_error() -> Bool { +test fn witness_observe_refuses_permission_error() -> Bool { is_observe_refused(o: belt_observe_from_result( success: false, stdout: "", @@ -220,7 +220,7 @@ fn witness_observe_refuses_permission_error() -> Bool { )) } -fn witness_observe_refuses_empty_stderr_failure() -> Bool { +test fn witness_observe_refuses_empty_stderr_failure() -> Bool { is_observe_refused(o: belt_observe_from_result( success: false, stdout: "", @@ -232,19 +232,19 @@ fn uuid_char(u: String, i: Int) -> String { substring(s: u, start: i, end: i + 1) } -fn witness_uuid_deterministic() -> Bool { +test fn witness_uuid_deterministic() -> Bool { let a = belt_spawn_session_uuid(node_id: "5-regen-cutover") let b = belt_spawn_session_uuid(node_id: "5-regen-cutover") a == b } -fn witness_uuid_distinct_nodes() -> Bool { +test fn witness_uuid_distinct_nodes() -> Bool { let a = belt_spawn_session_uuid(node_id: "node-a") let b = belt_spawn_session_uuid(node_id: "node-b") !(a == b) } -fn witness_uuid_rfc4122_shape() -> Bool { +test fn witness_uuid_rfc4122_shape() -> Bool { let u = belt_spawn_session_uuid(node_id: "5-regen-cutover") string_length(s: u) == 36 && uuid_char(u: u, i: 8) == "-" @@ -262,11 +262,11 @@ fn is_node_found(l: BeltNodeLookup) -> Bool { } } -fn witness_find_node_hits() -> Bool { +test fn witness_find_node_hits() -> Bool { is_node_found(l: belt_find_node_in(nodes: [ready_node(id: "a"), ready_node(id: "b")], node_id: "b")) } -fn witness_find_node_misses() -> Bool { +test fn witness_find_node_misses() -> Bool { !is_node_found(l: belt_find_node_in(nodes: [ready_node(id: "a"), ready_node(id: "b")], node_id: "z")) } @@ -288,27 +288,27 @@ fn found_owner(l: BeltNodeLookup) -> String { } } -fn witness_find_node_first_wins_on_duplicate() -> Bool { +test fn witness_find_node_first_wins_on_duplicate() -> Bool { found_owner(l: belt_find_node_in( nodes: [owned_node(id: "dup", owner: "first"), owned_node(id: "dup", owner: "second")], node_id: "dup", )) == "first" } -fn witness_node_session_live_true() -> Bool { +test fn witness_node_session_live_true() -> Bool { belt_node_session_live(live: [live_session(node_id: "a", verdict: Converged)], node_id: "a") } -fn witness_node_session_live_false() -> Bool { +test fn witness_node_session_live_false() -> Bool { !belt_node_session_live(live: [live_session(node_id: "a", verdict: Converged)], node_id: "b") } -fn witness_dispatch_result_ok_spawned_and_live() -> Bool { +test fn witness_dispatch_result_ok_spawned_and_live() -> Bool { belt_dispatch_result_ok(r: DispatchSpawned { node_id: "a", session_name: "gunbc-dispatch-a" }) && belt_dispatch_result_ok(r: DispatchAlreadyLive { node_id: "a", session_name: "gunbc-dispatch-a" }) } -fn witness_dispatch_result_refusals_not_ok() -> Bool { +test fn witness_dispatch_result_refusals_not_ok() -> Bool { !belt_dispatch_result_ok(r: DispatchNodeNotFound { node_id: "a" }) && !belt_dispatch_result_ok(r: DispatchNodeAlreadyDone { node_id: "a" }) && !belt_dispatch_result_ok(r: DispatchObserveRefused { node_id: "a", reason: "x" }) @@ -321,7 +321,7 @@ fn status_label_glued_to_ok(r: BeltDispatchResult) -> Bool { ok == label_in_ok_set } -fn witness_dispatch_status_labels_glued_to_ok_set() -> Bool { +test fn witness_dispatch_status_labels_glued_to_ok_set() -> Bool { status_label_glued_to_ok(r: DispatchSpawned { node_id: "a", session_name: "s" }) && status_label_glued_to_ok(r: DispatchAlreadyLive { node_id: "a", session_name: "s" }) && status_label_glued_to_ok(r: DispatchNodeNotFound { node_id: "a" }) @@ -330,7 +330,7 @@ fn witness_dispatch_status_labels_glued_to_ok_set() -> Bool { && status_label_glued_to_ok(r: DispatchSpawnFailed { node_id: "a", step: "git", detail: "x" }) } -fn witness_dispatch_status_labels_pin_wire_contract() -> Bool { +test fn witness_dispatch_status_labels_pin_wire_contract() -> Bool { belt_dispatch_status_label(r: DispatchSpawned { node_id: "a", session_name: "s" }) == "spawned" && belt_dispatch_status_label(r: DispatchAlreadyLive { node_id: "a", session_name: "s" }) == "already_live" && belt_dispatch_status_label(r: DispatchNodeNotFound { node_id: "a" }) == "node_not_found" @@ -347,7 +347,7 @@ fn band_key_for_label(label: String) -> String { } } -fn witness_band_fold_pins_operator_vocabulary() -> Bool { +test fn witness_band_fold_pins_operator_vocabulary() -> Bool { belt_dispatch_label_band_rows().length() == 6 && band_key_for_label(label: "spawned") == "ok" && band_key_for_label(label: "already_live") == "ok" @@ -357,15 +357,15 @@ fn witness_band_fold_pins_operator_vocabulary() -> Bool { && band_key_for_label(label: "spawn_failed") == "loud" } -fn witness_no_result_maps_to_in_progress() -> Bool { +test fn witness_no_result_maps_to_in_progress() -> Bool { all(belt_dispatch_label_band_rows(), row => row.band_key != "in-progress") } -fn witness_ok_labels_derive_from_band_fold() -> Bool { +test fn witness_ok_labels_derive_from_band_fold() -> Bool { belt_dispatch_ok_status_labels() == ["spawned", "already_live"] } -fn witness_label_band_cover_reds_on_missing_row() -> Bool { +test fn witness_label_band_cover_reds_on_missing_row() -> Bool { let rows = belt_dispatch_label_band_rows() let labels = belt_dispatch_all_status_labels() let truncated = filter(rows, row => row.wire_label != "spawned") @@ -383,7 +383,7 @@ fn d4_exemplars_reconcile(exemplars: List) -> Bool { map(exemplars, r => belt_dispatch_status_label(r: r)) == d4_wire_contract_labels() } -fn witness_exemplar_roster_reconciles_variant_set() -> Bool { +test fn witness_exemplar_roster_reconciles_variant_set() -> Bool { d4_exemplars_reconcile(exemplars: belt_dispatch_result_exemplars()) && belt_dispatch_all_status_labels() == d4_wire_contract_labels() } @@ -398,7 +398,7 @@ fn d4_exemplars_missing_one() -> List { ] } -fn witness_exemplar_roster_missing_variant_reds() -> Bool { +test fn witness_exemplar_roster_missing_variant_reds() -> Bool { !d4_exemplars_reconcile(exemplars: d4_exemplars_missing_one()) } @@ -431,7 +431,7 @@ fn preflight_with_config(config: String) -> BeltClaudePreflight { ) } -fn witness_preflight_refuses_missing_claude() -> Bool { +test fn witness_preflight_refuses_missing_claude() -> Bool { preflight_refused_step(p: belt_claude_preflight_decision( claude_on_path: false, home: "/home/u", @@ -442,7 +442,7 @@ fn witness_preflight_refuses_missing_claude() -> Bool { )) == "claude-cli" } -fn witness_preflight_refuses_unknown_home() -> Bool { +test fn witness_preflight_refuses_unknown_home() -> Bool { preflight_refused_step(p: belt_claude_preflight_decision( claude_on_path: true, home: "", @@ -453,7 +453,7 @@ fn witness_preflight_refuses_unknown_home() -> Bool { )) == "claude-trust-home" } -fn witness_preflight_refuses_unreadable_store() -> Bool { +test fn witness_preflight_refuses_unreadable_store() -> Bool { preflight_refused_step(p: belt_claude_preflight_decision( claude_on_path: true, home: "/home/u", @@ -464,7 +464,7 @@ fn witness_preflight_refuses_unreadable_store() -> Bool { )) == "claude-trust-store" } -fn witness_preflight_refuses_unseeded_root() -> Bool { +test fn witness_preflight_refuses_unseeded_root() -> Bool { preflight_refused_step(p: preflight_with_config( config: "\{\"projects\":\{\"/opt/other\":\{\"hasTrustDialogAccepted\":true\}\}\}", )) == "claude-trust-seed" @@ -473,52 +473,13 @@ fn witness_preflight_refuses_unseeded_root() -> Bool { )) == "claude-trust-seed" } -fn witness_preflight_ok_when_seeded() -> Bool { +test fn witness_preflight_ok_when_seeded() -> Bool { preflight_ok(p: preflight_with_config(config: seeded_trust_config())) } -fn witness_preflight_ok_on_enriched_entry() -> Bool { +test fn witness_preflight_ok_on_enriched_entry() -> Bool { preflight_ok(p: preflight_with_config( config: "\{\"projects\":\{\"/opt/x/worktrees\":\{\"mcpServers\":\{\},\"allowedTools\":[\"a\}b\"],\"hasTrustDialogAccepted\":true\}\}\}", )) } -test fn roadmap_belt_actuate_witnesses() -> Bool { - witness_exec_ok_runs_echo() - && witness_exec_refuses_missing_program() - && witness_exec_fails_on_nonzero_exit() - && witness_exec_all_runs_every_step_when_ok() - && witness_exec_all_short_circuits_after_failure() - && witness_exec_all_fails_on_later_step() - && witness_spawn_member_refuses_observed_shape() - && witness_teardown_member_refuses_desired_shape() - && witness_observe_parses_live_on_success() - && witness_observe_empty_on_no_server() - && witness_observe_empty_on_no_sessions() - && witness_observe_refuses_permission_error() - && witness_observe_refuses_empty_stderr_failure() - && witness_uuid_deterministic() - && witness_uuid_distinct_nodes() - && witness_uuid_rfc4122_shape() - && witness_find_node_hits() - && witness_find_node_misses() - && witness_find_node_first_wins_on_duplicate() - && witness_node_session_live_true() - && witness_node_session_live_false() - && witness_dispatch_result_ok_spawned_and_live() - && witness_dispatch_result_refusals_not_ok() - && witness_dispatch_status_labels_glued_to_ok_set() - && witness_dispatch_status_labels_pin_wire_contract() - && witness_exemplar_roster_reconciles_variant_set() - && witness_exemplar_roster_missing_variant_reds() - && witness_band_fold_pins_operator_vocabulary() - && witness_no_result_maps_to_in_progress() - && witness_ok_labels_derive_from_band_fold() - && witness_label_band_cover_reds_on_missing_row() - && witness_preflight_refuses_missing_claude() - && witness_preflight_refuses_unknown_home() - && witness_preflight_refuses_unreadable_store() - && witness_preflight_refuses_unseeded_root() - && witness_preflight_ok_when_seeded() - && witness_preflight_ok_on_enriched_entry() -} diff --git a/dag/test/claim/roadmap_belt_witness_test.dag b/dag/test/claim/roadmap_belt_witness_test.dag index 75c3588bc29..11531bcb637 100644 --- a/dag/test/claim/roadmap_belt_witness_test.dag +++ b/dag/test/claim/roadmap_belt_witness_test.dag @@ -61,13 +61,13 @@ fn at_capacity_waiting(actions: List) -> Int { fold(actions, init: 0, f: (acc, a) => match a { AtCapacity { ready_waiting } => ready_waiting, _ => acc }) } -fn witness_paused_spawns_nothing() -> Bool { +test fn witness_paused_spawns_nothing() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Paused, frontier: f, occupied: [], cap: cap(n: 3)) belt_spawn_count(actions: actions) == 0 && any_paused(actions: actions) } -fn witness_running_spawns_ready_within_capacity() -> Bool { +test fn witness_running_spawns_ready_within_capacity() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Running, frontier: f, occupied: [], cap: cap(n: 3)) belt_spawn_count(actions: actions) == 2 @@ -75,13 +75,13 @@ fn witness_running_spawns_ready_within_capacity() -> Bool { && belt_spawns_node(actions: actions, id: nid(s: "b")) } -fn witness_capacity_limits_spawns() -> Bool { +test fn witness_capacity_limits_spawns() -> Bool { let f = frontier_ready(ids: ["a", "b", "c"]) let actions = belt_step(state: Running, frontier: f, occupied: [], cap: cap(n: 1)) belt_spawn_count(actions: actions) == 1 } -fn witness_occupied_node_not_respawned() -> Bool { +test fn witness_occupied_node_not_respawned() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Running, frontier: f, occupied: [nid(s: "a")], cap: cap(n: 3)) belt_spawn_count(actions: actions) == 1 @@ -89,13 +89,13 @@ fn witness_occupied_node_not_respawned() -> Bool { && !belt_spawns_node(actions: actions, id: nid(s: "a")) } -fn witness_at_capacity_reports_backlog() -> Bool { +test fn witness_at_capacity_reports_backlog() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Running, frontier: f, occupied: [nid(s: "x"), nid(s: "y")], cap: cap(n: 2)) belt_spawn_count(actions: actions) == 0 && at_capacity_waiting(actions: actions) == 2 } -fn witness_belt_plan_equals_step_composition() -> Bool { +test fn witness_belt_plan_equals_step_composition() -> Bool { let doc = roadmap_authority() let merged = authored_merged_prs() let f = spawn_frontier(doc: doc, merged: merged) @@ -104,7 +104,7 @@ fn witness_belt_plan_equals_step_composition() -> Bool { belt_spawn_count(actions: via_plan) == belt_spawn_count(actions: via_step) } -fn witness_belt_plan_paused_holds_on_authority() -> Bool { +test fn witness_belt_plan_paused_holds_on_authority() -> Bool { let actions = belt_plan( state: Paused, doc: roadmap_authority(), @@ -115,7 +115,7 @@ fn witness_belt_plan_paused_holds_on_authority() -> Bool { belt_spawn_count(actions: actions) == 0 && any_paused(actions: actions) } -fn witness_belt_status_json_shape() -> Bool { +test fn witness_belt_status_json_shape() -> Bool { let j = roadmap_belt_status_json() string_contains(s: j, pattern: "roadmap-belt/v1") && string_contains(s: j, pattern: "run_state") @@ -124,17 +124,6 @@ fn witness_belt_status_json_shape() -> Bool { && string_contains(s: j, pattern: "max_concurrent") } -test fn roadmap_belt_witnesses() -> Bool { - witness_paused_spawns_nothing() - && witness_running_spawns_ready_within_capacity() - && witness_capacity_limits_spawns() - && witness_occupied_node_not_respawned() - && witness_at_capacity_reports_backlog() - && witness_belt_plan_equals_step_composition() - && witness_belt_plan_paused_holds_on_authority() - && witness_belt_status_json_shape() -} - fn live_session(node_id: String, verdict: ObservationVerdict) -> DispatchLiveSession { DispatchLiveSession { session_name: "gunbc-dispatch-{node_id}", @@ -152,7 +141,7 @@ fn tears_down_node(r: BeltReconcile, id: String) -> Bool { any(belt_member_ids(ms: r.teardowns), x => x == id) } -fn witness_reconcile_spawns_ready_missing_session() -> Bool { +test fn witness_reconcile_spawns_ready_missing_session() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let r = belt_reconcile(state: Running, frontier: f, live: [], cap: cap(n: 3)) belt_reconcile_spawn_count(r: r) == 2 @@ -162,7 +151,7 @@ fn witness_reconcile_spawns_ready_missing_session() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -fn witness_reconcile_noop_when_ready_and_live() -> Bool { +test fn witness_reconcile_noop_when_ready_and_live() -> Bool { let f = frontier_ready(ids: ["a"]) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "a", verdict: Converged)], cap: cap(n: 3)) belt_reconcile_spawn_count(r: r) == 0 @@ -170,7 +159,7 @@ fn witness_reconcile_noop_when_ready_and_live() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -fn witness_reconcile_reaps_owned_done_session() -> Bool { +test fn witness_reconcile_reaps_owned_done_session() -> Bool { let f = frontier_ready(ids: ["a"]) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Converged)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 1 @@ -180,13 +169,13 @@ fn witness_reconcile_reaps_owned_done_session() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -fn witness_reconcile_reaps_drifted_owned_session() -> Bool { +test fn witness_reconcile_reaps_drifted_owned_session() -> Bool { let f = frontier_ready(ids: []) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Drifted)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 1 && tears_down_node(r: r, id: "z") } -fn witness_r5_refuses_foreign_teardown() -> Bool { +test fn witness_r5_refuses_foreign_teardown() -> Bool { let f = frontier_ready(ids: ["a"]) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Conflict)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 0 @@ -195,19 +184,19 @@ fn witness_r5_refuses_foreign_teardown() -> Bool { && belt_reconcile_spawn_count(r: r) == 1 } -fn witness_r5_refuses_nameonly_teardown() -> Bool { +test fn witness_r5_refuses_nameonly_teardown() -> Bool { let f = frontier_ready(ids: []) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: UnknownRefused)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 0 && belt_reconcile_refusal_count(r: r) == 1 } -fn witness_reconcile_capacity_defers_surfaced() -> Bool { +test fn witness_reconcile_capacity_defers_surfaced() -> Bool { let f = frontier_ready(ids: ["a", "b", "c"]) let r = belt_reconcile(state: Running, frontier: f, live: [], cap: cap(n: 1)) belt_reconcile_spawn_count(r: r) == 1 && r.deferred == 2 } -fn witness_reconcile_paused_no_actions() -> Bool { +test fn witness_reconcile_paused_no_actions() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let r = belt_reconcile(state: Paused, frontier: f, live: [live_session(node_id: "z", verdict: Converged)], cap: cap(n: 3)) belt_reconcile_spawn_count(r: r) == 0 @@ -215,7 +204,7 @@ fn witness_reconcile_paused_no_actions() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -fn witness_reconcile_status_json_shape() -> Bool { +test fn witness_reconcile_status_json_shape() -> Bool { let f = frontier_ready(ids: ["a"]) let j = belt_reconcile_status_json(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Conflict)], cap: cap(n: 3)) string_contains(s: j, pattern: "roadmap-belt-reconcile/v1") @@ -224,14 +213,3 @@ fn witness_reconcile_status_json_shape() -> Bool { && string_contains(s: j, pattern: "deferred") } -test fn roadmap_belt_reconcile_witnesses() -> Bool { - witness_reconcile_spawns_ready_missing_session() - && witness_reconcile_noop_when_ready_and_live() - && witness_reconcile_reaps_owned_done_session() - && witness_reconcile_reaps_drifted_owned_session() - && witness_r5_refuses_foreign_teardown() - && witness_r5_refuses_nameonly_teardown() - && witness_reconcile_capacity_defers_surfaced() - && witness_reconcile_paused_no_actions() - && witness_reconcile_status_json_shape() -} diff --git a/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag b/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag index 3d0ba3bd3b9..4d4e86bae98 100644 --- a/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag +++ b/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag @@ -87,11 +87,11 @@ fn fixture_doc(nodes: List, edges: List) -> RoadmapDoc } } -fn witness_tmux_session_name_prefix() -> Bool { +test fn witness_tmux_session_name_prefix() -> Bool { dispatch_tmux_session_name(node_id: nid(s: "node-1")) == "gunbc-dispatch-node-1" } -fn witness_brief_fill_includes_node_metadata() -> Bool { +test fn witness_brief_fill_includes_node_metadata() -> Bool { let node = sized_derivable(id: "brief-node", prs: [1], title: "Brief Title") let brief = fill_dispatch_brief( template: dispatch_brief_template, @@ -101,11 +101,11 @@ fn witness_brief_fill_includes_node_metadata() -> Bool { && string_contains(s: brief, pattern: "Brief Title") } -fn witness_claude_effort_high_for_high_intricacy() -> Bool { +test fn witness_claude_effort_high_for_high_intricacy() -> Bool { claude_effort_for_intricacy(i: IntricacyHigh) == "high" } -fn witness_claude_argv_uses_dangerous_skip_permissions() -> Bool { +test fn witness_claude_argv_uses_dangerous_skip_permissions() -> Bool { let argv = claude_spawn_argv( effort: "high", session_uuid: "uuid-1", @@ -118,7 +118,7 @@ fn witness_claude_argv_uses_dangerous_skip_permissions() -> Bool { && !string_contains(s: join(argv, separator: "\0"), pattern: "--resume") } -fn witness_git_worktree_argv_is_execfile_safe() -> Bool { +test fn witness_git_worktree_argv_is_execfile_safe() -> Bool { let cmd = git_worktree_add_argv( worktree_path: "/opt/gunbc/dispatch-worktrees/node-1", branch_name: "dispatch/node-1", @@ -128,7 +128,7 @@ fn witness_git_worktree_argv_is_execfile_safe() -> Bool { && cmd.args == ["worktree", "add", "/opt/gunbc/dispatch-worktrees/node-1", "-b", "dispatch/node-1", "origin/main"] } -fn witness_tmux_spawn_argv_threads_claude_argv() -> Bool { +test fn witness_tmux_spawn_argv_threads_claude_argv() -> Bool { let claude = claude_spawn_argv( effort: "medium", session_uuid: "uuid-2", @@ -145,12 +145,12 @@ fn witness_tmux_spawn_argv_threads_claude_argv() -> Bool { && string_contains(s: join(cmd.args, separator: "\0"), pattern: "CLAUDE_CODE_NO_FLICKER=1") } -fn witness_stop_argv_targets_session() -> Bool { +test fn witness_stop_argv_targets_session() -> Bool { let cmd = tmux_kill_session_argv(session_name: "gunbc-dispatch-node-3") cmd.args == ["kill-session", "-t", "gunbc-dispatch-node-3"] } -fn witness_tmux_ls_parse_filters_prefix() -> Bool { +test fn witness_tmux_ls_parse_filters_prefix() -> Bool { let output = "other: 1 windows (created Fri Jul 3 04:14:00 2026)\ngunbc-dispatch-node-4: 2 windows (created Fri Jul 3 04:15:00 2026)\n" let entries = filter_dispatch_tmux_sessions(entries: parse_tmux_ls_output(output: output)) count(entries) == 1 @@ -158,7 +158,7 @@ fn witness_tmux_ls_parse_filters_prefix() -> Bool { && entries.first().windows == 2 } -fn witness_not_ready_node_refused() -> Bool { +test fn witness_not_ready_node_refused() -> Bool { let parent = sized_derivable(id: "parent", prs: [100], title: "Parent") let child = sized_derivable(id: "child", prs: [200], title: "Child") let edges = [RoadmapEdge { child: nid(s: "child"), parent: nid(s: "parent") }] @@ -170,7 +170,7 @@ fn witness_not_ready_node_refused() -> Bool { } } -fn witness_ready_node_permitted_without_live_session() -> Bool { +test fn witness_ready_node_permitted_without_live_session() -> Bool { let node = sized_derivable(id: "ready-node", prs: [10], title: "Ready") let doc = fixture_doc(nodes: [node], edges: []) let ready = next_spawnable(doc: doc, merged: []) @@ -185,7 +185,7 @@ fn witness_ready_node_permitted_without_live_session() -> Bool { } } -fn witness_live_lease_refused() -> Bool { +test fn witness_live_lease_refused() -> Bool { let node = sized_derivable(id: "leased-node", prs: [11], title: "Leased") let doc = fixture_doc(nodes: [node], edges: []) let ready = next_spawnable(doc: doc, merged: []) @@ -198,7 +198,7 @@ fn witness_live_lease_refused() -> Bool { } } -fn witness_absent_lease_classifies_spawn() -> Bool { +test fn witness_absent_lease_classifies_spawn() -> Bool { let scope = dispatch_tmux_session_scope(node_id: nid(s: "lease-absent")) match classify_dispatch_lease_upsert(scope: scope, obs: SessionAbsent) { UpsertClassification { verdict: Absent, decision: Apply { plan: SpawnSession } } => true @@ -206,11 +206,11 @@ fn witness_absent_lease_classifies_spawn() -> Bool { } } -fn witness_hostile_node_id_single_argv_token() -> Bool { +test fn witness_hostile_node_id_single_argv_token() -> Bool { hostile_node_id_stays_single_argv_token(node_id: "foo;rm -rf /") } -fn witness_live_sessions_panel_rows() -> Bool { +test fn witness_live_sessions_panel_rows() -> Bool { let output = "gunbc-dispatch-panel-a: 1 windows (created Fri Jul 3 04:14:00 2026)\n" let rows = dispatch_live_sessions(tmux_ls_output: output) count(rows) == 1 @@ -219,7 +219,7 @@ fn witness_live_sessions_panel_rows() -> Bool { && rows.first().lease_verdict == UnknownRefused } -fn witness_name_only_observation_not_converged() -> Bool { +test fn witness_name_only_observation_not_converged() -> Bool { let scope = dispatch_tmux_session_scope(node_id: nid(s: "name-only")) match classify_tmux_session( scope: scope, @@ -234,7 +234,7 @@ fn witness_name_only_observation_not_converged() -> Bool { } } -fn witness_foreign_process_fingerprint_is_conflict() -> Bool { +test fn witness_foreign_process_fingerprint_is_conflict() -> Bool { let scope = dispatch_tmux_session_scope(node_id: nid(s: "foreign-proc")) match classify_dispatch_lease_upsert( scope: scope, @@ -250,14 +250,14 @@ fn witness_foreign_process_fingerprint_is_conflict() -> Bool { } } -fn witness_fingerprint_scaffold_marker_present() -> Bool { +test fn witness_fingerprint_scaffold_marker_present() -> Bool { match dispatch_tmux_process_fingerprint_observation_dissolution_trigger { Scaffold { dissolves_to: _, bind: _ } => true Terminal { reason: _ } => false } } -fn witness_host_exec_argv_shapes_bound_to_extdeps() -> Bool { +test fn witness_host_exec_argv_shapes_bound_to_extdeps() -> Bool { let worktree_args = shape_git_worktree_add_argv( path: "/opt/gunbc/dispatch-worktrees/bound-node" as FilePath, branch: "dispatch/bound-node" as NonEmptyStr, @@ -297,7 +297,7 @@ fn witness_host_exec_argv_shapes_bound_to_extdeps() -> Bool { && !string_contains(s: join(claude_args_default, separator: "\0"), pattern: "--dangerously-skip-permissions") } -fn witness_claude_invoke_permission_args_are_gunbc_policy() -> Bool { +test fn witness_claude_invoke_permission_args_are_gunbc_policy() -> Bool { let argv = claude_spawn_argv( effort: "high", session_uuid: "uuid-policy", @@ -308,7 +308,7 @@ fn witness_claude_invoke_permission_args_are_gunbc_policy() -> Bool { && dispatch_claude_permission_args == ["--dangerously-skip-permissions"] } -fn witness_tmux_new_session_service_op_splices_inner_argv() -> Bool { +test fn witness_tmux_new_session_service_op_splices_inner_argv() -> Bool { let via_service_shape = shape_tmux_new_session_argv( session_name: "gunbc-dispatch-splice", working_dir: "/opt/gunbc/dispatch-worktrees/splice", @@ -321,7 +321,7 @@ fn witness_tmux_new_session_service_op_splices_inner_argv() -> Bool { ] } -fn witness_session_lease_shape_reused() -> Bool { +test fn witness_session_lease_shape_reused() -> Bool { session_lease_reuses_process_port_classifier_shape() } @@ -341,7 +341,7 @@ fn ticket_fixture_node() -> RoadmapNode { }, intricacy: IntricacyMedium, volume: VolumeSmall, repo: "gunbc") } -fn witness_ticket_brief_fills_real_slots() -> Bool { +test fn witness_ticket_brief_fills_real_slots() -> Bool { let brief = filled_dispatch_brief_for_node(node: ticket_fixture_node()) string_contains(s: brief, pattern: "the real displaced cost") && string_contains(s: brief, pattern: "the real current state") @@ -351,35 +351,10 @@ fn witness_ticket_brief_fills_real_slots() -> Bool { && string_contains(s: brief, pattern: "the real handback") } -fn witness_legacy_brief_still_stubs_with_title() -> Bool { +test fn witness_legacy_brief_still_stubs_with_title() -> Bool { let node = sized_derivable(id: "brief-node", prs: [1], title: "Brief Title") let brief = filled_dispatch_brief_for_node(node: node) string_contains(s: brief, pattern: "Brief Title") && !string_contains(s: brief, pattern: "the real displaced cost") } -test fn roadmap_dispatch_actuator_witnesses() -> Bool { - witness_tmux_session_name_prefix() - && witness_brief_fill_includes_node_metadata() - && witness_claude_effort_high_for_high_intricacy() - && witness_claude_argv_uses_dangerous_skip_permissions() - && witness_git_worktree_argv_is_execfile_safe() - && witness_tmux_spawn_argv_threads_claude_argv() - && witness_stop_argv_targets_session() - && witness_tmux_ls_parse_filters_prefix() - && witness_not_ready_node_refused() - && witness_ready_node_permitted_without_live_session() - && witness_live_lease_refused() - && witness_absent_lease_classifies_spawn() - && witness_hostile_node_id_single_argv_token() - && witness_live_sessions_panel_rows() - && witness_name_only_observation_not_converged() - && witness_foreign_process_fingerprint_is_conflict() - && witness_fingerprint_scaffold_marker_present() - && witness_claude_invoke_permission_args_are_gunbc_policy() - && witness_tmux_new_session_service_op_splices_inner_argv() - && witness_host_exec_argv_shapes_bound_to_extdeps() - && witness_session_lease_shape_reused() - && witness_ticket_brief_fills_real_slots() - && witness_legacy_brief_still_stubs_with_title() -} diff --git a/dag/test/claim/roadmap_document_test.dag b/dag/test/claim/roadmap_document_test.dag index 6462b640d9b..d60eb5e4660 100644 --- a/dag/test/claim/roadmap_document_test.dag +++ b/dag/test/claim/roadmap_document_test.dag @@ -77,33 +77,33 @@ fn emit(merged: List) -> String { serialize_markdown_source(doc: project_roadmap_to_markdown(doc: authority(), merged: merged)) } -fn witness_preamble_first() -> Bool { +test fn witness_preamble_first() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "# ROADMAP") && string_contains(s: out, pattern: "Generated from .dag authority") } -fn witness_both_sections() -> Bool { +test fn witness_both_sections() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "## 0. Fail-closed lock-down") && string_contains(s: out, pattern: "## 6. Expansion") } -fn witness_authored_evidence_awaiting_signoff() -> Bool { +test fn witness_authored_evidence_awaiting_signoff() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "[ ] **fail-open audit**") && string_contains(s: out, pattern: "[plan](docs/plans/fail-closed-lockdown.md)") && string_contains(s: out, pattern: "⏳ awaiting sign-off") } -fn witness_derived_merged_awaiting_signoff() -> Bool { +test fn witness_derived_merged_awaiting_signoff() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && string_contains(s: out, pattern: "⏳ awaiting sign-off") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") } -fn witness_derived_unchecked_when_unmerged() -> Bool { +test fn witness_derived_unchecked_when_unmerged() -> Bool { let out = emit(merged: []) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") @@ -126,21 +126,12 @@ fn expected_roadmap() -> String { ], "") } -fn witness_exact_bytes() -> Bool { +test fn witness_exact_bytes() -> Bool { emit(merged: [5491]) == expected_roadmap() } -fn witness_drift_receipt() -> Bool { +test fn witness_drift_receipt() -> Bool { emit(merged: [5491]) == expected_roadmap() && !(emit(merged: []) == expected_roadmap()) } -test fn roadmap_document_witnesses() -> Bool { - witness_preamble_first() - && witness_both_sections() - && witness_authored_evidence_awaiting_signoff() - && witness_derived_merged_awaiting_signoff() - && witness_derived_unchecked_when_unmerged() - && witness_exact_bytes() - && witness_drift_receipt() -} diff --git a/dag/test/claim/roadmap_emit_test.dag b/dag/test/claim/roadmap_emit_test.dag index 35aabdd2af4..ab3fc92b2d9 100644 --- a/dag/test/claim/roadmap_emit_test.dag +++ b/dag/test/claim/roadmap_emit_test.dag @@ -59,30 +59,30 @@ fn emit(merged: List) -> String { emit_nodes(nodes: nodes(), merged: merged) } -fn witness_heading() -> Bool { +test fn witness_heading() -> Bool { string_contains(s: emit(merged: [5491]), pattern: "## 6. Expansion") } -fn witness_parent_authored_box_and_link() -> Bool { +test fn witness_parent_authored_box_and_link() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "- [ ] **invert hand-maintained**") && string_contains(s: out, pattern: "[plan](docs/plans/invert-hand-maintained.md)") } -fn witness_child_merged_unsigned_awaiting_signoff() -> Bool { +test fn witness_child_merged_unsigned_awaiting_signoff() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && string_contains(s: out, pattern: "⏳ awaiting sign-off") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") } -fn witness_child_signed_checked() -> Bool { +test fn witness_child_signed_checked() -> Bool { let out = emit_nodes(nodes: [parent_node(), signed_child_node()], merged: []) string_contains(s: out, pattern: "[x] **PR-checkbox status**") && string_contains(s: out, pattern: "✓ signed off: operator") } -fn witness_child_derived_unchecked_when_unmerged() -> Bool { +test fn witness_child_derived_unchecked_when_unmerged() -> Bool { let out = emit(merged: []) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") @@ -100,17 +100,9 @@ fn superseded_child_node() -> RoadmapNode { } } -fn witness_superseded_checked_struck_no_signoff_suffix() -> Bool { +test fn witness_superseded_checked_struck_no_signoff_suffix() -> Bool { let out = emit_nodes(nodes: [parent_node(), superseded_child_node()], merged: []) string_contains(s: out, pattern: "[x] ~~**PR-checkbox status**~~ **superseded →** successor-lane") && !string_contains(s: out, pattern: "⏳ awaiting sign-off") } -test fn roadmap_emit_witnesses() -> Bool { - witness_heading() - && witness_parent_authored_box_and_link() - && witness_child_merged_unsigned_awaiting_signoff() - && witness_child_signed_checked() - && witness_child_derived_unchecked_when_unmerged() - && witness_superseded_checked_struck_no_signoff_suffix() -} diff --git a/dag/test/claim/roadmap_frontier_witness_test.dag b/dag/test/claim/roadmap_frontier_witness_test.dag index 166ed5c8a3b..1fbf821dfe6 100644 --- a/dag/test/claim/roadmap_frontier_witness_test.dag +++ b/dag/test/claim/roadmap_frontier_witness_test.dag @@ -60,7 +60,7 @@ fn fixture_doc(nodes: List, edges: List) -> RoadmapDoc } } -fn witness_ready_matches_next_spawnable() -> Bool { +test fn witness_ready_matches_next_spawnable() -> Bool { let node_a = sized_derivable(id: "parent-done", prs: [100], title: "Parent") let node_b = sized_derivable(id: "child-ready", prs: [200], title: "Child Ready") let edges = [RoadmapEdge { child: nid(s: "child-ready"), parent: nid(s: "parent-done") }] @@ -71,7 +71,7 @@ fn witness_ready_matches_next_spawnable() -> Bool { && any(frontier.ready, n => n.node == nid(s: "child-ready")) } -fn witness_upcoming_is_blocked_sized_node() -> Bool { +test fn witness_upcoming_is_blocked_sized_node() -> Bool { let node_a = sized_derivable(id: "parent-open", prs: [100], title: "Parent Open") let node_b = sized_derivable(id: "child-blocked", prs: [200], title: "Child Blocked") let edges = [RoadmapEdge { child: nid(s: "child-blocked"), parent: nid(s: "parent-open") }] @@ -81,7 +81,7 @@ fn witness_upcoming_is_blocked_sized_node() -> Bool { && !any(frontier.ready, n => n.node == nid(s: "child-blocked")) } -fn witness_done_is_merged_sized_node() -> Bool { +test fn witness_done_is_merged_sized_node() -> Bool { let node = sized_derivable(id: "done-node", prs: [999], title: "Done Node") let doc = fixture_doc(nodes: [node], edges: []) let frontier = spawn_frontier(doc: doc, merged: [999]) @@ -90,7 +90,7 @@ fn witness_done_is_merged_sized_node() -> Bool { && !any(frontier.upcoming, n => n.node == nid(s: "done-node")) } -fn witness_unsized_excluded_from_frontier() -> Bool { +test fn witness_unsized_excluded_from_frontier() -> Bool { let node = unsized_derivable(id: "unsized-open", prs: [], title: "Unsized") let doc = fixture_doc(nodes: [node], edges: []) let frontier = spawn_frontier(doc: doc, merged: []) @@ -99,7 +99,7 @@ fn witness_unsized_excluded_from_frontier() -> Bool { && count(frontier.done) == 0 } -fn witness_buckets_are_disjoint() -> Bool { +test fn witness_buckets_are_disjoint() -> Bool { let node_a = sized_derivable(id: "a-open", prs: [100], title: "A") let node_b = sized_derivable(id: "b-blocked", prs: [200], title: "B") let node_c = sized_derivable(id: "c-done", prs: [300], title: "C") @@ -120,7 +120,7 @@ fn daily_workspace_html(doc: RoadmapDocument, merged: List) -> String { } } -fn witness_page_renders_four_buckets() -> Bool { +test fn witness_page_renders_four_buckets() -> Bool { let node_a = sized_derivable(id: "ready-node", prs: [10], title: "Ready Title") let doc = fixture_doc(nodes: [node_a], edges: []) let h = daily_workspace_html(doc: doc, merged: []) @@ -147,7 +147,7 @@ fn superseded_node_fixture(id: String, by: String) -> RoadmapNode { } } -fn witness_superseded_bucket_holds_superseded_only() -> Bool { +test fn witness_superseded_bucket_holds_superseded_only() -> Bool { let node_old = superseded_node_fixture(id: "old-row", by: "successor-lane") let node_open = sized_derivable(id: "open-row", prs: [10], title: "Open Row") let doc = fixture_doc(nodes: [node_old, node_open], edges: []) @@ -159,7 +159,7 @@ fn witness_superseded_bucket_holds_superseded_only() -> Bool { && !any(frontier.done, n => n.node == nid(s: "old-row")) } -fn witness_page_places_superseded_node_in_superseded_bucket() -> Bool { +test fn witness_page_places_superseded_node_in_superseded_bucket() -> Bool { let node_old = superseded_node_fixture(id: "old-row", by: "successor-lane") let doc = fixture_doc(nodes: [node_old], edges: []) let h = daily_workspace_html(doc: doc, merged: []) @@ -169,7 +169,7 @@ fn witness_page_places_superseded_node_in_superseded_bucket() -> Bool { && !string_contains(s: h, pattern: "
") } -fn witness_authority_differs_from_empty() -> Bool { +test fn witness_authority_differs_from_empty() -> Bool { !(authority_page_html() == empty_doc_html()) } -fn witness_authority_shows_three_gate_progress() -> Bool { +test fn witness_authority_shows_three_gate_progress() -> Bool { let authority = authority_page_html() let empty = empty_doc_html() string_contains(s: authority, pattern: "class=\"three-gate-progress\"") @@ -91,13 +91,13 @@ fn bold_title_html() -> String { } } -fn witness_bold_title_renders_strong() -> Bool { +test fn witness_bold_title_renders_strong() -> Bool { let h = bold_title_html() string_contains(s: h, pattern: "bold") && !string_contains(s: h, pattern: "**") } -fn witness_depth_cap_fails_honest() -> Bool { +test fn witness_depth_cap_fails_honest() -> Bool { let truncated = depth_chain_html(fuel: 0) let expanded = depth_chain_html(fuel: 1) string_contains(s: truncated, pattern: "depth limit") @@ -137,7 +137,7 @@ fn dispatch_doc_page(rn: RoadmapNode) -> Fragment { roadmap_page(doc: doc, merged: []) } -fn witness_open_node_doc_emits_button_and_external_script() -> Bool { +test fn witness_open_node_doc_emits_button_and_external_script() -> Bool { let h = dispatch_doc_html_for(rn: open_dispatch_node()) string_contains(s: h, pattern: "" EmitRejected { reason: _ } => false } } -test fn witness_html_emit_matches_markup_fold() -> Bool { +fn witness_html_emit_matches_markup_fold() -> Bool { match try_serialize_html_source(node: sample_button()) { EmitOk { html: h } => h == serialize_html_source(node: sample_button()) EmitRejected { reason: _ } => false @@ -48,7 +48,7 @@ fn hostile_data_href() -> Fragment { } } -test fn witness_javascript_reject_discriminates_from_char_escape() -> Bool { +fn witness_javascript_reject_discriminates_from_char_escape() -> Bool { match try_serialize_html_source(node: hostile_javascript_href()) { EmitRejected { reason: _ } => { let unchecked = serialize_html_source(node: hostile_javascript_href()) @@ -58,7 +58,7 @@ test fn witness_javascript_reject_discriminates_from_char_escape() -> Bool { } } -test fn witness_data_reject_discriminates_from_char_escape() -> Bool { +fn witness_data_reject_discriminates_from_char_escape() -> Bool { match try_serialize_html_source(node: hostile_data_href()) { EmitRejected { reason: _ } => { let unchecked = serialize_html_source(node: hostile_data_href()) @@ -68,7 +68,7 @@ test fn witness_data_reject_discriminates_from_char_escape() -> Bool { } } -test fn witness_serialize_rejects_javascript_href() -> Bool { +fn witness_serialize_rejects_javascript_href() -> Bool { match try_serialize_html_source(node: hostile_javascript_href()) { EmitRejected { reason: u } => u == "javascript:alert(1)" @@ -76,7 +76,7 @@ test fn witness_serialize_rejects_javascript_href() -> Bool { } } -test fn witness_serialize_rejects_data_href() -> Bool { +fn witness_serialize_rejects_data_href() -> Bool { match try_serialize_html_source(node: hostile_data_href()) { EmitRejected { reason: u } => u.starts_with(prefix: "data:") @@ -84,7 +84,7 @@ test fn witness_serialize_rejects_data_href() -> Bool { } } -test fn witness_http_href_serializes() -> Bool { +fn witness_http_href_serializes() -> Bool { match try_serialize_html_source( node: Element { tag: "a", @@ -113,14 +113,14 @@ fn req_a_hostile_but_trusted_scheme() -> Fragment { } } -test fn witness_trusted_href_serializes() -> Bool { +fn witness_trusted_href_serializes() -> Bool { match try_serialize_html_source(node: trusted_relative_link()) { EmitOk { html: h } => h == "dag" EmitRejected { reason: _ } => false } } -test fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { +fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { match try_serialize_html_source(node: req_a_hostile_but_trusted_scheme()) { EmitOk { html: h } => h == "" @@ -128,3 +128,14 @@ test fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { } } +test fn html_emit_keystone_holds() -> Bool { + witness_html_emit_reduces_and_serializes() + && witness_html_emit_matches_markup_fold() + && witness_javascript_reject_discriminates_from_char_escape() + && witness_data_reject_discriminates_from_char_escape() + && witness_serialize_rejects_javascript_href() + && witness_serialize_rejects_data_href() + && witness_http_href_serializes() + && witness_trusted_href_serializes() + && witness_req_a_hostile_href_still_emits_with_escaping() +} diff --git a/dag/test/claim/html_markup_xss_witness_test.dag b/dag/test/claim/html_markup_xss_witness_test.dag index 96fbc7a1537..0081205957e 100644 --- a/dag/test/claim/html_markup_xss_witness_test.dag +++ b/dag/test/claim/html_markup_xss_witness_test.dag @@ -14,63 +14,63 @@ import extdeps.languages.html { try_serialize_html_source, EmitOk, EmitRejected data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_javascript_href_rejects() -> Bool { +fn witness_javascript_href_rejects() -> Bool { match validate_href(url: "javascript:alert(1)") { RejectedHref { reason: DangerousScheme { scheme: JavascriptScheme } } => true _ => false } } -test fn witness_javascript_href_case_insensitive_rejects() -> Bool { +fn witness_javascript_href_case_insensitive_rejects() -> Bool { match validate_href(url: " JAVASCRIPT:alert(1)") { RejectedHref { reason: DangerousScheme { scheme: JavascriptScheme } } => true _ => false } } -test fn witness_data_href_rejects() -> Bool { +fn witness_data_href_rejects() -> Bool { match validate_href(url: "data:text/html,") { RejectedHref { reason: DangerousScheme { scheme: DataScheme } } => true _ => false } } -test fn witness_protocol_relative_rejects() -> Bool { +fn witness_protocol_relative_rejects() -> Bool { match validate_href(url: "//evil.example/x") { RejectedHref { reason: SchemeNotAllowlisted } => true _ => false } } -test fn witness_mixed_case_javascript_rejects_fail_closed() -> Bool { +fn witness_mixed_case_javascript_rejects_fail_closed() -> Bool { match validate_href(url: "JaVaScRiPt:alert(1)") { RejectedHref { reason: SchemeNotAllowlisted } => true _ => false } } -test fn witness_relative_href_accepted() -> Bool { +fn witness_relative_href_accepted() -> Bool { match validate_href(url: "/safe/path") { SafeHref { url: u } => u == "/safe/path" _ => false } } -test fn witness_https_href_accepted() -> Bool { +fn witness_https_href_accepted() -> Bool { match validate_href(url: "https://example.com") { SafeHref { url: u } => u == "https://example.com" _ => false } } -test fn witness_http_href_accepted() -> Bool { +fn witness_http_href_accepted() -> Bool { match validate_href(url: "http://example.com") { SafeHref { url: u } => u == "http://example.com" _ => false } } -test fn witness_mailto_href_accepted() -> Bool { +fn witness_mailto_href_accepted() -> Bool { match validate_href(url: "mailto:user@example.com") { SafeHref { url: u } => u == "mailto:user@example.com" _ => false @@ -85,14 +85,32 @@ fn javascript_link_node() -> Fragment { } } -test fn witness_unsafe_href_blocks_serialization() -> Bool { +fn witness_unsafe_href_blocks_serialization() -> Bool { match try_serialize_html_source(node: javascript_link_node()) { EmitRejected { reason: _ } => true EmitOk { html: _ } => false } } -test fn witness_escape_url_passes_javascript_scheme() -> Bool { +fn witness_escape_url_passes_javascript_scheme() -> Bool { escape_url(s: "javascript:alert(1)") == "javascript:alert(1)" } +fn witness_allowlist_rejects_what_escape_url_passes() -> Bool { + witness_escape_url_passes_javascript_scheme() + && witness_javascript_href_rejects() + && witness_unsafe_href_blocks_serialization() +} + +test fn html_markup_xss_keystone_holds() -> Bool { + witness_javascript_href_rejects() + && witness_javascript_href_case_insensitive_rejects() + && witness_data_href_rejects() + && witness_protocol_relative_rejects() + && witness_mixed_case_javascript_rejects_fail_closed() + && witness_relative_href_accepted() + && witness_https_href_accepted() + && witness_http_href_accepted() + && witness_mailto_href_accepted() + && witness_allowlist_rejects_what_escape_url_passes() +} diff --git a/dag/test/claim/html_roundtrip_test.dag b/dag/test/claim/html_roundtrip_test.dag index 1b3849bac38..8af4996ad1e 100644 --- a/dag/test/claim/html_roundtrip_test.dag +++ b/dag/test/claim/html_roundtrip_test.dag @@ -34,7 +34,7 @@ fn roundtrip_core_node() -> Fragment { } } -test fn witness_roundtrip_core() -> Bool { +fn witness_roundtrip_core() -> Bool { match ingest_html_source(src: serialize_html_source(node: roundtrip_core_node())) { IngestedNode { node } => node == roundtrip_core_node() IngestRejected { reason: _ } => false @@ -60,7 +60,7 @@ fn perturbed_node() -> Fragment { } } -test fn witness_roundtrip_under_perturbed_rows() -> Bool { +fn witness_roundtrip_under_perturbed_rows() -> Bool { let sp = perturbed_spellings() match ingest_html_source_with(src: serialize_html_source_with(node: perturbed_node(), sp: sp), sp: sp) { IngestedNode { node } => node == perturbed_node() @@ -76,7 +76,7 @@ fn attr_node() -> Fragment { } } -test fn witness_ingest_reads_attr_assign_row() -> Bool { +fn witness_ingest_reads_attr_assign_row() -> Bool { let emitted_perturbed = serialize_html_source_with(node: attr_node(), sp: perturbed_spellings()) match ingest_html_source(src: emitted_perturbed) { IngestedNode { node } => !(node == attr_node()) @@ -84,7 +84,7 @@ test fn witness_ingest_reads_attr_assign_row() -> Bool { } } -test fn witness_core_advertised_lossless() -> Bool { +fn witness_core_advertised_lossless() -> Bool { let node = roundtrip_core_node() let m = html_medium_lossless(node: node) match m.fidelity { @@ -93,7 +93,7 @@ test fn witness_core_advertised_lossless() -> Bool { } } -test fn witness_frontier_unsafe_href_rejected() -> Bool { +fn witness_frontier_unsafe_href_rejected() -> Bool { let serialized = serialize_html_source(node: Element { tag: "a", attributes: [attr(name: "href", value: "javascript:alert(1)" )], @@ -116,10 +116,18 @@ fn adjacent_text_node() -> Fragment { } } -test fn witness_frontier_not_roundtripped() -> Bool { +fn witness_frontier_not_roundtripped() -> Bool { match ingest_html_source(src: serialize_html_source(node: adjacent_text_node())) { IngestedNode { node } => !(node == adjacent_text_node()) IngestRejected { reason: _ } => false } } +test fn html_roundtrip_keystone_holds() -> Bool { + witness_roundtrip_core() + && witness_roundtrip_under_perturbed_rows() + && witness_ingest_reads_attr_assign_row() + && witness_core_advertised_lossless() + && witness_frontier_unsafe_href_rejected() + && witness_frontier_not_roundtripped() +} diff --git a/dag/test/claim/http_serve_route_witness_test.dag b/dag/test/claim/http_serve_route_witness_test.dag index 1c056653c5f..cda4eff0abf 100644 --- a/dag/test/claim/http_serve_route_witness_test.dag +++ b/dag/test/claim/http_serve_route_witness_test.dag @@ -67,11 +67,11 @@ fn selection_param(sel: RouteSelection, name: String) -> String { } } -test fn witness_root_selects_page_handler() -> Bool { +fn witness_root_selects_page_handler() -> Bool { selected_dynamic_is(sel: serve_select_route(table: probe_table(), method: GET, path: "/"), want_dispatch: false) } -test fn witness_static_row_selects_static() -> Bool { +fn witness_static_row_selects_static() -> Bool { match serve_select_route(table: probe_table(), method: GET, path: "/healthz") { SelectedStatic { route: r } => r.body == "ok" && r.status_on_hit == 200 SelectedDynamic { handler: _, params: _ } => false @@ -80,13 +80,13 @@ test fn witness_static_row_selects_static() -> Bool { } } -test fn witness_dispatch_post_binds_param() -> Bool { +fn witness_dispatch_post_binds_param() -> Bool { let sel = serve_select_route(table: probe_table(), method: POST, path: "/dispatch/2-cd-transport") selected_dynamic_is(sel: sel, want_dispatch: true) && selection_param(sel: sel, name: "node_id") == "2-cd-transport" } -test fn witness_wrong_method_folds_405_with_allowed() -> Bool { +fn witness_wrong_method_folds_405_with_allowed() -> Bool { match serve_select_route(table: probe_table(), method: GET, path: "/dispatch/x") { MethodNotAllowed { allowed: ms } => count(ms) == 1 && any(ms, m => m == POST) @@ -96,7 +96,7 @@ test fn witness_wrong_method_folds_405_with_allowed() -> Bool { } } -test fn witness_unknown_path_folds_404() -> Bool { +fn witness_unknown_path_folds_404() -> Bool { match serve_select_route(table: probe_table(), method: GET, path: "/nope") { NoRouteMatched => true SelectedStatic { route: _ } => false @@ -105,7 +105,7 @@ test fn witness_unknown_path_folds_404() -> Bool { } } -test fn witness_first_match_wins_on_overlap() -> Bool { +fn witness_first_match_wins_on_overlap() -> Bool { let overlap = ServedRouteTable { routes: [ DynamicRoute { method: GET, path_pattern: tpl(raw: "/a/\{x\}"), handler: ProbePage }, @@ -212,10 +212,19 @@ fn parity_on_template(raw: String) -> Bool { ) } -test fn witness_forward_backward_agreement() -> Bool { +fn witness_forward_backward_agreement() -> Bool { parity_on_template(raw: "/") && parity_on_template(raw: "/roadmap") && parity_on_template(raw: "/healthz") && parity_on_template(raw: "/dispatch/\{node_id\}") } +test fn http_serve_route_witnesses() -> Bool { + witness_root_selects_page_handler() + && witness_static_row_selects_static() + && witness_dispatch_post_binds_param() + && witness_wrong_method_folds_405_with_allowed() + && witness_unknown_path_folds_404() + && witness_first_match_wins_on_overlap() + && witness_forward_backward_agreement() +} diff --git a/dag/test/claim/interpreter_kernel_model_witness_test.dag b/dag/test/claim/interpreter_kernel_model_witness_test.dag index d4210d3b6b4..14f2f806d2a 100644 --- a/dag/test/claim/interpreter_kernel_model_witness_test.dag +++ b/dag/test/claim/interpreter_kernel_model_witness_test.dag @@ -1,8 +1,9 @@ module test.claim.interpreter_kernel_model_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn w_pure_eval_authority_modules() -> Bool { +fn w_pure_eval_authority_modules() -> Bool { is_pure_eval_authority_module(path: "src/v2/compiler/05_eval.dag") && is_pure_eval_authority_module(path: "src/v2/compiler/emit_host.dag") && is_pure_eval_authority_module(path: "src/v2/extdeps/runtimes/v2_evaluator.dag") && @@ -11,7 +12,7 @@ test fn w_pure_eval_authority_modules() -> Bool { !is_pure_eval_authority_module(path: "src/v1/stage0/src/v1_interpreter.rs") } -test fn w_pinned_host_physics_roster() -> Bool { +fn w_pinned_host_physics_roster() -> Bool { is_pinned_host_physics_stage0_file(basename: "recorded_fixture.rs") && is_pinned_host_physics_stage0_file(basename: "resolved_graph_cache.rs") && !is_pinned_host_physics_stage0_file(basename: "cache_purity_oracle.rs") && @@ -20,16 +21,16 @@ test fn w_pinned_host_physics_roster() -> Bool { !is_pinned_host_physics_stage0_file(basename: "wire_value_serialize.rs") } -test fn w_hybrid_interpreter_file_boundary() -> Bool { +fn w_hybrid_interpreter_file_boundary() -> Bool { v1_interpreter_hybrid_seed_file == "v1_interpreter.rs" && v1_interpreter_not_classified_as_pinned_host_physics() } -test fn w_kernel_d_phase_pure_eval_emit_wired() -> Bool { +fn w_kernel_d_phase_pure_eval_emit_wired() -> Bool { interpreter_kernel_d_phase_is_pure_eval_emit_wired() } -test fn w_seam_class_authority_modules() -> Bool { +fn w_seam_class_authority_modules() -> Bool { match seam_class_for_authority_module(path: "src/v2/compiler/05_eval.dag") { Present { value: PureEvalAuthority } => true _ => false @@ -44,7 +45,7 @@ test fn w_seam_class_authority_modules() -> Bool { } } -test fn w_hybrid_seed_seam_unclassified() -> Bool { +fn w_hybrid_seed_seam_unclassified() -> Bool { hybrid_seed_file_is_seam_unclassified() && match seam_class_for_pinned_basename(basename: v1_interpreter_hybrid_seed_file) { Absent => true @@ -52,3 +53,11 @@ test fn w_hybrid_seed_seam_unclassified() -> Bool { } } +test fn interpreter_kernel_model_witnesses() -> Bool { + w_pure_eval_authority_modules() && + w_pinned_host_physics_roster() && + w_hybrid_interpreter_file_boundary() && + w_kernel_d_phase_pure_eval_emit_wired() && + w_seam_class_authority_modules() && + w_hybrid_seed_seam_unclassified() +} diff --git a/dag/test/claim/jedec_ddr_generation_witness_test.dag b/dag/test/claim/jedec_ddr_generation_witness_test.dag index 85a24abc824..3efbc0557ae 100644 --- a/dag/test/claim/jedec_ddr_generation_witness_test.dag +++ b/dag/test/claim/jedec_ddr_generation_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.jedec_ddr_generation + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data mod_ddr4_32g_1rx8: DramModuleCatalogRow = DramModuleCatalogRow { @@ -26,22 +27,22 @@ data mod_ddr5_32g_1rx8: DramModuleCatalogRow = DramModuleCatalogRow { rank_count: 1, } -test fn generation_axis_is_decomposed() -> Bool { +fn generation_axis_is_decomposed() -> Bool { dram_generation_ddr4.signaling_family == DoubleDataRate && dram_generation_ddr4.generation_number == 4 && dram_generation_ddr5.signaling_family == DoubleDataRate && dram_generation_ddr5.generation_number == 5 } -test fn ddr4_ceiling_is_2_gib() -> Bool { +fn ddr4_ceiling_is_2_gib() -> Bool { byte_size_count(b: ddr4_generation_catalog.max_monolithic_die_density) == 2147483648 } -test fn ddr5_ceiling_is_8_gib() -> Bool { +fn ddr5_ceiling_is_8_gib() -> Bool { byte_size_count(b: ddr5_generation_catalog.max_monolithic_die_density) == 8589934592 } -test fn dispatch_selects_matching_generation() -> Bool { +fn dispatch_selects_matching_generation() -> Bool { dram_generation_eq( a: jedec_ddr_generation_catalog_row(dram_generation_ddr4).generation, b: dram_generation_ddr4, @@ -52,12 +53,20 @@ test fn dispatch_selects_matching_generation() -> Bool { ) } -test fn per_generation_ceiling_discriminates() -> Bool { +fn per_generation_ceiling_discriminates() -> Bool { !dram_module_is_realizable(module: mod_ddr4_32g_1rx8, jedec: ddr4_generation_catalog) && dram_module_is_realizable(module: mod_ddr5_32g_1rx8, jedec: ddr5_generation_catalog) } -test fn generation_mismatch_fails_closed() -> Bool { +fn generation_mismatch_fails_closed() -> Bool { !dram_module_is_realizable(module: mod_ddr4_32g_1rx8, jedec: ddr5_generation_catalog) } +test fn jedec_ddr_generation_holds() -> Bool { + generation_axis_is_decomposed() + && ddr4_ceiling_is_2_gib() + && ddr5_ceiling_is_8_gib() + && dispatch_selects_matching_generation() + && per_generation_ceiling_discriminates() + && generation_mismatch_fails_closed() +} diff --git a/dag/test/claim/js_site_emit_test.dag b/dag/test/claim/js_site_emit_test.dag index 774bc4eed2b..65f387cfb29 100644 --- a/dag/test/claim/js_site_emit_test.dag +++ b/dag/test/claim/js_site_emit_test.dag @@ -1,5 +1,6 @@ module test.claim.js_site_emit + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn js_site_hostile_page() -> JsSitePage { @@ -11,14 +12,14 @@ fn js_site_hostile_page() -> JsSitePage { } } -test fn witness_hostile_html_rejected() -> Bool { +fn witness_hostile_html_rejected() -> Bool { match js_site_emit_html(page: js_site_hostile_page()) { EmitRejected { reason: _ } => true EmitOk { html: _ } => false } } -test fn witness_hostile_tsx_rejected() -> Bool { +fn witness_hostile_tsx_rejected() -> Bool { match js_site_emit_tsx(page: js_site_hostile_page()) { JsxRejected { reason: _ } => true JsxOk { tsx: _ } => false @@ -37,31 +38,31 @@ data expected_browse_tsx: String = "export function JsSiteBrowsePage(): JSX.Elem data expected_about_tsx: String = "export function JsSiteAboutPage(): JSX.Element { return gunbc — About

gunbc

gunbc models programs as dependency graphs. Rust is bootstrap seed.

; }" -test fn witness_three_page_source() -> Bool { +fn witness_three_page_source() -> Bool { js_site_page_count() == 3 } -test fn witness_home_html_emit() -> Bool { +fn witness_home_html_emit() -> Bool { js_site_page_html(page: js_site_pages().first()) == expected_home_html } -test fn witness_browse_html_emit() -> Bool { +fn witness_browse_html_emit() -> Bool { js_site_page_html(page: js_site_pages().skip(n: 1).first()) == expected_browse_html } -test fn witness_about_html_emit() -> Bool { +fn witness_about_html_emit() -> Bool { js_site_page_html(page: js_site_pages().skip(n: 2).first()) == expected_about_html } -test fn witness_home_tsx_emit() -> Bool { +fn witness_home_tsx_emit() -> Bool { js_site_page_tsx(page: js_site_pages().first()) == expected_home_tsx } -test fn witness_browse_tsx_emit() -> Bool { +fn witness_browse_tsx_emit() -> Bool { js_site_page_tsx(page: js_site_pages().skip(n: 1).first()) == expected_browse_tsx } -test fn witness_about_tsx_emit() -> Bool { +fn witness_about_tsx_emit() -> Bool { js_site_page_tsx(page: js_site_pages().skip(n: 2).first()) == expected_about_tsx } @@ -70,27 +71,44 @@ fn artifact_matches_emit(path: String, expected: String) -> Bool { r.success && r.content == expected } -test fn witness_committed_home_html() -> Bool { +fn witness_committed_home_html() -> Bool { artifact_matches_emit(path: js_site_html_artifact_path(id: Home), expected: expected_home_html) } -test fn witness_committed_browse_html() -> Bool { +fn witness_committed_browse_html() -> Bool { artifact_matches_emit(path: js_site_html_artifact_path(id: Browse), expected: expected_browse_html) } -test fn witness_committed_about_html() -> Bool { +fn witness_committed_about_html() -> Bool { artifact_matches_emit(path: js_site_html_artifact_path(id: About), expected: expected_about_html) } -test fn witness_committed_home_tsx() -> Bool { +fn witness_committed_home_tsx() -> Bool { artifact_matches_emit(path: js_site_tsx_artifact_path(id: Home), expected: expected_home_tsx) } -test fn witness_committed_browse_tsx() -> Bool { +fn witness_committed_browse_tsx() -> Bool { artifact_matches_emit(path: js_site_tsx_artifact_path(id: Browse), expected: expected_browse_tsx) } -test fn witness_committed_about_tsx() -> Bool { +fn witness_committed_about_tsx() -> Bool { artifact_matches_emit(path: js_site_tsx_artifact_path(id: About), expected: expected_about_tsx) } +test fn js_site_emit_keystone_holds() -> Bool { + witness_three_page_source() + && witness_home_html_emit() + && witness_browse_html_emit() + && witness_about_html_emit() + && witness_home_tsx_emit() + && witness_browse_tsx_emit() + && witness_about_tsx_emit() + && witness_committed_home_html() + && witness_committed_browse_html() + && witness_committed_about_html() + && witness_committed_home_tsx() + && witness_committed_browse_tsx() + && witness_committed_about_tsx() + && witness_hostile_html_rejected() + && witness_hostile_tsx_rejected() +} diff --git a/dag/test/claim/json_emit_witness_test.dag b/dag/test/claim/json_emit_witness_test.dag index 9beac7a0d05..c086cc03a8e 100644 --- a/dag/test/claim/json_emit_witness_test.dag +++ b/dag/test/claim/json_emit_witness_test.dag @@ -1,100 +1,101 @@ module test.claim.json_emit_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_json_cites_rfc8259() -> Bool { +fn witness_json_cites_rfc8259() -> Bool { match extdeps.languages.json.emit.extdeps_external_authority_anchor { ExternalAuthority { uri } => uri.locator == "www.rfc-editor.org/rfc/rfc8259" } } -test fn witness_escape_backslash_and_quote() -> Bool { +fn witness_escape_backslash_and_quote() -> Bool { escape_json_string(s: "a\"b\\c") == "a\\\"b\\\\c" } -test fn witness_escape_newline() -> Bool { +fn witness_escape_newline() -> Bool { escape_json_string(s: "line one\nline two") == "line one\\nline two" } -test fn witness_escape_tab() -> Bool { +fn witness_escape_tab() -> Bool { escape_json_string(s: concat("a", concat(from_code_point(cp: 9), "b"))) == "a\\tb" } -test fn witness_escape_carriage_return() -> Bool { +fn witness_escape_carriage_return() -> Bool { escape_json_string(s: concat("x", concat(from_code_point(cp: 13), "y"))) == "x\\ry" } -test fn witness_escape_control_u0001() -> Bool { +fn witness_escape_control_u0001() -> Bool { escape_json_string(s: from_code_point(cp: 1)) == "\\u0001" } -test fn witness_quote_json_string() -> Bool { +fn witness_quote_json_string() -> Bool { quote_json_string(s: "hello") == "\"hello\"" && quote_json_string(s: "a\"b") == "\"a\\\"b\"" } -test fn witness_serialize_null() -> Bool { +fn witness_serialize_null() -> Bool { serialize_json(v: json_null()) == "null" } -test fn witness_serialize_bool() -> Bool { +fn witness_serialize_bool() -> Bool { serialize_json(v: json_bool(b: true)) == "true" && serialize_json(v: json_bool(b: false)) == "false" } -test fn witness_serialize_int() -> Bool { +fn witness_serialize_int() -> Bool { serialize_json(v: json_int(n: 42)) == "42" } -test fn witness_serialize_object() -> Bool { +fn witness_serialize_object() -> Bool { serialize_json(v: json_object(members: [ json_kv(key: "host", value: json_string(s: "srv1")), json_kv(key: "runner_count", value: json_int(n: 4)), ])) == "{\"host\": \"srv1\", \"runner_count\": 4}" } -test fn witness_serialize_nested_object() -> Bool { +fn witness_serialize_nested_object() -> Bool { serialize_json(v: json_object(members: [ json_kv(key: "Password", value: json_string(s: "secret")), ])) == "{\"Password\": \"secret\"}" } -test fn witness_serialize_array() -> Bool { +fn witness_serialize_array() -> Bool { serialize_json(v: json_array(elements: [json_string(s: "a"), json_string(s: "b")])) == "[\"a\", \"b\"]" } -test fn witness_int_list_helper() -> Bool { +fn witness_int_list_helper() -> Bool { json_int_list(nums: [1, 2, 3]) == "[1, 2, 3]" } -test fn witness_str_list_helper() -> Bool { +fn witness_str_list_helper() -> Bool { json_str_list(items: ["x", "y"]) == "[\"x\", \"y\"]" } -test fn witness_grammar_rows_cover_json_value_variants() -> Bool { +fn witness_grammar_rows_cover_json_value_variants() -> Bool { length(xs: json_production_rows) >= 8 } -test fn witness_invalid_number_lexeme_rejected() -> Bool { +fn witness_invalid_number_lexeme_rejected() -> Bool { !json_number_lexeme_valid(s: "not-a-number") && !json_number_lexeme_valid(s: "12abc") && !json_number_lexeme_valid(s: "") && !json_number_lexeme_valid(s: "01") } -test fn witness_json_int_lexeme_always_valid() -> Bool { +fn witness_json_int_lexeme_always_valid() -> Bool { json_number_lexeme_valid(s: json_int_lexeme(n: 42) as String) && json_number_lexeme_valid(s: json_int_lexeme(n: -7) as String) && json_number_lexeme_valid(s: json_int_lexeme(n: 0) as String) } -test fn witness_json_number_lexeme_valid_accepts_fraction_and_exp() -> Bool { +fn witness_json_number_lexeme_valid_accepts_fraction_and_exp() -> Bool { json_number_lexeme_valid(s: "12.34") && json_number_lexeme_valid(s: "1e10") && json_number_lexeme_valid(s: "-0.5e+2") } -test fn witness_json_number_lexeme_refuses_invalid_at_construction() -> Bool { +fn witness_json_number_lexeme_refuses_invalid_at_construction() -> Bool { match json_number_lexeme(s: "not-a-number") { none => true Present { value: _ } => false @@ -109,7 +110,7 @@ test fn witness_json_number_lexeme_refuses_invalid_at_construction() -> Bool { } } -test fn witness_json_number_lexeme_accepts_valid_at_construction() -> Bool { +fn witness_json_number_lexeme_accepts_valid_at_construction() -> Bool { match json_number_lexeme(s: "12.34") { Present { value: l } => (l as String) == "12.34" none => false @@ -120,18 +121,44 @@ test fn witness_json_number_lexeme_accepts_valid_at_construction() -> Bool { } } -test fn witness_json_number_from_lexeme_string_refuses_invalid() -> Bool { +fn witness_json_number_from_lexeme_string_refuses_invalid() -> Bool { match json_number_from_lexeme_string(s: "01") { Absent => true Present { value: _ } => false } } -test fn witness_unicode_escape_hex4_boundary_0fff() -> Bool { +fn witness_unicode_escape_hex4_boundary_0fff() -> Bool { json_unicode_escape_hex4(cp: 4095) == "0FFF" } -test fn witness_unicode_escape_hex4_boundary_ffff() -> Bool { +fn witness_unicode_escape_hex4_boundary_ffff() -> Bool { json_unicode_escape_hex4(cp: 65535) == "FFFF" } +test fn json_emit_witnesses() -> Bool { + witness_json_cites_rfc8259() + && witness_escape_backslash_and_quote() + && witness_escape_newline() + && witness_escape_tab() + && witness_escape_carriage_return() + && witness_escape_control_u0001() + && witness_quote_json_string() + && witness_serialize_null() + && witness_serialize_bool() + && witness_serialize_int() + && witness_serialize_object() + && witness_serialize_nested_object() + && witness_serialize_array() + && witness_int_list_helper() + && witness_str_list_helper() + && witness_grammar_rows_cover_json_value_variants() + && witness_invalid_number_lexeme_rejected() + && witness_json_int_lexeme_always_valid() + && witness_json_number_lexeme_valid_accepts_fraction_and_exp() + && witness_json_number_lexeme_refuses_invalid_at_construction() + && witness_json_number_lexeme_accepts_valid_at_construction() + && witness_json_number_from_lexeme_string_refuses_invalid() + && witness_unicode_escape_hex4_boundary_0fff() + && witness_unicode_escape_hex4_boundary_ffff() +} diff --git a/dag/test/claim/keyed_delta_fold_witness_test.dag b/dag/test/claim/keyed_delta_fold_witness_test.dag index 44f9ae279c2..2a0f594964a 100644 --- a/dag/test/claim/keyed_delta_fold_witness_test.dag +++ b/dag/test/claim/keyed_delta_fold_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.keyed_delta_fold_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly type FixtureVal { @@ -81,7 +82,7 @@ fn fixture_removed_hunk() -> KeyedPatch { ) } -test fn witness_patch_monoid_left_identity() -> Bool { +fn witness_patch_monoid_left_identity() -> Bool { let monoid = keyed_patch_monoid() keyed_patches_equal( left: keyed_patch_append(left: monoid.identity, right: fixture_modified_hunk()), @@ -91,7 +92,7 @@ test fn witness_patch_monoid_left_identity() -> Bool { ) } -test fn witness_patch_monoid_right_identity() -> Bool { +fn witness_patch_monoid_right_identity() -> Bool { let monoid = keyed_patch_monoid() keyed_patches_equal( left: keyed_patch_append(left: fixture_modified_hunk(), right: monoid.identity), @@ -101,7 +102,7 @@ test fn witness_patch_monoid_right_identity() -> Bool { ) } -test fn witness_patch_monoid_associativity() -> Bool { +fn witness_patch_monoid_associativity() -> Bool { let a = fixture_modified_hunk() let b = fixture_added_hunk() let c = fixture_removed_hunk() @@ -113,7 +114,7 @@ test fn witness_patch_monoid_associativity() -> Bool { ) } -test fn witness_patch_fold_matches_diff() -> Bool { +fn witness_patch_fold_matches_diff() -> Bool { keyed_patches_equal( left: keyed_patch_fold( contributions: [ @@ -136,7 +137,7 @@ test fn witness_patch_fold_matches_diff() -> Bool { ) } -test fn witness_three_way_patch_monoid_identity() -> Bool { +fn witness_three_way_patch_monoid_identity() -> Bool { let monoid = keyed_three_way_patch_monoid(key_eq: fixture_key_eq, value_eq: fixture_val_eq) let patch = keyed_three_way_fold( base: fixture_rows_a(), @@ -153,7 +154,7 @@ test fn witness_three_way_patch_monoid_identity() -> Bool { ).entries) == list_length(items: patch.entries) } -test fn witness_leaf_verdict_join_bottom() -> Bool { +fn witness_leaf_verdict_join_bottom() -> Bool { match keyed_leaf_verdict_join( a: KeyedUnchanged, b: KeyedUnchanged, @@ -188,7 +189,7 @@ test fn witness_leaf_verdict_join_bottom() -> Bool { } } -test fn witness_leaf_verdict_join_added_idempotent() -> Bool { +fn witness_leaf_verdict_join_added_idempotent() -> Bool { let added = fixture_verdict_added(label: "new") match keyed_leaf_verdict_join(a: added, b: added, equal: fixture_val_eq) { KeyedVerdictAdded { value: v } => v.payload == "new" @@ -196,7 +197,7 @@ test fn witness_leaf_verdict_join_added_idempotent() -> Bool { } } -test fn witness_leaf_verdict_join_removed_idempotent() -> Bool { +fn witness_leaf_verdict_join_removed_idempotent() -> Bool { let removed = fixture_verdict_removed(label: "old") match keyed_leaf_verdict_join(a: removed, b: removed, equal: fixture_val_eq) { KeyedVerdictRemoved { value: v } => v.payload == "old" @@ -204,7 +205,7 @@ test fn witness_leaf_verdict_join_removed_idempotent() -> Bool { } } -test fn witness_leaf_verdict_join_added_disagree_is_conflict() -> Bool { +fn witness_leaf_verdict_join_added_disagree_is_conflict() -> Bool { match keyed_leaf_verdict_join( a: fixture_verdict_added(label: "one"), b: fixture_verdict_added(label: "two"), @@ -215,7 +216,7 @@ test fn witness_leaf_verdict_join_added_disagree_is_conflict() -> Bool { } } -test fn witness_diff_identity_law() -> Bool { +fn witness_diff_identity_law() -> Bool { keyed_patches_equal( left: keyed_two_way_diff( left: fixture_rows_a(), @@ -229,7 +230,7 @@ test fn witness_diff_identity_law() -> Bool { ) } -test fn witness_apply_diff_law_modified() -> Bool { +fn witness_apply_diff_law_modified() -> Bool { keyed_rows_snapshot_equal( left: keyed_apply_two_way_diff( left: fixture_rows_a(), @@ -243,7 +244,7 @@ test fn witness_apply_diff_law_modified() -> Bool { ) } -test fn witness_apply_added_is_upsert() -> Bool { +fn witness_apply_added_is_upsert() -> Bool { let patch = fixture_added_hunk() let once = keyed_apply_patch( rows: fixture_rows_a(), @@ -264,7 +265,7 @@ test fn witness_apply_added_is_upsert() -> Bool { ) } -test fn witness_apply_diff_law_added() -> Bool { +fn witness_apply_diff_law_added() -> Bool { keyed_rows_snapshot_equal( left: keyed_apply_two_way_diff( left: fixture_rows_a(), @@ -278,7 +279,7 @@ test fn witness_apply_diff_law_added() -> Bool { ) } -test fn witness_apply_diff_law_removed() -> Bool { +fn witness_apply_diff_law_removed() -> Bool { keyed_rows_snapshot_equal( left: keyed_apply_two_way_diff( left: fixture_rows_a(), @@ -292,7 +293,7 @@ test fn witness_apply_diff_law_removed() -> Bool { ) } -test fn witness_inverse_retract_law_modified() -> Bool { +fn witness_inverse_retract_law_modified() -> Bool { keyed_rows_snapshot_equal( left: keyed_retract_two_way_diff( left: fixture_rows_a(), @@ -306,7 +307,7 @@ test fn witness_inverse_retract_law_modified() -> Bool { ) } -test fn witness_inverse_retract_law_added() -> Bool { +fn witness_inverse_retract_law_added() -> Bool { keyed_rows_snapshot_equal( left: keyed_retract_two_way_diff( left: fixture_rows_a(), @@ -320,7 +321,7 @@ test fn witness_inverse_retract_law_added() -> Bool { ) } -test fn witness_inverse_retract_law_removed() -> Bool { +fn witness_inverse_retract_law_removed() -> Bool { keyed_rows_snapshot_equal( left: keyed_retract_two_way_diff( left: fixture_rows_a(), @@ -334,7 +335,7 @@ test fn witness_inverse_retract_law_removed() -> Bool { ) } -test fn witness_unchanged_rows_emit_no_hunk() -> Bool { +fn witness_unchanged_rows_emit_no_hunk() -> Bool { keyed_patch_hunk_count( patch: keyed_two_way_diff( left: fixture_rows_a(), @@ -345,7 +346,7 @@ test fn witness_unchanged_rows_emit_no_hunk() -> Bool { ) == 0 } -test fn witness_reorder_invariance() -> Bool { +fn witness_reorder_invariance() -> Bool { keyed_patches_equal( left: keyed_two_way_diff( left: fixture_rows_a(), @@ -364,7 +365,7 @@ test fn witness_reorder_invariance() -> Bool { ) } -test fn witness_added_hunk() -> Bool { +fn witness_added_hunk() -> Bool { let patch = fixture_added_hunk() keyed_patch_hunk_count(patch: patch) == 1 && fold(patch.hunks, init: false, f: fn(found, hunk) { @@ -375,7 +376,7 @@ test fn witness_added_hunk() -> Bool { }) } -test fn witness_removed_hunk() -> Bool { +fn witness_removed_hunk() -> Bool { let patch = fixture_removed_hunk() keyed_patch_hunk_count(patch: patch) == 1 && fold(patch.hunks, init: false, f: fn(found, hunk) { @@ -386,7 +387,7 @@ test fn witness_removed_hunk() -> Bool { }) } -test fn witness_modified_hunk() -> Bool { +fn witness_modified_hunk() -> Bool { let patch = fixture_modified_hunk() keyed_patch_hunk_count(patch: patch) == 1 && fold(patch.hunks, init: false, f: fn(found, hunk) { @@ -397,7 +398,7 @@ test fn witness_modified_hunk() -> Bool { }) } -test fn witness_three_way_apply_hunk() -> Bool { +fn witness_three_way_apply_hunk() -> Bool { match keyed_three_way_leaf( base: fixture_val(payload: "one"), observed: fixture_val(payload: "one"), @@ -410,7 +411,7 @@ test fn witness_three_way_apply_hunk() -> Bool { } } -test fn witness_three_way_noop() -> Bool { +fn witness_three_way_noop() -> Bool { match keyed_three_way_leaf( base: fixture_val(payload: "one"), observed: fixture_val(payload: "two"), @@ -422,7 +423,7 @@ test fn witness_three_way_noop() -> Bool { } } -test fn witness_three_way_conflict() -> Bool { +fn witness_three_way_conflict() -> Bool { match keyed_three_way_leaf( base: fixture_val(payload: "one"), observed: fixture_val(payload: "drift"), @@ -437,7 +438,7 @@ test fn witness_three_way_conflict() -> Bool { } } -test fn witness_conflict_has_no_mutation_arm() -> Bool { +fn witness_conflict_has_no_mutation_arm() -> Bool { let blocked = KeyedConflict match blocked { KeyedConflict => true @@ -455,7 +456,7 @@ fn fixture_apply_verdict(from_label: String, to_label: String) -> KeyedLeafVerdi } } -test fn witness_apply_verdict_has_mutation_arm() -> Bool { +fn witness_apply_verdict_has_mutation_arm() -> Bool { match fixture_apply_verdict(from_label: "a", to_label: "b") { KeyedApplyHunk { from: f, to: t } => f.payload == "a" && t.payload == "b" @@ -471,7 +472,7 @@ fn fixture_verdict_removed(label: String) -> KeyedLeafVerdict { KeyedVerdictRemoved { value: fixture_val(payload: label) } } -test fn witness_verdict_add_is_not_remove() -> Bool { +fn witness_verdict_add_is_not_remove() -> Bool { match fixture_verdict_added(label: "new") { KeyedVerdictAdded { value: v } => v.payload == "new" _ => false @@ -482,7 +483,7 @@ test fn witness_verdict_add_is_not_remove() -> Bool { } } -test fn witness_three_way_fold_omits_unchanged() -> Bool { +fn witness_three_way_fold_omits_unchanged() -> Bool { let patch = keyed_three_way_fold( base: fixture_rows_a(), observed: fixture_rows_a(), @@ -496,7 +497,7 @@ test fn witness_three_way_fold_omits_unchanged() -> Bool { }) } -test fn witness_identity_law_red_control() -> Bool { +fn witness_identity_law_red_control() -> Bool { keyed_patch_hunk_count( patch: keyed_two_way_diff( left: fixture_rows_a(), @@ -507,3 +508,35 @@ test fn witness_identity_law_red_control() -> Bool { ) != 0 } +test fn keyed_delta_fold_keystone_holds() -> Bool { + witness_patch_monoid_left_identity() + && witness_patch_monoid_right_identity() + && witness_patch_monoid_associativity() + && witness_patch_fold_matches_diff() + && witness_three_way_patch_monoid_identity() + && witness_leaf_verdict_join_bottom() + && witness_leaf_verdict_join_added_idempotent() + && witness_leaf_verdict_join_removed_idempotent() + && witness_leaf_verdict_join_added_disagree_is_conflict() + && witness_diff_identity_law() + && witness_apply_diff_law_modified() + && witness_apply_added_is_upsert() + && witness_apply_diff_law_added() + && witness_apply_diff_law_removed() + && witness_inverse_retract_law_modified() + && witness_inverse_retract_law_added() + && witness_inverse_retract_law_removed() + && witness_unchanged_rows_emit_no_hunk() + && witness_reorder_invariance() + && witness_added_hunk() + && witness_removed_hunk() + && witness_modified_hunk() + && witness_three_way_apply_hunk() + && witness_three_way_noop() + && witness_three_way_conflict() + && witness_conflict_has_no_mutation_arm() + && witness_apply_verdict_has_mutation_arm() + && witness_verdict_add_is_not_remove() + && witness_three_way_fold_omits_unchanged() + && witness_identity_law_red_control() +} diff --git a/dag/test/claim/layout_render_witness_test.dag b/dag/test/claim/layout_render_witness_test.dag index 7bc4ce182d8..109212fe900 100644 --- a/dag/test/claim/layout_render_witness_test.dag +++ b/dag/test/claim/layout_render_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.layout_render_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data flat_proto: LayoutProtocol = LayoutProtocol { indent_unit: "" } @@ -17,35 +18,35 @@ fn nested_doc(levels: Int) -> Doc { ]) } -test fn witness_flat_lines() -> Bool { +fn witness_flat_lines() -> Bool { render(doc: flat_doc(), proto: flat_proto) == "a\nb\n" } -test fn witness_nesting_applies_indent() -> Bool { +fn witness_nesting_applies_indent() -> Bool { render(doc: nested_doc(levels: 1), proto: yaml_proto) == "root:\n child\n" } -test fn witness_nest_level_discriminates() -> Bool { +fn witness_nest_level_discriminates() -> Bool { render(doc: nested_doc(levels: 1), proto: yaml_proto) != render(doc: nested_doc(levels: 2), proto: yaml_proto) } -test fn witness_indent_unit_discriminates() -> Bool { +fn witness_indent_unit_discriminates() -> Bool { render(doc: nested_doc(levels: 1), proto: yaml_proto) != render(doc: nested_doc(levels: 1), proto: flat_proto) } -test fn witness_blank_line_carries_no_indent() -> Bool { +fn witness_blank_line_carries_no_indent() -> Bool { let d = doc_concat(parts: [doc_text(text: "k:"), DocLine, doc_blank(), doc_nest(levels: 3, body: doc_concat(parts: [doc_text(text: "x"), DocLine]))]) render(doc: d, proto: yaml_proto) == "k:\n\n x\n" } -test fn witness_trailing_line_no_trailing_indent() -> Bool { +fn witness_trailing_line_no_trailing_indent() -> Bool { let d = doc_nest(levels: 2, body: doc_concat(parts: [doc_text(text: "deep"), DocLine])) render(doc: d, proto: yaml_proto) == " deep\n" } -test fn witness_dash_nest_alignment() -> Bool { +fn witness_dash_nest_alignment() -> Bool { let item = doc_concat(parts: [ doc_text(text: "- "), doc_nest(levels: 1, body: doc_concat(parts: [doc_text(text: "name: a"), DocLine, doc_text(text: "run: x"), DocLine])) @@ -53,9 +54,19 @@ test fn witness_dash_nest_alignment() -> Bool { render(doc: item, proto: yaml_proto) == "- name: a\n run: x\n" } -test fn witness_render_is_format_agnostic() -> Bool { +fn witness_render_is_format_agnostic() -> Bool { let flat = render(doc: flat_doc(), proto: flat_proto) let nested = render(doc: nested_doc(levels: 1), proto: yaml_proto) (flat == "a\nb\n") && (nested == "root:\n child\n") } +test fn layout_render_keystone_holds() -> Bool { + witness_flat_lines() && + witness_nesting_applies_indent() && + witness_nest_level_discriminates() && + witness_indent_unit_discriminates() && + witness_blank_line_carries_no_indent() && + witness_trailing_line_no_trailing_indent() && + witness_dash_nest_alignment() && + witness_render_is_format_agnostic() +} diff --git a/dag/test/claim/lens_verdict_witness_test.dag b/dag/test/claim/lens_verdict_witness_test.dag index 3cc7fb12472..c64e77fe425 100644 --- a/dag/test/claim/lens_verdict_witness_test.dag +++ b/dag/test/claim/lens_verdict_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.lens_verdict_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_module: String = "test.claim.lens_verdict_witness" @@ -22,35 +23,35 @@ fn sample_holds() -> v2.std.lens_verdict.LensVerdict { Holds } -test fn witness_fail_closed_green_on_unrealized() -> Bool { +fn witness_fail_closed_green_on_unrealized() -> Bool { match sample_unrealized() { Unrealized { diagnostic: _ } => true _ => false } } -test fn witness_fail_closed_red_on_holds() -> Bool { +fn witness_fail_closed_red_on_holds() -> Bool { match sample_holds() { Unrealized { diagnostic: _ } => false _ => true } } -test fn witness_is_violation_green_on_violation() -> Bool { +fn witness_is_violation_green_on_violation() -> Bool { match sample_violation() { Violation { diagnostic: _ } => true _ => false } } -test fn witness_is_violation_red_on_holds() -> Bool { +fn witness_is_violation_red_on_holds() -> Bool { match sample_holds() { Violation { diagnostic: _ } => false _ => true } } -test fn witness_locus_green_on_violation() -> Bool { +fn witness_locus_green_on_violation() -> Bool { match sample_violation() { Violation { diagnostic: d } => v2.std.lens_verdict.lens_verdict_diagnostic_locus_module(d: d) == witness_module @@ -58,7 +59,7 @@ test fn witness_locus_green_on_violation() -> Bool { } } -test fn witness_locus_red_on_perturbed_module() -> Bool { +fn witness_locus_red_on_perturbed_module() -> Bool { let perturbed = v2.std.lens_verdict.lens_verdict_module_violation( reason: ^lens_verdict_witness_perturbed, module_name: "test.claim.lens_verdict_witness_wrong_module" @@ -70,3 +71,11 @@ test fn witness_locus_red_on_perturbed_module() -> Bool { } } +test fn lens_verdict_witnesses() -> Bool { + witness_fail_closed_green_on_unrealized() + && witness_fail_closed_red_on_holds() + && witness_is_violation_green_on_violation() + && witness_is_violation_red_on_holds() + && witness_locus_green_on_violation() + && witness_locus_red_on_perturbed_module() +} diff --git a/dag/test/claim/live_deploy/apply_witness_test.dag b/dag/test/claim/live_deploy/apply_witness_test.dag index 2fdb2f63369..10922ac297a 100644 --- a/dag/test/claim/live_deploy/apply_witness_test.dag +++ b/dag/test/claim/live_deploy/apply_witness_test.dag @@ -72,7 +72,7 @@ fn fixture_service_not_ready_readiness() -> Reconciliation Bool { +fn witness_red_control_mutation_without_readiness_cannot_converge() -> Bool { !reconciliation_converged( r: live_deploy_apply_readiness_gate_with_readiness( mutation: fixture_converged_mutation(), @@ -81,7 +81,7 @@ test fn witness_red_control_mutation_without_readiness_cannot_converge() -> Bool ) } -test fn witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() -> Bool { +fn witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() -> Bool { match live_deploy_apply_readiness_gate_with_readiness( mutation: fixture_converged_mutation(), readiness: fixture_service_not_ready_readiness(), @@ -93,7 +93,7 @@ test fn witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() } } -test fn witness_digest_readback_script_is_bounded_and_post_mutation() -> Bool { +fn witness_digest_readback_script_is_bounded_and_post_mutation() -> Bool { let port = deployment_plan_listen_port(spec: deployment_spec_srv1()) let script = roadmap_site_digest_readback_script(port: port) string_contains(s: script, pattern: roadmap_site_roadmap_url_path) @@ -104,3 +104,8 @@ test fn witness_digest_readback_script_is_bounded_and_post_mutation() -> Bool { && !string_contains(s: script, pattern: "healthz json parse failed") } +test fn live_deploy_apply_witnesses() -> Bool { + witness_red_control_mutation_without_readiness_cannot_converge() + && witness_red_control_service_not_ready_reason_surfaces_on_blocked_apply() + && witness_digest_readback_script_is_bounded_and_post_mutation() +} diff --git a/dag/test/claim/live_deploy/emit_test.dag b/dag/test/claim/live_deploy/emit_test.dag index b4077d7df01..118dc4ff322 100644 --- a/dag/test/claim/live_deploy/emit_test.dag +++ b/dag/test/claim/live_deploy/emit_test.dag @@ -52,22 +52,22 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_spec_targets_srv1() -> Bool { +fn witness_spec_targets_srv1() -> Bool { deployment_plan_host_identity(spec: deployment_spec_srv1()) == "srv1" } -test fn witness_spec_uses_apt_package_manager() -> Bool { +fn witness_spec_uses_apt_package_manager() -> Bool { match deployment_spec_srv1().target.os_package_manager { Apt => true _ => false } } -test fn witness_spec_listen_port_is_8080() -> Bool { +fn witness_spec_listen_port_is_8080() -> Bool { deployment_plan_listen_port(spec: deployment_spec_srv1()) == 8080 } -test fn witness_owned_vs_ensured_typed() -> Bool { +fn witness_owned_vs_ensured_typed() -> Bool { let spec = deployment_spec_srv1() let has_owned = fold(spec.steps, init: false, f: (acc, s) => match s { @@ -84,25 +84,25 @@ test fn witness_owned_vs_ensured_typed() -> Bool { has_owned && has_ensured } -test fn witness_retract_owned_only() -> Bool { +fn witness_retract_owned_only() -> Bool { count(deployment_owned_steps_retract_order()) == 5 } -test fn witness_tailnet_domain_propagates_optional() -> Bool { +fn witness_tailnet_domain_propagates_optional() -> Bool { match deployment_spec_srv1().target.tailnet_domain { Present { value: d } => d == "tailecbe08.ts.net" Absent => false } } -test fn witness_tailnet_url_absent_not_fabricated() -> Bool { +fn witness_tailnet_url_absent_not_fabricated() -> Bool { match deployment_tailnet_url(spec: deployment_spec_srv1()) { Present { value: url } => string_contains(s: url, pattern: "https://srv1.tailecbe08.ts.net") Absent => false } } -test fn witness_dependency_ensure_is_idempotent() -> Bool { +fn witness_dependency_ensure_is_idempotent() -> Bool { let tailscale = deployment_ensure_dependency_script( dep: DeploymentDependencyStep { kind: TailscalePackage, package: package_tailscale } ) @@ -115,7 +115,7 @@ test fn witness_dependency_ensure_is_idempotent() -> Bool { && string_contains(s: tmux, pattern: "apt-get install --yes tmux") } -test fn witness_apply_script_contains_preflight_and_sudoers() -> Bool { +fn witness_apply_script_contains_preflight_and_sudoers() -> Bool { let sh = expected_live_deploy_apply_script() string_contains(s: sh, pattern: "deploy-access-bootstrap-preflight") && string_contains(s: sh, pattern: "whoami") @@ -129,13 +129,13 @@ test fn witness_apply_script_contains_preflight_and_sudoers() -> Bool { && !string_contains(s: sh, pattern: "gunbc-deploy-privileged") } -test fn witness_retract_preamble_acknowledges_shared_sudoers_install() -> Bool { +fn witness_retract_preamble_acknowledges_shared_sudoers_install() -> Bool { let sh = expected_live_deploy_retract_script() string_contains(s: sh, pattern: "first retract-after-flip may be the dropin install") && string_contains(s: sh, pattern: "sudo -n -l /usr/bin/tailscale >/dev/null 2>&1") } -test fn witness_apply_script_contains_systemd_and_tailscale() -> Bool { +fn witness_apply_script_contains_systemd_and_tailscale() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "sudo bash") && string_contains(s: sh, pattern: "sudo -n install -d -m 0755 -o briansrls -g briansrls /opt/gunbc/gunbc") @@ -155,7 +155,7 @@ test fn witness_apply_script_contains_systemd_and_tailscale() -> Bool { data unprivileged_principal_witness_note: String = "Discriminating RED for the run-29822498755 regression class: the ci-runner principal (fleet_posix_accounts FleetAccountCiRunner) holds NO rsync/chown/rmdir grant and no write on the service-user-owned tree, so a bare rsync/chown/rmdir in either script is a deploy that fails on the host again. The tree sync must instead ride the service-user oneshot unit (both rsync directions live INSIDE gunbc-tree-sync.service, principal User=briansrls), and every mutation outside it must be one of the five granted sudo -n commands. Post-hoc admission of each sudo -n command against the ci_deploy_access grant envelope is the named residue (emit_deploy_principal_note)." -test fn witness_scripts_stay_within_ci_runner_grants() -> Bool { +fn witness_scripts_stay_within_ci_runner_grants() -> Bool { let apply = expected_live_deploy_apply_script() let retract = expected_live_deploy_retract_script() let unit = live_deploy_tree_sync_unit_for(spec: deployment_spec_srv1()) @@ -179,12 +179,12 @@ test fn witness_scripts_stay_within_ci_runner_grants() -> Bool { data tree_sync_restart_diagnosis_witness_note: String = "Discriminating RED for #7011/receipt 29928424523: the tree-sync restart is synchronous and precedes the poll-based unit_diagnosis capture, so a bare restart failure carries no WHY. The apply script must fall through to the same unit-status-tail authority the roadmap-unit diagnosis already uses (never a second format), append it to stderr, and still fail the step — never proceed as if the restart had succeeded." -test fn witness_tree_sync_restart_diagnoses_on_failure() -> Bool { +fn witness_tree_sync_restart_diagnoses_on_failure() -> Bool { let sh = expected_live_deploy_apply_script() string_contains(s: sh, pattern: "sudo -n systemctl restart gunbc-tree-sync.service || { echo '--- gunbc-tree-sync.service control-process diagnosis ---' >&2; systemctl status --no-pager --full gunbc-tree-sync.service 2>&1 | tail -n 40 >&2; exit 1; }") } -test fn witness_retract_script_owned_only() -> Bool { +fn witness_retract_script_owned_only() -> Bool { let sh = expected_live_deploy_retract_script() !string_contains(s: sh, pattern: "sudo bash") && string_contains(s: sh, pattern: "sudo -n tailscale serve reset") @@ -202,20 +202,20 @@ test fn witness_retract_script_owned_only() -> Bool { data apply_no_frozen_page_note: String = "The belt-B section-3 fix made executable: the apply script ships NO emitted node server and NO deploy-frozen page snapshot — the service renders the live roadmap per request. These two witnesses red if either ever creeps back into the apply script." -test fn witness_apply_script_has_no_node_server() -> Bool { +fn witness_apply_script_has_no_node_server() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "require('http').createServer") && !string_contains(s: sh, pattern: "server.js") && string_contains(s: sh, pattern: "gunbc serve") } -test fn witness_apply_script_has_no_frozen_page() -> Bool { +fn witness_apply_script_has_no_frozen_page() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "roadmap-section") && !string_contains(s: sh, pattern: " Bool { +fn witness_apply_script_excludes_readback_curls() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "roadmap-site-readback") && !string_contains(s: sh, pattern: "roadmap-site-receipt") @@ -224,7 +224,7 @@ test fn witness_apply_script_excludes_readback_curls() -> Bool { && !string_contains(s: sh, pattern: "--connect-timeout") } -test fn witness_retract_owned_process_removes_serve_service() -> Bool { +fn witness_retract_owned_process_removes_serve_service() -> Bool { let sh = expected_live_deploy_retract_script() string_contains(s: sh, pattern: "/opt/gunbc/bin/gunbc") && string_contains(s: sh, pattern: gunbc_roadmap_unit_name) @@ -234,7 +234,7 @@ test fn witness_retract_owned_process_removes_serve_service() -> Bool { && !string_contains(s: sh, pattern: "roadmap-site-readback") } -test fn witness_systemd_unit_emitted() -> Bool { +fn witness_systemd_unit_emitted() -> Bool { let unit = live_deploy_systemd_unit_for(spec: deployment_spec_srv1()) string_contains(s: unit, pattern: "ExecStart=/opt/gunbc/bin/gunbc serve --source-root dag --source-root src/v2 --entry dag/gunbc/roadmap_serve.dag --function roadmap_serve_handle --host 0.0.0.0 --port 8080") && string_contains(s: unit, pattern: "User=briansrls") @@ -243,7 +243,7 @@ test fn witness_systemd_unit_emitted() -> Bool { && !string_contains(s: unit, pattern: "node") } -test fn witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis() -> Bool { +fn witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis() -> Bool { match live_deploy_remote_mutation_service_op_realization_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -255,14 +255,14 @@ test fn witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_ } } -test fn witness_emit_shell_dissolution_trigger_is_scaffold() -> Bool { +fn witness_emit_shell_dissolution_trigger_is_scaffold() -> Bool { match live_deploy_emit_shell_dissolution_trigger { Scaffold { dissolves_to: _, bind: _ } => true Terminal { reason: _ } => false } } -test fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { +fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { match live_deploy_intent_dependency_graph_emit_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -273,7 +273,7 @@ test fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Boo } } -test fn witness_apply_script_matches_committed_golden() -> Bool { +fn witness_apply_script_matches_committed_golden() -> Bool { let r = Filesystem.Read(path: artifact_path(a: LiveDeployApplyScriptArtifact)) let expected = expected_live_deploy_apply_script() r.success @@ -281,7 +281,7 @@ test fn witness_apply_script_matches_committed_golden() -> Bool { && !(concat(r.content, "x") == expected) } -test fn witness_retract_script_matches_committed_golden() -> Bool { +fn witness_retract_script_matches_committed_golden() -> Bool { let r = Filesystem.Read(path: artifact_path(a: LiveDeployRetractScriptArtifact)) let expected = expected_live_deploy_retract_script() r.success @@ -291,7 +291,7 @@ test fn witness_retract_script_matches_committed_golden() -> Bool { data emit_poison_backstop_witness_note: String = "GOLDEN-INDEPENDENT backstop (calm-ferret pass-2 flag 2): the emit-level poison markers (teardown-dependency-unreachable, wholesale-refused) are the defense-in-depth backstop to the PRIMARY typed refusal (the EffectsOrRefusal SUM, proven golden-independent by w_effects_refuses_wholesale_on_any_refusal in the spine test). But the poison backstops are golden-DEPENDENT — a regen while a refusal was buggily active could commit a poisoned golden and the drift gate would then pass. These two witnesses call the refusal producers directly and assert the marker is present, golden-INDEPENDENT, so a golden-absorption can never hide that the arm still refuses loudly." -test fn witness_teardown_dependency_arm_refuses_golden_independent() -> Bool { +fn witness_teardown_dependency_arm_refuses_golden_independent() -> Bool { let steps = emit_deploy_teardown_dependency_refusal(dep: DeploymentDependencyStep { kind: TmuxPackage, package: package_tmux }) count(steps) == 1 && any(steps, s => match s { @@ -300,13 +300,13 @@ test fn witness_teardown_dependency_arm_refuses_golden_independent() -> Bool { }) } -test fn witness_wholesale_refused_poison_carries_marker() -> Bool { +fn witness_wholesale_refused_poison_carries_marker() -> Bool { let poison = live_deploy_wholesale_refused_poison(refusals: [], fold_label: "APPLY") string_contains(s: poison, pattern: "__GUNBC_DEPLOY_REFUSED__") && string_contains(s: poison, pattern: "APPLY refused-member-count=0") } -test fn witness_deploy_access_job_principal_refused_poison_golden_independent() -> Bool { +fn witness_deploy_access_job_principal_refused_poison_golden_independent() -> Bool { let poison = deploy_access_job_principal_refused_emit_poison( refusal: DeployAccessJobPrincipalRefusal { job_user: "runner" as NonEmptyStr, @@ -317,8 +317,38 @@ test fn witness_deploy_access_job_principal_refused_poison_golden_independent() && string_contains(s: poison, pattern: "job_user=runner") } -test fn witness_apply_script_access_ready_not_deploy_access_poison() -> Bool { +fn witness_apply_script_access_ready_not_deploy_access_poison() -> Bool { let sh = expected_live_deploy_apply_script() !string_contains(s: sh, pattern: "__GUNBC_DEPLOY_ACCESS_REFUSED__") } +test fn live_deploy_emit_holds() -> Bool { + witness_spec_targets_srv1() + && witness_spec_uses_apt_package_manager() + && witness_spec_listen_port_is_8080() + && witness_owned_vs_ensured_typed() + && witness_retract_owned_only() + && witness_tailnet_domain_propagates_optional() + && witness_tailnet_url_absent_not_fabricated() + && witness_dependency_ensure_is_idempotent() + && witness_apply_script_contains_preflight_and_sudoers() + && witness_retract_preamble_acknowledges_shared_sudoers_install() + && witness_apply_script_contains_systemd_and_tailscale() + && witness_scripts_stay_within_ci_runner_grants() + && witness_tree_sync_restart_diagnoses_on_failure() + && witness_retract_script_owned_only() + && witness_apply_script_has_no_node_server() + && witness_apply_script_has_no_frozen_page() + && witness_apply_script_excludes_readback_curls() + && witness_retract_owned_process_removes_serve_service() + && witness_systemd_unit_emitted() + && witness_apply_script_matches_committed_golden() + && witness_retract_script_matches_committed_golden() + && witness_remote_mutation_service_op_realization_binds_emit_shell_phase_b_axis() + && witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() + && witness_emit_shell_dissolution_trigger_is_scaffold() + && witness_teardown_dependency_arm_refuses_golden_independent() + && witness_wholesale_refused_poison_carries_marker() + && witness_deploy_access_job_principal_refused_poison_golden_independent() + && witness_apply_script_access_ready_not_deploy_access_poison() +} diff --git a/dag/test/claim/live_deploy/intent_witness_test.dag b/dag/test/claim/live_deploy/intent_witness_test.dag index def6bbd1051..27e4340d53d 100644 --- a/dag/test/claim/live_deploy/intent_witness_test.dag +++ b/dag/test/claim/live_deploy/intent_witness_test.dag @@ -18,24 +18,24 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_readback_requires_service_ready_gate() -> Bool { +fn witness_readback_requires_service_ready_gate() -> Bool { let rb = live_deploy_readback_for_spec(spec: deployment_spec_srv1()) second_count(s: rb.after.timeout) == 120 && rb.after.probe.health_url == live_deploy_health_url_for_port(port: 8080) } -test fn witness_health_url_is_localhost_on_srv1() -> Bool { +fn witness_health_url_is_localhost_on_srv1() -> Bool { let url = live_deploy_health_url_for_port(port: 8080) starts_with(s: url as String, prefix: "http://127.0.0.1:8080") && ends_with(s: url as String, suffix: roadmap_site_health_path) } -test fn witness_service_ready_gate_is_required_on_readback() -> Bool { +fn witness_service_ready_gate_is_required_on_readback() -> Bool { let gate = live_deploy_service_ready_gate_for_spec(spec: deployment_spec_srv1()) gate.probe.health_url != "" as NonEmptyStr } -test fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { +fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Bool { match live_deploy_intent_dependency_graph_emit_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -46,3 +46,9 @@ test fn witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() -> Boo } } +test fn live_deploy_intent_witnesses() -> Bool { + witness_readback_requires_service_ready_gate() + && witness_health_url_is_localhost_on_srv1() + && witness_service_ready_gate_is_required_on_readback() + && witness_dependency_graph_emit_frontier_binds_orch_emit_pipeline() +} diff --git a/dag/test/claim/live_deploy/operations_witness_test.dag b/dag/test/claim/live_deploy/operations_witness_test.dag index e1427496c6e..9346c492e83 100644 --- a/dag/test/claim/live_deploy/operations_witness_test.dag +++ b/dag/test/claim/live_deploy/operations_witness_test.dag @@ -36,7 +36,7 @@ fn argv_join(argv: List) -> String { join(argv, " ") } -test fn witness_dpkg_status_argv_matches_transport_row() -> Bool { +fn witness_dpkg_status_argv_matches_transport_row() -> Bool { let helper = dpkg_status_argv(package: package_tailscale) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -51,7 +51,7 @@ test fn witness_dpkg_status_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -test fn witness_apt_install_argv_matches_transport_row() -> Bool { +fn witness_apt_install_argv_matches_transport_row() -> Bool { let helper = apt_install_argv(package: package_nodejs) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -66,7 +66,7 @@ test fn witness_apt_install_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -test fn witness_systemctl_restart_argv_matches_transport_row() -> Bool { +fn witness_systemctl_restart_argv_matches_transport_row() -> Bool { let helper = systemctl_restart_argv(unit: gunbc_roadmap_unit_name) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -81,7 +81,7 @@ test fn witness_systemctl_restart_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -test fn witness_systemctl_disable_now_argv_matches_transport_row() -> Bool { +fn witness_systemctl_disable_now_argv_matches_transport_row() -> Bool { let helper = systemctl_disable_now_argv(unit: gunbc_roadmap_unit_name) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -96,7 +96,7 @@ test fn witness_systemctl_disable_now_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -test fn witness_systemctl_daemon_reload_argv_matches_transport_row() -> Bool { +fn witness_systemctl_daemon_reload_argv_matches_transport_row() -> Bool { let helper = systemctl_daemon_reload_argv() let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -109,7 +109,7 @@ test fn witness_systemctl_daemon_reload_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -test fn witness_systemctl_enable_argv_matches_transport_row() -> Bool { +fn witness_systemctl_enable_argv_matches_transport_row() -> Bool { let helper = systemctl_enable_argv(unit: gunbc_roadmap_unit_name) let transport = operation_argv_tokens_or_refusal_label( m: shell_materialize_operation_argv( @@ -124,38 +124,55 @@ test fn witness_systemctl_enable_argv_matches_transport_row() -> Bool { argv_join(argv: helper) == argv_join(argv: transport) } -test fn witness_dpkg_status_command_matches_transport() -> Bool { +fn witness_dpkg_status_command_matches_transport() -> Bool { dpkg_status_command(package: package_tailscale) == "dpkg -s tailscale" } -test fn witness_apt_install_command_matches_transport() -> Bool { +fn witness_apt_install_command_matches_transport() -> Bool { apt_install_command(package: package_nodejs, privileged: false) == "apt-get install --yes nodejs" } -test fn witness_privileged_apt_install_command() -> Bool { +fn witness_privileged_apt_install_command() -> Bool { apt_install_command(package: package_tailscale, privileged: true) == "sudo -n apt-get install --yes tailscale" } -test fn witness_systemctl_restart_command_matches_transport() -> Bool { +fn witness_systemctl_restart_command_matches_transport() -> Bool { systemctl_restart_command(unit: gunbc_roadmap_unit_name, privileged: true) == "sudo -n systemctl restart gunbc-roadmap.service" } -test fn witness_systemctl_enable_command_matches_transport() -> Bool { +fn witness_systemctl_enable_command_matches_transport() -> Bool { systemctl_enable_command(unit: gunbc_roadmap_unit_name, privileged: true) == "sudo -n systemctl enable gunbc-roadmap.service" } -test fn witness_systemctl_disable_now_command_matches_transport() -> Bool { +fn witness_systemctl_disable_now_command_matches_transport() -> Bool { systemctl_disable_now_command(unit: gunbc_roadmap_unit_name, privileged: true) == "sudo -n systemctl disable --now gunbc-roadmap.service" } -test fn witness_privileged_command_prefixes_sudo_n() -> Bool { +fn witness_privileged_command_prefixes_sudo_n() -> Bool { privileged_command(argv: systemctl_daemon_reload_argv()) == "sudo -n systemctl daemon-reload" } -test fn witness_systemctl_daemon_reload_command_privileged() -> Bool { +fn witness_systemctl_daemon_reload_command_privileged() -> Bool { systemctl_daemon_reload_command(privileged: true) == "sudo -n systemctl daemon-reload" } +test fn live_deploy_operations_holds() -> Bool { + witness_dpkg_status_argv_matches_transport_row() + && witness_apt_install_argv_matches_transport_row() + && witness_systemctl_restart_argv_matches_transport_row() + && witness_systemctl_disable_now_argv_matches_transport_row() + && witness_systemctl_daemon_reload_argv_matches_transport_row() + && witness_systemctl_enable_argv_matches_transport_row() + && witness_dpkg_status_command_matches_transport() + && witness_apt_install_command_matches_transport() + && witness_privileged_apt_install_command() + && witness_systemctl_restart_command_matches_transport() + && witness_systemctl_enable_command_matches_transport() + && witness_systemctl_disable_now_command_matches_transport() + && witness_privileged_command_prefixes_sudo_n() + && witness_systemctl_daemon_reload_command_privileged() +} + test fn live_deploy_operations_RED_apt_install_wrong_package_golden() -> Bool { apt_install_command(package: package_tailscale, privileged: false) != "apt-get install --yes nodejs" } diff --git a/dag/test/claim/live_deploy/readiness_witness_test.dag b/dag/test/claim/live_deploy/readiness_witness_test.dag index 360dfc1a914..05b0daac672 100644 --- a/dag/test/claim/live_deploy/readiness_witness_test.dag +++ b/dag/test/claim/live_deploy/readiness_witness_test.dag @@ -68,23 +68,23 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_ssh_mock_stdout: String = "mock ssh stdin script executed" -test fn witness_healthz_mock_body_groundable() -> Bool { +fn witness_healthz_mock_body_groundable() -> Bool { healthz_body_groundable(body: "{\"status\":\"ok\"}") } -test fn witness_healthz_trailing_lf_body_groundable() -> Bool { +fn witness_healthz_trailing_lf_body_groundable() -> Bool { healthz_body_groundable(body: concat("{\"status\":\"ok\"}", "\n")) } -test fn witness_healthz_malformed_extension_not_groundable() -> Bool { +fn witness_healthz_malformed_extension_not_groundable() -> Bool { !healthz_body_groundable(body: concat(roadmap_site_healthz_body(), "}")) } -test fn witness_healthz_bad_body_not_groundable() -> Bool { +fn witness_healthz_bad_body_not_groundable() -> Bool { !healthz_body_groundable(body: "") } -test fn witness_ssh_mock_stdout_is_discriminating_red() -> Bool { +fn witness_ssh_mock_stdout_is_discriminating_red() -> Bool { !healthz_body_groundable(body: witness_ssh_mock_stdout) && match ground_service_ready_from_healthz( read: HealthzEffectiveRead { @@ -105,7 +105,7 @@ fn witness_argv_join(argv: List) -> String { ) } -test fn witness_transport_probe_targets_localhost_healthz() -> Bool { +fn witness_transport_probe_targets_localhost_healthz() -> Bool { let port = deployment_plan_listen_port(spec: deployment_spec_srv1()) let url = live_deploy_health_url_for_port(port: port) let argv = http_client_get_argv(url: url) @@ -119,7 +119,7 @@ test fn witness_transport_probe_targets_localhost_healthz() -> Bool { && string_contains(s: url as String, pattern: "/healthz") } -test fn witness_accept_no_response_probe_fails_fast_not_hangs() -> Bool { +fn witness_accept_no_response_probe_fails_fast_not_hangs() -> Bool { match ground_service_ready_from_healthz( read: HealthzEffectiveRead { body: "", @@ -131,18 +131,18 @@ test fn witness_accept_no_response_probe_fails_fast_not_hangs() -> Bool { } } -test fn witness_transport_status_probe_uses_typed_systemctl_argv() -> Bool { +fn witness_transport_status_probe_uses_typed_systemctl_argv() -> Bool { systemctl_status_operation_argv_matches_authority( unit: live_deploy_service_ready_unit_authority ) } -test fn witness_transport_status_probe_realizes_hermetically() -> Bool { +fn witness_transport_status_probe_realizes_hermetically() -> Bool { let r = systemd.Systemctl.Status(unit: live_deploy_service_ready_unit_authority) r.stdout != "" } -test fn witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() -> Bool { +fn witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() -> Bool { let port = deployment_plan_listen_port(spec: deployment_spec_srv1()) let read = live_deploy_healthz_get_for_port( port: port, @@ -155,21 +155,21 @@ test fn witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() -> Bo ) } -test fn witness_service_ready_once_converges_on_healthy_fixture() -> Bool { +fn witness_service_ready_once_converges_on_healthy_fixture() -> Bool { reconciliation_converged(r: live_deploy_service_ready_once()) } -test fn witness_reconcile_grounds_healthy_fixture_read() -> Bool { +fn witness_reconcile_grounds_healthy_fixture_read() -> Bool { reconciliation_converged( r: reconcile_service_ready_read(read: show_healthz_read_fixture_healthy()) ) } -test fn witness_sleep_second_carrier_projection_paces_poll() -> Bool { +fn witness_sleep_second_carrier_projection_paces_poll() -> Bool { sleep_delay_seconds_second_carrier_projection(duration: live_deploy_service_ready_poll_cadence_seconds()) } -test fn witness_sleep_flat_scalar_dissolution_trigger_tracked() -> Bool { +fn witness_sleep_flat_scalar_dissolution_trigger_tracked() -> Bool { match sleep_delay_seconds_flat_scalar_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -180,7 +180,7 @@ test fn witness_sleep_flat_scalar_dissolution_trigger_tracked() -> Bool { } } -test fn witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() -> Bool { +fn witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() -> Bool { let spec = deployment_spec_srv1() let probe = live_deploy_service_ready_once_for_deploy( spec: spec, @@ -191,13 +191,13 @@ test fn witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() -> !reconciliation_converged(r: probe) && delay } -test fn witness_bounded_poll_early_exit_on_grounded_read() -> Bool { +fn witness_bounded_poll_early_exit_on_grounded_read() -> Bool { reconciliation_converged( r: reconcile_service_ready_read(read: show_healthz_read_fixture_healthy()) ) } -test fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { +fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { let max_attempts = live_deploy_service_ready_poll_max_attempts() let r = live_deploy_poll_service_ready_after_attempts( spec: deployment_spec_srv1(), @@ -216,11 +216,11 @@ test fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { } } -test fn witness_bounded_poll_max_attempts_derived_from_bound_over_cadence() -> Bool { +fn witness_bounded_poll_max_attempts_derived_from_bound_over_cadence() -> Bool { live_deploy_service_ready_poll_max_attempts() == measure_fit_count_floor(capacity: live_deploy_service_ready_poll_bound, each: live_deploy_service_ready_poll_cadence_seconds()) } -test fn witness_fresh_surface_read_grounds() -> Bool { +fn witness_fresh_surface_read_grounds() -> Bool { match ground_service_ready_from_healthz( read: HealthzEffectiveRead { body: roadmap_site_healthz_body(), probe_error: "" } ) { @@ -229,7 +229,7 @@ test fn witness_fresh_surface_read_grounds() -> Bool { } } -test fn witness_stale_surface_read_does_not_ground() -> Bool { +fn witness_stale_surface_read_does_not_ground() -> Bool { let stale = "{\"status\":\"ok\",\"service\":\"gunbc-roadmap\",\"artifacts\":{\"/roadmap\":\"stale-digest\"}}" roadmap_site_healthz_json_string_parses(body: stale) && !roadmap_site_healthz_surface_is_current(observed_body: stale) @@ -244,11 +244,11 @@ test fn witness_stale_surface_read_does_not_ground() -> Bool { } } -test fn witness_healthz_surface_tolerates_transport_trailing_lf() -> Bool { +fn witness_healthz_surface_tolerates_transport_trailing_lf() -> Bool { roadmap_site_healthz_surface_is_current(observed_body: concat(roadmap_site_healthz_body(), "\n")) } -test fn witness_healthz_publishes_every_served_surface_digest() -> Bool { +fn witness_healthz_publishes_every_served_surface_digest() -> Bool { let body = roadmap_site_healthz_body() string_contains(s: body, pattern: "\"/ROADMAP.md\":") && string_contains(s: body, pattern: "\"/target/roadmap-dispatch.json\":") @@ -257,7 +257,7 @@ test fn witness_healthz_publishes_every_served_surface_digest() -> Bool { && string_contains(s: body, pattern: "\"/assets/roadmap-dispatch.js\":") } -test fn witness_served_surface_digest_tracks_the_page() -> Bool { +fn witness_served_surface_digest_tracks_the_page() -> Bool { let published = roadmap_site_healthz_body() let page_digest = site_artifact_digest(body: served_page_body(page: roadmap_page_for_authority())) as String let js_digest = site_artifact_digest(body: dispatch_client_js_source()) as String @@ -266,7 +266,7 @@ test fn witness_served_surface_digest_tracks_the_page() -> Bool { && !(page_digest == js_digest) } -test fn witness_service_not_ready_refusal_shape_matches_contract() -> Bool { +fn witness_service_not_ready_refusal_shape_matches_contract() -> Bool { let reason = service_not_ready_reason(refusal: ServiceNotReady { unit: live_deploy_service_ready_unit_authority, endpoint: live_deploy_service_ready_endpoint_authority, @@ -279,3 +279,29 @@ test fn witness_service_not_ready_refusal_shape_matches_contract() -> Bool { && string_contains(s: reason, pattern: "Active: failed (Result: exit-code)") } +test fn live_deploy_readiness_witnesses() -> Bool { + witness_healthz_mock_body_groundable() + && witness_healthz_trailing_lf_body_groundable() + && witness_healthz_malformed_extension_not_groundable() + && witness_healthz_bad_body_not_groundable() + && witness_ssh_mock_stdout_is_discriminating_red() + && witness_transport_probe_targets_localhost_healthz() + && witness_transport_status_probe_uses_typed_systemctl_argv() + && witness_transport_status_probe_realizes_hermetically() + && witness_accept_no_response_probe_fails_fast_not_hangs() + && witness_transport_get_probe_over_ssh_does_not_ground_mock_stdout() + && witness_service_ready_once_converges_on_healthy_fixture() + && witness_reconcile_grounds_healthy_fixture_read() + && witness_bounded_poll_one_iteration_composes_probe_and_modeled_sleep() + && witness_sleep_second_carrier_projection_paces_poll() + && witness_sleep_flat_scalar_dissolution_trigger_tracked() + && witness_bounded_poll_early_exit_on_grounded_read() + && witness_bounded_poll_max_attempts_derived_from_bound_over_cadence() + && witness_red_control_never_ready_refuses_at_poll_bound() + && witness_service_not_ready_refusal_shape_matches_contract() + && witness_fresh_surface_read_grounds() + && witness_stale_surface_read_does_not_ground() + && witness_healthz_surface_tolerates_transport_trailing_lf() + && witness_healthz_publishes_every_served_surface_digest() + && witness_served_surface_digest_tracks_the_page() +} diff --git a/dag/test/claim/live_deploy/service_ready_witness_test.dag b/dag/test/claim/live_deploy/service_ready_witness_test.dag index 898c6585192..01df81112dd 100644 --- a/dag/test/claim/live_deploy/service_ready_witness_test.dag +++ b/dag/test/claim/live_deploy/service_ready_witness_test.dag @@ -29,15 +29,15 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_service_ready_unit_authority() -> Bool { +fn witness_service_ready_unit_authority() -> Bool { live_deploy_service_ready_unit_authority == gunbc_roadmap_unit_name } -test fn witness_service_ready_endpoint_authority() -> Bool { +fn witness_service_ready_endpoint_authority() -> Bool { live_deploy_service_ready_endpoint_authority == roadmap_site_health_path } -test fn witness_service_not_ready_reason_is_located() -> Bool { +fn witness_service_not_ready_reason_is_located() -> Bool { let reason = service_not_ready_reason(refusal: ServiceNotReady { unit: gunbc_roadmap_unit_name, endpoint: roadmap_site_health_path, @@ -52,7 +52,7 @@ test fn witness_service_not_ready_reason_is_located() -> Bool { && string_contains(s: reason, pattern: "Active: failed (Result: exit-code)") } -test fn witness_readiness_poll_bound_grounded_on_std_measure_second() -> Bool { +fn witness_readiness_poll_bound_grounded_on_std_measure_second() -> Bool { live_deploy_readiness_poll_bound_is_positive() && second_count(s: live_deploy_readiness_poll_bound_seconds()) == 120 } @@ -70,11 +70,11 @@ fn witness_expected_startup_covers_measured_srv1_observations() -> Bool { expected >= 39 } -test fn witness_health_probe_path_matches_service_ready_endpoint() -> Bool { +fn witness_health_probe_path_matches_service_ready_endpoint() -> Bool { live_deploy_service_ready_endpoint_authority == roadmap_site_health_path } -test fn witness_scaffold_dissolution_trigger_binds_readiness_poll() -> Bool { +fn witness_scaffold_dissolution_trigger_binds_readiness_poll() -> Bool { match live_deploy_service_ready_scaffold_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -85,7 +85,7 @@ test fn witness_scaffold_dissolution_trigger_binds_readiness_poll() -> Bool { } } -test fn witness_scaffold_carries_named_dissolution_trigger() -> Bool { +fn witness_scaffold_carries_named_dissolution_trigger() -> Bool { match live_deploy_service_ready_scaffold { Scaffold { dissolves_to: RealizationDispatch, @@ -97,7 +97,7 @@ test fn witness_scaffold_carries_named_dissolution_trigger() -> Bool { } } -test fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { +fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { let refusal = service_not_ready_refusal_at_poll_bound( last_probe: "health probe never succeeded", unit_diagnosis: UnitDiagnosisCaptured { text: "Active: failed (Result: exit-code) Main PID: 4242 (code=exited, status=1/FAILURE)" } @@ -111,7 +111,7 @@ test fn witness_red_control_never_ready_refuses_at_poll_bound() -> Bool { && !string_contains(s: reason, pattern: "proceed anyway") } -test fn witness_refusal_locates_unit_state_distinctly_from_probe() -> Bool { +fn witness_refusal_locates_unit_state_distinctly_from_probe() -> Bool { let probe_only = service_not_ready_refusal_at_poll_bound( last_probe: "connection refused", unit_diagnosis: UnitDiagnosisUnavailable @@ -129,7 +129,7 @@ test fn witness_refusal_locates_unit_state_distinctly_from_probe() -> Bool { && probe_only_reason != located_reason } -test fn witness_host_sleep_frontier_trigger_binds_srv3_consumer() -> Bool { +fn witness_host_sleep_frontier_trigger_binds_srv3_consumer() -> Bool { match live_deploy_host_sleep_generalization_dissolution_trigger { Scaffold { dissolves_to: RealizationDispatch, @@ -140,11 +140,25 @@ test fn witness_host_sleep_frontier_trigger_binds_srv3_consumer() -> Bool { } } -test fn witness_poll_max_attempts_is_thirty() -> Bool { +fn witness_poll_max_attempts_is_thirty() -> Bool { live_deploy_service_ready_poll_max_attempts() == 120 } -test fn witness_poll_max_attempts_tracks_cadence() -> Bool { +fn witness_poll_max_attempts_tracks_cadence() -> Bool { live_deploy_service_ready_poll_max_attempts() == measure_fit_count_floor(capacity: live_deploy_service_ready_poll_bound, each: live_deploy_service_ready_poll_cadence) } +test fn live_deploy_service_ready_witnesses() -> Bool { + witness_service_ready_unit_authority() + && witness_service_ready_endpoint_authority() + && witness_service_not_ready_reason_is_located() + && witness_readiness_poll_bound_grounded_on_std_measure_second() + && witness_health_probe_path_matches_service_ready_endpoint() + && witness_scaffold_carries_named_dissolution_trigger() + && witness_scaffold_dissolution_trigger_binds_readiness_poll() + && witness_host_sleep_frontier_trigger_binds_srv3_consumer() + && witness_poll_max_attempts_is_thirty() + && witness_poll_max_attempts_tracks_cadence() + && witness_red_control_never_ready_refuses_at_poll_bound() + && witness_refusal_locates_unit_state_distinctly_from_probe() +} diff --git a/dag/test/claim/machine_shape_catalog_integration_witness_test.dag b/dag/test/claim/machine_shape_catalog_integration_witness_test.dag index 1db8242590f..96fd4f24ba5 100644 --- a/dag/test/claim/machine_shape_catalog_integration_witness_test.dag +++ b/dag/test/claim/machine_shape_catalog_integration_witness_test.dag @@ -43,7 +43,7 @@ fn cpu_catalog_shape() -> MachineShape { } } -test fn w_cpu_cache_levels_integrated_into_memory_shape() -> Bool { +fn w_cpu_cache_levels_integrated_into_memory_shape() -> Bool { let memory = cpu_catalog_shape().domains.first().memory list_length(items: memory) == 3 && memory.first().id == ampere_l1_level @@ -58,7 +58,7 @@ test fn w_cpu_cache_levels_integrated_into_memory_shape() -> Bool { && byte_size_count(b: memory.skip(n: 2).first().capacity) == ampere_l3_bytes } -test fn w_cpu_catalog_lane_count_matches_threads() -> Bool { +fn w_cpu_catalog_lane_count_matches_threads() -> Bool { match machine_shape_domain_lane_count(shape: cpu_catalog_shape()) { Present { value: lanes } => hardware_thread_count_value(t: lanes) == hardware_thread_count_value(t: altra_max_m12830_catalog.threads) @@ -66,3 +66,7 @@ test fn w_cpu_catalog_lane_count_matches_threads() -> Bool { } } +test fn machine_shape_catalog_integration_witnesses() -> Bool { + w_cpu_cache_levels_integrated_into_memory_shape() + && w_cpu_catalog_lane_count_matches_threads() +} diff --git a/dag/test/claim/machine_shape_construction_wall_test.dag b/dag/test/claim/machine_shape_construction_wall_test.dag index 6261d4c1593..d8bca0616db 100644 --- a/dag/test/claim/machine_shape_construction_wall_test.dag +++ b/dag/test/claim/machine_shape_construction_wall_test.dag @@ -93,3 +93,6 @@ test fn gate_green_synthetic_shape_from_catalog_call() -> Bool { gate_accepts(o: machine_shape_compile_gate(node: shape_from_catalog_call_fixture())) } +test fn machine_shape_construction_wall_witnesses() -> Bool { + gate_red_synthetic_machine_shape_call() && gate_green_synthetic_shape_from_catalog_call() +} diff --git a/dag/test/claim/machine_shape_witness_test.dag b/dag/test/claim/machine_shape_witness_test.dag index a4e61c2027b..a7b0e04da15 100644 --- a/dag/test/claim/machine_shape_witness_test.dag +++ b/dag/test/claim/machine_shape_witness_test.dag @@ -71,7 +71,7 @@ fn shape_from_rtx5090_catalog() -> MachineShape { } } -test fn catalog_derivation_matches_row() -> Bool { +fn catalog_derivation_matches_row() -> Bool { let shape = shape_from_rtx5090_catalog() let memory = shape.domains.first().memory let device = memory.skip(n: list_length(items: memory) - 1).first() @@ -88,7 +88,7 @@ test fn catalog_derivation_matches_row() -> Bool { } } -test fn minimal_grant_is_single_domain() -> Bool { +fn minimal_grant_is_single_domain() -> Bool { machine_shape_is_single_domain(shape: shape_from_rtx5090_catalog()) } @@ -105,26 +105,26 @@ fn shape_from_m5_catalog() -> MachineShape { } } -test fn gpu_sm_cache_levels_integrated_when_cited() -> Bool { +fn gpu_sm_cache_levels_integrated_when_cited() -> Bool { let memory = shape_from_rtx5090_catalog().domains.first().memory list_length(items: memory) == 3 && byte_size_count(b: memory.first().capacity) == rtx5090_sm_register_bytes && byte_size_count(b: memory.skip(n: 1).first().capacity) == rtx5090_sm_shared_bytes } -test fn gpu_sm_cache_absent_when_ungranted() -> Bool { +fn gpu_sm_cache_absent_when_ungranted() -> Bool { list_length(items: shape_from_m5_catalog().domains.first().memory) == 1 } -test fn energy_derived_not_stored() -> Bool { +fn energy_derived_not_stored() -> Bool { joule_count(j: energy_from_power_and_time(power: watt(count: 100), time: second(count: 5))) == 500 } -test fn pcie_interconnect_link_derives_bandwidth() -> Bool { +fn pcie_interconnect_link_derives_bandwidth() -> Bool { bandwidth_count(b: pcie_interconnect_link(link: rtx5090_pcie_link).bandwidth) == bandwidth_count(b: pcie_link_bandwidth(link: rtx5090_pcie_link)) } -test fn red_dangling_domain_refuses() -> Bool { +fn red_dangling_domain_refuses() -> Bool { let good = shape_from_rtx5090_catalog() let bad = MachineShape { domains: good.domains @@ -143,7 +143,7 @@ test fn red_dangling_domain_refuses() -> Bool { } } -test fn red_dangling_level_refuses() -> Bool { +fn red_dangling_level_refuses() -> Bool { let bad_level: LevelId = "missing-level" as LevelId let bad = MachineShape { domains: shape_from_rtx5090_catalog().domains @@ -163,3 +163,13 @@ test fn red_dangling_level_refuses() -> Bool { } } +test fn machine_shape_witnesses() -> Bool { + catalog_derivation_matches_row() + && minimal_grant_is_single_domain() + && gpu_sm_cache_levels_integrated_when_cited() + && gpu_sm_cache_absent_when_ungranted() + && energy_derived_not_stored() + && pcie_interconnect_link_derives_bandwidth() + && red_dangling_domain_refuses() + && red_dangling_level_refuses() +} diff --git a/dag/test/claim/markdown_inline_render_test.dag b/dag/test/claim/markdown_inline_render_test.dag index e890df6312a..1ea99334b32 100644 --- a/dag/test/claim/markdown_inline_render_test.dag +++ b/dag/test/claim/markdown_inline_render_test.dag @@ -16,17 +16,17 @@ fn parse_and_render(text: String) -> List { ) } -test fn witness_bold_renders_to_strong_node() -> Bool { +fn witness_bold_renders_to_strong_node() -> Bool { parse_and_render(text: "**bold text**") == [ Element { tag: "strong", attributes: [], children: [ FragmentText { content: "bold text" } ] } ] } -test fn witness_code_renders_to_code_node() -> Bool { +fn witness_code_renders_to_code_node() -> Bool { parse_and_render(text: "`inline code`") == [ Element { tag: "code", attributes: [], children: [ FragmentText { content: "inline code" } ] } ] } -test fn witness_link_renders_to_anchor_node() -> Bool { +fn witness_link_renders_to_anchor_node() -> Bool { parse_and_render(text: "[label](/docs/plan.md)") == [ Element { tag: "a", @@ -36,12 +36,12 @@ test fn witness_link_renders_to_anchor_node() -> Bool { ] } -test fn witness_em_renders_to_em_node() -> Bool { +fn witness_em_renders_to_em_node() -> Bool { parse_and_render(text: "*emphasis*") == [ Element { tag: "em", attributes: [], children: [ FragmentText { content: "emphasis" } ] } ] } -test fn witness_mixed_inline_renders_to_nodes() -> Bool { +fn witness_mixed_inline_renders_to_nodes() -> Bool { parse_and_render(text: "**bold** and `code`") == [ Element { tag: "strong", attributes: [], children: [ FragmentText { content: "bold" } ] }, @@ -50,15 +50,15 @@ test fn witness_mixed_inline_renders_to_nodes() -> Bool { ] } -test fn witness_plain_text_stays_text_node() -> Bool { +fn witness_plain_text_stays_text_node() -> Bool { parse_and_render(text: "plain text no markup") == [ FragmentText { content: "plain text no markup" } ] } -test fn witness_markup_bold_differs_from_plain() -> Bool { +fn witness_markup_bold_differs_from_plain() -> Bool { !(parse_and_render(text: "**bold**") == parse_and_render(text: "bold")) } -test fn witness_image_inline_renders_to_img_node() -> Bool { +fn witness_image_inline_renders_to_img_node() -> Bool { markdown_inline_to_fragments(inline: ImageInline { alt: "description", url: "/img.png" }) == [ Element { tag: "img", @@ -71,3 +71,13 @@ test fn witness_image_inline_renders_to_img_node() -> Bool { ] } +test fn markdown_inline_render_keystone_holds() -> Bool { + witness_bold_renders_to_strong_node() + && witness_code_renders_to_code_node() + && witness_link_renders_to_anchor_node() + && witness_em_renders_to_em_node() + && witness_mixed_inline_renders_to_nodes() + && witness_plain_text_stays_text_node() + && witness_markup_bold_differs_from_plain() + && witness_image_inline_renders_to_img_node() +} diff --git a/dag/test/claim/markdown_markup_xss_witness_test.dag b/dag/test/claim/markdown_markup_xss_witness_test.dag index 3dab790e579..e7050e75eed 100644 --- a/dag/test/claim/markdown_markup_xss_witness_test.dag +++ b/dag/test/claim/markdown_markup_xss_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.markdown_markup_xss_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn sample_readme_doc() -> MarkdownDocument { @@ -53,7 +54,7 @@ fn sample_readme_doc() -> MarkdownDocument { } } -test fn witness_markdown_reduces_and_serializes() -> Bool { +fn witness_markdown_reduces_and_serializes() -> Bool { match try_serialize_markdown_document(doc: sample_readme_doc()) { Serialized { html: h } => h == concat( @@ -73,7 +74,7 @@ test fn witness_markdown_reduces_and_serializes() -> Bool { } } -test fn witness_markdown_uses_one_serialize_fragment_fold() -> Bool { +fn witness_markdown_uses_one_serialize_fragment_fold() -> Bool { let via_consumer = serialize_markdown_document(doc: sample_readme_doc()) let via_fold = serialize_fragment( frag: markdown_document_to_fragment(doc: sample_readme_doc()) @@ -81,7 +82,7 @@ test fn witness_markdown_uses_one_serialize_fragment_fold() -> Bool { via_consumer == via_fold } -test fn witness_ordered_list_serializes() -> Bool { +fn witness_ordered_list_serializes() -> Bool { let doc = MarkdownDocument { blocks: [ OrderedListBlock { @@ -110,7 +111,7 @@ test fn witness_ordered_list_serializes() -> Bool { } } -test fn witness_image_serializes() -> Bool { +fn witness_image_serializes() -> Bool { let doc = MarkdownDocument { blocks: [ ParagraphBlock { @@ -127,7 +128,7 @@ test fn witness_image_serializes() -> Bool { } } -test fn witness_heading_levels_map_to_tags() -> Bool { +fn witness_heading_levels_map_to_tags() -> Bool { let doc = MarkdownDocument { blocks: [ HeadingBlock { level: H2, inlines: [ TextInline { text: "sub" } ] }, @@ -169,14 +170,14 @@ fn data_image_doc() -> MarkdownDocument { } } -test fn witness_javascript_link_rejects() -> Bool { +fn witness_javascript_link_rejects() -> Bool { match try_serialize_markdown_document(doc: javascript_link_doc()) { Rejected { reason: _ } => true Serialized { html: _ } => false } } -test fn witness_data_image_rejects() -> Bool { +fn witness_data_image_rejects() -> Bool { match try_serialize_markdown_document(doc: data_image_doc()) { Rejected { reason: _ } => true Serialized { html: _ } => false @@ -187,14 +188,14 @@ fn witness_escape_url_passes_javascript_scheme() -> Bool { escape_url(s: "javascript:alert(1)") == "javascript:alert(1)" } -test fn witness_javascript_link_reject_discriminates_from_char_escape() -> Bool { +fn witness_javascript_link_reject_discriminates_from_char_escape() -> Bool { let unchecked = serialize_markdown_document(doc: javascript_link_doc()) witness_javascript_link_rejects() && witness_escape_url_passes_javascript_scheme() && unchecked == "" } -test fn witness_data_image_reject_discriminates_from_char_escape() -> Bool { +fn witness_data_image_reject_discriminates_from_char_escape() -> Bool { witness_data_image_rejects() && starts_with( s: serialize_markdown_document(doc: data_image_doc()), @@ -202,28 +203,28 @@ test fn witness_data_image_reject_discriminates_from_char_escape() -> Bool { ) } -test fn witness_validate_href_javascript_rejects() -> Bool { +fn witness_validate_href_javascript_rejects() -> Bool { match validate_href(url: "javascript:alert(1)") { RejectedHref { reason: DangerousScheme { scheme: JavascriptScheme } } => true _ => false } } -test fn witness_validate_href_data_rejects() -> Bool { +fn witness_validate_href_data_rejects() -> Bool { match validate_href(url: "data:text/html,x") { RejectedHref { reason: DangerousScheme { scheme: DataScheme } } => true _ => false } } -test fn witness_relative_link_accepted() -> Bool { +fn witness_relative_link_accepted() -> Bool { match validate_href(url: "/safe/path") { SafeHref { url: u } => u == "/safe/path" _ => false } } -test fn witness_https_link_serializes() -> Bool { +fn witness_https_link_serializes() -> Bool { let doc = MarkdownDocument { blocks: [ ParagraphBlock { @@ -243,7 +244,7 @@ test fn witness_https_link_serializes() -> Bool { } } -test fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { +fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { let doc = MarkdownDocument { blocks: [ ParagraphBlock { @@ -263,3 +264,19 @@ test fn witness_req_a_hostile_href_still_emits_with_escaping() -> Bool { } } +test fn markdown_markup_xss_keystone_holds() -> Bool { + witness_markdown_reduces_and_serializes() + && witness_markdown_uses_one_serialize_fragment_fold() + && witness_ordered_list_serializes() + && witness_image_serializes() + && witness_heading_levels_map_to_tags() + && witness_javascript_link_rejects() + && witness_data_image_rejects() + && witness_javascript_link_reject_discriminates_from_char_escape() + && witness_data_image_reject_discriminates_from_char_escape() + && witness_validate_href_javascript_rejects() + && witness_validate_href_data_rejects() + && witness_relative_link_accepted() + && witness_https_link_serializes() + && witness_req_a_hostile_href_still_emits_with_escaping() +} diff --git a/dag/test/claim/markdown_roundtrip_test.dag b/dag/test/claim/markdown_roundtrip_test.dag index 4b7ee4cc14a..23f45758c8c 100644 --- a/dag/test/claim/markdown_roundtrip_test.dag +++ b/dag/test/claim/markdown_roundtrip_test.dag @@ -1,5 +1,6 @@ module test.claim.markdown_roundtrip + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn roundtrip_core_doc() -> MarkdownDocument { @@ -37,7 +38,7 @@ fn roundtrip_core_doc() -> MarkdownDocument { } } -test fn witness_roundtrip_core() -> Bool { +fn witness_roundtrip_core() -> Bool { ingest_markdown_source(src: serialize_markdown_source(doc: roundtrip_core_doc())) == roundtrip_core_doc() } @@ -79,7 +80,7 @@ fn perturbed_separator_spellings() -> MarkdownSpellings { spellings_override(bullet: commonmark_gfm_spellings.unordered_bullet, separator: "\n---\n") } -test fn witness_roundtrip_under_perturbed_rows() -> Bool { +fn witness_roundtrip_under_perturbed_rows() -> Bool { let spb = perturbed_bullet_spellings() let restored_b = ingest_markdown_source_with(src: serialize_markdown_source_with(doc: roundtrip_core_doc(), sp: spb), sp: spb) let sps = perturbed_separator_spellings() @@ -87,14 +88,14 @@ test fn witness_roundtrip_under_perturbed_rows() -> Bool { (restored_b == roundtrip_core_doc()) && (restored_s == roundtrip_core_doc()) } -test fn witness_ingest_reads_bullet_row() -> Bool { +fn witness_ingest_reads_bullet_row() -> Bool { let emitted_b = serialize_markdown_source_with(doc: roundtrip_core_doc(), sp: perturbed_bullet_spellings()) let emitted_s = serialize_markdown_source_with(doc: roundtrip_core_doc(), sp: perturbed_separator_spellings()) !(ingest_markdown_source(src: emitted_b) == roundtrip_core_doc()) && !(ingest_markdown_source(src: emitted_s) == roundtrip_core_doc()) } -test fn witness_core_advertised_lossless() -> Bool { +fn witness_core_advertised_lossless() -> Bool { let recovered = ingest_markdown_source(src: serialize_markdown_source(doc: roundtrip_core_doc())) let m = markdown_medium_lossless(doc: recovered) match m.fidelity { @@ -116,7 +117,14 @@ fn frontier_emphasis_doc() -> MarkdownDocument { } } -test fn witness_frontier_not_roundtripped() -> Bool { +fn witness_frontier_not_roundtripped() -> Bool { !(ingest_markdown_source(src: serialize_markdown_source(doc: frontier_emphasis_doc())) == frontier_emphasis_doc()) } +test fn markdown_roundtrip_keystone_holds() -> Bool { + witness_roundtrip_core() + && witness_roundtrip_under_perturbed_rows() + && witness_ingest_reads_bullet_row() + && witness_core_advertised_lossless() + && witness_frontier_not_roundtripped() +} diff --git a/dag/test/claim/markdown_source_emit_test.dag b/dag/test/claim/markdown_source_emit_test.dag index 63ecee84677..6421e759157 100644 --- a/dag/test/claim/markdown_source_emit_test.dag +++ b/dag/test/claim/markdown_source_emit_test.dag @@ -1,5 +1,6 @@ module test.claim.markdown_source_emit + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn sample_doc() -> MarkdownDocument { @@ -117,7 +118,7 @@ fn expected_markdown() -> String { ], "") } -test fn witness_exact_bytes() -> Bool { +fn witness_exact_bytes() -> Bool { serialize_markdown_source(doc: sample_doc()) == expected_markdown() } @@ -125,7 +126,7 @@ fn code_only_doc(code: String) -> MarkdownDocument { MarkdownDocument { blocks: [ CodeBlock { code: code } ] } } -test fn witness_code_block_closing_fence_on_own_line() -> Bool { +fn witness_code_block_closing_fence_on_own_line() -> Bool { let no_nl = serialize_markdown_source(doc: code_only_doc(code: "let x = 1;")) let with_nl = serialize_markdown_source(doc: code_only_doc(code: "let x = 1;\n")) (no_nl == "```\nlet x = 1;\n```\n") && (no_nl == with_nl) @@ -173,9 +174,14 @@ fn tiny_list_doc() -> MarkdownDocument { } } -test fn witness_row_driven_bullet() -> Bool { +fn witness_row_driven_bullet() -> Bool { let canonical = serialize_markdown_source_with(doc: tiny_list_doc(), sp: commonmark_gfm_spellings) let perturbed = serialize_markdown_source_with(doc: tiny_list_doc(), sp: perturbed_bullet_spellings()) (canonical == "- x\n") && (perturbed == "+ x\n") && !(canonical == perturbed) } +test fn markdown_source_emit_keystone_holds() -> Bool { + witness_exact_bytes() + && witness_row_driven_bullet() + && witness_code_block_closing_fence_on_own_line() +} diff --git a/dag/test/claim/markup_medium_convergence_test.dag b/dag/test/claim/markup_medium_convergence_test.dag index a7e83efa625..9de7637f0d7 100644 --- a/dag/test/claim/markup_medium_convergence_test.dag +++ b/dag/test/claim/markup_medium_convergence_test.dag @@ -44,7 +44,7 @@ fn md_medium() -> MarkupMedium { markdown_markup_medium(sp: commonmark_gfm_spellings) } -test fn witness_same_fold_html_vs_md() -> Bool { +fn witness_same_fold_html_vs_md() -> Bool { let html = serialize_fragment_with(frag: em_hi(), medium: html_markup_medium()) let md = serialize_fragment_with(frag: em_hi(), medium: md_medium()) (html == "hi") && (md == "*hi*") && (html != md) @@ -61,7 +61,7 @@ fn md_medium_underscore() -> MarkupMedium { } } -test fn witness_perturb_row_flips_output() -> Bool { +fn witness_perturb_row_flips_output() -> Bool { let base = serialize_fragment_with(frag: em_hi(), medium: md_medium()) let perturbed = serialize_fragment_with(frag: em_hi(), medium: md_medium_underscore()) (base == "*hi*") && (perturbed == "_hi_") && (base != perturbed) @@ -93,7 +93,7 @@ fn single_quote_medium() -> MarkupMedium { } } -test fn witness_third_medium_is_one_row() -> Bool { +fn witness_third_medium_is_one_row() -> Bool { let html = serialize_fragment_with(frag: button_node(), medium: html_markup_medium()) let single_quote = serialize_fragment_with(frag: button_node(), medium: single_quote_medium()) (html == "") @@ -115,7 +115,7 @@ fn md_mixed_doc() -> MarkdownDocument { } } -test fn witness_md_inline_emission_bytes() -> Bool { +fn witness_md_inline_emission_bytes() -> Bool { let out = serialize_markdown_source_with(doc: md_mixed_doc(), sp: commonmark_gfm_spellings) out == "**bold** and *em*\n" } @@ -132,7 +132,7 @@ fn md_link_doc() -> MarkdownDocument { } } -test fn witness_md_link_named_arm_bytes() -> Bool { +fn witness_md_link_named_arm_bytes() -> Bool { let out = serialize_markdown_source_with(doc: md_link_doc(), sp: commonmark_gfm_spellings) out == "[text](https://x.com)\n" } @@ -145,10 +145,18 @@ fn hostile_href_node() -> Fragment { } } -test fn witness_xss_still_rejected_through_fold() -> Bool { +fn witness_xss_still_rejected_through_fold() -> Bool { match try_serialize_html_source(node: hostile_href_node()) { EmitRejected { reason: _ } => true EmitOk { html: _ } => false } } +test fn markup_medium_convergence_holds() -> Bool { + witness_same_fold_html_vs_md() + && witness_perturb_row_flips_output() + && witness_third_medium_is_one_row() + && witness_md_inline_emission_bytes() + && witness_md_link_named_arm_bytes() + && witness_xss_still_rejected_through_fold() +} diff --git a/dag/test/claim/markup_serializer_witness_test.dag b/dag/test/claim/markup_serializer_witness_test.dag index 7300006bbb4..3b45b17c832 100644 --- a/dag/test/claim/markup_serializer_witness_test.dag +++ b/dag/test/claim/markup_serializer_witness_test.dag @@ -18,15 +18,15 @@ import extdeps.languages.html_fragment { serialize_fragment } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_text_escaping_by_execution() -> Bool { +fn witness_text_escaping_by_execution() -> Bool { escape_text(s: "a & c") == "a <b> & c" } -test fn witness_attribute_escaping_by_execution() -> Bool { +fn witness_attribute_escaping_by_execution() -> Bool { escape_attribute(s: "a \"q\" <&>") == "a "q" <&>" } -test fn witness_url_escaping_by_execution() -> Bool { +fn witness_url_escaping_by_execution() -> Bool { escape_url(s: "/p?x=a b&y=\"z\"<") == "/p?x=a%20b&y=%22z%22%3C" } @@ -41,7 +41,7 @@ fn sample_fragment() -> Fragment { } } -test fn witness_serialize_fragment_full() -> Bool { +fn witness_serialize_fragment_full() -> Bool { serialize_fragment(frag: sample_fragment()) == "hi <b> & \"q\">end" } @@ -62,25 +62,25 @@ fn react_consumer_button() -> Fragment { } } -test fn witness_one_fold_serves_html_and_react() -> Bool { +fn witness_one_fold_serves_html_and_react() -> Bool { let html = serialize_fragment(frag: html_consumer_button()) let react = serialize_fragment(frag: react_consumer_button()) (html == react) && (html == "") } -test fn witness_round_trip_text() -> Bool { +fn witness_round_trip_text() -> Bool { unescape_text(s: escape_text(s: "x & \"q\" y")) == "x & \"q\" y" } -test fn witness_round_trip_attribute() -> Bool { +fn witness_round_trip_attribute() -> Bool { unescape_attribute(s: escape_attribute(s: "x & \"q\" y")) == "x & \"q\" y" } -test fn witness_round_trip_url() -> Bool { +fn witness_round_trip_url() -> Bool { unescape_url(s: escape_url(s: "x & \"q\" y")) == "x & \"q\" y" } -test fn witness_round_trip_url_literal_percent() -> Bool { +fn witness_round_trip_url_literal_percent() -> Bool { unescape_url(s: escape_url(s: "a %3C %22 %25 ")) == "a %3C %22 %25 " } @@ -92,7 +92,7 @@ fn req_a_breakout_fragment() -> Fragment { } } -test fn witness_url_within_attribute_composition() -> Bool { +fn witness_url_within_attribute_composition() -> Bool { serialize_fragment(frag: req_a_breakout_fragment()) == "" } @@ -101,9 +101,22 @@ fn escape_text_drop_lt(s: String) -> String { replace(replace(s, "&", "&"), ">", ">") } -test fn witness_perturb_break_escape_goes_red() -> Bool { +fn witness_perturb_break_escape_goes_red() -> Bool { (escape_text(s: "a ") != escape_text_drop_lt(s: "a ")) && (escape_text(s: "a ") == "a <b>") && (escape_text_drop_lt(s: "a ") == "a Bool { + witness_text_escaping_by_execution() && + witness_attribute_escaping_by_execution() && + witness_url_escaping_by_execution() && + witness_serialize_fragment_full() && + witness_one_fold_serves_html_and_react() && + witness_round_trip_text() && + witness_round_trip_attribute() && + witness_round_trip_url() && + witness_round_trip_url_literal_percent() && + witness_url_within_attribute_composition() && + witness_perturb_break_escape_goes_red() +} diff --git a/dag/test/claim/materialized_secret_witness_test.dag b/dag/test/claim/materialized_secret_witness_test.dag index 0ca69a65709..9d383a6f482 100644 --- a/dag/test/claim/materialized_secret_witness_test.dag +++ b/dag/test/claim/materialized_secret_witness_test.dag @@ -14,7 +14,7 @@ fn use_marker(m: MaterializedSecret) -> Int { data witness_a3_hinge_note: String = "THE conjunct A3 exists for, and it is the srv4 incident replayed. Secret Manager says SmEnabled — every existence check the model can perform is green, and it stayed green through the entire incident — while NO liveness observation exists. The materialization must REFUSE. If it completes, the model has certified a credential on the strength of the store's opinion about its own contents, which is exactly the state that produced the 401, and it would do so on the same inputs that produced it." -test fn witness_enabled_but_unprobed_refuses() -> Bool { +fn witness_enabled_but_unprobed_refuses() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -38,7 +38,7 @@ test fn witness_enabled_but_unprobed_refuses() -> Bool { data witness_revoked_note: String = "The incident's other half: the store is enabled AND a probe ran AND the upstream rejected the key. The refusal must carry the probe's own verdict rather than collapsing to a generic failure, because 'GitHub does not accept this key' and 'nobody asked GitHub' are different pieces of work — reconcile the credential versus build the probe — and this lane already paid for conflating them once." -test fn witness_enabled_but_revoked_refuses() -> Bool { +fn witness_enabled_but_revoked_refuses() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -62,7 +62,7 @@ test fn witness_enabled_but_revoked_refuses() -> Bool { data witness_non_vacuity_note: String = "The non-vacuity control, without which every conjunct above is satisfied by a bracket that refuses unconditionally. Store enabled AND upstream accepts: the materialization completes AND the use function actually RAN — proven by its return value travelling out through MaterializationCompleted, not merely by the outcome's tag. That distinction matters because a bracket that returned Completed with a fabricated value would look identical at the tag." -test fn witness_live_secret_materializes_and_runs_the_use() -> Bool { +fn witness_live_secret_materializes_and_runs_the_use() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -103,7 +103,7 @@ fn refusal_cause_is_upstream_axis(outcome: MaterializationOutcome) -> Bool } } -test fn witness_destroyed_version_refuses_even_when_probe_says_live() -> Bool { +fn witness_destroyed_version_refuses_even_when_probe_says_live() -> Bool { let destroyed = with_materialized_secret( ref: incident_secret_ref(), binding: EnvVar { name: "GH_APP_PEM" }, @@ -136,7 +136,7 @@ test fn witness_destroyed_version_refuses_even_when_probe_says_live() -> Bool { data witness_self_repairing_probe_note: String = "A probe that repairs what it tests cannot certify it. The self-repairing sketch is the automation of the exact hand reconciliation the A3 gap row describes — mint, and on failure add a fresh key version — so its Converged may be reporting the version the probe itself just wrote. The bracket refuses on the probe's CLASSIFICATION before it ever looks at the verdict, and the refusal names the probe so the remedy is 'replace this probe' rather than 'the credential is bad'." -test fn witness_self_repairing_probe_is_refused_by_classification() -> Bool { +fn witness_self_repairing_probe_is_refused_by_classification() -> Bool { let outcome = with_materialized_secret( ref: incident_secret_ref(), binding: SshKeyFile, @@ -159,7 +159,7 @@ test fn witness_self_repairing_probe_is_refused_by_classification() -> Bool { data witness_red_control_note: String = "The discriminating RED control. The perturbation is materializing on store existence alone — what every hand-run credential step in the srv4 session effectively did, and the behaviour that produced the 401 — and it is executed rather than described. On the incident's own inputs (SmEnabled, no liveness observation) the sketch COMPLETES where the authority REFUSES, the gate rejects the sketch and accepts the authority, and the gate's decision is computed from the liveness argument rather than from which function produced the outcome, so relabelling cannot satisfy it. The final conjunct is the other direction: with liveness Converged the gate accepts a completion, so this is not an always-reject gate." -test fn witness_red_control_existence_only_rejected_by_gate() -> Bool { +fn witness_red_control_existence_only_rejected_by_gate() -> Bool { let widened = materialize_existence_only_widen_sketch( ref: incident_secret_ref(), binding: SshKeyFile, @@ -192,7 +192,7 @@ test fn witness_red_control_existence_only_rejected_by_gate() -> Bool { data witness_qualification_asymmetry_note: String = "Liveness qualification is a presupposition check and not a meet, pinned the same way the swap axis pins its own. A DISABLED store version under a live probe stays Drifted — the probe does not repair the store — while an ENABLED version under an absent probe becomes UnknownRefused. Under a symmetric meet those two would be indistinguishable and the direction of the check would be lost." -test fn witness_liveness_qualification_is_asymmetric() -> Bool { +fn witness_liveness_qualification_is_asymmetric() -> Bool { let store_drifted = secret_liveness_qualified_verdict( existence: secret_existence_verdict(state: SmDisabled), liveness: std.upsert_decision.Converged, @@ -209,3 +209,12 @@ test fn witness_liveness_qualification_is_asymmetric() -> Bool { ) } +test fn materialized_secret_witnesses() -> Bool { + witness_enabled_but_unprobed_refuses() + && witness_enabled_but_revoked_refuses() + && witness_live_secret_materializes_and_runs_the_use() + && witness_destroyed_version_refuses_even_when_probe_says_live() + && witness_self_repairing_probe_is_refused_by_classification() + && witness_red_control_existence_only_rejected_by_gate() + && witness_liveness_qualification_is_asymmetric() +} diff --git a/dag/test/claim/measure_lifted_algebra_test.dag b/dag/test/claim/measure_lifted_algebra_test.dag index b7a8ad675c6..1f16bc1d8bb 100644 --- a/dag/test/claim/measure_lifted_algebra_test.dag +++ b/dag/test/claim/measure_lifted_algebra_test.dag @@ -1,57 +1,73 @@ module test.claim.measure_lifted_algebra + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn scale_fraction_exact_holds() -> Bool { +fn scale_fraction_exact_holds() -> Bool { byte_size_count(b: measure_scale_fraction_floor(m: byte_size(10), num: 4, den: 5)) == 8 } -test fn scale_fraction_floors_not_rounds_holds() -> Bool { +fn scale_fraction_floors_not_rounds_holds() -> Bool { byte_size_count(b: measure_scale_fraction_floor(m: byte_size(7), num: 1, den: 2)) == 3 } -test fn scale_fraction_zero_den_is_zero_holds() -> Bool { +fn scale_fraction_zero_den_is_zero_holds() -> Bool { byte_size_count(b: measure_scale_fraction_floor(m: byte_size(100), num: 4, den: 0)) == 0 } -test fn fit_count_exact_holds() -> Bool { +fn fit_count_exact_holds() -> Bool { measure_fit_count_floor(capacity: byte_size(10), each: byte_size(5)) == 2 } -test fn fit_count_floors_not_rounds_holds() -> Bool { +fn fit_count_floors_not_rounds_holds() -> Bool { measure_fit_count_floor(capacity: byte_size(7), each: byte_size(2)) == 3 } -test fn fit_count_zero_divisor_is_zero_holds() -> Bool { +fn fit_count_zero_divisor_is_zero_holds() -> Bool { measure_fit_count_floor(capacity: byte_size(7), each: byte_size(0)) == 0 } -test fn scale_fraction_generic_over_quantity_holds() -> Bool { +fn scale_fraction_generic_over_quantity_holds() -> Bool { hertz_count(h: measure_scale_fraction_floor(m: hertz(9), num: 2, den: 4)) == 4 } -test fn fit_count_generic_over_quantity_holds() -> Bool { +fn fit_count_generic_over_quantity_holds() -> Bool { measure_fit_count_floor(capacity: hertz(9), each: hertz(4)) == 2 } -test fn scale_fraction_ceil_exact_holds() -> Bool { +fn scale_fraction_ceil_exact_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(8), num: 1, den: 4)) == 2 } -test fn scale_fraction_ceil_rounds_up_holds() -> Bool { +fn scale_fraction_ceil_rounds_up_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(7), num: 1, den: 2)) == 4 && byte_size_count(b: measure_scale_fraction_floor(m: byte_size(7), num: 1, den: 2)) == 3 } -test fn scale_fraction_ceil_remainder_to_one_holds() -> Bool { +fn scale_fraction_ceil_remainder_to_one_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(10), num: 1, den: 4)) == 3 } -test fn scale_fraction_ceil_zero_den_is_whole_holds() -> Bool { +fn scale_fraction_ceil_zero_den_is_whole_holds() -> Bool { byte_size_count(b: measure_scale_fraction_ceil(m: byte_size(100), num: 4, den: 0)) == 400 } -test fn scale_fraction_ceil_generic_over_quantity_holds() -> Bool { +fn scale_fraction_ceil_generic_over_quantity_holds() -> Bool { hertz_count(h: measure_scale_fraction_ceil(m: hertz(9), num: 1, den: 2)) == 5 } +test fn measure_lifted_algebra_witnesses() -> Bool { + scale_fraction_exact_holds() + && scale_fraction_floors_not_rounds_holds() + && scale_fraction_zero_den_is_zero_holds() + && fit_count_exact_holds() + && fit_count_floors_not_rounds_holds() + && fit_count_zero_divisor_is_zero_holds() + && scale_fraction_generic_over_quantity_holds() + && fit_count_generic_over_quantity_holds() + && scale_fraction_ceil_exact_holds() + && scale_fraction_ceil_rounds_up_holds() + && scale_fraction_ceil_remainder_to_one_holds() + && scale_fraction_ceil_zero_den_is_whole_holds() + && scale_fraction_ceil_generic_over_quantity_holds() +} diff --git a/dag/test/claim/media_type_witness_test.dag b/dag/test/claim/media_type_witness_test.dag index 5f8c7b017d6..3f0d70e779c 100644 --- a/dag/test/claim/media_type_witness_test.dag +++ b/dag/test/claim/media_type_witness_test.dag @@ -12,7 +12,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data media_type_witness_note: String = "D1 keystone: the served stack's Content-Type wire strings are a SERIALIZATION of the modeled MediaType (RFC 9110 section 8.3 type/subtype/parameters), not hand-composed strings hiding the structure. The five preset labels are pinned byte-exact (browsers are the consumer — these must NEVER drift), and the RED controls perturb a parameter value and a subtype so the wire string changes and the pin reds, proving the pin discriminates. ApplicationOctetStream's charset-less form falls out of an EMPTY parameter list, not a special variant." -test fn witness_preset_wire_strings_byte_exact() -> Bool { +fn witness_preset_wire_strings_byte_exact() -> Bool { media_type_wire_label(m: text_html_utf8) == "text/html; charset=utf-8" && media_type_wire_label(m: text_plain_utf8) == "text/plain; charset=utf-8" && media_type_wire_label(m: application_json_utf8) == "application/json; charset=utf-8" @@ -20,14 +20,14 @@ test fn witness_preset_wire_strings_byte_exact() -> Bool { && media_type_wire_label(m: application_octet_stream) == "application/octet-stream" } -test fn witness_octet_stream_has_no_charset() -> Bool { +fn witness_octet_stream_has_no_charset() -> Bool { count(application_octet_stream.parameters) == 0 && !string_contains(s: media_type_wire_label(m: application_octet_stream), pattern: "charset") && count(text_html_utf8.parameters) == 1 && string_contains(s: media_type_wire_label(m: text_html_utf8), pattern: "; charset=utf-8") } -test fn witness_structure_projects() -> Bool { +fn witness_structure_projects() -> Bool { text_html_utf8.top_level == TopLevelText && text_html_utf8.subtype == "html" && application_json_utf8.top_level == TopLevelApplication @@ -45,14 +45,21 @@ fn perturbed_charset_media_type() -> MediaType { data perturbed_parameter_red_note: String = "RED control: perturb the charset parameter value; the wire string changes, so the byte-exact pin above no longer holds — a silent drift would go red here." -test fn witness_perturbed_parameter_reds() -> Bool { +fn witness_perturbed_parameter_reds() -> Bool { media_type_wire_label(m: perturbed_charset_media_type()) != "text/html; charset=utf-8" && media_type_wire_label(m: perturbed_charset_media_type()) == "text/html; charset=utf-16" } -test fn witness_perturbed_subtype_reds() -> Bool { +fn witness_perturbed_subtype_reds() -> Bool { let bad = MediaType { top_level: TopLevelText, subtype: "xml", parameters: [charset_utf8] } media_type_wire_label(m: bad) != media_type_wire_label(m: text_html_utf8) && media_type_wire_label(m: bad) == "text/xml; charset=utf-8" } +test fn media_type_witnesses() -> Bool { + witness_preset_wire_strings_byte_exact() + && witness_octet_stream_has_no_charset() + && witness_structure_projects() + && witness_perturbed_parameter_reds() + && witness_perturbed_subtype_reds() +} diff --git a/dag/test/claim/medium_fidelity_witness_test.dag b/dag/test/claim/medium_fidelity_witness_test.dag index 98afabde260..1365c94d236 100644 --- a/dag/test/claim/medium_fidelity_witness_test.dag +++ b/dag/test/claim/medium_fidelity_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.medium_fidelity + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly type ProbeVerdict = Dominates | Incomparable @@ -36,7 +37,7 @@ fn mis_tagged_prose_medium() -> extdeps.communication.medium.Medium { } } -test fn text_medium_tag_is_lossless() -> Bool { +fn text_medium_tag_is_lossless() -> Bool { let m = text_medium_lossless() match m.fidelity { Lossless => true @@ -44,7 +45,7 @@ test fn text_medium_tag_is_lossless() -> Bool { } } -test fn probe_medium_tag_is_lossless() -> Bool { +fn probe_medium_tag_is_lossless() -> Bool { let m = probe_medium_lossless() match m.fidelity { Lossless => true @@ -52,7 +53,7 @@ test fn probe_medium_tag_is_lossless() -> Bool { } } -test fn probe_carried_is_non_text() -> Bool { +fn probe_carried_is_non_text() -> Bool { let m = probe_medium_lossless() match m.carried { Dominates => true @@ -60,7 +61,7 @@ test fn probe_carried_is_non_text() -> Bool { } } -test fn prose_medium_tag_is_lossy() -> Bool { +fn prose_medium_tag_is_lossy() -> Bool { let m = prose_medium() match m.fidelity { Lossy => true @@ -68,11 +69,19 @@ test fn prose_medium_tag_is_lossy() -> Bool { } } -test fn lossy_prose_not_advertised_lossless() -> Bool { +fn lossy_prose_not_advertised_lossless() -> Bool { !is_lossless(prose_medium().fidelity) } -test fn red_mistag_certifies_lossless_by_tag_alone() -> Bool { +fn red_mistag_certifies_lossless_by_tag_alone() -> Bool { is_lossless(mis_tagged_prose_medium().fidelity) } +test fn medium_fidelity_holds() -> Bool { + text_medium_tag_is_lossless() + && probe_medium_tag_is_lossless() + && probe_carried_is_non_text() + && prose_medium_tag_is_lossy() + && lossy_prose_not_advertised_lossless() + && red_mistag_certifies_lossless_by_tag_alone() +} diff --git a/dag/test/claim/membership_reconcile_witness_test.dag b/dag/test/claim/membership_reconcile_witness_test.dag index 6f559825437..1336dc53ee7 100644 --- a/dag/test/claim/membership_reconcile_witness_test.dag +++ b/dag/test/claim/membership_reconcile_witness_test.dag @@ -76,21 +76,21 @@ fn plan_has_refused_unknown(plan: MembershipPlan, mid: String) -> Bool ) } -test fn w_added_upserts() -> Bool { +fn w_added_upserts() -> Bool { let plan = t_reconcile(desired: [tm_owned(mid: "a", ver: "1")], observed: []) plan_has_upsert(plan: plan, mid: "a") && membership_upsert_count(plan: plan) == 1 && membership_teardown_count(plan: plan) == 0 } -test fn w_removed_owned_tears_down() -> Bool { +fn w_removed_owned_tears_down() -> Bool { let plan = t_reconcile(desired: [], observed: [tm_owned(mid: "a", ver: "1")]) plan_has_teardown(plan: plan, mid: "a") && membership_teardown_count(plan: plan) == 1 && membership_refusal_count(plan: plan) == 0 } -test fn w_unchanged_noop() -> Bool { +fn w_unchanged_noop() -> Bool { let m = tm_owned(mid: "a", ver: "1") let plan = t_reconcile(desired: [m], observed: [m]) membership_upsert_count(plan: plan) == 0 @@ -98,7 +98,7 @@ test fn w_unchanged_noop() -> Bool { && membership_refusal_count(plan: plan) == 0 } -test fn w_modified_reupserts() -> Bool { +fn w_modified_reupserts() -> Bool { let plan = t_reconcile( desired: [tm_owned(mid: "a", ver: "2")], observed: [tm_owned(mid: "a", ver: "1")], @@ -108,7 +108,7 @@ test fn w_modified_reupserts() -> Bool { && membership_teardown_count(plan: plan) == 0 } -test fn w_r5_owned_only_teardown_synthetic() -> Bool { +fn w_r5_owned_only_teardown_synthetic() -> Bool { let plan = t_reconcile( desired: [], observed: [ @@ -132,7 +132,7 @@ fn effects_has_teardown(es: List>, mid: String) -> Bool { data w_effects_wholesale_refuse_note: String = "DISCRIMINATING (§5): a plan carrying any Refused MUST refuse WHOLESALE — membership_effects returns ApplyRefused (o's owned teardown NOT surfaced as an effect), never EffectsReady with the refused sibling silently filtered out. If membership_effects is ever broken to drop-the-refused and return the effects, this hits the EffectsReady arm and returns false = RED. The degenerate apply/retract poles never produce a Refused, so only this synthetic mixed observed set exercises the wall." -test fn w_effects_refuses_wholesale_on_any_refusal() -> Bool { +fn w_effects_refuses_wholesale_on_any_refusal() -> Bool { let plan = t_reconcile( desired: [], observed: [tm_owned(mid: "o", ver: "1"), tm_ensured(mid: "e", ver: "1")], @@ -147,7 +147,7 @@ test fn w_effects_refuses_wholesale_on_any_refusal() -> Bool { } } -test fn w_effects_ready_when_no_refusal() -> Bool { +fn w_effects_ready_when_no_refusal() -> Bool { let plan = t_reconcile(desired: [], observed: [tm_owned(mid: "o", ver: "1")]) match membership_effects(plan: plan) { EffectsReady { effects: es } => @@ -156,7 +156,7 @@ test fn w_effects_ready_when_no_refusal() -> Bool { } } -test fn w_tally_matches_counts() -> Bool { +fn w_tally_matches_counts() -> Bool { let plan = t_reconcile( desired: [tm_owned(mid: "a", ver: "1")], observed: [tm_owned(mid: "b", ver: "1"), tm_ensured(mid: "c", ver: "1")], @@ -168,3 +168,13 @@ test fn w_tally_matches_counts() -> Bool { && t.refusals == membership_refusal_count(plan: plan) } +test fn membership_reconcile_witnesses() -> Bool { + w_added_upserts() + && w_removed_owned_tears_down() + && w_unchanged_noop() + && w_modified_reupserts() + && w_r5_owned_only_teardown_synthetic() + && w_effects_refuses_wholesale_on_any_refusal() + && w_effects_ready_when_no_refusal() + && w_tally_matches_counts() +} diff --git a/dag/test/claim/nested_fold_generic_param_emit_test.dag b/dag/test/claim/nested_fold_generic_param_emit_test.dag index 590406cc421..ac562c91140 100644 --- a/dag/test/claim/nested_fold_generic_param_emit_test.dag +++ b/dag/test/claim/nested_fold_generic_param_emit_test.dag @@ -7,12 +7,12 @@ import std.realization_measurement { schedule_critical_path_time, } -test fn witness_flat_fold_resolves_generic_scale() -> Bool { +fn witness_flat_fold_resolves_generic_scale() -> Bool { let batch = [time_measure(count: 10)] measure_count(m: schedule_batch_critical_path(batch_times: batch)) == 10 } -test fn witness_nested_fold_resolves_generic_scale() -> Bool { +fn witness_nested_fold_resolves_generic_scale() -> Bool { let batches = [ [time_measure(count: 40), time_measure(count: 5)], [time_measure(count: 20)], @@ -20,3 +20,7 @@ test fn witness_nested_fold_resolves_generic_scale() -> Bool { measure_count(m: schedule_critical_path_time(batch_times: batches)) == 60 } +test fn nested_fold_generic_param_emit_test() -> Bool { + witness_flat_fold_resolves_generic_scale() + && witness_nested_fold_resolves_generic_scale() +} diff --git a/dag/test/claim/observation_ci_render_witness_test.dag b/dag/test/claim/observation_ci_render_witness_test.dag index 12a8dadc6f7..0c810411cc8 100644 --- a/dag/test/claim/observation_ci_render_witness_test.dag +++ b/dag/test/claim/observation_ci_render_witness_test.dag @@ -109,14 +109,14 @@ fn crawl_basis() -> AttentionBasis { AttentionBasis { average: millisecond(count: 1000), maximum: millisecond(count: 5000) } } -test fn w_human_units_replace_raw_byte_dumps() -> Bool { +fn w_human_units_replace_raw_byte_dumps() -> Bool { ci_human_bytes(b: byte_size(crawl_heartbeat_rss_bytes)) == "15.0 GiB" && ci_human_bytes(b: byte_size(crawl_heartbeat_swap_bytes)) == "32.0 GiB" && ci_human_percent(bp: basis_point(count: crawl_heartbeat_pressure_bp)) == "9.0%" && ci_human_duration(d: millisecond(count: crawl_module_wall_ms)) == "10 minutes" } -test fn w_heartbeat_names_its_subject_where_the_capture_was_silent() -> Bool { +fn w_heartbeat_names_its_subject_where_the_capture_was_silent() -> Bool { let line = ci_heartbeat_line(sample: crawl_heartbeat()) string_contains(s: line.text, pattern: crawl_quiet_module) && string_contains(s: line.text, pattern: "entry 214 of 602") && @@ -124,18 +124,18 @@ test fn w_heartbeat_names_its_subject_where_the_capture_was_silent() -> Bool { !string_contains(s: line.text, pattern: to_string(crawl_heartbeat_rss_bytes)) } -test fn w_heartbeat_puts_identity_before_vitals() -> Bool { +fn w_heartbeat_puts_identity_before_vitals() -> Bool { let line = ci_heartbeat_line(sample: crawl_heartbeat()) starts_with(s: line.text, prefix: "33 minutes in — still in witness discovery") && string_contains(s: line.text, pattern: "memory 15.0 GiB") } -test fn w_heartbeat_uses_the_clock_pulse_glyph() -> Bool { +fn w_heartbeat_uses_the_clock_pulse_glyph() -> Bool { let line = ci_heartbeat_line(sample: crawl_heartbeat()) ci_render_line(line: line, tier: Emoji) == concat("🕐 ", line.text) } -test fn w_escalation_surfaces_the_quiet_module_at_one_threshold() -> Bool { +fn w_escalation_surfaces_the_quiet_module_at_one_threshold() -> Bool { let line = ci_escalation_line( quiet_subject: crawl_entry_subject(), active_leaf: crawl_leaf_subject(), @@ -147,7 +147,7 @@ test fn w_escalation_surfaces_the_quiet_module_at_one_threshold() -> Bool { line.attention == Notable } -test fn w_escalation_surfaces_the_cause_at_the_deeper_threshold() -> Bool { +fn w_escalation_surfaces_the_cause_at_the_deeper_threshold() -> Bool { let line = ci_escalation_blocked_line( quiet_subject: crawl_entry_subject(), active_leaf: crawl_leaf_subject(), @@ -160,12 +160,12 @@ test fn w_escalation_surfaces_the_cause_at_the_deeper_threshold() -> Bool { line.attention == Anomaly } -test fn w_escalation_is_recursive_over_the_captured_window() -> Bool { +fn w_escalation_is_recursive_over_the_captured_window() -> Bool { observation_escalation_depth(quiet: millisecond(count: 600000), t: observation_dwell_threshold) == 10 && observation_escalation_depth(quiet: millisecond(count: 120000), t: observation_dwell_threshold) == 2 } -test fn w_outcome_lines_carry_durations() -> Bool { +fn w_outcome_lines_carry_durations() -> Bool { let event = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Done }, @@ -175,7 +175,7 @@ test fn w_outcome_lines_carry_durations() -> Bool { string_contains(s: ci_event_line(event: event, basis: crawl_basis()).text, pattern: "in 230ms") } -test fn w_refusal_never_renders_inside_a_collapsed_group() -> Bool { +fn w_refusal_never_renders_inside_a_collapsed_group() -> Bool { let refusal = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Refused { diagnostic: "FLOOR-BATCH-OVER-BUDGET" as NonEmptyStr } }, @@ -187,7 +187,7 @@ test fn w_refusal_never_renders_inside_a_collapsed_group() -> Bool { ci_line_placement(attention: line.attention) == OutsideGroup } -test fn w_routine_green_collapses_inside_a_group() -> Bool { +fn w_routine_green_collapses_inside_a_group() -> Bool { let green = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Done }, @@ -200,7 +200,7 @@ test fn w_routine_green_collapses_inside_a_group() -> Bool { ci_collapsed_summary(green_count: 213) == "… 213 more finished cleanly" } -test fn w_failure_and_refusal_are_restated_at_the_end() -> Bool { +fn w_failure_and_refusal_are_restated_at_the_end() -> Bool { let summary = ci_run_summary_line(summary: FloorRunSummary { entries_complete: 213, entries_total: 602, @@ -215,7 +215,7 @@ test fn w_failure_and_refusal_are_restated_at_the_end() -> Bool { string_contains(s: restate.text, pattern: "FLOOR-BATCH-OVER-BUDGET") } -test fn w_relayed_diagnostic_cannot_mint_workflow_commands() -> Bool { +fn w_relayed_diagnostic_cannot_mint_workflow_commands() -> Bool { let restate = ci_refusal_restate_line( subject: crawl_entry_subject(), diagnostic: "budget exceeded\n::error::a child process said this" as NonEmptyStr @@ -224,27 +224,27 @@ test fn w_relayed_diagnostic_cannot_mint_workflow_commands() -> Bool { !string_contains(s: restate.text, pattern: "\n::error::") } -test fn w_group_markers_come_from_the_github_authority() -> Bool { +fn w_group_markers_come_from_the_github_authority() -> Bool { ci_group_open(title: "witness discovery") == "::group::witness discovery" && ci_group_close() == "::endgroup::" } -test fn w_captured_window_would_have_spoken_four_times() -> Bool { +fn w_captured_window_would_have_spoken_four_times() -> Bool { ci_escalation_emission_count(quiet: millisecond(count: 600000), t: observation_dwell_threshold) == 4 && ci_escalation_emission_count(quiet: millisecond(count: 120000), t: observation_dwell_threshold) == 2 && ci_escalation_emission_count(quiet: millisecond(count: 30000), t: observation_dwell_threshold) == 0 } -test fn w_a_silent_phase_past_the_threshold_is_not_responsive() -> Bool { +fn w_a_silent_phase_past_the_threshold_is_not_responsive() -> Bool { ci_window_is_responsive(quiet: millisecond(count: 30000), t: observation_dwell_threshold) && ci_window_is_responsive(quiet: millisecond(count: 600000), t: observation_dwell_threshold) } -test fn w_escalation_emission_stays_bounded_under_unbounded_silence() -> Bool { +fn w_escalation_emission_stays_bounded_under_unbounded_silence() -> Bool { ci_escalation_emission_count(quiet: millisecond(count: 999999999), t: observation_dwell_threshold) <= 13 } -test fn w_run_summary_keeps_refused_and_failed_apart() -> Bool { +fn w_run_summary_keeps_refused_and_failed_apart() -> Bool { let refused_only = FloorRunSummary { entries_complete: 213, entries_total: 602, refusals: 1, failures: 0, wall: millisecond(count: 2472000) } let failed_only = FloorRunSummary { entries_complete: 601, entries_total: 602, refusals: 0, failures: 1, wall: millisecond(count: 600000) } let both = FloorRunSummary { entries_complete: 200, entries_total: 602, refusals: 2, failures: 3, wall: millisecond(count: 600000) } @@ -256,7 +256,7 @@ test fn w_run_summary_keeps_refused_and_failed_apart() -> Bool { string_contains(s: ci_run_summary_line(summary: both).text, pattern: "2 refused and 3 failed") } -test fn w_unmeasured_duration_names_its_cause_rather_than_vanishing() -> Bool { +fn w_unmeasured_duration_names_its_cause_rather_than_vanishing() -> Bool { let event = ObservationEvent { subject: crawl_entry_subject(), transition: Concluded { outcome: Done }, @@ -267,3 +267,23 @@ test fn w_unmeasured_duration_names_its_cause_rather_than_vanishing() -> Bool { string_contains(s: line.text, pattern: "duration unmeasured: clock unavailable in this leg") } +test fn observation_ci_render_witnesses() -> Bool { + w_run_summary_keeps_refused_and_failed_apart() && + w_unmeasured_duration_names_its_cause_rather_than_vanishing() && + w_captured_window_would_have_spoken_four_times() && + w_a_silent_phase_past_the_threshold_is_not_responsive() && + w_escalation_emission_stays_bounded_under_unbounded_silence() && + w_human_units_replace_raw_byte_dumps() && + w_heartbeat_names_its_subject_where_the_capture_was_silent() && + w_heartbeat_puts_identity_before_vitals() && + w_heartbeat_uses_the_clock_pulse_glyph() && + w_escalation_surfaces_the_quiet_module_at_one_threshold() && + w_escalation_surfaces_the_cause_at_the_deeper_threshold() && + w_escalation_is_recursive_over_the_captured_window() && + w_outcome_lines_carry_durations() && + w_refusal_never_renders_inside_a_collapsed_group() && + w_routine_green_collapses_inside_a_group() && + w_failure_and_refusal_are_restated_at_the_end() && + w_relayed_diagnostic_cannot_mint_workflow_commands() && + w_group_markers_come_from_the_github_authority() +} diff --git a/dag/test/claim/observation_crawl_replay_test.dag b/dag/test/claim/observation_crawl_replay_test.dag index 53ddff74288..c12fdd07f3f 100644 --- a/dag/test/claim/observation_crawl_replay_test.dag +++ b/dag/test/claim/observation_crawl_replay_test.dag @@ -105,24 +105,29 @@ fn observation_crawl_after_block() -> String { join(lines, "\n") } -test fn w_replay_names_the_module_where_the_capture_was_silent() -> Bool { +fn w_replay_names_the_module_where_the_capture_was_silent() -> Bool { let block = observation_crawl_after_block() string_contains(s: block, pattern: "still in witness discovery: entry 214 of 602, now typecheck v2.compiler.normalized_tree") && string_contains(s: block, pattern: "quiet for 2 minutes — still working") && string_contains(s: block, pattern: "quiet for 4 minutes — blocked on memory reclaim (pressure 9.0%)") } -test fn w_replay_uses_human_units_not_raw_bytes() -> Bool { +fn w_replay_uses_human_units_not_raw_bytes() -> Bool { let block = observation_crawl_after_block() string_contains(s: block, pattern: "memory 15.0 GiB, swap 32.0 GiB, pressure 9.0%") && !string_contains(s: block, pattern: "16107200512") && !string_contains(s: block, pattern: "current=") } -test fn w_replay_ends_in_a_refusal_summary_not_a_silent_timeout() -> Bool { +fn w_replay_ends_in_a_refusal_summary_not_a_silent_timeout() -> Bool { let block = observation_crawl_after_block() string_contains(s: block, pattern: "213 of 602 entries finished") && string_contains(s: block, pattern: "1 refused and 0 failed") && string_contains(s: block, pattern: "FLOOR-BATCH-OVER-BUDGET") } +test fn observation_crawl_replay_witnesses() -> Bool { + w_replay_names_the_module_where_the_capture_was_silent() && + w_replay_uses_human_units_not_raw_bytes() && + w_replay_ends_in_a_refusal_summary_not_a_silent_timeout() +} diff --git a/dag/test/claim/observation_emit_census_witness_test.dag b/dag/test/claim/observation_emit_census_witness_test.dag index 28d9f86061c..fff29c35804 100644 --- a/dag/test/claim/observation_emit_census_witness_test.dag +++ b/dag/test/claim/observation_emit_census_witness_test.dag @@ -40,12 +40,12 @@ fn census_marker_present(site: CensusedEmitSite) -> Bool { string_contains(s: census_source(path: site.source_file), pattern: site.marker) } -test fn w_every_rostered_marker_still_exists_in_the_seed() -> Bool { +fn w_every_rostered_marker_still_exists_in_the_seed() -> Bool { fold(observation_emit_roster, init: true, f: (acc, site) => acc && census_marker_present(site: site)) } -test fn w_roster_staleness_check_discriminates() -> Bool { +fn w_roster_staleness_check_discriminates() -> Bool { let bogus = CensusedEmitSite { marker: "[this-marker-does-not-exist-in-the-seed]" as NonEmptyStr, source_file: "src/v1/stage0/src/bin/claim_executor.rs" as NonEmptyStr, @@ -57,7 +57,7 @@ test fn w_roster_staleness_check_discriminates() -> Bool { !census_marker_present(site: bogus) } -test fn w_every_frontier_row_carries_a_real_dissolve_on() -> Bool { +fn w_every_frontier_row_carries_a_real_dissolve_on() -> Bool { fold(observation_emit_roster, init: true, f: (acc, site) => if emit_site_is_frontier(site: site) { acc && emit_site_dissolve_on(site: site) != "" @@ -66,14 +66,14 @@ test fn w_every_frontier_row_carries_a_real_dissolve_on() -> Bool { }) } -test fn w_the_named_negative_example_has_migrated() -> Bool { +fn w_the_named_negative_example_has_migrated() -> Bool { census_marker_present(site: floor_memory_site) && !emit_site_is_frontier(site: floor_memory_site) && string_contains(s: floor_memory_site.marker, pattern: "floor-memory") && string_contains(s: emit_site_dissolve_on(site: floor_memory_site), pattern: "ci_heartbeat_line") } -test fn w_gantt_has_migrated() -> Bool { +fn w_gantt_has_migrated() -> Bool { census_marker_present(site: gantt_site) && !emit_site_is_frontier(site: gantt_site) && string_contains(s: gantt_site.marker, pattern: "gantt") && @@ -81,7 +81,7 @@ test fn w_gantt_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: gantt_site), pattern: "phase_begin_line") } -test fn w_governor_has_migrated() -> Bool { +fn w_governor_has_migrated() -> Bool { census_marker_present(site: governor_site) && !emit_site_is_frontier(site: governor_site) && string_contains(s: governor_site.marker, pattern: "governor") && @@ -89,7 +89,7 @@ test fn w_governor_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: governor_site), pattern: "render_governor_hold_line_mirror") } -test fn w_typecheck_attribution_has_migrated() -> Bool { +fn w_typecheck_attribution_has_migrated() -> Bool { census_marker_present(site: typecheck_attribution_site) && !emit_site_is_frontier(site: typecheck_attribution_site) && string_contains(s: typecheck_attribution_site.marker, pattern: "typecheck-attribution") && @@ -97,7 +97,7 @@ test fn w_typecheck_attribution_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: typecheck_attribution_site), pattern: "typecheck_concluded_line") } -test fn w_measurement_has_migrated() -> Bool { +fn w_measurement_has_migrated() -> Bool { census_marker_present(site: measurement_site) && !emit_site_is_frontier(site: measurement_site) && string_contains(s: measurement_site.marker, pattern: "measurement") && @@ -105,7 +105,7 @@ test fn w_measurement_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: measurement_site), pattern: "render_peak_rss_line_mirror") } -test fn w_shell_has_migrated() -> Bool { +fn w_shell_has_migrated() -> Bool { census_marker_present(site: shell_site) && !emit_site_is_frontier(site: shell_site) && string_contains(s: shell_site.marker, pattern: "shell") && @@ -113,14 +113,14 @@ test fn w_shell_has_migrated() -> Bool { string_contains(s: emit_site_dissolve_on(site: shell_site), pattern: "render_shell_effect_") } -test fn w_the_census_states_post_snapshot_frontier_count() -> Bool { +fn w_the_census_states_post_snapshot_frontier_count() -> Bool { observation_emit_frontier_count() == 6 && count(observation_emit_roster) == 12 } data w_post_snapshot_live_tags_are_rostered_bidirectional_note: String = "Operator finding 3 (run 30142403230): hygiene is bidirectional — growth tags born after the initial census snapshot must appear on the roster, not only the reverse (rostered markers still exist). Extended for #7205 resolve/assembly split tags." -test fn w_post_snapshot_live_tags_are_rostered_bidirectional() -> Bool { +fn w_post_snapshot_live_tags_are_rostered_bidirectional() -> Bool { census_marker_present(site: floor_drain_site) && emit_site_is_frontier(site: floor_drain_site) && census_marker_present(site: gate_warm_cost_site) && @@ -135,14 +135,14 @@ test fn w_post_snapshot_live_tags_are_rostered_bidirectional() -> Bool { emit_site_is_frontier(site: assembly_split_site) } -test fn w_the_raw_byte_dump_shape_is_gone_from_the_seed() -> Bool { +fn w_the_raw_byte_dump_shape_is_gone_from_the_seed() -> Bool { let executor = census_source(path: "src/v1/stage0/src/bin/claim_executor.rs") !string_contains(s: executor, pattern: "[floor-memory] t=") && !string_contains(s: executor, pattern: "current={}") && string_contains(s: executor, pattern: "render_heartbeat_line_mirror") } -test fn w_the_raw_gantt_shape_is_gone_from_the_seed() -> Bool { +fn w_the_raw_gantt_shape_is_gone_from_the_seed() -> Bool { let rt = census_source(path: "src/v1/stage0/src/v1_rt.rs") let executor = census_source(path: "src/v1/stage0/src/bin/claim_executor.rs") !string_contains(s: rt, pattern: "t_ms=") && @@ -153,7 +153,7 @@ test fn w_the_raw_gantt_shape_is_gone_from_the_seed() -> Bool { string_contains(s: executor, pattern: "render_phase_concluded_line_mirror") } -test fn w_the_raw_governor_shape_is_gone_from_the_seed() -> Bool { +fn w_the_raw_governor_shape_is_gone_from_the_seed() -> Bool { let gov = census_source(path: "src/v1/stage0/src/memory_governor.rs") !string_contains(s: gov, pattern: "[governor] hard back-off:") && !string_contains(s: gov, pattern: "[governor] creep back-off:") && @@ -163,14 +163,14 @@ test fn w_the_raw_governor_shape_is_gone_from_the_seed() -> Bool { string_contains(s: gov, pattern: "GOVERNOR_CENSUS_MARKER") } -test fn w_the_raw_typecheck_attribution_shape_is_gone_from_the_seed() -> Bool { +fn w_the_raw_typecheck_attribution_shape_is_gone_from_the_seed() -> Bool { let cli = census_source(path: "src/v1/stage0/src/cli_run.rs") !string_contains(s: cli, pattern: "[typecheck-attribution] module=") && string_contains(s: cli, pattern: "render_typecheck_concluded_line_mirror") && string_contains(s: cli, pattern: "TYPECHECK_ATTRIBUTION_CENSUS_MARKER") } -test fn w_the_raw_measurement_shape_is_gone_from_the_seed() -> Bool { +fn w_the_raw_measurement_shape_is_gone_from_the_seed() -> Bool { let executor = census_source(path: "src/v1/stage0/src/bin/claim_executor.rs") let cli = census_source(path: "src/v1/stage0/src/cli_run.rs") !string_contains(s: executor, pattern: "bytes (VmHWM)") && @@ -180,7 +180,7 @@ test fn w_the_raw_measurement_shape_is_gone_from_the_seed() -> Bool { string_contains(s: cli, pattern: "MEASUREMENT_CENSUS_MARKER") } -test fn w_the_raw_shell_shape_is_gone_from_the_seed() -> Bool { +fn w_the_raw_shell_shape_is_gone_from_the_seed() -> Bool { let interp = census_source(path: "src/v1/stage0/src/v1_interpreter.rs") !string_contains(s: interp, pattern: "[shell] done exit=") && !string_contains(s: interp, pattern: "[shell] stderr (exit=") && @@ -188,3 +188,22 @@ test fn w_the_raw_shell_shape_is_gone_from_the_seed() -> Bool { string_contains(s: interp, pattern: "SHELL_CENSUS_MARKER") } +test fn observation_emit_census_witnesses() -> Bool { + w_every_rostered_marker_still_exists_in_the_seed() && + w_roster_staleness_check_discriminates() && + w_every_frontier_row_carries_a_real_dissolve_on() && + w_the_named_negative_example_has_migrated() && + w_gantt_has_migrated() && + w_governor_has_migrated() && + w_typecheck_attribution_has_migrated() && + w_measurement_has_migrated() && + w_shell_has_migrated() && + w_the_census_states_post_snapshot_frontier_count() && + w_post_snapshot_live_tags_are_rostered_bidirectional() && + w_the_raw_byte_dump_shape_is_gone_from_the_seed() && + w_the_raw_gantt_shape_is_gone_from_the_seed() && + w_the_raw_governor_shape_is_gone_from_the_seed() && + w_the_raw_typecheck_attribution_shape_is_gone_from_the_seed() && + w_the_raw_measurement_shape_is_gone_from_the_seed() && + w_the_raw_shell_shape_is_gone_from_the_seed() +} diff --git a/dag/test/claim/observation_lockstep_witness_test.dag b/dag/test/claim/observation_lockstep_witness_test.dag index ad2f26e2ec6..0bd63f7f752 100644 --- a/dag/test/claim/observation_lockstep_witness_test.dag +++ b/dag/test/claim/observation_lockstep_witness_test.dag @@ -23,14 +23,14 @@ fn lockstep_has(path: String, needle: String) -> Bool { string_contains(s: lockstep_source(path: path), pattern: needle) } -test fn w_every_law_names_a_declaration_that_exists() -> Bool { +fn w_every_law_names_a_declaration_that_exists() -> Bool { let src = lockstep_source(path: observation_module_path) fold(observation_laws, init: true, f: (acc, l) => acc && string_contains(s: src, pattern: concat("fn ", concat(l.enforced_by.decl_name, "("))) ) } -test fn w_orphan_law_check_discriminates() -> Bool { +fn w_orphan_law_check_discriminates() -> Bool { let src = lockstep_source(path: observation_module_path) !string_contains(s: src, pattern: "fn observation_law_with_no_enforcer(") } @@ -45,7 +45,7 @@ data governor_hold_variants: List = [ "AdmissionCeiling" ] -test fn w_scheduler_hold_is_in_lockstep_with_the_seed_governor() -> Bool { +fn w_scheduler_hold_is_in_lockstep_with_the_seed_governor() -> Bool { let governor = lockstep_source(path: governor_source_path) let model = lockstep_source(path: observation_module_path) fold(governor_hold_variants, init: true, f: (acc, v) => @@ -55,22 +55,30 @@ test fn w_scheduler_hold_is_in_lockstep_with_the_seed_governor() -> Bool { ) } -test fn w_lockstep_check_discriminates() -> Bool { +fn w_lockstep_check_discriminates() -> Bool { let governor = lockstep_source(path: governor_source_path) let model = lockstep_source(path: observation_module_path) !string_contains(s: governor, pattern: "HoldReason::DiskPressure") && !string_contains(s: model, pattern: "DiskPressure") } -test fn w_heartbeat_period_matches_the_seed_cadence() -> Bool { +fn w_heartbeat_period_matches_the_seed_cadence() -> Bool { millisecond_count(m: observation_heartbeat_period) == 60000 && lockstep_has(path: executor_source_path, needle: "from_secs(60)") && lockstep_has(path: executor_source_path, needle: "floor-memory-heartbeat") } -test fn w_heartbeat_source_still_refuses_to_fabricate() -> Bool { +fn w_heartbeat_source_still_refuses_to_fabricate() -> Bool { lockstep_has(path: executor_source_path, needle: "refusing to fabricate") && lockstep_has(path: executor_source_path, needle: "render_heartbeat_line_mirror") && lockstep_has(path: executor_source_path, needle: "heartbeat_feed_snapshot") } +test fn observation_lockstep_witnesses() -> Bool { + w_every_law_names_a_declaration_that_exists() && + w_orphan_law_check_discriminates() && + w_scheduler_hold_is_in_lockstep_with_the_seed_governor() && + w_lockstep_check_discriminates() && + w_heartbeat_period_matches_the_seed_cadence() && + w_heartbeat_source_still_refuses_to_fabricate() +} diff --git a/dag/test/claim/observation_model_witness_test.dag b/dag/test/claim/observation_model_witness_test.dag index 0bac8b66bec..db270fe484b 100644 --- a/dag/test/claim/observation_model_witness_test.dag +++ b/dag/test/claim/observation_model_witness_test.dag @@ -191,13 +191,13 @@ fn obs_glyph_resolves_all_tiers(c: ObservationEventClass) -> Bool { } } -test fn w_presentation_is_total_over_class_roster() -> Bool { +fn w_presentation_is_total_over_class_roster() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => acc && obs_glyph_resolves_all_tiers(c: c) ) } -test fn w_class_roster_covers_every_constructed_class() -> Bool { +fn w_class_roster_covers_every_constructed_class() -> Bool { count(observation_event_classes) == 10 && observation_event_class(event: obs_event(transition: Begin, wall_ms: 1)) == ClassBegin && observation_event_class(event: obs_event(transition: Step { k: 34, n: 61 }, wall_ms: 1)) == ClassStep && @@ -208,7 +208,7 @@ test fn w_class_roster_covers_every_constructed_class() -> Bool { observation_event_class(event: obs_event(transition: Concluded { outcome: Final { shown_failures: 0 } }, wall_ms: 1)) == ClassFinal } -test fn w_refused_is_distinct_from_failed() -> Bool { +fn w_refused_is_distinct_from_failed() -> Bool { let refused = observation_presentation(c: ClassRefused) let failed = observation_presentation(c: ClassFailed) let timed_out = observation_presentation(c: ClassTimedOut) @@ -226,7 +226,7 @@ test fn w_refused_is_distinct_from_failed() -> Bool { } } -test fn w_anomaly_classes_never_collapse() -> Bool { +fn w_anomaly_classes_never_collapse() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => { let p = observation_presentation(c: c) if observation_class_is_intrinsic_anomaly(c: c) { @@ -237,7 +237,7 @@ test fn w_anomaly_classes_never_collapse() -> Bool { }) } -test fn w_density_is_the_single_display_authority() -> Bool { +fn w_density_is_the_single_display_authority() -> Bool { observation_class_density(c: ClassRefused) == AnomalyExpanded && observation_class_density(c: ClassFailed) == AnomalyExpanded && observation_class_density(c: ClassTimedOut) == AnomalyExpanded && @@ -250,7 +250,7 @@ test fn w_density_is_the_single_display_authority() -> Bool { observation_class_density(c: ClassSkipped) == RoutineCollapsible } -test fn w_presentation_projects_density_rather_than_restating_it() -> Bool { +fn w_presentation_projects_density_rather_than_restating_it() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => { let p = observation_presentation(c: c) let d = observation_class_density(c: c) @@ -261,7 +261,7 @@ test fn w_presentation_projects_density_rather_than_restating_it() -> Bool { }) } -test fn w_routine_progress_collapses_but_the_summary_always_shows() -> Bool { +fn w_routine_progress_collapses_but_the_summary_always_shows() -> Bool { observation_presentation(c: ClassBegin).collapsible && observation_presentation(c: ClassStep).collapsible && observation_presentation(c: ClassDone).collapsible && @@ -270,14 +270,14 @@ test fn w_routine_progress_collapses_but_the_summary_always_shows() -> Bool { !observation_class_is_intrinsic_anomaly(c: ClassFinal) } -test fn w_refusal_is_anomaly_on_any_basis() -> Bool { +fn w_refusal_is_anomaly_on_any_basis() -> Bool { let refused = obs_event(transition: Concluded { outcome: Refused { diagnostic: "budget" as NonEmptyStr } }, wall_ms: 1) let generous = AttentionBasis { average: millisecond(count: 999999), maximum: millisecond(count: 999999) } observation_attention(event: refused, basis: generous) == Anomaly && observation_attention(event: refused, basis: obs_basis()) == Anomaly } -test fn w_attention_grounds_on_supplied_basis() -> Bool { +fn w_attention_grounds_on_supplied_basis() -> Bool { let quick = obs_event(transition: Concluded { outcome: Done }, wall_ms: 500) let over_average = obs_event(transition: Concluded { outcome: Done }, wall_ms: 2000) let over_maximum = obs_event(transition: Concluded { outcome: Done }, wall_ms: 9000) @@ -286,7 +286,7 @@ test fn w_attention_grounds_on_supplied_basis() -> Bool { observation_attention(event: over_maximum, basis: obs_basis()) == Anomaly } -test fn w_attention_moves_with_the_basis_not_a_local_constant() -> Bool { +fn w_attention_moves_with_the_basis_not_a_local_constant() -> Bool { let event = obs_event(transition: Concluded { outcome: Done }, wall_ms: 2000) let strict = AttentionBasis { average: millisecond(count: 100), maximum: millisecond(count: 200) } let loose = AttentionBasis { average: millisecond(count: 10000), maximum: millisecond(count: 20000) } @@ -296,7 +296,7 @@ test fn w_attention_moves_with_the_basis_not_a_local_constant() -> Bool { ) } -test fn w_unavailable_measurement_carries_a_cause() -> Bool { +fn w_unavailable_measurement_carries_a_cause() -> Bool { let event = obs_event(transition: Concluded { outcome: Done }, wall_ms: 1) match event.rss { MeasuredValue { value: _ } => false @@ -304,7 +304,7 @@ test fn w_unavailable_measurement_carries_a_cause() -> Bool { } } -test fn w_blocked_on_resource_is_derived_for_every_hold() -> Bool { +fn w_blocked_on_resource_is_derived_for_every_hold() -> Bool { observation_hold_resource(hold: WindowFull { active: 4, target: 4 }) == AdmissionWindow && observation_hold_resource(hold: CurrentHighWater { current: byte_size(1), high_water: byte_size(2) }) == MemoryBudget && observation_hold_resource(hold: PsiPressure { avg10: basis_point(count: 900) }) == MemoryBudget && @@ -314,7 +314,7 @@ test fn w_blocked_on_resource_is_derived_for_every_hold() -> Bool { observation_hold_resource(hold: AdmissionCeiling { current: byte_size(1), ceiling: byte_size(2) }) == MaturationReserve } -test fn w_blocked_on_carries_holders_and_named_remaining() -> Bool { +fn w_blocked_on_carries_holders_and_named_remaining() -> Bool { let b = observation_blocked_on( hold: PsiPressure { avg10: basis_point(count: 900) }, holders: [obs_leaf_subject()], @@ -328,7 +328,7 @@ test fn w_blocked_on_carries_holders_and_named_remaining() -> Bool { } } -test fn w_escalation_depth_is_recursive_not_one_level() -> Bool { +fn w_escalation_depth_is_recursive_not_one_level() -> Bool { let t = observation_dwell_threshold observation_escalation_depth(quiet: millisecond(count: 0), t: t) == 0 && observation_escalation_depth(quiet: millisecond(count: 60000), t: t) == 1 && @@ -336,7 +336,7 @@ test fn w_escalation_depth_is_recursive_not_one_level() -> Bool { observation_escalation_depth(quiet: millisecond(count: 240000), t: t) == 4 } -test fn w_escalation_surfaces_deeper_subject_over_time() -> Bool { +fn w_escalation_surfaces_deeper_subject_over_time() -> Bool { let t = observation_dwell_threshold let quiet = obs_entry_subject() let leaf = obs_leaf_subject() @@ -347,7 +347,7 @@ test fn w_escalation_surfaces_deeper_subject_over_time() -> Bool { observation_subject_contains(ancestor: at_t, descendant: at_2t) } -test fn w_escalation_refuses_to_surface_an_unrelated_subject() -> Bool { +fn w_escalation_refuses_to_surface_an_unrelated_subject() -> Bool { let t = observation_dwell_threshold let unrelated = ObservationSubject { segments: [RunSegment { id: "other-run" as NonEmptyStr }] } let surfaced = observation_escalation_subject( @@ -359,7 +359,7 @@ test fn w_escalation_refuses_to_surface_an_unrelated_subject() -> Bool { count(surfaced.segments) == 3 } -test fn w_watchdog_converts_quiet_past_budget_into_a_typed_line() -> Bool { +fn w_watchdog_converts_quiet_past_budget_into_a_typed_line() -> Bool { let within = observation_watchdog(subject: obs_entry_subject(), elapsed: millisecond(count: 1000), budget: millisecond(count: 5000)) let past = observation_watchdog(subject: obs_entry_subject(), elapsed: millisecond(count: 607000), budget: millisecond(count: 60000)) observation_watchdog_attention(v: within) == Ambient && @@ -370,7 +370,7 @@ test fn w_watchdog_converts_quiet_past_budget_into_a_typed_line() -> Bool { } } -test fn w_subject_identity_is_rendered_not_anonymous() -> Bool { +fn w_subject_identity_is_rendered_not_anonymous() -> Bool { let rendered = observation_subject_render(subject: obs_leaf_subject()) string_contains(s: rendered, pattern: "module=v2.compiler.normalized_tree") && string_contains(s: rendered, pattern: "phase=typecheck") && @@ -378,13 +378,13 @@ test fn w_subject_identity_is_rendered_not_anonymous() -> Bool { string_contains(s: rendered, pattern: "batch=") } -test fn w_containment_holds_along_the_path() -> Bool { +fn w_containment_holds_along_the_path() -> Bool { observation_subject_contains(ancestor: obs_run_subject(), descendant: obs_leaf_subject()) && observation_subject_contains(ancestor: obs_entry_subject(), descendant: obs_leaf_subject()) && !observation_subject_contains(ancestor: obs_leaf_subject(), descendant: obs_run_subject()) } -test fn w_grain_orders_the_containment_tree() -> Bool { +fn w_grain_orders_the_containment_tree() -> Bool { observation_subject_grain(subject: obs_run_subject()) == RunGrain && observation_subject_grain(subject: obs_entry_subject()) == EntryGrain && observation_subject_grain(subject: obs_leaf_subject()) == PhaseGrain && @@ -393,7 +393,7 @@ test fn w_grain_orders_the_containment_tree() -> Bool { !observation_grain_at_or_above_entry(g: PhaseGrain) } -test fn w_presentation_glyph_reads_the_table_not_a_hardcoded_string() -> Bool { +fn w_presentation_glyph_reads_the_table_not_a_hardcoded_string() -> Bool { let p = observation_presentation(c: ClassRefused) match resolve_symbol(id: p.glyph, tier: Unicode) { Present { value: u } => @@ -407,7 +407,7 @@ test fn w_presentation_glyph_reads_the_table_not_a_hardcoded_string() -> Bool { } } -test fn w_presentation_colour_comes_from_the_glyph_authority() -> Bool { +fn w_presentation_colour_comes_from_the_glyph_authority() -> Bool { fold(observation_event_classes, init: true, f: (acc, c) => { let p = observation_presentation(c: c) acc && match symbol_color(id: p.glyph) { @@ -417,7 +417,7 @@ test fn w_presentation_colour_comes_from_the_glyph_authority() -> Bool { }) } -test fn w_reward_animal_selection_is_deterministic_and_wraps() -> Bool { +fn w_reward_animal_selection_is_deterministic_and_wraps() -> Bool { let n = count(reward_animals) n > 0 && match reward_animal_at(index: 3, tier: Ascii) { @@ -434,14 +434,14 @@ test fn w_reward_animal_selection_is_deterministic_and_wraps() -> Bool { } } -test fn w_every_law_is_stated_and_bound_to_an_enforcer() -> Bool { +fn w_every_law_is_stated_and_bound_to_an_enforcer() -> Bool { count(observation_laws) == 5 && fold(observation_laws, init: true, f: (acc, l) => acc && l.id != "" && l.statement != "" && l.enforced_by.module_path == "std.observation" && l.enforced_by.decl_name != "" ) } -test fn w_change_kind_projects_from_the_one_diff_carrier() -> Bool { +fn w_change_kind_projects_from_the_one_diff_carrier() -> Bool { let added = observation_change_presentation(hunk: KeyedDiffAddedHunk { hunk_key: "a", to: 1 }) let removed = observation_change_presentation(hunk: KeyedDiffRemovedHunk { hunk_key: "a", from: 1 }) let modified = observation_change_presentation(hunk: KeyedDiffModifiedHunk { hunk_key: "a", from: 1, to: 2 }) @@ -453,7 +453,7 @@ test fn w_change_kind_projects_from_the_one_diff_carrier() -> Bool { modified.symbol == ChangeModified } -test fn w_change_kind_colour_follows_git_diff_convention() -> Bool { +fn w_change_kind_colour_follows_git_diff_convention() -> Bool { match symbol_color(id: ChangeAdded) { Present { value: a } => match symbol_color(id: ChangeModified) { @@ -468,7 +468,7 @@ test fn w_change_kind_colour_follows_git_diff_convention() -> Bool { } } -test fn w_change_kind_degrades_losslessly_without_colour() -> Bool { +fn w_change_kind_degrades_losslessly_without_colour() -> Bool { let added = observation_change_presentation(hunk: KeyedDiffAddedHunk { hunk_key: "a", to: 1 }) let removed = observation_change_presentation(hunk: KeyedDiffRemovedHunk { hunk_key: "a", from: 1 }) let modified = observation_change_presentation(hunk: KeyedDiffModifiedHunk { hunk_key: "a", from: 1, to: 2 }) @@ -476,7 +476,7 @@ test fn w_change_kind_degrades_losslessly_without_colour() -> Bool { added.tag != removed.tag && added.tag != modified.tag && removed.tag != modified.tag } -test fn w_no_op_kinds_each_explain_themselves() -> Bool { +fn w_no_op_kinds_each_explain_themselves() -> Bool { let kinds = [ DocsPolicy, Uncovered { declaration: "std.observation.observation_attention" as NonEmptyStr }, @@ -495,13 +495,13 @@ test fn w_no_op_kinds_each_explain_themselves() -> Bool { }) } -test fn w_uncovered_is_a_nudge_not_a_comfort() -> Bool { +fn w_uncovered_is_a_nudge_not_a_comfort() -> Bool { observation_no_op_attention(n: Uncovered { declaration: "std.observation.observation_watchdog" as NonEmptyStr }) == Notable && observation_no_op_attention(n: DocsPolicy) == Ambient && observation_no_op_symbol(n: Uncovered { declaration: "x" as NonEmptyStr }) == StatusWarning } -test fn w_departed_path_is_not_a_no_op() -> Bool { +fn w_departed_path_is_not_a_no_op() -> Bool { observation_no_op_is_actually_a_widen(n: DepartedPath { cause: "deleted module" as NonEmptyStr }) && !observation_no_op_is_actually_a_widen(n: DocsPolicy) && !observation_no_op_is_actually_a_widen(n: NoDeclsTouched) && @@ -510,7 +510,7 @@ test fn w_departed_path_is_not_a_no_op() -> Bool { observation_no_op_attention(n: DepartedPath { cause: "deleted module" as NonEmptyStr }) == Notable } -test fn w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() -> Bool { +fn w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() -> Bool { let hold = PsiPressure { avg10: basis_point(count: 3750) } match hold { PsiPressure { avg10: r } => basis_point_count(bp: r) == 3750 @@ -518,10 +518,44 @@ test fn w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() -> Bool { } } -test fn w_status_pulse_glyph_is_available_to_the_heartbeat() -> Bool { +fn w_status_pulse_glyph_is_available_to_the_heartbeat() -> Bool { match resolve_symbol(id: StatusPulse, tier: Emoji) { Present { value: e } => e == "🕐" Absent => false } } +test fn observation_model_witnesses() -> Bool { + w_presentation_is_total_over_class_roster() && + w_class_roster_covers_every_constructed_class() && + w_refused_is_distinct_from_failed() && + w_anomaly_classes_never_collapse() && + w_density_is_the_single_display_authority() && + w_presentation_projects_density_rather_than_restating_it() && + w_routine_progress_collapses_but_the_summary_always_shows() && + w_refusal_is_anomaly_on_any_basis() && + w_attention_grounds_on_supplied_basis() && + w_attention_moves_with_the_basis_not_a_local_constant() && + w_unavailable_measurement_carries_a_cause() && + w_blocked_on_resource_is_derived_for_every_hold() && + w_blocked_on_carries_holders_and_named_remaining() && + w_escalation_depth_is_recursive_not_one_level() && + w_escalation_surfaces_deeper_subject_over_time() && + w_escalation_refuses_to_surface_an_unrelated_subject() && + w_watchdog_converts_quiet_past_budget_into_a_typed_line() && + w_subject_identity_is_rendered_not_anonymous() && + w_containment_holds_along_the_path() && + w_grain_orders_the_containment_tree() && + w_presentation_glyph_reads_the_table_not_a_hardcoded_string() && + w_presentation_colour_comes_from_the_glyph_authority() && + w_reward_animal_selection_is_deterministic_and_wraps() && + w_every_law_is_stated_and_bound_to_an_enforcer() && + w_change_kind_projects_from_the_one_diff_carrier() && + w_change_kind_colour_follows_git_diff_convention() && + w_change_kind_degrades_losslessly_without_colour() && + w_no_op_kinds_each_explain_themselves() && + w_uncovered_is_a_nudge_not_a_comfort() && + w_departed_path_is_not_a_no_op() && + w_psi_pressure_carries_a_scaled_magnitude_not_a_scalar() && + w_status_pulse_glyph_is_available_to_the_heartbeat() +} diff --git a/dag/test/claim/observation_tty_render_witness_test.dag b/dag/test/claim/observation_tty_render_witness_test.dag index 236c9da4722..ff99d37909f 100644 --- a/dag/test/claim/observation_tty_render_witness_test.dag +++ b/dag/test/claim/observation_tty_render_witness_test.dag @@ -69,7 +69,7 @@ fn tty_basis() -> AttentionBasis { AttentionBasis { average: millisecond(count: 1000), maximum: millisecond(count: 5000) } } -test fn w_preamble_names_what_why_and_how_much() -> Bool { +fn w_preamble_names_what_why_and_how_much() -> Bool { let line = tty_preamble_line(fields: PreambleFields { run_id: "30044816605" as NonEmptyStr, trigger: "pull_request" as NonEmptyStr, @@ -82,18 +82,18 @@ test fn w_preamble_names_what_why_and_how_much() -> Bool { string_contains(s: line.text, pattern: "602 entries") } -test fn w_routine_repaints_in_place_but_anomaly_scrolls() -> Bool { +fn w_routine_repaints_in_place_but_anomaly_scrolls() -> Bool { tty_cursor_action(attention: Ambient, cap: tty_cap()) == Overwrite && tty_cursor_action(attention: Notable, cap: tty_cap()) == Append && tty_cursor_action(attention: Anomaly, cap: tty_cap()) == Append } -test fn w_non_addressable_terminal_always_appends() -> Bool { +fn w_non_addressable_terminal_always_appends() -> Bool { tty_cursor_action(attention: Ambient, cap: pipe_cap()) == Append && tty_cursor_action(attention: Anomaly, cap: pipe_cap()) == Append } -test fn w_refusal_never_repaints_away() -> Bool { +fn w_refusal_never_repaints_away() -> Bool { let refusal = ObservationEvent { subject: tty_entry_subject(), transition: Concluded { outcome: Refused { diagnostic: "FLOOR-BATCH-OVER-BUDGET" as NonEmptyStr } }, @@ -105,7 +105,7 @@ test fn w_refusal_never_repaints_away() -> Bool { emission.cursor == Append } -test fn w_same_event_drives_both_surfaces() -> Bool { +fn w_same_event_drives_both_surfaces() -> Bool { let event = ObservationEvent { subject: tty_entry_subject(), transition: Concluded { outcome: Done }, @@ -116,14 +116,14 @@ test fn w_same_event_drives_both_surfaces() -> Bool { string_contains(s: tty_render_emission(emission: emission, tier: Emoji), pattern: "in 230ms") } -test fn w_group_line_names_the_current_entry() -> Bool { +fn w_group_line_names_the_current_entry() -> Bool { let line = tty_group_line(active: tty_entry_subject(), k: 214, n: 602, spinner: Spinner0) string_contains(s: line.text, pattern: "214 of 602") && string_contains(s: line.text, pattern: "v2.compiler.normalized_tree") && line.attention == Ambient } -test fn w_blocked_line_carries_holder_and_bounded_remaining() -> Bool { +fn w_blocked_line_carries_holder_and_bounded_remaining() -> Bool { let bounded = tty_blocked_line(blocked: BlockedOn { resource: MemoryBudget, holders: [tty_entry_subject()], @@ -134,7 +134,7 @@ test fn w_blocked_line_carries_holder_and_bounded_remaining() -> Bool { bounded.attention == Anomaly } -test fn w_blocked_line_names_why_remaining_is_unknown() -> Bool { +fn w_blocked_line_names_why_remaining_is_unknown() -> Bool { let unknown = tty_blocked_line(blocked: BlockedOn { resource: MemoryBudget, holders: [tty_entry_subject()], @@ -144,7 +144,7 @@ test fn w_blocked_line_names_why_remaining_is_unknown() -> Bool { !string_contains(s: unknown.text, pattern: "remaining") } -test fn w_reward_animal_is_deterministic_and_degrades_to_a_word() -> Bool { +fn w_reward_animal_is_deterministic_and_degrades_to_a_word() -> Bool { let emoji_clean = tty_final_line(shown_failures: 0, run_index: 3, tier: Emoji) let emoji_again = tty_final_line(shown_failures: 0, run_index: 3, tier: Emoji) let ascii_clean = tty_final_line(shown_failures: 0, run_index: 3, tier: Ascii) @@ -154,9 +154,21 @@ test fn w_reward_animal_is_deterministic_and_degrades_to_a_word() -> Bool { !string_contains(s: ascii_clean.text, pattern: "🦦") } -test fn w_final_with_failures_names_them_and_is_anomaly() -> Bool { +fn w_final_with_failures_names_them_and_is_anomaly() -> Bool { let line = tty_final_line(shown_failures: 3, run_index: 3, tier: Emoji) string_contains(s: line.text, pattern: "3 problems shown") && line.attention == Anomaly } +test fn observation_tty_render_witnesses() -> Bool { + w_preamble_names_what_why_and_how_much() && + w_routine_repaints_in_place_but_anomaly_scrolls() && + w_non_addressable_terminal_always_appends() && + w_refusal_never_repaints_away() && + w_same_event_drives_both_surfaces() && + w_group_line_names_the_current_entry() && + w_blocked_line_carries_holder_and_bounded_remaining() && + w_blocked_line_names_why_remaining_is_unknown() && + w_reward_animal_is_deterministic_and_degrades_to_a_word() && + w_final_with_failures_names_them_and_is_anomaly() +} diff --git a/dag/test/claim/oomd_install_grounding_witness_test.dag b/dag/test/claim/oomd_install_grounding_witness_test.dag index 2d72b4f7a9c..e5f177642d9 100644 --- a/dag/test/claim/oomd_install_grounding_witness_test.dag +++ b/dag/test/claim/oomd_install_grounding_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.oomd_install_grounding_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn test_thresholds() -> OomdGroundingThresholds { @@ -238,21 +239,21 @@ fn grounds(read: OomdEffectiveRead) -> Bool { grounding_is_enforced(g: ground_oomd_from_read(read: read, req: test_thresholds())) } -test fn witness_full_conjunction_grounds_enforced() -> Bool { +fn witness_full_conjunction_grounds_enforced() -> Bool { grounds(read: good_read()) } -test fn witness_slice_absent_fails_closed() -> Bool { !grounds(read: slice_absent_read()) } -test fn witness_inactive_fails_closed() -> Bool { !grounds(read: inactive_read()) } -test fn witness_disabled_fails_closed() -> Bool { !grounds(read: disabled_read()) } -test fn witness_auto_pressure_fails_closed() -> Bool { !grounds(read: auto_pressure_read()) } -test fn witness_wrong_per_session_cap_fails_closed() -> Bool { !grounds(read: wrong_per_session_cap_read()) } -test fn witness_unbounded_per_session_cap_fails_closed() -> Bool { !grounds(read: unbounded_per_session_cap_read()) } -test fn witness_wrong_parent_slice_cap_fails_closed() -> Bool { !grounds(read: wrong_parent_slice_cap_read()) } -test fn witness_wrong_pressure_limit_fails_closed() -> Bool { !grounds(read: wrong_pressure_limit_read()) } -test fn witness_oomctl_unmanaged_fails_closed() -> Bool { !grounds(read: oomctl_unmanaged_read()) } +fn witness_slice_absent_fails_closed() -> Bool { !grounds(read: slice_absent_read()) } +fn witness_inactive_fails_closed() -> Bool { !grounds(read: inactive_read()) } +fn witness_disabled_fails_closed() -> Bool { !grounds(read: disabled_read()) } +fn witness_auto_pressure_fails_closed() -> Bool { !grounds(read: auto_pressure_read()) } +fn witness_wrong_per_session_cap_fails_closed() -> Bool { !grounds(read: wrong_per_session_cap_read()) } +fn witness_unbounded_per_session_cap_fails_closed() -> Bool { !grounds(read: unbounded_per_session_cap_read()) } +fn witness_wrong_parent_slice_cap_fails_closed() -> Bool { !grounds(read: wrong_parent_slice_cap_read()) } +fn witness_wrong_pressure_limit_fails_closed() -> Bool { !grounds(read: wrong_pressure_limit_read()) } +fn witness_oomctl_unmanaged_fails_closed() -> Bool { !grounds(read: oomctl_unmanaged_read()) } -test fn witness_unmeasured_aggregate_fails_closed() -> Bool { +fn witness_unmeasured_aggregate_fails_closed() -> Bool { !grounding_is_enforced(g: ground_oomd_from_read(read: good_read(), req: unmeasured_aggregate_thresholds())) } @@ -267,39 +268,63 @@ fn is_enforced(e: OomdEnforcementEvidence) -> Bool { } } -test fn witness_reconcile_good_read_enforces() -> Bool { +fn witness_reconcile_good_read_enforces() -> Bool { is_enforced(e: oomd_evidence_from_reconciliation(r: reconcile_oomd(read: managed_observed_read(), req: test_thresholds()))) } -test fn witness_reconcile_good_read_converges() -> Bool { +fn witness_reconcile_good_read_converges() -> Bool { reconciliation_converged(r: reconcile_oomd(read: managed_observed_read(), req: test_thresholds())) } -test fn witness_absent_read_is_fail_closed() -> Bool { +fn witness_absent_read_is_fail_closed() -> Bool { !is_enforced(e: gunbc_oomd_install_evidence()) } -test fn witness_fleet_evidence_seam_fail_closed() -> Bool { +fn witness_fleet_evidence_seam_fail_closed() -> Bool { !is_enforced(e: gunbc_oomd_fleet_evidence(req: test_thresholds())) } -test fn witness_membership_check_contract_passes_with_sessions_in_slice() -> Bool { +fn witness_membership_check_contract_passes_with_sessions_in_slice() -> Bool { membership_check_passes(m: good_membership()) } -test fn witness_membership_check_contract_passes_partial_migration() -> Bool { +fn witness_membership_check_contract_passes_partial_migration() -> Bool { membership_check_passes(m: partial_migration_membership()) } -test fn witness_membership_check_contract_fails_all_legacy() -> Bool { +fn witness_membership_check_contract_fails_all_legacy() -> Bool { !membership_check_passes(m: all_legacy_membership()) } -test fn witness_membership_check_contract_fails_empty_host() -> Bool { +fn witness_membership_check_contract_fails_empty_host() -> Bool { !membership_check_passes(m: empty_host_membership()) } -test fn witness_all_legacy_read_fails_closed() -> Bool { !grounds(read: all_legacy_read()) } -test fn witness_empty_host_read_fails_closed() -> Bool { !grounds(read: empty_host_read()) } -test fn witness_partial_migration_grounds() -> Bool { grounds(read: partial_migration_read()) } - +fn witness_all_legacy_read_fails_closed() -> Bool { !grounds(read: all_legacy_read()) } +fn witness_empty_host_read_fails_closed() -> Bool { !grounds(read: empty_host_read()) } +fn witness_partial_migration_grounds() -> Bool { grounds(read: partial_migration_read()) } + +test fn oomd_install_grounding_holds() -> Bool { + witness_full_conjunction_grounds_enforced() + && witness_slice_absent_fails_closed() + && witness_inactive_fails_closed() + && witness_disabled_fails_closed() + && witness_auto_pressure_fails_closed() + && witness_wrong_per_session_cap_fails_closed() + && witness_unbounded_per_session_cap_fails_closed() + && witness_wrong_parent_slice_cap_fails_closed() + && witness_wrong_pressure_limit_fails_closed() + && witness_oomctl_unmanaged_fails_closed() + && witness_unmeasured_aggregate_fails_closed() + && witness_reconcile_good_read_enforces() + && witness_reconcile_good_read_converges() + && witness_absent_read_is_fail_closed() + && witness_fleet_evidence_seam_fail_closed() + && witness_membership_check_contract_passes_with_sessions_in_slice() + && witness_membership_check_contract_passes_partial_migration() + && witness_membership_check_contract_fails_all_legacy() + && witness_membership_check_contract_fails_empty_host() + && witness_all_legacy_read_fails_closed() + && witness_empty_host_read_fails_closed() + && witness_partial_migration_grounds() +} diff --git a/dag/test/claim/orchestration_if_emit_test.dag b/dag/test/claim/orchestration_if_emit_test.dag index a593e49d6a1..5ff9c16ce9f 100644 --- a/dag/test/claim/orchestration_if_emit_test.dag +++ b/dag/test/claim/orchestration_if_emit_test.dag @@ -283,3 +283,13 @@ test fn orch_if_and_tests_holds() -> Bool { } } +test fn orch_if_band_holds() -> Bool { + orch_if_streq_empty_then_holds() + && orch_if_streq_empty_then_has_teeth_holds() + && orch_if_streq_else_holds() + && orch_if_exit_zero_negated_holds() + && orch_if_run_redirect_ignore_fail_holds() + && orch_if_log_matches_holds() + && orch_if_and_tests_holds() +} + diff --git a/dag/test/claim/output_policy_witness_test.dag b/dag/test/claim/output_policy_witness_test.dag index af450ce9e2a..9be94b8ad37 100644 --- a/dag/test/claim/output_policy_witness_test.dag +++ b/dag/test/claim/output_policy_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.output_policy_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn dec_is(d: OutputDecision, suppressed: Bool, condensed: Bool, full: Bool) -> Bool { @@ -22,50 +23,50 @@ fn verbosity_is_normal(v: Verbosity) -> Bool { match v { Normal => true, _ => false } } -test fn w_diagnostic_never_hidden() -> Bool { +fn w_diagnostic_never_hidden() -> Bool { dec_is(d: channel_decision(channel: gunbc.output_policy.Diagnostic, verbosity: Quiet), suppressed: false, condensed: false, full: true) && dec_is(d: channel_decision(channel: gunbc.output_policy.Diagnostic, verbosity: Normal), suppressed: false, condensed: false, full: true) && dec_is(d: channel_decision(channel: gunbc.output_policy.Diagnostic, verbosity: Verbose), suppressed: false, condensed: false, full: true) } -test fn w_instrumentation_is_debug_only() -> Bool { +fn w_instrumentation_is_debug_only() -> Bool { dec_is(d: channel_decision(channel: Instrumentation, verbosity: Normal), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: Instrumentation, verbosity: Quiet), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: Instrumentation, verbosity: Verbose), suppressed: false, condensed: false, full: true) } -test fn w_shell_trace_is_debug_only_at_normal() -> Bool { +fn w_shell_trace_is_debug_only_at_normal() -> Bool { dec_is(d: channel_decision(channel: ShellTrace, verbosity: Normal), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: ShellTrace, verbosity: Quiet), suppressed: true, condensed: false, full: false) && dec_is(d: channel_decision(channel: ShellTrace, verbosity: Verbose), suppressed: false, condensed: false, full: true) } -test fn w_claim_result_shown_at_normal_hidden_at_quiet() -> Bool { +fn w_claim_result_shown_at_normal_hidden_at_quiet() -> Bool { dec_is(d: channel_decision(channel: ClaimResult, verbosity: Normal), suppressed: false, condensed: false, full: true) && dec_is(d: channel_decision(channel: ClaimResult, verbosity: Quiet), suppressed: true, condensed: false, full: false) } -test fn w_progress_condenses_at_normal() -> Bool { +fn w_progress_condenses_at_normal() -> Bool { dec_is(d: channel_decision(channel: Progress, verbosity: Normal), suppressed: false, condensed: true, full: false) && dec_is(d: channel_decision(channel: Progress, verbosity: Quiet), suppressed: true, condensed: false, full: false) } -test fn w_verbose_wins_over_quiet() -> Bool { +fn w_verbose_wins_over_quiet() -> Bool { verbosity_is_verbose(v: resolve_verbosity(env: VerbosityEnv { verbose: true, quiet: true })) && verbosity_is_quiet(v: resolve_verbosity(env: VerbosityEnv { verbose: false, quiet: true })) && verbosity_is_normal(v: resolve_verbosity(env: VerbosityEnv { verbose: false, quiet: false })) } -test fn w_env_var_dispatch_names_grounded() -> Bool { +fn w_env_var_dispatch_names_grounded() -> Bool { env_var_for(v: Verbose) == "GUNBC_VERBOSE" && env_var_for(v: Quiet) == "GUNBC_QUIET" } -test fn w_shell_trace_cap_is_authority() -> Bool { +fn w_shell_trace_cap_is_authority() -> Bool { shell_trace_summary_max_columns == 100 } -test fn w_resolve_channel_policy_normal_bundles_decisions() -> Bool { +fn w_resolve_channel_policy_normal_bundles_decisions() -> Bool { let p = resolve_channel_policy(verbose: false, quiet: false) dec_is(d: p.diagnostic, suppressed: false, condensed: false, full: true) && dec_is(d: p.claim_result, suppressed: false, condensed: false, full: true) && @@ -74,7 +75,7 @@ test fn w_resolve_channel_policy_normal_bundles_decisions() -> Bool { dec_is(d: p.instrumentation, suppressed: true, condensed: false, full: false) } -test fn w_resolve_channel_policy_verbose_all_full() -> Bool { +fn w_resolve_channel_policy_verbose_all_full() -> Bool { let p = resolve_channel_policy(verbose: true, quiet: false) dec_is(d: p.shell_trace, suppressed: false, condensed: false, full: true) && dec_is(d: p.instrumentation, suppressed: false, condensed: false, full: true) && @@ -100,7 +101,7 @@ fn surfaced_text_or_marker(d: StreamDisposition, text: String) -> String { } } -test fn w_divergence_surfaces_agreement_counts_at_normal() -> Bool { +fn w_divergence_surfaces_agreement_counts_at_normal() -> Bool { disp_is(d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)), surface: true, counts: false, suppressed: false) && disp_is(d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: ObservedSuccess), @@ -111,35 +112,35 @@ test fn w_divergence_surfaces_agreement_counts_at_normal() -> Bool { surface: true, counts: false, suppressed: false) } -test fn w_red_control_failing_as_declared_does_not_replay_content() -> Bool { +fn w_red_control_failing_as_declared_does_not_replay_content() -> Bool { surfaced_text_or_marker( d: shell_stream(verbosity: Normal, expected: ExpectFailure, observed: observed_outcome_from_exit(exit: 1)), text: "::error::build verification: declared artifact absent" ) == "" } -test fn w_red_control_that_unexpectedly_succeeds_surfaces() -> Bool { +fn w_red_control_that_unexpectedly_succeeds_surfaces() -> Bool { surfaced_text_or_marker( d: shell_stream(verbosity: Normal, expected: ExpectFailure, observed: ObservedSuccess), text: "wall did not fire" ) == "| wall did not fire" } -test fn w_surfaced_subject_text_cannot_mint_annotations() -> Bool { +fn w_surfaced_subject_text_cannot_mint_annotations() -> Bool { surfaced_text_or_marker( d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)), text: "::error::boom\n::warning::next" ) == "| ::error::boom\n| ::warning::next" } -test fn w_neutralization_is_the_only_route_to_surfaced_text() -> Bool { +fn w_neutralization_is_the_only_route_to_surfaced_text() -> Bool { neutralize_workflow_commands(text: "::endgroup::") == "| ::endgroup::" && subject_text_line_guard == "| " } data w_quiet_ambient_silent_but_divergence_still_surfaces_note: String = "Observation dissolve: Quiet suppresses Ambient ShellTrace scaffolding, but stream disposition follows divergence — Anomaly is never silenced by channel Suppressed (DESIGN section 5). Verbose still surfaces every stream (Full)." -test fn w_quiet_ambient_silent_but_divergence_still_surfaces() -> Bool { +fn w_quiet_ambient_silent_but_divergence_still_surfaces() -> Bool { disp_is(d: shell_stream(verbosity: Quiet, expected: ExpectFailure, observed: ObservedSuccess), surface: true, counts: false, suppressed: false) && disp_is(d: shell_stream(verbosity: Quiet, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)), @@ -152,21 +153,21 @@ test fn w_quiet_ambient_silent_but_divergence_still_surfaces() -> Bool { surface: true, counts: false, suppressed: false) } -test fn w_effect_stream_disposition_is_exit_invariant() -> Bool { +fn w_effect_stream_disposition_is_exit_invariant() -> Bool { disp_is(d: shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 137)), surface: true, counts: false, suppressed: false) && disp_is(d: shell_stream(verbosity: Normal, expected: ExpectFailure, observed: observed_outcome_from_exit(exit: 137)), surface: false, counts: true, suppressed: false) } -test fn w_expectation_axis_is_load_bearing_red_control() -> Bool { +fn w_expectation_axis_is_load_bearing_red_control() -> Bool { let agree = shell_stream(verbosity: Normal, expected: ExpectFailure, observed: observed_outcome_from_exit(exit: 1)) let diverge = shell_stream(verbosity: Normal, expected: ExpectSuccess, observed: observed_outcome_from_exit(exit: 1)) disp_is(d: agree, surface: true, counts: false, suppressed: false) == false && disp_is(d: diverge, surface: false, counts: true, suppressed: false) == false } -test fn w_shell_trace_stream_policy_projects_the_four_corners() -> Bool { +fn w_shell_trace_stream_policy_projects_the_four_corners() -> Bool { let p = resolve_shell_trace_stream_policy(verbose: false, quiet: false) disp_is(d: p.expect_success_observed_success, surface: false, counts: true, suppressed: false) && disp_is(d: p.expect_success_observed_failure, surface: true, counts: false, suppressed: false) && @@ -183,7 +184,7 @@ fn disp_surfaces(d: StreamDisposition) -> Bool { disp_is(d: d, surface: true, counts: false, suppressed: false) } -test fn w_outcome_is_data_is_exit_invariant() -> Bool { +fn w_outcome_is_data_is_exit_invariant() -> Bool { let p = resolve_shell_trace_stream_policy(verbose: false, quiet: false) let es_flips = disp_surfaces(d: p.expect_success_observed_failure) && !disp_surfaces(d: p.expect_success_observed_success) let ef_flips = disp_surfaces(d: p.expect_failure_observed_success) && !disp_surfaces(d: p.expect_failure_observed_failure) @@ -191,3 +192,28 @@ test fn w_outcome_is_data_is_exit_invariant() -> Bool { es_flips && ef_flips && oid_still } +test fn output_policy_effect_stream_witnesses() -> Bool { + w_divergence_surfaces_agreement_counts_at_normal() && + w_red_control_failing_as_declared_does_not_replay_content() && + w_red_control_that_unexpectedly_succeeds_surfaces() && + w_surfaced_subject_text_cannot_mint_annotations() && + w_neutralization_is_the_only_route_to_surfaced_text() && + w_quiet_ambient_silent_but_divergence_still_surfaces() && + w_effect_stream_disposition_is_exit_invariant() && + w_expectation_axis_is_load_bearing_red_control() && + w_shell_trace_stream_policy_projects_the_four_corners() && + w_outcome_is_data_is_exit_invariant() +} + +test fn output_policy_witnesses() -> Bool { + w_diagnostic_never_hidden() && + w_instrumentation_is_debug_only() && + w_shell_trace_is_debug_only_at_normal() && + w_claim_result_shown_at_normal_hidden_at_quiet() && + w_progress_condenses_at_normal() && + w_verbose_wins_over_quiet() && + w_env_var_dispatch_names_grounded() && + w_shell_trace_cap_is_authority() && + w_resolve_channel_policy_normal_bundles_decisions() && + w_resolve_channel_policy_verbose_all_full() +} diff --git a/dag/test/claim/pareto_dominance_witness_test.dag b/dag/test/claim/pareto_dominance_witness_test.dag index 3d7864bb8fc..63ef5fe06e0 100644 --- a/dag/test/claim/pareto_dominance_witness_test.dag +++ b/dag/test/claim/pareto_dominance_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.pareto_dominance + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn compare_axes(a_cap: Int, a_cost: Int, b_cap: Int, b_cost: Int) -> List { @@ -13,24 +14,24 @@ fn verdict_of(a_cap: Int, a_cost: Int, b_cap: Int, b_cost: Int) -> DominanceVerd dominance_of_comparisons(comparisons: compare_axes(a_cap: a_cap, a_cost: a_cost, b_cap: b_cap, b_cost: b_cost)) } -test fn dominates_when_better_on_all_axes() -> Bool { +fn dominates_when_better_on_all_axes() -> Bool { verdict_dominates(v: verdict_of(a_cap: 64, a_cost: 100, b_cap: 32, b_cost: 200)) } -test fn dominated_is_the_mirror() -> Bool { +fn dominated_is_the_mirror() -> Bool { verdict_is_dominated(v: verdict_of(a_cap: 32, a_cost: 200, b_cap: 64, b_cost: 100)) } -test fn equivalent_when_identical() -> Bool { +fn equivalent_when_identical() -> Bool { verdict_is_equivalent(v: verdict_of(a_cap: 48, a_cost: 150, b_cap: 48, b_cost: 150)) } -test fn incomparable_is_not_a_tie() -> Bool { +fn incomparable_is_not_a_tie() -> Bool { let v = verdict_of(a_cap: 64, a_cost: 200, b_cap: 32, b_cost: 100) verdict_is_incomparable(v: v) && !verdict_is_equivalent(v: v) } -test fn dominated_candidate_is_off_front() -> Bool { +fn dominated_candidate_is_off_front() -> Bool { let pool = [ verdict_of(a_cap: 64, a_cost: 100, b_cap: 32, b_cost: 200), @@ -39,7 +40,7 @@ test fn dominated_candidate_is_off_front() -> Bool { any_dominates(verdicts: pool) && !on_pareto_front(verdicts: pool) } -test fn undominated_candidate_stays_on_front() -> Bool { +fn undominated_candidate_stays_on_front() -> Bool { let pool = [ verdict_of(a_cap: 32, a_cost: 50, b_cap: 64, b_cost: 100), @@ -48,3 +49,11 @@ test fn undominated_candidate_stays_on_front() -> Bool { on_pareto_front(verdicts: pool) && !any_dominates(verdicts: pool) } +test fn pareto_dominance_holds() -> Bool { + dominates_when_better_on_all_axes() + && dominated_is_the_mirror() + && equivalent_when_identical() + && incomparable_is_not_a_tie() + && dominated_candidate_is_off_front() + && undominated_candidate_stays_on_front() +} diff --git a/dag/test/claim/perturbation_kernel_test.dag b/dag/test/claim/perturbation_kernel_test.dag index 8963232f1b0..a8e2ec60b74 100644 --- a/dag/test/claim/perturbation_kernel_test.dag +++ b/dag/test/claim/perturbation_kernel_test.dag @@ -1,5 +1,6 @@ module test.claim.perturbation_kernel + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn is_consistent(reading: PerturbationReading, responded: Bool) -> Bool { @@ -9,26 +10,33 @@ fn is_consistent(reading: PerturbationReading, responded: Bool) -> Bool { } } -test fn witness_forward_silent_is_consistent() -> Bool { +fn witness_forward_silent_is_consistent() -> Bool { is_consistent(reading: ForwardSameInSameOut, responded: false) } -test fn witness_forward_responded_is_violation() -> Bool { +fn witness_forward_responded_is_violation() -> Bool { perturbation_is_violation(reading: ForwardSameInSameOut, output_responded: true) } -test fn witness_backward_responded_is_consistent() -> Bool { +fn witness_backward_responded_is_consistent() -> Bool { perturbation_consistent(reading: BackwardDiffInDiffOut, output_responded: true) } -test fn witness_backward_silent_is_violation() -> Bool { +fn witness_backward_silent_is_violation() -> Bool { perturbation_is_violation(reading: BackwardDiffInDiffOut, output_responded: false) } -test fn witness_readings_are_dual() -> Bool { +fn witness_readings_are_dual() -> Bool { (is_consistent(reading: ForwardSameInSameOut, responded: false) && (is_consistent(reading: BackwardDiffInDiffOut, responded: false) == false)) && (is_consistent(reading: BackwardDiffInDiffOut, responded: true) && (is_consistent(reading: ForwardSameInSameOut, responded: true) == false)) } +test fn perturbation_kernel_witnesses() -> Bool { + witness_forward_silent_is_consistent() + && witness_forward_responded_is_violation() + && witness_backward_responded_is_consistent() + && witness_backward_silent_is_violation() + && witness_readings_are_dual() +} diff --git a/dag/test/claim/power_watt_witness_test.dag b/dag/test/claim/power_watt_witness_test.dag index 168b70537c4..525677ed676 100644 --- a/dag/test/claim/power_watt_witness_test.dag +++ b/dag/test/claim/power_watt_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.power_watt + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn total_power_watts(components: List) -> Watt { @@ -13,15 +14,20 @@ data example_component_draws: List = [ watt(count: 30) ] -test fn total_power_is_computed_sum() -> Bool { +fn total_power_is_computed_sum() -> Bool { watt_count(w: total_power_watts(components: example_component_draws)) == 220 } -test fn empty_budget_is_zero_watts() -> Bool { +fn empty_budget_is_zero_watts() -> Bool { watt_count(w: total_power_watts(components: [])) == 0 } -test fn watt_roundtrips() -> Bool { +fn watt_roundtrips() -> Bool { watt_count(w: watt(count: 183)) == 183 } +test fn power_watt_witnesses() -> Bool { + watt_roundtrips() + && empty_budget_is_zero_watts() + && total_power_is_computed_sum() +} diff --git a/dag/test/claim/pricing_surface_witness_test.dag b/dag/test/claim/pricing_surface_witness_test.dag index fee6a8ed1f6..681ac06996e 100644 --- a/dag/test/claim/pricing_surface_witness_test.dag +++ b/dag/test/claim/pricing_surface_witness_test.dag @@ -22,12 +22,12 @@ import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_github_2core_per_hour_derived_not_stored() -> Bool { +fn witness_github_2core_per_hour_derived_not_stored() -> Bool { let derived = per_hour_equivalent_from_per_minute(q: github_actions_linux_2core_price.per_minute) money_per_hour_micros(q: derived) == 360000 } -test fn witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() -> Bool { +fn witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() -> Bool { let github_hourly = per_hour_equivalent_from_per_minute(q: github_actions_linux_2core_price.per_minute) let aws_hourly = aws_ec2_m7a_large_us_east_1.per_hour money_per_hour_micros(q: github_hourly) > money_per_hour_micros(q: aws_hourly) @@ -35,18 +35,18 @@ test fn witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() -> Bool && money_per_hour_micros(q: aws_hourly) == 115920 } -test fn witness_ubicloud_premium_2core_undercuts_github_2core_per_minute() -> Bool { +fn witness_ubicloud_premium_2core_undercuts_github_2core_per_minute() -> Bool { money_per_minute_micros(q: github_actions_linux_2core_price.per_minute) > money_per_minute_micros(q: ubicloud_premium_standard_2_price.per_minute) && money_per_minute_micros(q: ubicloud_premium_standard_2_price.per_minute) == 1600 && money_per_minute_micros(q: github_actions_linux_2core_price.per_minute) == 6000 } -test fn witness_hetzner_ax41_monthly_matches_cited_price() -> Bool { +fn witness_hetzner_ax41_monthly_matches_cited_price() -> Bool { money_per_month_micros(q: hetzner_ax41_1_ltd_price.monthly) == 57300000 && hetzner_dedicated_setup_fee_micros(row: hetzner_ax41_1_ltd_price) == 0 } -test fn witness_hetzner_ax41_hourly_equivalent_derived() -> Bool { +fn witness_hetzner_ax41_hourly_equivalent_derived() -> Bool { let derived = per_hour_equivalent_from_per_month(q: hetzner_ax41_1_ltd_price.monthly) money_per_hour_micros(q: derived) == 57300000 / billing_month_as_hour_count() } @@ -56,8 +56,16 @@ data wrong_github_2core_per_minute_fixture: MoneyPerMinute = MoneyPerMinute { currency: Usd, } -test fn witness_wrong_github_per_minute_red_control() -> Bool { +fn witness_wrong_github_per_minute_red_control() -> Bool { let derived = per_hour_equivalent_from_per_minute(q: wrong_github_2core_per_minute_fixture) money_per_hour_micros(q: derived) != 360000 } +test fn pricing_surface_witness_holds() -> Bool { + witness_github_2core_per_hour_derived_not_stored() + && witness_github_2core_per_hour_exceeds_aws_m7a_large_on_demand() + && witness_ubicloud_premium_2core_undercuts_github_2core_per_minute() + && witness_hetzner_ax41_monthly_matches_cited_price() + && witness_hetzner_ax41_hourly_equivalent_derived() + && witness_wrong_github_per_minute_red_control() +} diff --git a/dag/test/claim/python_pep440_version_witness_test.dag b/dag/test/claim/python_pep440_version_witness_test.dag index 9e317d41f19..7433e6a5f20 100644 --- a/dag/test/claim/python_pep440_version_witness_test.dag +++ b/dag/test/claim/python_pep440_version_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.python_pep440_version_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn release_1() -> Pep440ReleaseSegments { @@ -101,36 +102,36 @@ fn v_local_1_0_abc_5() -> Pep440Version { } } -test fn w_final_release_label() -> Bool { +fn w_final_release_label() -> Bool { pep440_version_label(v: v_final_1_0()) == "1.0" } -test fn w_alpha_pre_release_label() -> Bool { +fn w_alpha_pre_release_label() -> Bool { pep440_version_label(v: v_alpha_1_0a1()) == "1.0a1" } -test fn w_epoch_prefix_label() -> Bool { +fn w_epoch_prefix_label() -> Bool { pep440_version_label(v: v_epoch_1_2_0()) == "1!2.0" } -test fn w_post_release_label() -> Bool { +fn w_post_release_label() -> Bool { pep440_version_label(v: v_post_1_0_post1()) == "1.0.post1" } -test fn w_dev_release_label() -> Bool { +fn w_dev_release_label() -> Bool { pep440_version_label(v: v_dev_1_0_dev456()) == "1.0.dev456" } -test fn w_local_version_label() -> Bool { +fn w_local_version_label() -> Bool { pep440_version_label(v: v_local_1_0_abc_5()) == "1.0+abc.5" } -test fn w_spec_citation_present() -> Bool { +fn w_spec_citation_present() -> Bool { string_contains(s: pep440_spec_url, pattern: "packaging.python.org") && string_contains(s: pep440_spec_label, pattern: "PEP 440") } -test fn w_version_specifier_clause_label() -> Bool { +fn w_version_specifier_clause_label() -> Bool { pep440_version_specifier_label(spec: [ { op: Pep440CompatibleRelease, @@ -155,7 +156,7 @@ test fn w_version_specifier_clause_label() -> Bool { ]) == "~= 2.2, >= 1.0" } -test fn w_discriminates_pre_release_numbers() -> Bool { +fn w_discriminates_pre_release_numbers() -> Bool { let a1 = pep440_version_label(v: v_alpha_1_0a1()) let a2 = pep440_version_label(v: Pep440Version { public: Pep440PublicVersion { @@ -172,11 +173,11 @@ test fn w_discriminates_pre_release_numbers() -> Bool { a1 == "1.0a1" && a2 == "1.0a2" && a1 != a2 } -test fn w_version_identity_projection() -> Bool { +fn w_version_identity_projection() -> Bool { pep440_version_identity(v: v_final_1_0()) == "1.0" } -test fn w_version_specifier_constraint_projection() -> Bool { +fn w_version_specifier_constraint_projection() -> Bool { pep440_version_specifier_constraint(spec: [ { op: Pep440InclusiveAtLeast, @@ -191,7 +192,7 @@ test fn w_version_specifier_constraint_projection() -> Bool { ]) == ">= 1.0" } -test fn w_release_segments_zero_pad_equal() -> Bool { +fn w_release_segments_zero_pad_equal() -> Bool { pep440_compare_public( a: Pep440PublicVersion { epoch: 0, @@ -210,14 +211,14 @@ test fn w_release_segments_zero_pad_equal() -> Bool { ) == Equal } -test fn w_structural_alpha_before_final() -> Bool { +fn w_structural_alpha_before_final() -> Bool { pep440_compare_public( a: v_alpha_1_0a1().public, b: v_final_1_0().public ) == Less } -test fn w_a2_dev1_greater_than_a1() -> Bool { +fn w_a2_dev1_greater_than_a1() -> Bool { pep440_compare_public( a: Pep440PublicVersion { epoch: 0, @@ -232,14 +233,14 @@ test fn w_a2_dev1_greater_than_a1() -> Bool { ) == Greater } -test fn w_bare_dev_before_alpha() -> Bool { +fn w_bare_dev_before_alpha() -> Bool { pep440_compare_public( a: v_dev_1_0_dev456().public, b: v_alpha_1_0a1().public ) == Less } -test fn w_dev_on_pre_before_same_pre() -> Bool { +fn w_dev_on_pre_before_same_pre() -> Bool { pep440_compare_public( a: Pep440PublicVersion { epoch: 0, @@ -254,7 +255,26 @@ test fn w_dev_on_pre_before_same_pre() -> Bool { ) == Less } -test fn w_min_python_interpreter_grounded() -> Bool { +fn w_min_python_interpreter_grounded() -> Bool { min_python_interpreter == ">= 3.11" } +test fn python_pep440_version_witnesses() -> Bool { + w_final_release_label() + && w_alpha_pre_release_label() + && w_epoch_prefix_label() + && w_post_release_label() + && w_dev_release_label() + && w_local_version_label() + && w_spec_citation_present() + && w_version_specifier_clause_label() + && w_discriminates_pre_release_numbers() + && w_version_identity_projection() + && w_version_specifier_constraint_projection() + && w_release_segments_zero_pad_equal() + && w_structural_alpha_before_final() + && w_a2_dev1_greater_than_a1() + && w_bare_dev_before_alpha() + && w_dev_on_pre_before_same_pre() + && w_min_python_interpreter_grounded() +} diff --git a/dag/test/claim/react_jsx_emit_test.dag b/dag/test/claim/react_jsx_emit_test.dag index 86ae476e52e..951082a5cc9 100644 --- a/dag/test/claim/react_jsx_emit_test.dag +++ b/dag/test/claim/react_jsx_emit_test.dag @@ -1,17 +1,18 @@ module test.claim.react_jsx_emit + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn browse_page_jsx() -> String { serialize_jsx_component(fn_name: "GunbhubBrowsePage", node: gunbhub_browse_page()) } -test fn witness_browse_page_jsx_exact_bytes() -> Bool { +fn witness_browse_page_jsx_exact_bytes() -> Bool { browse_page_jsx() == "export function GunbhubBrowsePage(): JSX.Element { return gunbc

gunbc

; }" } -test fn witness_fn_name_in_output() -> Bool { +fn witness_fn_name_in_output() -> Bool { let a = serialize_jsx_component(fn_name: "PageA", node: gunbhub_browse_page()) let b = serialize_jsx_component(fn_name: "PageB", node: gunbhub_browse_page()) a.starts_with(prefix: "export function PageA():") && @@ -19,17 +20,23 @@ test fn witness_fn_name_in_output() -> Bool { !(a == b) } -test fn witness_hostile_href_rejected() -> Bool { +fn witness_hostile_href_rejected() -> Bool { match try_serialize_jsx_component(fn_name: "HostilePage", node: gunbhub_hostile_page()) { JsxRejected { reason: _ } => true JsxOk { tsx: _ } => false } } -test fn witness_safe_page_emits_ok() -> Bool { +fn witness_safe_page_emits_ok() -> Bool { match try_serialize_jsx_component(fn_name: "GunbhubBrowsePage", node: gunbhub_browse_page()) { JsxOk { tsx: s } => s.starts_with(prefix: "export function GunbhubBrowsePage():") JsxRejected { reason: _ } => false } } +test fn react_jsx_emit_keystone_holds() -> Bool { + witness_browse_page_jsx_exact_bytes() + && witness_fn_name_in_output() + && witness_hostile_href_rejected() + && witness_safe_page_emits_ok() +} diff --git a/dag/test/claim/readback_independence_witness_test.dag b/dag/test/claim/readback_independence_witness_test.dag index 1e74c4b17f4..464877bdfa2 100644 --- a/dag/test/claim/readback_independence_witness_test.dag +++ b/dag/test/claim/readback_independence_witness_test.dag @@ -4,7 +4,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_cited_incident_note: String = "The conjunct is the incident itself, replayed through the criterion. On srv3 2026-07-25 `sccache --show-stats` returned a full stats table — a Converged read — over a host whose modeled unit had been dead for six hours. The criterion must turn that exact input into UnknownRefused, and it must do so because of what the PROBE can do, not because of anything about the value it returned." -test fn witness_self_establishing_probe_cannot_report_converged() -> Bool { +fn witness_self_establishing_probe_cannot_report_converged() -> Bool { observation_verdict_eq( a: readback_evidence_verdict( p: sccache_show_stats_probe, @@ -16,7 +16,7 @@ test fn witness_self_establishing_probe_cannot_report_converged() -> Bool { data witness_negatives_survive_note: String = "The asymmetry, and it is the conjunct that stops the criterion from being a blunt discard. A self-establishing probe that reports a NEGATIVE is still telling the truth: it had every opportunity to bring the subject into existence and still could not report it, so Absent stays Absent, Drifted stays Drifted, Inaccessible stays Inaccessible. Only the positive is rewritten. A fold that returned UnknownRefused for every verdict from a non-independent probe would pass the conjunct above and destroy real evidence here." -test fn witness_negative_results_from_a_tainted_probe_survive() -> Bool { +fn witness_negative_results_from_a_tainted_probe_survive() -> Bool { observation_verdict_eq( a: readback_evidence_verdict(p: sccache_show_stats_probe, observed: std.upsert_decision.Absent), b: std.upsert_decision.Absent, @@ -39,7 +39,7 @@ test fn witness_negative_results_from_a_tainted_probe_survive() -> Bool { data witness_inert_probe_note: String = "The non-vacuity control in the other direction. `systemctl show` and `systemctl --user is-active` read the manager's recorded state and start nothing, so their Converged results must survive untouched. Without this, a criterion that refused every probe would satisfy every other conjunct in this file while making read-back worthless — the absorbing fallback wearing a safety badge, which is precisely the failure this lane keeps catching." -test fn witness_inert_probes_keep_their_evidence() -> Bool { +fn witness_inert_probes_keep_their_evidence() -> Bool { observation_verdict_eq( a: readback_evidence_verdict( p: systemd_is_active_probe, @@ -59,7 +59,7 @@ test fn witness_inert_probes_keep_their_evidence() -> Bool { data witness_unknown_effect_note: String = "An unaudited transport must be treated as tainted, not as clean. This is the fail-closed default and it is where the criterion earns most of its value, because the classified probes are a handful and the unclassified ones are everything else." -test fn witness_unclassified_probe_is_treated_as_tainted() -> Bool { +fn witness_unclassified_probe_is_treated_as_tainted() -> Bool { let unaudited = ReadBackProbe { label: "hypothetical unaudited transport", subject: "some subject", @@ -74,7 +74,7 @@ test fn witness_unclassified_probe_is_treated_as_tainted() -> Bool { data witness_red_control_note: String = "The discriminating RED control. The perturbation is trusting the probe's own answer regardless of transport — the corpus's behaviour everywhere the criterion has not been applied — and the gate rejects it on the srv3 inputs while accepting the authority on the same inputs. Both directions are asserted so neither an always-reject nor an always-accept gate could pass." -test fn witness_red_control_trusting_probe_rejected_by_gate() -> Bool { +fn witness_red_control_trusting_probe_rejected_by_gate() -> Bool { let p = sccache_show_stats_probe let widened = readback_evidence_trusting_widen_sketch( p: p, @@ -89,7 +89,7 @@ test fn witness_red_control_trusting_probe_rejected_by_gate() -> Bool { data witness_live_consumer_note: String = "The criterion has a live consumer, or it is an inert lens — a thing DESIGN §6 calls a lie in its own right. gunbc.host_swap_backing routes every host verdict through it. The routing is a no-op today because /proc/swaps is inert, so the conjunct proves it by SUBSTITUTION: the same swap verdict carried by the sccache probe instead would be refused. That is what makes the classification load-bearing rather than decorative — swapping the transport for an ensure-shaped one changes the answer." -test fn witness_swap_axis_consumes_the_criterion() -> Bool { +fn witness_swap_axis_consumes_the_criterion() -> Bool { let inert_route = readback_evidence_verdict( p: proc_swaps_read_probe, observed: std.upsert_decision.Converged, @@ -106,8 +106,17 @@ test fn witness_swap_axis_consumes_the_criterion() -> Bool { ) } -test fn witness_roster_names_the_cited_incident() -> Bool { +fn witness_roster_names_the_cited_incident() -> Bool { readback_non_independent_probe_count() == 1 && readback_probe_roster.length() == 4 } +test fn readback_independence_witnesses() -> Bool { + witness_self_establishing_probe_cannot_report_converged() + && witness_negative_results_from_a_tainted_probe_survive() + && witness_inert_probes_keep_their_evidence() + && witness_unclassified_probe_is_treated_as_tainted() + && witness_red_control_trusting_probe_rejected_by_gate() + && witness_swap_axis_consumes_the_criterion() + && witness_roster_names_the_cited_incident() +} diff --git a/dag/test/claim/realization_reconcile_witness_test.dag b/dag/test/claim/realization_reconcile_witness_test.dag index 37d4c1868cd..10f508ac130 100644 --- a/dag/test/claim/realization_reconcile_witness_test.dag +++ b/dag/test/claim/realization_reconcile_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.realization_reconcile_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn is_share(m: Materialization) -> Bool { @@ -36,7 +37,7 @@ fn has_no_share(steps: List>) -> Bool { (steps |> filter(e => is_share(m: e.materialization)) |> length) == 0 } -test fn witness_same_keysource_collapses_to_share() -> Bool { +fn witness_same_keysource_collapses_to_share() -> Bool { let out = std.realization.reconcile(steps: [ step_create_if_absent(field: "id"), step_create_if_absent(field: "id") @@ -44,7 +45,7 @@ test fn witness_same_keysource_collapses_to_share() -> Bool { (out |> length) == 1 && has_exactly_one_share(steps: out) } -test fn witness_different_keysource_does_not_collapse() -> Bool { +fn witness_different_keysource_does_not_collapse() -> Bool { let out = std.realization.reconcile(steps: [ step_create_if_absent(field: "id"), step_create_if_absent(field: "other") @@ -52,8 +53,13 @@ test fn witness_different_keysource_does_not_collapse() -> Bool { (out |> length) == 2 && has_no_share(steps: out) } -test fn witness_post_always_never_collapses() -> Bool { +fn witness_post_always_never_collapses() -> Bool { let out = std.realization.reconcile(steps: [ step_post_always(), step_post_always() ]) (out |> length) == 2 && has_no_share(steps: out) } +test fn reconcile_share_collapse_witnesses() -> Bool { + witness_same_keysource_collapses_to_share() + && witness_different_keysource_does_not_collapse() + && witness_post_always_never_collapses() +} diff --git a/dag/test/claim/realization_scale_agnostic_test.dag b/dag/test/claim/realization_scale_agnostic_test.dag index 9432fc5ba7b..51c39429ced 100644 --- a/dag/test/claim/realization_scale_agnostic_test.dag +++ b/dag/test/claim/realization_scale_agnostic_test.dag @@ -1,30 +1,37 @@ module test.claim.realization_scale_agnostic + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn milli(count: std.nat.Nat) -> Measure { time_measure(count: count) } -test fn witness_milli_seq_and_par() -> Bool { +fn witness_milli_seq_and_par() -> Bool { let a = milli(count: 30) let b = milli(count: 12) (measure_count(m: time_measure_seq(a: a, b: b)) == 42) && (measure_count(m: time_measure_par(a: a, b: b)) == 30) } -test fn witness_milli_critical_path() -> Bool { +fn witness_milli_critical_path() -> Bool { let batches = [[milli(count: 10), milli(count: 40)], [milli(count: 5)]] measure_count(m: schedule_critical_path_time(batch_times: batches)) == 45 } -test fn witness_milli_cost_account() -> Bool { +fn witness_milli_cost_account() -> Bool { let batches = [[milli(count: 7)], [milli(count: 8)]] let account = cost_account_measured_from_schedule_critical_path(batch_times: batches) cost_account_time_count(account: account) == 15 } -test fn witness_milli_rollup_discriminates() -> Bool { +fn witness_milli_rollup_discriminates() -> Bool { witness_measured_rollup_differs_from_predicted_zero(wall_time: milli(count: 99)) } +test fn realization_scale_agnostic_witnesses() -> Bool { + witness_milli_seq_and_par() + && witness_milli_critical_path() + && witness_milli_cost_account() + && witness_milli_rollup_discriminates() +} diff --git a/dag/test/claim/realization_schedule_critical_path_test.dag b/dag/test/claim/realization_schedule_critical_path_test.dag index 44cd42f63fa..700f75c31ac 100644 --- a/dag/test/claim/realization_schedule_critical_path_test.dag +++ b/dag/test/claim/realization_schedule_critical_path_test.dag @@ -1,8 +1,9 @@ module test.claim.realization_schedule_critical_path + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_parallel_batch_takes_max_not_sum() -> Bool { +fn witness_parallel_batch_takes_max_not_sum() -> Bool { let batch = [ nanosecond_duration(count: 100), nanosecond_duration(count: 5), @@ -14,7 +15,7 @@ test fn witness_parallel_batch_takes_max_not_sum() -> Bool { && nanosecond_duration_count(d: critical) != nanosecond_duration_count(d: summed) } -test fn witness_sequential_batches_add_critical_paths() -> Bool { +fn witness_sequential_batches_add_critical_paths() -> Bool { let batches = [ [nanosecond_duration(count: 50)], [ @@ -25,7 +26,7 @@ test fn witness_sequential_batches_add_critical_paths() -> Bool { nanosecond_duration_count(d: schedule_critical_path_time(batch_times: batches)) == 150 } -test fn witness_measured_total_uses_critical_path_basis() -> Bool { +fn witness_measured_total_uses_critical_path_basis() -> Bool { let batches = [ [ nanosecond_duration(count: 200), @@ -40,10 +41,16 @@ test fn witness_measured_total_uses_critical_path_basis() -> Bool { } } -test fn witness_nat_ordering_supports_max() -> Bool { +fn witness_nat_ordering_supports_max() -> Bool { match std.nat.nat_compare(a: 7, b: 3) { Greater => nat_max(a: 7, b: 3) == 7 _ => false } } +test fn realization_schedule_critical_path_witnesses() -> Bool { + witness_parallel_batch_takes_max_not_sum() + && witness_sequential_batches_add_critical_paths() + && witness_measured_total_uses_critical_path_basis() + && witness_nat_ordering_supports_max() +} diff --git a/dag/test/claim/realization_schedule_witness_test.dag b/dag/test/claim/realization_schedule_witness_test.dag index ff3e1ad6aac..570b6ce26da 100644 --- a/dag/test/claim/realization_schedule_witness_test.dag +++ b/dag/test/claim/realization_schedule_witness_test.dag @@ -2,6 +2,7 @@ module test.claim.realization_schedule_witness import v2.workflow.ci_floor_plan { cheap_floor_gate_step_labels } + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data synthetic_target: ContentHash = "realization-schedule-witness-v1" @@ -47,7 +48,7 @@ fn perturbed_schedule_wrong_order(correct: List>) -> List Bool { +fn witness_schedule_lens_green_on_synthetic_plan() -> Bool { match v2.lens.schedule_lens.schedule_lens_verdict_for_ci_floor( plan: synthetic_correct_plan(), compile_gate_fn: compile_gate_fn, @@ -60,7 +61,7 @@ test fn witness_schedule_lens_green_on_synthetic_plan() -> Bool { } } -test fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool { +fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool { let perturbed = RealizationPlan { target: synthetic_target objective: RealizationObjective { goals: [] } @@ -79,3 +80,7 @@ test fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool } } +test fn realization_schedule_witnesses() -> Bool { + witness_schedule_lens_green_on_synthetic_plan() + && witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() +} diff --git a/dag/test/claim/realization_witness_test.dag b/dag/test/claim/realization_witness_test.dag index 48a4364706e..2a209fe6230 100644 --- a/dag/test/claim/realization_witness_test.dag +++ b/dag/test/claim/realization_witness_test.dag @@ -1,8 +1,9 @@ module test.claim.realization_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn witness_unknown_independence_never_reorders() -> Bool { +fn witness_unknown_independence_never_reorders() -> Bool { let indep = std.realization.Unknown match indep { Independent => false @@ -11,11 +12,11 @@ test fn witness_unknown_independence_never_reorders() -> Bool { } } -test fn witness_read_read_independent() -> Bool { +fn witness_read_read_independent() -> Bool { independence_from_effect_shapes(left: ReadEffect, right: ReadEffect) == Independent } -test fn witness_create_unknown_not_independent() -> Bool { +fn witness_create_unknown_not_independent() -> Bool { match independence_from_effect_shapes( left: CreateEffect { cause: PostAlways }, right: ReadEffect @@ -26,17 +27,24 @@ test fn witness_create_unknown_not_independent() -> Bool { } } -test fn witness_upsert_same_key_dependent() -> Bool { +fn witness_upsert_same_key_dependent() -> Bool { independence_from_effect_shapes( left: UpsertEffect { key_source: PathParam { param: "id" } }, right: UpsertEffect { key_source: PathParam { param: "id" } } ) == Dependent } -test fn witness_upsert_different_keys_independent() -> Bool { +fn witness_upsert_different_keys_independent() -> Bool { independence_from_effect_shapes( left: UpsertEffect { key_source: InputField { field: "a" } }, right: UpsertEffect { key_source: InputField { field: "b" } } ) == Independent } +test fn realization_witnesses() -> Bool { + witness_unknown_independence_never_reorders() + && witness_read_read_independent() + && witness_create_unknown_not_independent() + && witness_upsert_same_key_dependent() + && witness_upsert_different_keys_independent() +} diff --git a/dag/test/claim/realize_kernel_test.dag b/dag/test/claim/realize_kernel_test.dag index 6c814105483..427ca7bafaf 100644 --- a/dag/test/claim/realize_kernel_test.dag +++ b/dag/test/claim/realize_kernel_test.dag @@ -1,5 +1,6 @@ module test.claim.realize_kernel + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data witness_store_id: CacheInterfaceId = "realize-kernel-witness-store" @@ -25,7 +26,7 @@ fn mk_receipt(content: ContentHash) -> CachedArtifactReceipt { } } -test fn witness_verified_hit_reuses() -> Bool { +fn witness_verified_hit_reuses() -> Bool { let r = mk_receipt(content: content_v1) match realize_route(lookup: Hit { receipt: r }) { Reuse { receipt: _ } => true @@ -33,28 +34,28 @@ test fn witness_verified_hit_reuses() -> Bool { } } -test fn witness_miss_recomputes() -> Bool { +fn witness_miss_recomputes() -> Bool { match realize_route(lookup: Miss) { Recompute { reason: SubjectAbsent } => true _ => false } } -test fn witness_refused_hit_never_reused() -> Bool { +fn witness_refused_hit_never_reused() -> Bool { match realize_route(lookup: RejectedHit { reason: ContentDigestMismatch }) { Recompute { reason: _ } => true Reuse { receipt: _ } => false } } -test fn witness_refused_hit_surfaces_reason() -> Bool { +fn witness_refused_hit_surfaces_reason() -> Bool { match realize_route(lookup: RejectedHit { reason: ContentDigestMismatch }) { Recompute { reason: HitRefused { reason: ContentDigestMismatch } } => true _ => false } } -test fn witness_fresh_subject_written() -> Bool { +fn witness_fresh_subject_written() -> Bool { let fresh = mk_receipt(content: content_v1) match classify_write(existing: Miss, offered_content: content_v1, fresh_receipt: fresh) { Written { receipt: _ } => true @@ -62,7 +63,7 @@ test fn witness_fresh_subject_written() -> Bool { } } -test fn witness_idempotent_same_content() -> Bool { +fn witness_idempotent_same_content() -> Bool { let existing = mk_receipt(content: content_v1) let fresh = mk_receipt(content: content_v1) match classify_write(existing: Hit { receipt: existing }, offered_content: content_v1, fresh_receipt: fresh) { @@ -71,7 +72,7 @@ test fn witness_idempotent_same_content() -> Bool { } } -test fn witness_purity_conflict_rejects_overwrite() -> Bool { +fn witness_purity_conflict_rejects_overwrite() -> Bool { let existing = mk_receipt(content: content_v1) let fresh = mk_receipt(content: content_v2) match classify_write(existing: Hit { receipt: existing }, offered_content: content_v2, fresh_receipt: fresh) { @@ -80,7 +81,7 @@ test fn witness_purity_conflict_rejects_overwrite() -> Bool { } } -test fn witness_write_over_rejected_hit_composes_reason() -> Bool { +fn witness_write_over_rejected_hit_composes_reason() -> Bool { let fresh = mk_receipt(content: content_v1) match classify_write( existing: RejectedHit { reason: ContentDigestMismatch }, @@ -92,3 +93,13 @@ test fn witness_write_over_rejected_hit_composes_reason() -> Bool { } } +test fn realize_kernel_witnesses() -> Bool { + witness_verified_hit_reuses() + && witness_miss_recomputes() + && witness_refused_hit_never_reused() + && witness_refused_hit_surfaces_reason() + && witness_fresh_subject_written() + && witness_idempotent_same_content() + && witness_purity_conflict_rejects_overwrite() + && witness_write_over_rejected_hit_composes_reason() +} diff --git a/dag/test/claim/reconcile_in_process_cache_test.dag b/dag/test/claim/reconcile_in_process_cache_test.dag index a3dd33f3dc7..14e59371e32 100644 --- a/dag/test/claim/reconcile_in_process_cache_test.dag +++ b/dag/test/claim/reconcile_in_process_cache_test.dag @@ -1,10 +1,11 @@ module test.claim.reconcile_in_process_cache + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data shared_subject_digest: ContentHash = "reconcile-in-process-witness-shared-subject-digest" -test fn witness_parse_cache_is_in_process_hand_authored() -> Bool { +fn witness_parse_cache_is_in_process_hand_authored() -> Bool { let row = cache_interface_facts_from_catalog(row: parse_cache_facts) (catalog_key_derivation_classification(kd: parse_cache_facts.key_derivation) == HandAuthoredString) && !row.key_derivation.content_verified_on_read @@ -13,7 +14,7 @@ test fn witness_parse_cache_is_in_process_hand_authored() -> Bool { && (row.miss_semantics == MissThenCreate) } -test fn witness_typed_module_cache_is_in_process_native_internal() -> Bool { +fn witness_typed_module_cache_is_in_process_native_internal() -> Bool { let row = cache_interface_facts_from_catalog(row: typed_module_cache_facts) (catalog_key_derivation_classification(kd: typed_module_cache_facts.key_derivation) == NativeInternalHash) && !row.key_derivation.content_verified_on_read @@ -22,14 +23,14 @@ test fn witness_typed_module_cache_is_in_process_native_internal() -> Bool { && (row.miss_semantics == MissThenCreate) } -test fn witness_disk_sibling_is_content_addressed() -> Bool { +fn witness_disk_sibling_is_content_addressed() -> Bool { let disk = cache_interface_facts_from_catalog(row: resolved_graph_cache_facts) (catalog_key_derivation_classification(kd: resolved_graph_cache_facts.key_derivation) == ContentAddressedByValue) && disk.key_derivation.content_verified_on_read && (disk.locality == PerHostFilesystem) } -test fn witness_in_process_siblings_share_locality_not_key_class() -> Bool { +fn witness_in_process_siblings_share_locality_not_key_class() -> Bool { let parse = cache_interface_facts_from_catalog(row: parse_cache_facts) let typed = cache_interface_facts_from_catalog(row: typed_module_cache_facts) let disk = cache_interface_facts_from_catalog(row: resolved_graph_cache_facts) @@ -41,7 +42,7 @@ test fn witness_in_process_siblings_share_locality_not_key_class() -> Bool { && (catalog_key_derivation_classification(kd: resolved_graph_cache_facts.key_derivation) == ContentAddressedByValue) } -test fn witness_parse_source_routes_to_parse_cache_backend() -> Bool { +fn witness_parse_source_routes_to_parse_cache_backend() -> Bool { let id = ArtifactIdentity { subject_digest: shared_subject_digest, artifact_kind: parse_source_artifact_kind, @@ -50,7 +51,7 @@ test fn witness_parse_source_routes_to_parse_cache_backend() -> Bool { key.store == parse_cache_id } -test fn witness_typed_module_routes_to_typed_module_cache_backend() -> Bool { +fn witness_typed_module_routes_to_typed_module_cache_backend() -> Bool { let id = ArtifactIdentity { subject_digest: shared_subject_digest, artifact_kind: typed_module_artifact_kind, @@ -59,7 +60,7 @@ test fn witness_typed_module_routes_to_typed_module_cache_backend() -> Bool { key.store == typed_module_cache_id } -test fn witness_resolved_graph_routes_to_disk_backend() -> Bool { +fn witness_resolved_graph_routes_to_disk_backend() -> Bool { let id = ArtifactIdentity { subject_digest: shared_subject_digest, artifact_kind: resolved_graph_artifact_kind, @@ -68,9 +69,19 @@ test fn witness_resolved_graph_routes_to_disk_backend() -> Bool { key.store == resolved_graph_cache_id } -test fn witness_reconcile_family_backends_are_distinct() -> Bool { +fn witness_reconcile_family_backends_are_distinct() -> Bool { !(parse_cache_id == typed_module_cache_id) && !(parse_cache_id == resolved_graph_cache_id) && !(typed_module_cache_id == resolved_graph_cache_id) } +test fn reconcile_in_process_cache_witnesses() -> Bool { + witness_parse_cache_is_in_process_hand_authored() + && witness_typed_module_cache_is_in_process_native_internal() + && witness_disk_sibling_is_content_addressed() + && witness_in_process_siblings_share_locality_not_key_class() + && witness_parse_source_routes_to_parse_cache_backend() + && witness_typed_module_routes_to_typed_module_cache_backend() + && witness_resolved_graph_routes_to_disk_backend() + && witness_reconcile_family_backends_are_distinct() +} diff --git a/dag/test/claim/regional_compute_witness_test.dag b/dag/test/claim/regional_compute_witness_test.dag index 4a5cc124ebf..51fd7222299 100644 --- a/dag/test/claim/regional_compute_witness_test.dag +++ b/dag/test/claim/regional_compute_witness_test.dag @@ -67,7 +67,7 @@ fn w_premium_equals(baseline: RegionalComputeRow, region: RegionalComputeRow, ex } } -test fn w_no_aws_region_is_cheaper_than_us_east() -> Bool { +fn w_no_aws_region_is_cheaper_than_us_east() -> Bool { w_premium_at_least(baseline: aws_us_east_1, region: aws_ap_south_1, floor_bp: 1) && w_premium_at_least(baseline: aws_us_east_1, region: aws_eu_central_1, floor_bp: 1) && w_premium_at_least(baseline: aws_us_east_1, region: aws_me_central_1, floor_bp: 1) @@ -79,7 +79,7 @@ test fn w_no_aws_region_is_cheaper_than_us_east() -> Bool { && w_premium_at_least(baseline: aws_us_east_1, region: aws_sa_east_1, floor_bp: 1) } -test fn w_no_azure_region_is_cheaper_than_east_us() -> Bool { +fn w_no_azure_region_is_cheaper_than_east_us() -> Bool { w_premium_at_least(baseline: azure_eastus, region: azure_centralindia, floor_bp: 1) && w_premium_at_least(baseline: azure_eastus, region: azure_southindia, floor_bp: 1) && w_premium_at_least(baseline: azure_eastus, region: azure_uaenorth, floor_bp: 1) @@ -87,7 +87,7 @@ test fn w_no_azure_region_is_cheaper_than_east_us() -> Bool { && w_premium_at_least(baseline: azure_eastus, region: azure_brazilsouth, floor_bp: 1) } -test fn w_brazil_premium_agrees_across_two_independent_providers() -> Bool { +fn w_brazil_premium_agrees_across_two_independent_providers() -> Bool { match premium_bp_of(baseline: aws_us_east_1, region: aws_sa_east_1) { Present { value: aws_bp } => match premium_bp_of(baseline: azure_eastus, region: azure_brazilsouth) { @@ -99,7 +99,7 @@ test fn w_brazil_premium_agrees_across_two_independent_providers() -> Bool { } } -test fn w_india_is_the_smallest_premium_and_south_america_the_largest() -> Bool { +fn w_india_is_the_smallest_premium_and_south_america_the_largest() -> Bool { match premium_bp_of(baseline: aws_us_east_1, region: aws_ap_south_1) { Present { value: mumbai } => match premium_bp_of(baseline: aws_us_east_1, region: aws_sa_east_1) { @@ -115,7 +115,7 @@ test fn w_india_is_the_smallest_premium_and_south_america_the_largest() -> Bool } } -test fn w_geography_axis_is_populated_across_all_requested_regions() -> Bool { +fn w_geography_axis_is_populated_across_all_requested_regions() -> Bool { geography_eq(a: aws_ap_south_1.geography, b: SouthAsia) && geography_eq(a: aws_af_south_1.geography, b: Africa) && geography_eq(a: aws_sa_east_1.geography, b: SouthAmerica) @@ -124,7 +124,7 @@ test fn w_geography_axis_is_populated_across_all_requested_regions() -> Bool { && geography_eq(a: azure_brazilsouth.geography, b: SouthAmerica) } -test fn w_per_vcpu_month_is_derived_within_one_currency() -> Bool { +fn w_per_vcpu_month_is_derived_within_one_currency() -> Bool { match per_vcpu_month_micros(row: aws_us_east_1) { Present { value: virginia } => match per_vcpu_month_micros(row: aws_sa_east_1) { @@ -136,14 +136,14 @@ test fn w_per_vcpu_month_is_derived_within_one_currency() -> Bool { } } -test fn w_red_cross_provider_premium_refuses() -> Bool { +fn w_red_cross_provider_premium_refuses() -> Bool { match derive_regional_premium(baseline: aws_us_east_1, region: azure_brazilsouth) { RegionalPremiumRefused { cause: ProviderMismatch } => true _ => false } } -test fn w_red_unreadable_local_provider_rates_refuse() -> Bool { +fn w_red_unreadable_local_provider_rates_refuse() -> Bool { match hourly_micros(row: e2e_networks_india) { Present { value: _ } => false _ => @@ -166,7 +166,7 @@ test fn w_red_unreadable_local_provider_rates_refuse() -> Bool { } } -test fn w_red_unrepresentable_currency_refuses_distinctly() -> Bool { +fn w_red_unrepresentable_currency_refuses_distinctly() -> Bool { match hourly_micros(row: sakura_japan_vps) { Present { value: _ } => false _ => @@ -177,7 +177,7 @@ test fn w_red_unrepresentable_currency_refuses_distinctly() -> Bool { } } -test fn w_red_premium_against_an_unpriced_region_refuses() -> Bool { +fn w_red_premium_against_an_unpriced_region_refuses() -> Bool { match derive_regional_premium(baseline: aws_us_east_1, region: aws_us_east_1) { RegionalPremiumDerived { premium_bp: bp } => (basis_point_count(bp: bp) == 0) @@ -189,3 +189,15 @@ test fn w_red_premium_against_an_unpriced_region_refuses() -> Bool { } } +test fn regional_compute_witness() -> Bool { + w_no_aws_region_is_cheaper_than_us_east() + && w_no_azure_region_is_cheaper_than_east_us() + && w_brazil_premium_agrees_across_two_independent_providers() + && w_india_is_the_smallest_premium_and_south_america_the_largest() + && w_geography_axis_is_populated_across_all_requested_regions() + && w_per_vcpu_month_is_derived_within_one_currency() + && w_red_cross_provider_premium_refuses() + && w_red_unreadable_local_provider_rates_refuse() + && w_red_unrepresentable_currency_refuses_distinctly() + && w_red_premium_against_an_unpriced_region_refuses() +} diff --git a/dag/test/claim/render_glyphs_ansi_witness_test.dag b/dag/test/claim/render_glyphs_ansi_witness_test.dag index 8d4a029b4d1..efbdb87c2d2 100644 --- a/dag/test/claim/render_glyphs_ansi_witness_test.dag +++ b/dag/test/claim/render_glyphs_ansi_witness_test.dag @@ -1,15 +1,16 @@ module test.claim.render_glyphs_ansi_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly -test fn w_completed_ascii() -> Bool { +fn w_completed_ascii() -> Bool { match resolve_symbol(id: NodeCompleted, tier: Ascii) { Present { value: s } => s == "[x]" Absent => false } } -test fn w_completed_unicode_differs_from_ascii() -> Bool { +fn w_completed_unicode_differs_from_ascii() -> Bool { match resolve_symbol(id: NodeCompleted, tier: Unicode) { Present { value: u } => match resolve_symbol(id: NodeCompleted, tier: Ascii) { @@ -20,7 +21,7 @@ test fn w_completed_unicode_differs_from_ascii() -> Bool { } } -test fn w_glyph_at_selects_matching_tier_text() -> Bool { +fn w_glyph_at_selects_matching_tier_text() -> Bool { let g = glyphs_for_tiers( emoji: glyph(text: "E"), unicode: glyph(text: "U"), @@ -31,7 +32,7 @@ test fn w_glyph_at_selects_matching_tier_text() -> Bool { glyph_at(glyphs: g, tier: Emoji) == "E" } -test fn w_failed_color_is_error() -> Bool { +fn w_failed_color_is_error() -> Bool { match symbol_color(id: NodeFailed) { Present { value: c } => match c { @@ -42,7 +43,7 @@ test fn w_failed_color_is_error() -> Bool { } } -test fn w_success_ansi_is_256_green() -> Bool { +fn w_success_ansi_is_256_green() -> Bool { match ansi_code(c: Success) { Present { value: code } => code == "\x1b[38;5;34m" Absent => false @@ -51,17 +52,26 @@ test fn w_success_ansi_is_256_green() -> Bool { data ansi_escape_is_a_real_byte_note: String = "w_success_ansi_is_256_green above compares one \\x1b literal against another, so it agreed with itself for as long as the tokenizer left BOTH undecoded — it passed throughout the period when every colour this repo authored rendered as the literal text backslash-x-1-b (seen in CI run 30167957464's TOP SLOWEST WITNESSES table). Equality against a same-source literal can never discriminate a decode defect. The two witnesses below do: they read the CODE POINT of the first character (27 = ESC, never 92 = backslash) and pin the decoded length, both of which are properties of the decode rather than of the spelling." -test fn w_ansi_first_char_is_escape_byte() -> Bool { +fn w_ansi_first_char_is_escape_byte() -> Bool { match ansi_code(c: Success) { Present { value: code } => code_point(char_at(s: code, pos: 0)) == 27 Absent => false } } -test fn w_ansi_code_has_no_literal_backslash() -> Bool { +fn w_ansi_code_has_no_literal_backslash() -> Bool { match ansi_code(c: Success) { Present { value: code } => !string_contains(s: code, pattern: "\\") Absent => false } } +test fn render_glyphs_ansi_witnesses() -> Bool { + w_completed_ascii() && + w_completed_unicode_differs_from_ascii() && + w_glyph_at_selects_matching_tier_text() && + w_failed_color_is_error() && + w_success_ansi_is_256_green() && + w_ansi_first_char_is_escape_byte() && + w_ansi_code_has_no_literal_backslash() +} diff --git a/dag/test/claim/render_surface_witness_test.dag b/dag/test/claim/render_surface_witness_test.dag index ea696d86668..88e0d22fc23 100644 --- a/dag/test/claim/render_surface_witness_test.dag +++ b/dag/test/claim/render_surface_witness_test.dag @@ -1,5 +1,6 @@ module test.claim.render_surface_witness + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly data plain_cap: RenderCapability = RenderCapability { @@ -24,21 +25,21 @@ data sample_doc: Document = Document { ] } -test fn w_detect_github() -> Bool { +fn w_detect_github() -> Bool { match detect_target(env: SurfaceEnv { github_actions: true }) { GithubActions => true PlainTerminal => false } } -test fn w_detect_plain() -> Bool { +fn w_detect_plain() -> Bool { match detect_target(env: SurfaceEnv { github_actions: false }) { PlainTerminal => true GithubActions => false } } -test fn w_github_wraps_group_in_workflow_commands() -> Bool { +fn w_github_wraps_group_in_workflow_commands() -> Bool { let out = serialize_document(doc: sample_doc, target: GithubActions, cap: plain_cap) string_contains(s: out, pattern: "::group::host effects") && string_contains(s: out, pattern: "[file] read foo.dag") && @@ -46,7 +47,7 @@ test fn w_github_wraps_group_in_workflow_commands() -> Bool { string_contains(s: out, pattern: "PASS some_witness") } -test fn w_plain_terminal_uses_header_not_commands() -> Bool { +fn w_plain_terminal_uses_header_not_commands() -> Bool { let out = serialize_document(doc: sample_doc, target: PlainTerminal, cap: plain_cap) string_contains(s: out, pattern: "── host effects ──") && string_contains(s: out, pattern: "[file] read foo.dag") && @@ -54,7 +55,7 @@ test fn w_plain_terminal_uses_header_not_commands() -> Bool { !string_contains(s: out, pattern: "::endgroup::") } -test fn w_close_line_is_explicit_only_on_github() -> Bool { +fn w_close_line_is_explicit_only_on_github() -> Bool { let gha = group_syntax(target: GithubActions) let term = group_syntax(target: PlainTerminal) match gha.close_line { @@ -67,10 +68,18 @@ test fn w_close_line_is_explicit_only_on_github() -> Bool { } } -test fn w_resolve_group_syntax_keys_off_github_flag() -> Bool { +fn w_resolve_group_syntax_keys_off_github_flag() -> Bool { let gha = resolve_group_syntax(github_actions: true) let term = resolve_group_syntax(github_actions: false) gha.open_prefix == "::group::" && term.open_prefix == "── " } +test fn render_surface_witnesses() -> Bool { + w_detect_github() && + w_detect_plain() && + w_github_wraps_group_in_workflow_commands() && + w_plain_terminal_uses_header_not_commands() && + w_close_line_is_explicit_only_on_github() && + w_resolve_group_syntax_keys_off_github_flag() +} diff --git a/dag/test/claim/retained_shell_script_witness_test.dag b/dag/test/claim/retained_shell_script_witness_test.dag index 3b5407e9283..cbf014f138d 100644 --- a/dag/test/claim/retained_shell_script_witness_test.dag +++ b/dag/test/claim/retained_shell_script_witness_test.dag @@ -14,7 +14,7 @@ data srvn_takeover_ref: DeclarationRef = DeclarationRef { field: WholeDeclaration, } -test fn witness_retained_transport_mints_from_record() -> Bool { +fn witness_retained_transport_mints_from_record() -> Bool { let t = retained_transport( body: "echo hi", reason: "witness: cross-module as TransportScript mint", @@ -23,7 +23,7 @@ test fn witness_retained_transport_mints_from_record() -> Bool { (t as String) == "echo hi" } -test fn witness_converter_preserves_body() -> Bool { +fn witness_converter_preserves_body() -> Bool { let rss = RetainedShellScript { body: "systemctl daemon-reload", reason: "witness: record -> transport", @@ -32,3 +32,7 @@ test fn witness_converter_preserves_body() -> Bool { (retained_shell_script_to_transport(rss: rss) as String) == "systemctl daemon-reload" } +test fn retained_shell_script_holds() -> Bool { + witness_retained_transport_mints_from_record() + && witness_converter_preserves_body() +} diff --git a/dag/test/claim/roadmap_authority_test.dag b/dag/test/claim/roadmap_authority_test.dag index 41d2a9c69e9..ca10af5b9b8 100644 --- a/dag/test/claim/roadmap_authority_test.dag +++ b/dag/test/claim/roadmap_authority_test.dag @@ -1,5 +1,6 @@ module test.claim.roadmap_authority + data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly fn merged() -> List { authored_merged_prs() } @@ -9,7 +10,7 @@ fn emit_with(m: List) -> String { } fn out() -> String { emit_with(m: merged()) } -test fn witness_frame_all_sections() -> Bool { +fn witness_frame_all_sections() -> Bool { let o = out() string_contains(s: o, pattern: "# gunbc — Roadmap") && string_contains(s: o, pattern: "## 1. Get off v1 — v2 self-hosts (TERMINAL: `src/v1` deleted)") @@ -18,13 +19,13 @@ test fn witness_frame_all_sections() -> Bool { && string_contains(s: o, pattern: "## 4. Shelved (parked 2026-07-01 — not deleted)") } -test fn witness_reset_marker() -> Bool { +fn witness_reset_marker() -> Bool { let o = out() string_contains(s: o, pattern: "**Reset 2026-07-01 (operator-directed).**") && string_contains(s: o, pattern: "The prior roadmap with full detail is in git history.") } -test fn witness_subgroup_labels() -> Bool { +fn witness_subgroup_labels() -> Bool { let o = out() string_contains(s: o, pattern: "**Now — correctness of the current posture:**") && string_contains(s: o, pattern: "**Floor throughput — reduce work, then schedule it (26m → <1min on a typical PR):**") @@ -33,7 +34,7 @@ test fn witness_subgroup_labels() -> Bool { && string_contains(s: o, pattern: "**Fleet hardening — make our metal safe for the load it carries:**") } -test fn witness_fabric_design_rule() -> Bool { +fn witness_fabric_design_rule() -> Bool { let o = out() string_contains(s: o, pattern: "provider-specific power is earned behind a `ProviderOffer` adapter") && string_contains(s: o, pattern: "oversubscription is an optimization proven by receipts, never assumed by placement") @@ -43,14 +44,14 @@ test fn witness_fabric_design_rule() -> Bool { && string_contains(s: o, pattern: "**Ordering (operator-signed):**") } -test fn witness_emit_refs_from_binding() -> Bool { +fn witness_emit_refs_from_binding() -> Bool { let o = out() string_contains(s: o, pattern: "**provenance ingest live at floor runtime** (#6105)") && string_contains(s: o, pattern: "**orchestration emission → agnostic registry dispatch** (#6106)") && string_contains(s: o, pattern: "**no-dual-representation-test lens rebuilt pure-v2** (#6104)") } -test fn witness_pillar1_no_overclaim() -> Bool { +fn witness_pillar1_no_overclaim() -> Bool { let o = out() string_contains(s: o, pattern: "interim fixpoint gate, 2-of-92 roster ✓ (#6009)") && string_contains(s: o, pattern: "**TERMINAL: `src/v1` deleted**") @@ -58,7 +59,7 @@ test fn witness_pillar1_no_overclaim() -> Bool { && !string_contains(s: o, pattern: "- [x] **real fixed point**") } -test fn witness_pillar2_posture() -> Bool { +fn witness_pillar2_posture() -> Bool { let o = out() string_contains(s: o, pattern: "required CI is back on the fleet") && string_contains(s: o, pattern: "#6107, reverted #6111") @@ -66,12 +67,12 @@ test fn witness_pillar2_posture() -> Bool { && string_contains(s: o, pattern: "the re-land is an architecture change, not a rebase") } -test fn witness_a_prose_verbatim() -> Bool { +fn witness_a_prose_verbatim() -> Bool { string_contains(s: out(), pattern: "**◆ Milestones:** front-end ✓ · emit-rust well-typed ✓ · cross-tree import ✓ (#5473)") } -test fn witness_b_ordered_interleaving() -> Bool { +fn witness_b_ordered_interleaving() -> Bool { let o = out() string_contains(s: o, pattern: "[seed census](docs/plans/seed-shrink-census.md)\n\nGround truth (2026-07-05):") && string_contains(s: o, pattern: "so the walls are CI-proven now.\n\n**◆ Milestones:** front-end ✓") @@ -79,11 +80,11 @@ test fn witness_b_ordered_interleaving() -> Bool { && string_contains(s: o, pattern: "Phase 2, earned by receipts.\n\n**◆ Milestones:** OOM root-caused") } -test fn witness_b_order_discriminator() -> Bool { +fn witness_b_order_discriminator() -> Bool { !string_contains(s: out(), pattern: "**◆ Milestones:** front-end ✓ · emit-rust well-typed ✓ · cross-tree import ✓ (#5473)\n\nGround truth (2026-07-05):") } -test fn witness_merge_perturb_does_not_flip_boxes() -> Bool { +fn witness_merge_perturb_does_not_flip_boxes() -> Bool { let full = out() let flipped = emit_with(m: [6104, 6105, 6106]) let pat = "- [ ] **provenance ingest live at floor runtime** (#6105)" @@ -93,13 +94,13 @@ test fn witness_merge_perturb_does_not_flip_boxes() -> Bool { && !string_contains(s: flipped, pattern: "- [x] **provenance ingest live at floor runtime** (#6105)") } -test fn witness_shelf_is_uncheckboxed() -> Bool { +fn witness_shelf_is_uncheckboxed() -> Bool { let o = out() string_contains(s: o, pattern: "- **fold-ergonomics lane** —") && !string_contains(s: o, pattern: "- [ ] **fold-ergonomics lane** —") } -test fn witness_audit_lane_present() -> Bool { +fn witness_audit_lane_present() -> Bool { let o = out() string_contains(s: o, pattern: "**Audit — green by execution, red by perturbation:**") && string_contains(s: o, pattern: "**affected-set lens — discharged by a standing mechanism**") @@ -108,3 +109,18 @@ test fn witness_audit_lane_present() -> Bool { && string_contains(s: o, pattern: "**one tree, one verdict**") } +test fn roadmap_authority_witnesses() -> Bool { + witness_frame_all_sections() + && witness_reset_marker() + && witness_subgroup_labels() + && witness_fabric_design_rule() + && witness_emit_refs_from_binding() + && witness_pillar1_no_overclaim() + && witness_pillar2_posture() + && witness_a_prose_verbatim() + && witness_b_ordered_interleaving() + && witness_b_order_discriminator() + && witness_merge_perturb_does_not_flip_boxes() + && witness_shelf_is_uncheckboxed() + && witness_audit_lane_present() +} diff --git a/dag/test/claim/roadmap_belt_actuate_witness_test.dag b/dag/test/claim/roadmap_belt_actuate_witness_test.dag index bf4df4a743e..f57757eaecb 100644 --- a/dag/test/claim/roadmap_belt_actuate_witness_test.dag +++ b/dag/test/claim/roadmap_belt_actuate_witness_test.dag @@ -113,12 +113,12 @@ fn is_teardown_failed(o: BeltTeardownOutcome) -> Bool { } } -test fn witness_exec_ok_runs_echo() -> Bool { +fn witness_exec_ok_runs_echo() -> Bool { let o = belt_exec(cmd: host_exec_argv(program: "echo", args: ["belt-ok"]), workdir: "/") is_exec_ok(o: o) && exec_ok_stdout_contains(o: o, pattern: "belt-ok") } -test fn witness_exec_refuses_missing_program() -> Bool { +fn witness_exec_refuses_missing_program() -> Bool { let o = belt_exec( cmd: host_exec_argv(program: "belt-nonexistent-program-xyz", args: []), workdir: "/", @@ -126,12 +126,12 @@ test fn witness_exec_refuses_missing_program() -> Bool { is_exec_refused(o: o) } -test fn witness_exec_fails_on_nonzero_exit() -> Bool { +fn witness_exec_fails_on_nonzero_exit() -> Bool { let o = belt_exec(cmd: host_exec_argv(program: "false", args: []), workdir: "/") is_exec_failed(o: o) } -test fn witness_exec_all_runs_every_step_when_ok() -> Bool { +fn witness_exec_all_runs_every_step_when_ok() -> Bool { let o = belt_exec_all( cmds: [ host_exec_argv(program: "echo", args: ["first"]), @@ -142,7 +142,7 @@ test fn witness_exec_all_runs_every_step_when_ok() -> Bool { is_exec_ok(o: o) && exec_ok_stdout_contains(o: o, pattern: "second") } -test fn witness_exec_all_short_circuits_after_failure() -> Bool { +fn witness_exec_all_short_circuits_after_failure() -> Bool { let o = belt_exec_all( cmds: [ host_exec_argv(program: "false", args: []), @@ -153,7 +153,7 @@ test fn witness_exec_all_short_circuits_after_failure() -> Bool { is_exec_failed(o: o) && !exec_ok_stdout_contains(o: o, pattern: "should-not-run") } -test fn witness_exec_all_fails_on_later_step() -> Bool { +fn witness_exec_all_fails_on_later_step() -> Bool { let o = belt_exec_all( cmds: [ host_exec_argv(program: "echo", args: ["ok"]), @@ -164,12 +164,12 @@ test fn witness_exec_all_fails_on_later_step() -> Bool { is_exec_failed(o: o) } -test fn witness_spawn_member_refuses_observed_shape() -> Bool { +fn witness_spawn_member_refuses_observed_shape() -> Bool { let m = ObservedMember { node_id: "z", session: live_session(node_id: "z", verdict: Converged) } is_spawn_failed(o: belt_actuate_spawn_member(m: m, workdir: "/")) } -test fn witness_teardown_member_refuses_desired_shape() -> Bool { +fn witness_teardown_member_refuses_desired_shape() -> Bool { let m = DesiredMember { node_id: "a", node: ready_node(id: "a") } is_teardown_failed(o: belt_actuate_teardown_member(m: m)) } @@ -188,7 +188,7 @@ fn is_observe_refused(o: BeltObserve) -> Bool { } } -test fn witness_observe_parses_live_on_success() -> Bool { +fn witness_observe_parses_live_on_success() -> Bool { observe_live_count(o: belt_observe_from_result( success: true, stdout: "gunbc-dispatch-a: 1 windows", @@ -196,7 +196,7 @@ test fn witness_observe_parses_live_on_success() -> Bool { )) == 1 } -test fn witness_observe_empty_on_no_server() -> Bool { +fn witness_observe_empty_on_no_server() -> Bool { observe_live_count(o: belt_observe_from_result( success: false, stdout: "", @@ -204,7 +204,7 @@ test fn witness_observe_empty_on_no_server() -> Bool { )) == 0 } -test fn witness_observe_empty_on_no_sessions() -> Bool { +fn witness_observe_empty_on_no_sessions() -> Bool { observe_live_count(o: belt_observe_from_result( success: false, stdout: "", @@ -212,7 +212,7 @@ test fn witness_observe_empty_on_no_sessions() -> Bool { )) == 0 } -test fn witness_observe_refuses_permission_error() -> Bool { +fn witness_observe_refuses_permission_error() -> Bool { is_observe_refused(o: belt_observe_from_result( success: false, stdout: "", @@ -220,7 +220,7 @@ test fn witness_observe_refuses_permission_error() -> Bool { )) } -test fn witness_observe_refuses_empty_stderr_failure() -> Bool { +fn witness_observe_refuses_empty_stderr_failure() -> Bool { is_observe_refused(o: belt_observe_from_result( success: false, stdout: "", @@ -232,19 +232,19 @@ fn uuid_char(u: String, i: Int) -> String { substring(s: u, start: i, end: i + 1) } -test fn witness_uuid_deterministic() -> Bool { +fn witness_uuid_deterministic() -> Bool { let a = belt_spawn_session_uuid(node_id: "5-regen-cutover") let b = belt_spawn_session_uuid(node_id: "5-regen-cutover") a == b } -test fn witness_uuid_distinct_nodes() -> Bool { +fn witness_uuid_distinct_nodes() -> Bool { let a = belt_spawn_session_uuid(node_id: "node-a") let b = belt_spawn_session_uuid(node_id: "node-b") !(a == b) } -test fn witness_uuid_rfc4122_shape() -> Bool { +fn witness_uuid_rfc4122_shape() -> Bool { let u = belt_spawn_session_uuid(node_id: "5-regen-cutover") string_length(s: u) == 36 && uuid_char(u: u, i: 8) == "-" @@ -262,11 +262,11 @@ fn is_node_found(l: BeltNodeLookup) -> Bool { } } -test fn witness_find_node_hits() -> Bool { +fn witness_find_node_hits() -> Bool { is_node_found(l: belt_find_node_in(nodes: [ready_node(id: "a"), ready_node(id: "b")], node_id: "b")) } -test fn witness_find_node_misses() -> Bool { +fn witness_find_node_misses() -> Bool { !is_node_found(l: belt_find_node_in(nodes: [ready_node(id: "a"), ready_node(id: "b")], node_id: "z")) } @@ -288,27 +288,27 @@ fn found_owner(l: BeltNodeLookup) -> String { } } -test fn witness_find_node_first_wins_on_duplicate() -> Bool { +fn witness_find_node_first_wins_on_duplicate() -> Bool { found_owner(l: belt_find_node_in( nodes: [owned_node(id: "dup", owner: "first"), owned_node(id: "dup", owner: "second")], node_id: "dup", )) == "first" } -test fn witness_node_session_live_true() -> Bool { +fn witness_node_session_live_true() -> Bool { belt_node_session_live(live: [live_session(node_id: "a", verdict: Converged)], node_id: "a") } -test fn witness_node_session_live_false() -> Bool { +fn witness_node_session_live_false() -> Bool { !belt_node_session_live(live: [live_session(node_id: "a", verdict: Converged)], node_id: "b") } -test fn witness_dispatch_result_ok_spawned_and_live() -> Bool { +fn witness_dispatch_result_ok_spawned_and_live() -> Bool { belt_dispatch_result_ok(r: DispatchSpawned { node_id: "a", session_name: "gunbc-dispatch-a" }) && belt_dispatch_result_ok(r: DispatchAlreadyLive { node_id: "a", session_name: "gunbc-dispatch-a" }) } -test fn witness_dispatch_result_refusals_not_ok() -> Bool { +fn witness_dispatch_result_refusals_not_ok() -> Bool { !belt_dispatch_result_ok(r: DispatchNodeNotFound { node_id: "a" }) && !belt_dispatch_result_ok(r: DispatchNodeAlreadyDone { node_id: "a" }) && !belt_dispatch_result_ok(r: DispatchObserveRefused { node_id: "a", reason: "x" }) @@ -321,7 +321,7 @@ fn status_label_glued_to_ok(r: BeltDispatchResult) -> Bool { ok == label_in_ok_set } -test fn witness_dispatch_status_labels_glued_to_ok_set() -> Bool { +fn witness_dispatch_status_labels_glued_to_ok_set() -> Bool { status_label_glued_to_ok(r: DispatchSpawned { node_id: "a", session_name: "s" }) && status_label_glued_to_ok(r: DispatchAlreadyLive { node_id: "a", session_name: "s" }) && status_label_glued_to_ok(r: DispatchNodeNotFound { node_id: "a" }) @@ -330,7 +330,7 @@ test fn witness_dispatch_status_labels_glued_to_ok_set() -> Bool { && status_label_glued_to_ok(r: DispatchSpawnFailed { node_id: "a", step: "git", detail: "x" }) } -test fn witness_dispatch_status_labels_pin_wire_contract() -> Bool { +fn witness_dispatch_status_labels_pin_wire_contract() -> Bool { belt_dispatch_status_label(r: DispatchSpawned { node_id: "a", session_name: "s" }) == "spawned" && belt_dispatch_status_label(r: DispatchAlreadyLive { node_id: "a", session_name: "s" }) == "already_live" && belt_dispatch_status_label(r: DispatchNodeNotFound { node_id: "a" }) == "node_not_found" @@ -347,7 +347,7 @@ fn band_key_for_label(label: String) -> String { } } -test fn witness_band_fold_pins_operator_vocabulary() -> Bool { +fn witness_band_fold_pins_operator_vocabulary() -> Bool { belt_dispatch_label_band_rows().length() == 6 && band_key_for_label(label: "spawned") == "ok" && band_key_for_label(label: "already_live") == "ok" @@ -357,15 +357,15 @@ test fn witness_band_fold_pins_operator_vocabulary() -> Bool { && band_key_for_label(label: "spawn_failed") == "loud" } -test fn witness_no_result_maps_to_in_progress() -> Bool { +fn witness_no_result_maps_to_in_progress() -> Bool { all(belt_dispatch_label_band_rows(), row => row.band_key != "in-progress") } -test fn witness_ok_labels_derive_from_band_fold() -> Bool { +fn witness_ok_labels_derive_from_band_fold() -> Bool { belt_dispatch_ok_status_labels() == ["spawned", "already_live"] } -test fn witness_label_band_cover_reds_on_missing_row() -> Bool { +fn witness_label_band_cover_reds_on_missing_row() -> Bool { let rows = belt_dispatch_label_band_rows() let labels = belt_dispatch_all_status_labels() let truncated = filter(rows, row => row.wire_label != "spawned") @@ -383,7 +383,7 @@ fn d4_exemplars_reconcile(exemplars: List) -> Bool { map(exemplars, r => belt_dispatch_status_label(r: r)) == d4_wire_contract_labels() } -test fn witness_exemplar_roster_reconciles_variant_set() -> Bool { +fn witness_exemplar_roster_reconciles_variant_set() -> Bool { d4_exemplars_reconcile(exemplars: belt_dispatch_result_exemplars()) && belt_dispatch_all_status_labels() == d4_wire_contract_labels() } @@ -398,7 +398,7 @@ fn d4_exemplars_missing_one() -> List { ] } -test fn witness_exemplar_roster_missing_variant_reds() -> Bool { +fn witness_exemplar_roster_missing_variant_reds() -> Bool { !d4_exemplars_reconcile(exemplars: d4_exemplars_missing_one()) } @@ -431,7 +431,7 @@ fn preflight_with_config(config: String) -> BeltClaudePreflight { ) } -test fn witness_preflight_refuses_missing_claude() -> Bool { +fn witness_preflight_refuses_missing_claude() -> Bool { preflight_refused_step(p: belt_claude_preflight_decision( claude_on_path: false, home: "/home/u", @@ -442,7 +442,7 @@ test fn witness_preflight_refuses_missing_claude() -> Bool { )) == "claude-cli" } -test fn witness_preflight_refuses_unknown_home() -> Bool { +fn witness_preflight_refuses_unknown_home() -> Bool { preflight_refused_step(p: belt_claude_preflight_decision( claude_on_path: true, home: "", @@ -453,7 +453,7 @@ test fn witness_preflight_refuses_unknown_home() -> Bool { )) == "claude-trust-home" } -test fn witness_preflight_refuses_unreadable_store() -> Bool { +fn witness_preflight_refuses_unreadable_store() -> Bool { preflight_refused_step(p: belt_claude_preflight_decision( claude_on_path: true, home: "/home/u", @@ -464,7 +464,7 @@ test fn witness_preflight_refuses_unreadable_store() -> Bool { )) == "claude-trust-store" } -test fn witness_preflight_refuses_unseeded_root() -> Bool { +fn witness_preflight_refuses_unseeded_root() -> Bool { preflight_refused_step(p: preflight_with_config( config: "\{\"projects\":\{\"/opt/other\":\{\"hasTrustDialogAccepted\":true\}\}\}", )) == "claude-trust-seed" @@ -473,13 +473,52 @@ test fn witness_preflight_refuses_unseeded_root() -> Bool { )) == "claude-trust-seed" } -test fn witness_preflight_ok_when_seeded() -> Bool { +fn witness_preflight_ok_when_seeded() -> Bool { preflight_ok(p: preflight_with_config(config: seeded_trust_config())) } -test fn witness_preflight_ok_on_enriched_entry() -> Bool { +fn witness_preflight_ok_on_enriched_entry() -> Bool { preflight_ok(p: preflight_with_config( config: "\{\"projects\":\{\"/opt/x/worktrees\":\{\"mcpServers\":\{\},\"allowedTools\":[\"a\}b\"],\"hasTrustDialogAccepted\":true\}\}\}", )) } +test fn roadmap_belt_actuate_witnesses() -> Bool { + witness_exec_ok_runs_echo() + && witness_exec_refuses_missing_program() + && witness_exec_fails_on_nonzero_exit() + && witness_exec_all_runs_every_step_when_ok() + && witness_exec_all_short_circuits_after_failure() + && witness_exec_all_fails_on_later_step() + && witness_spawn_member_refuses_observed_shape() + && witness_teardown_member_refuses_desired_shape() + && witness_observe_parses_live_on_success() + && witness_observe_empty_on_no_server() + && witness_observe_empty_on_no_sessions() + && witness_observe_refuses_permission_error() + && witness_observe_refuses_empty_stderr_failure() + && witness_uuid_deterministic() + && witness_uuid_distinct_nodes() + && witness_uuid_rfc4122_shape() + && witness_find_node_hits() + && witness_find_node_misses() + && witness_find_node_first_wins_on_duplicate() + && witness_node_session_live_true() + && witness_node_session_live_false() + && witness_dispatch_result_ok_spawned_and_live() + && witness_dispatch_result_refusals_not_ok() + && witness_dispatch_status_labels_glued_to_ok_set() + && witness_dispatch_status_labels_pin_wire_contract() + && witness_exemplar_roster_reconciles_variant_set() + && witness_exemplar_roster_missing_variant_reds() + && witness_band_fold_pins_operator_vocabulary() + && witness_no_result_maps_to_in_progress() + && witness_ok_labels_derive_from_band_fold() + && witness_label_band_cover_reds_on_missing_row() + && witness_preflight_refuses_missing_claude() + && witness_preflight_refuses_unknown_home() + && witness_preflight_refuses_unreadable_store() + && witness_preflight_refuses_unseeded_root() + && witness_preflight_ok_when_seeded() + && witness_preflight_ok_on_enriched_entry() +} diff --git a/dag/test/claim/roadmap_belt_witness_test.dag b/dag/test/claim/roadmap_belt_witness_test.dag index 11531bcb637..75c3588bc29 100644 --- a/dag/test/claim/roadmap_belt_witness_test.dag +++ b/dag/test/claim/roadmap_belt_witness_test.dag @@ -61,13 +61,13 @@ fn at_capacity_waiting(actions: List) -> Int { fold(actions, init: 0, f: (acc, a) => match a { AtCapacity { ready_waiting } => ready_waiting, _ => acc }) } -test fn witness_paused_spawns_nothing() -> Bool { +fn witness_paused_spawns_nothing() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Paused, frontier: f, occupied: [], cap: cap(n: 3)) belt_spawn_count(actions: actions) == 0 && any_paused(actions: actions) } -test fn witness_running_spawns_ready_within_capacity() -> Bool { +fn witness_running_spawns_ready_within_capacity() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Running, frontier: f, occupied: [], cap: cap(n: 3)) belt_spawn_count(actions: actions) == 2 @@ -75,13 +75,13 @@ test fn witness_running_spawns_ready_within_capacity() -> Bool { && belt_spawns_node(actions: actions, id: nid(s: "b")) } -test fn witness_capacity_limits_spawns() -> Bool { +fn witness_capacity_limits_spawns() -> Bool { let f = frontier_ready(ids: ["a", "b", "c"]) let actions = belt_step(state: Running, frontier: f, occupied: [], cap: cap(n: 1)) belt_spawn_count(actions: actions) == 1 } -test fn witness_occupied_node_not_respawned() -> Bool { +fn witness_occupied_node_not_respawned() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Running, frontier: f, occupied: [nid(s: "a")], cap: cap(n: 3)) belt_spawn_count(actions: actions) == 1 @@ -89,13 +89,13 @@ test fn witness_occupied_node_not_respawned() -> Bool { && !belt_spawns_node(actions: actions, id: nid(s: "a")) } -test fn witness_at_capacity_reports_backlog() -> Bool { +fn witness_at_capacity_reports_backlog() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let actions = belt_step(state: Running, frontier: f, occupied: [nid(s: "x"), nid(s: "y")], cap: cap(n: 2)) belt_spawn_count(actions: actions) == 0 && at_capacity_waiting(actions: actions) == 2 } -test fn witness_belt_plan_equals_step_composition() -> Bool { +fn witness_belt_plan_equals_step_composition() -> Bool { let doc = roadmap_authority() let merged = authored_merged_prs() let f = spawn_frontier(doc: doc, merged: merged) @@ -104,7 +104,7 @@ test fn witness_belt_plan_equals_step_composition() -> Bool { belt_spawn_count(actions: via_plan) == belt_spawn_count(actions: via_step) } -test fn witness_belt_plan_paused_holds_on_authority() -> Bool { +fn witness_belt_plan_paused_holds_on_authority() -> Bool { let actions = belt_plan( state: Paused, doc: roadmap_authority(), @@ -115,7 +115,7 @@ test fn witness_belt_plan_paused_holds_on_authority() -> Bool { belt_spawn_count(actions: actions) == 0 && any_paused(actions: actions) } -test fn witness_belt_status_json_shape() -> Bool { +fn witness_belt_status_json_shape() -> Bool { let j = roadmap_belt_status_json() string_contains(s: j, pattern: "roadmap-belt/v1") && string_contains(s: j, pattern: "run_state") @@ -124,6 +124,17 @@ test fn witness_belt_status_json_shape() -> Bool { && string_contains(s: j, pattern: "max_concurrent") } +test fn roadmap_belt_witnesses() -> Bool { + witness_paused_spawns_nothing() + && witness_running_spawns_ready_within_capacity() + && witness_capacity_limits_spawns() + && witness_occupied_node_not_respawned() + && witness_at_capacity_reports_backlog() + && witness_belt_plan_equals_step_composition() + && witness_belt_plan_paused_holds_on_authority() + && witness_belt_status_json_shape() +} + fn live_session(node_id: String, verdict: ObservationVerdict) -> DispatchLiveSession { DispatchLiveSession { session_name: "gunbc-dispatch-{node_id}", @@ -141,7 +152,7 @@ fn tears_down_node(r: BeltReconcile, id: String) -> Bool { any(belt_member_ids(ms: r.teardowns), x => x == id) } -test fn witness_reconcile_spawns_ready_missing_session() -> Bool { +fn witness_reconcile_spawns_ready_missing_session() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let r = belt_reconcile(state: Running, frontier: f, live: [], cap: cap(n: 3)) belt_reconcile_spawn_count(r: r) == 2 @@ -151,7 +162,7 @@ test fn witness_reconcile_spawns_ready_missing_session() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -test fn witness_reconcile_noop_when_ready_and_live() -> Bool { +fn witness_reconcile_noop_when_ready_and_live() -> Bool { let f = frontier_ready(ids: ["a"]) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "a", verdict: Converged)], cap: cap(n: 3)) belt_reconcile_spawn_count(r: r) == 0 @@ -159,7 +170,7 @@ test fn witness_reconcile_noop_when_ready_and_live() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -test fn witness_reconcile_reaps_owned_done_session() -> Bool { +fn witness_reconcile_reaps_owned_done_session() -> Bool { let f = frontier_ready(ids: ["a"]) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Converged)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 1 @@ -169,13 +180,13 @@ test fn witness_reconcile_reaps_owned_done_session() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -test fn witness_reconcile_reaps_drifted_owned_session() -> Bool { +fn witness_reconcile_reaps_drifted_owned_session() -> Bool { let f = frontier_ready(ids: []) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Drifted)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 1 && tears_down_node(r: r, id: "z") } -test fn witness_r5_refuses_foreign_teardown() -> Bool { +fn witness_r5_refuses_foreign_teardown() -> Bool { let f = frontier_ready(ids: ["a"]) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Conflict)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 0 @@ -184,19 +195,19 @@ test fn witness_r5_refuses_foreign_teardown() -> Bool { && belt_reconcile_spawn_count(r: r) == 1 } -test fn witness_r5_refuses_nameonly_teardown() -> Bool { +fn witness_r5_refuses_nameonly_teardown() -> Bool { let f = frontier_ready(ids: []) let r = belt_reconcile(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: UnknownRefused)], cap: cap(n: 3)) belt_reconcile_teardown_count(r: r) == 0 && belt_reconcile_refusal_count(r: r) == 1 } -test fn witness_reconcile_capacity_defers_surfaced() -> Bool { +fn witness_reconcile_capacity_defers_surfaced() -> Bool { let f = frontier_ready(ids: ["a", "b", "c"]) let r = belt_reconcile(state: Running, frontier: f, live: [], cap: cap(n: 1)) belt_reconcile_spawn_count(r: r) == 1 && r.deferred == 2 } -test fn witness_reconcile_paused_no_actions() -> Bool { +fn witness_reconcile_paused_no_actions() -> Bool { let f = frontier_ready(ids: ["a", "b"]) let r = belt_reconcile(state: Paused, frontier: f, live: [live_session(node_id: "z", verdict: Converged)], cap: cap(n: 3)) belt_reconcile_spawn_count(r: r) == 0 @@ -204,7 +215,7 @@ test fn witness_reconcile_paused_no_actions() -> Bool { && belt_reconcile_refusal_count(r: r) == 0 } -test fn witness_reconcile_status_json_shape() -> Bool { +fn witness_reconcile_status_json_shape() -> Bool { let f = frontier_ready(ids: ["a"]) let j = belt_reconcile_status_json(state: Running, frontier: f, live: [live_session(node_id: "z", verdict: Conflict)], cap: cap(n: 3)) string_contains(s: j, pattern: "roadmap-belt-reconcile/v1") @@ -213,3 +224,14 @@ test fn witness_reconcile_status_json_shape() -> Bool { && string_contains(s: j, pattern: "deferred") } +test fn roadmap_belt_reconcile_witnesses() -> Bool { + witness_reconcile_spawns_ready_missing_session() + && witness_reconcile_noop_when_ready_and_live() + && witness_reconcile_reaps_owned_done_session() + && witness_reconcile_reaps_drifted_owned_session() + && witness_r5_refuses_foreign_teardown() + && witness_r5_refuses_nameonly_teardown() + && witness_reconcile_capacity_defers_surfaced() + && witness_reconcile_paused_no_actions() + && witness_reconcile_status_json_shape() +} diff --git a/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag b/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag index 4d4e86bae98..3d0ba3bd3b9 100644 --- a/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag +++ b/dag/test/claim/roadmap_dispatch_actuator_witness_test.dag @@ -87,11 +87,11 @@ fn fixture_doc(nodes: List, edges: List) -> RoadmapDoc } } -test fn witness_tmux_session_name_prefix() -> Bool { +fn witness_tmux_session_name_prefix() -> Bool { dispatch_tmux_session_name(node_id: nid(s: "node-1")) == "gunbc-dispatch-node-1" } -test fn witness_brief_fill_includes_node_metadata() -> Bool { +fn witness_brief_fill_includes_node_metadata() -> Bool { let node = sized_derivable(id: "brief-node", prs: [1], title: "Brief Title") let brief = fill_dispatch_brief( template: dispatch_brief_template, @@ -101,11 +101,11 @@ test fn witness_brief_fill_includes_node_metadata() -> Bool { && string_contains(s: brief, pattern: "Brief Title") } -test fn witness_claude_effort_high_for_high_intricacy() -> Bool { +fn witness_claude_effort_high_for_high_intricacy() -> Bool { claude_effort_for_intricacy(i: IntricacyHigh) == "high" } -test fn witness_claude_argv_uses_dangerous_skip_permissions() -> Bool { +fn witness_claude_argv_uses_dangerous_skip_permissions() -> Bool { let argv = claude_spawn_argv( effort: "high", session_uuid: "uuid-1", @@ -118,7 +118,7 @@ test fn witness_claude_argv_uses_dangerous_skip_permissions() -> Bool { && !string_contains(s: join(argv, separator: "\0"), pattern: "--resume") } -test fn witness_git_worktree_argv_is_execfile_safe() -> Bool { +fn witness_git_worktree_argv_is_execfile_safe() -> Bool { let cmd = git_worktree_add_argv( worktree_path: "/opt/gunbc/dispatch-worktrees/node-1", branch_name: "dispatch/node-1", @@ -128,7 +128,7 @@ test fn witness_git_worktree_argv_is_execfile_safe() -> Bool { && cmd.args == ["worktree", "add", "/opt/gunbc/dispatch-worktrees/node-1", "-b", "dispatch/node-1", "origin/main"] } -test fn witness_tmux_spawn_argv_threads_claude_argv() -> Bool { +fn witness_tmux_spawn_argv_threads_claude_argv() -> Bool { let claude = claude_spawn_argv( effort: "medium", session_uuid: "uuid-2", @@ -145,12 +145,12 @@ test fn witness_tmux_spawn_argv_threads_claude_argv() -> Bool { && string_contains(s: join(cmd.args, separator: "\0"), pattern: "CLAUDE_CODE_NO_FLICKER=1") } -test fn witness_stop_argv_targets_session() -> Bool { +fn witness_stop_argv_targets_session() -> Bool { let cmd = tmux_kill_session_argv(session_name: "gunbc-dispatch-node-3") cmd.args == ["kill-session", "-t", "gunbc-dispatch-node-3"] } -test fn witness_tmux_ls_parse_filters_prefix() -> Bool { +fn witness_tmux_ls_parse_filters_prefix() -> Bool { let output = "other: 1 windows (created Fri Jul 3 04:14:00 2026)\ngunbc-dispatch-node-4: 2 windows (created Fri Jul 3 04:15:00 2026)\n" let entries = filter_dispatch_tmux_sessions(entries: parse_tmux_ls_output(output: output)) count(entries) == 1 @@ -158,7 +158,7 @@ test fn witness_tmux_ls_parse_filters_prefix() -> Bool { && entries.first().windows == 2 } -test fn witness_not_ready_node_refused() -> Bool { +fn witness_not_ready_node_refused() -> Bool { let parent = sized_derivable(id: "parent", prs: [100], title: "Parent") let child = sized_derivable(id: "child", prs: [200], title: "Child") let edges = [RoadmapEdge { child: nid(s: "child"), parent: nid(s: "parent") }] @@ -170,7 +170,7 @@ test fn witness_not_ready_node_refused() -> Bool { } } -test fn witness_ready_node_permitted_without_live_session() -> Bool { +fn witness_ready_node_permitted_without_live_session() -> Bool { let node = sized_derivable(id: "ready-node", prs: [10], title: "Ready") let doc = fixture_doc(nodes: [node], edges: []) let ready = next_spawnable(doc: doc, merged: []) @@ -185,7 +185,7 @@ test fn witness_ready_node_permitted_without_live_session() -> Bool { } } -test fn witness_live_lease_refused() -> Bool { +fn witness_live_lease_refused() -> Bool { let node = sized_derivable(id: "leased-node", prs: [11], title: "Leased") let doc = fixture_doc(nodes: [node], edges: []) let ready = next_spawnable(doc: doc, merged: []) @@ -198,7 +198,7 @@ test fn witness_live_lease_refused() -> Bool { } } -test fn witness_absent_lease_classifies_spawn() -> Bool { +fn witness_absent_lease_classifies_spawn() -> Bool { let scope = dispatch_tmux_session_scope(node_id: nid(s: "lease-absent")) match classify_dispatch_lease_upsert(scope: scope, obs: SessionAbsent) { UpsertClassification { verdict: Absent, decision: Apply { plan: SpawnSession } } => true @@ -206,11 +206,11 @@ test fn witness_absent_lease_classifies_spawn() -> Bool { } } -test fn witness_hostile_node_id_single_argv_token() -> Bool { +fn witness_hostile_node_id_single_argv_token() -> Bool { hostile_node_id_stays_single_argv_token(node_id: "foo;rm -rf /") } -test fn witness_live_sessions_panel_rows() -> Bool { +fn witness_live_sessions_panel_rows() -> Bool { let output = "gunbc-dispatch-panel-a: 1 windows (created Fri Jul 3 04:14:00 2026)\n" let rows = dispatch_live_sessions(tmux_ls_output: output) count(rows) == 1 @@ -219,7 +219,7 @@ test fn witness_live_sessions_panel_rows() -> Bool { && rows.first().lease_verdict == UnknownRefused } -test fn witness_name_only_observation_not_converged() -> Bool { +fn witness_name_only_observation_not_converged() -> Bool { let scope = dispatch_tmux_session_scope(node_id: nid(s: "name-only")) match classify_tmux_session( scope: scope, @@ -234,7 +234,7 @@ test fn witness_name_only_observation_not_converged() -> Bool { } } -test fn witness_foreign_process_fingerprint_is_conflict() -> Bool { +fn witness_foreign_process_fingerprint_is_conflict() -> Bool { let scope = dispatch_tmux_session_scope(node_id: nid(s: "foreign-proc")) match classify_dispatch_lease_upsert( scope: scope, @@ -250,14 +250,14 @@ test fn witness_foreign_process_fingerprint_is_conflict() -> Bool { } } -test fn witness_fingerprint_scaffold_marker_present() -> Bool { +fn witness_fingerprint_scaffold_marker_present() -> Bool { match dispatch_tmux_process_fingerprint_observation_dissolution_trigger { Scaffold { dissolves_to: _, bind: _ } => true Terminal { reason: _ } => false } } -test fn witness_host_exec_argv_shapes_bound_to_extdeps() -> Bool { +fn witness_host_exec_argv_shapes_bound_to_extdeps() -> Bool { let worktree_args = shape_git_worktree_add_argv( path: "/opt/gunbc/dispatch-worktrees/bound-node" as FilePath, branch: "dispatch/bound-node" as NonEmptyStr, @@ -297,7 +297,7 @@ test fn witness_host_exec_argv_shapes_bound_to_extdeps() -> Bool { && !string_contains(s: join(claude_args_default, separator: "\0"), pattern: "--dangerously-skip-permissions") } -test fn witness_claude_invoke_permission_args_are_gunbc_policy() -> Bool { +fn witness_claude_invoke_permission_args_are_gunbc_policy() -> Bool { let argv = claude_spawn_argv( effort: "high", session_uuid: "uuid-policy", @@ -308,7 +308,7 @@ test fn witness_claude_invoke_permission_args_are_gunbc_policy() -> Bool { && dispatch_claude_permission_args == ["--dangerously-skip-permissions"] } -test fn witness_tmux_new_session_service_op_splices_inner_argv() -> Bool { +fn witness_tmux_new_session_service_op_splices_inner_argv() -> Bool { let via_service_shape = shape_tmux_new_session_argv( session_name: "gunbc-dispatch-splice", working_dir: "/opt/gunbc/dispatch-worktrees/splice", @@ -321,7 +321,7 @@ test fn witness_tmux_new_session_service_op_splices_inner_argv() -> Bool { ] } -test fn witness_session_lease_shape_reused() -> Bool { +fn witness_session_lease_shape_reused() -> Bool { session_lease_reuses_process_port_classifier_shape() } @@ -341,7 +341,7 @@ fn ticket_fixture_node() -> RoadmapNode { }, intricacy: IntricacyMedium, volume: VolumeSmall, repo: "gunbc") } -test fn witness_ticket_brief_fills_real_slots() -> Bool { +fn witness_ticket_brief_fills_real_slots() -> Bool { let brief = filled_dispatch_brief_for_node(node: ticket_fixture_node()) string_contains(s: brief, pattern: "the real displaced cost") && string_contains(s: brief, pattern: "the real current state") @@ -351,10 +351,35 @@ test fn witness_ticket_brief_fills_real_slots() -> Bool { && string_contains(s: brief, pattern: "the real handback") } -test fn witness_legacy_brief_still_stubs_with_title() -> Bool { +fn witness_legacy_brief_still_stubs_with_title() -> Bool { let node = sized_derivable(id: "brief-node", prs: [1], title: "Brief Title") let brief = filled_dispatch_brief_for_node(node: node) string_contains(s: brief, pattern: "Brief Title") && !string_contains(s: brief, pattern: "the real displaced cost") } +test fn roadmap_dispatch_actuator_witnesses() -> Bool { + witness_tmux_session_name_prefix() + && witness_brief_fill_includes_node_metadata() + && witness_claude_effort_high_for_high_intricacy() + && witness_claude_argv_uses_dangerous_skip_permissions() + && witness_git_worktree_argv_is_execfile_safe() + && witness_tmux_spawn_argv_threads_claude_argv() + && witness_stop_argv_targets_session() + && witness_tmux_ls_parse_filters_prefix() + && witness_not_ready_node_refused() + && witness_ready_node_permitted_without_live_session() + && witness_live_lease_refused() + && witness_absent_lease_classifies_spawn() + && witness_hostile_node_id_single_argv_token() + && witness_live_sessions_panel_rows() + && witness_name_only_observation_not_converged() + && witness_foreign_process_fingerprint_is_conflict() + && witness_fingerprint_scaffold_marker_present() + && witness_claude_invoke_permission_args_are_gunbc_policy() + && witness_tmux_new_session_service_op_splices_inner_argv() + && witness_host_exec_argv_shapes_bound_to_extdeps() + && witness_session_lease_shape_reused() + && witness_ticket_brief_fills_real_slots() + && witness_legacy_brief_still_stubs_with_title() +} diff --git a/dag/test/claim/roadmap_document_test.dag b/dag/test/claim/roadmap_document_test.dag index d60eb5e4660..6462b640d9b 100644 --- a/dag/test/claim/roadmap_document_test.dag +++ b/dag/test/claim/roadmap_document_test.dag @@ -77,33 +77,33 @@ fn emit(merged: List) -> String { serialize_markdown_source(doc: project_roadmap_to_markdown(doc: authority(), merged: merged)) } -test fn witness_preamble_first() -> Bool { +fn witness_preamble_first() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "# ROADMAP") && string_contains(s: out, pattern: "Generated from .dag authority") } -test fn witness_both_sections() -> Bool { +fn witness_both_sections() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "## 0. Fail-closed lock-down") && string_contains(s: out, pattern: "## 6. Expansion") } -test fn witness_authored_evidence_awaiting_signoff() -> Bool { +fn witness_authored_evidence_awaiting_signoff() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "[ ] **fail-open audit**") && string_contains(s: out, pattern: "[plan](docs/plans/fail-closed-lockdown.md)") && string_contains(s: out, pattern: "⏳ awaiting sign-off") } -test fn witness_derived_merged_awaiting_signoff() -> Bool { +fn witness_derived_merged_awaiting_signoff() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && string_contains(s: out, pattern: "⏳ awaiting sign-off") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") } -test fn witness_derived_unchecked_when_unmerged() -> Bool { +fn witness_derived_unchecked_when_unmerged() -> Bool { let out = emit(merged: []) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") @@ -126,12 +126,21 @@ fn expected_roadmap() -> String { ], "") } -test fn witness_exact_bytes() -> Bool { +fn witness_exact_bytes() -> Bool { emit(merged: [5491]) == expected_roadmap() } -test fn witness_drift_receipt() -> Bool { +fn witness_drift_receipt() -> Bool { emit(merged: [5491]) == expected_roadmap() && !(emit(merged: []) == expected_roadmap()) } +test fn roadmap_document_witnesses() -> Bool { + witness_preamble_first() + && witness_both_sections() + && witness_authored_evidence_awaiting_signoff() + && witness_derived_merged_awaiting_signoff() + && witness_derived_unchecked_when_unmerged() + && witness_exact_bytes() + && witness_drift_receipt() +} diff --git a/dag/test/claim/roadmap_emit_test.dag b/dag/test/claim/roadmap_emit_test.dag index ab3fc92b2d9..35aabdd2af4 100644 --- a/dag/test/claim/roadmap_emit_test.dag +++ b/dag/test/claim/roadmap_emit_test.dag @@ -59,30 +59,30 @@ fn emit(merged: List) -> String { emit_nodes(nodes: nodes(), merged: merged) } -test fn witness_heading() -> Bool { +fn witness_heading() -> Bool { string_contains(s: emit(merged: [5491]), pattern: "## 6. Expansion") } -test fn witness_parent_authored_box_and_link() -> Bool { +fn witness_parent_authored_box_and_link() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "- [ ] **invert hand-maintained**") && string_contains(s: out, pattern: "[plan](docs/plans/invert-hand-maintained.md)") } -test fn witness_child_merged_unsigned_awaiting_signoff() -> Bool { +fn witness_child_merged_unsigned_awaiting_signoff() -> Bool { let out = emit(merged: [5491]) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && string_contains(s: out, pattern: "⏳ awaiting sign-off") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") } -test fn witness_child_signed_checked() -> Bool { +fn witness_child_signed_checked() -> Bool { let out = emit_nodes(nodes: [parent_node(), signed_child_node()], merged: []) string_contains(s: out, pattern: "[x] **PR-checkbox status**") && string_contains(s: out, pattern: "✓ signed off: operator") } -test fn witness_child_derived_unchecked_when_unmerged() -> Bool { +fn witness_child_derived_unchecked_when_unmerged() -> Bool { let out = emit(merged: []) string_contains(s: out, pattern: "[ ] **PR-checkbox status**") && !string_contains(s: out, pattern: "[x] **PR-checkbox status**") @@ -100,9 +100,17 @@ fn superseded_child_node() -> RoadmapNode { } } -test fn witness_superseded_checked_struck_no_signoff_suffix() -> Bool { +fn witness_superseded_checked_struck_no_signoff_suffix() -> Bool { let out = emit_nodes(nodes: [parent_node(), superseded_child_node()], merged: []) string_contains(s: out, pattern: "[x] ~~**PR-checkbox status**~~ **superseded →** successor-lane") && !string_contains(s: out, pattern: "⏳ awaiting sign-off") } +test fn roadmap_emit_witnesses() -> Bool { + witness_heading() + && witness_parent_authored_box_and_link() + && witness_child_merged_unsigned_awaiting_signoff() + && witness_child_signed_checked() + && witness_child_derived_unchecked_when_unmerged() + && witness_superseded_checked_struck_no_signoff_suffix() +} diff --git a/dag/test/claim/roadmap_frontier_witness_test.dag b/dag/test/claim/roadmap_frontier_witness_test.dag index 1fbf821dfe6..166ed5c8a3b 100644 --- a/dag/test/claim/roadmap_frontier_witness_test.dag +++ b/dag/test/claim/roadmap_frontier_witness_test.dag @@ -60,7 +60,7 @@ fn fixture_doc(nodes: List, edges: List) -> RoadmapDoc } } -test fn witness_ready_matches_next_spawnable() -> Bool { +fn witness_ready_matches_next_spawnable() -> Bool { let node_a = sized_derivable(id: "parent-done", prs: [100], title: "Parent") let node_b = sized_derivable(id: "child-ready", prs: [200], title: "Child Ready") let edges = [RoadmapEdge { child: nid(s: "child-ready"), parent: nid(s: "parent-done") }] @@ -71,7 +71,7 @@ test fn witness_ready_matches_next_spawnable() -> Bool { && any(frontier.ready, n => n.node == nid(s: "child-ready")) } -test fn witness_upcoming_is_blocked_sized_node() -> Bool { +fn witness_upcoming_is_blocked_sized_node() -> Bool { let node_a = sized_derivable(id: "parent-open", prs: [100], title: "Parent Open") let node_b = sized_derivable(id: "child-blocked", prs: [200], title: "Child Blocked") let edges = [RoadmapEdge { child: nid(s: "child-blocked"), parent: nid(s: "parent-open") }] @@ -81,7 +81,7 @@ test fn witness_upcoming_is_blocked_sized_node() -> Bool { && !any(frontier.ready, n => n.node == nid(s: "child-blocked")) } -test fn witness_done_is_merged_sized_node() -> Bool { +fn witness_done_is_merged_sized_node() -> Bool { let node = sized_derivable(id: "done-node", prs: [999], title: "Done Node") let doc = fixture_doc(nodes: [node], edges: []) let frontier = spawn_frontier(doc: doc, merged: [999]) @@ -90,7 +90,7 @@ test fn witness_done_is_merged_sized_node() -> Bool { && !any(frontier.upcoming, n => n.node == nid(s: "done-node")) } -test fn witness_unsized_excluded_from_frontier() -> Bool { +fn witness_unsized_excluded_from_frontier() -> Bool { let node = unsized_derivable(id: "unsized-open", prs: [], title: "Unsized") let doc = fixture_doc(nodes: [node], edges: []) let frontier = spawn_frontier(doc: doc, merged: []) @@ -99,7 +99,7 @@ test fn witness_unsized_excluded_from_frontier() -> Bool { && count(frontier.done) == 0 } -test fn witness_buckets_are_disjoint() -> Bool { +fn witness_buckets_are_disjoint() -> Bool { let node_a = sized_derivable(id: "a-open", prs: [100], title: "A") let node_b = sized_derivable(id: "b-blocked", prs: [200], title: "B") let node_c = sized_derivable(id: "c-done", prs: [300], title: "C") @@ -120,7 +120,7 @@ fn daily_workspace_html(doc: RoadmapDocument, merged: List) -> String { } } -test fn witness_page_renders_four_buckets() -> Bool { +fn witness_page_renders_four_buckets() -> Bool { let node_a = sized_derivable(id: "ready-node", prs: [10], title: "Ready Title") let doc = fixture_doc(nodes: [node_a], edges: []) let h = daily_workspace_html(doc: doc, merged: []) @@ -147,7 +147,7 @@ fn superseded_node_fixture(id: String, by: String) -> RoadmapNode { } } -test fn witness_superseded_bucket_holds_superseded_only() -> Bool { +fn witness_superseded_bucket_holds_superseded_only() -> Bool { let node_old = superseded_node_fixture(id: "old-row", by: "successor-lane") let node_open = sized_derivable(id: "open-row", prs: [10], title: "Open Row") let doc = fixture_doc(nodes: [node_old, node_open], edges: []) @@ -159,7 +159,7 @@ test fn witness_superseded_bucket_holds_superseded_only() -> Bool { && !any(frontier.done, n => n.node == nid(s: "old-row")) } -test fn witness_page_places_superseded_node_in_superseded_bucket() -> Bool { +fn witness_page_places_superseded_node_in_superseded_bucket() -> Bool { let node_old = superseded_node_fixture(id: "old-row", by: "successor-lane") let doc = fixture_doc(nodes: [node_old], edges: []) let h = daily_workspace_html(doc: doc, merged: []) @@ -169,7 +169,7 @@ test fn witness_page_places_superseded_node_in_superseded_bucket() -> Bool { && !string_contains(s: h, pattern: "
") } -test fn witness_authority_differs_from_empty() -> Bool { +fn witness_authority_differs_from_empty() -> Bool { !(authority_page_html() == empty_doc_html()) } -test fn witness_authority_shows_three_gate_progress() -> Bool { +fn witness_authority_shows_three_gate_progress() -> Bool { let authority = authority_page_html() let empty = empty_doc_html() string_contains(s: authority, pattern: "class=\"three-gate-progress\"") @@ -91,13 +91,13 @@ fn bold_title_html() -> String { } } -test fn witness_bold_title_renders_strong() -> Bool { +fn witness_bold_title_renders_strong() -> Bool { let h = bold_title_html() string_contains(s: h, pattern: "bold") && !string_contains(s: h, pattern: "**") } -test fn witness_depth_cap_fails_honest() -> Bool { +fn witness_depth_cap_fails_honest() -> Bool { let truncated = depth_chain_html(fuel: 0) let expanded = depth_chain_html(fuel: 1) string_contains(s: truncated, pattern: "depth limit") @@ -137,7 +137,7 @@ fn dispatch_doc_page(rn: RoadmapNode) -> Fragment { roadmap_page(doc: doc, merged: []) } -test fn witness_open_node_doc_emits_button_and_external_script() -> Bool { +fn witness_open_node_doc_emits_button_and_external_script() -> Bool { let h = dispatch_doc_html_for(rn: open_dispatch_node()) string_contains(s: h, pattern: "