diff --git a/_pkgdown.yml b/_pkgdown.yml index 17017e5..061b553 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -339,3 +339,4 @@ articles: - articles/devlog-2026-11-22-p3-cs13-io-interop-witness - articles/devlog-2026-11-23-p3-cs14-segments-witness - articles/devlog-2026-11-23-p3-cs15-refdb-witness + - articles/devlog-2026-11-23-p3-cs16-ard-witness diff --git a/bench/scenarios/out/cs16_degenerates.tsv b/bench/scenarios/out/cs16_degenerates.tsv new file mode 100644 index 0000000..60a7150 --- /dev/null +++ b/bench/scenarios/out/cs16_degenerates.tsv @@ -0,0 +1,15 @@ +pair side arm mode cls msg +maxiter-floor hi maxiter-floor-hi accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=1;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +maxiter-floor lo maxiter-floor-lo reject msuiter_error_engine `max_iter` must be a single positive whole number | got: 0 | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter +seed-floor hi seed-floor-hi accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=0;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +seed-floor lo seed-floor-lo reject msuiter_error_engine `seed` must be a single whole number in [0, 2^31 - 1] | got: -1 | the ARD initializer-seed property `seed` | construct with a whole-number seed in range +seed-ceiling hi seed-ceiling-hi accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=2147483647;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +seed-ceiling lo seed-ceiling-lo reject msuiter_error_engine `seed` must be a single whole number in [0, 2^31 - 1] | got: 2147483648 | the ARD initializer-seed property `seed` | construct with a whole-number seed in range +tol-floor hi tol-floor-hi accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-300;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +tol-floor lo tol-floor-lo reject msuiter_error_engine `tol` must be a single finite number > 0 | got: 0 | the ARD convergence-tolerance property `tol` | construct with a finite positive tolerance +label-empty hi label-empty-hi accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=;a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ard (ard) | mode: extract | deterministic +label-empty lo label-empty-lo reject msuiter_error_engine label must be a single string (empty allowed) | the label is an optional human-readable engine name | received: 'NA' | pass a short label, or leave it empty +mode-domain hi mode-domain-hi accept s7:msuiter::MsArd name=ard;mode=fit;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: fit | deterministic +mode-domain lo mode-domain-lo reject msuiter_error_engine engine mode must be one of the known modes | known modes: extract, fit | received: 'transform' | declare whether the engine extracts signatures or fits exposures +a0-finite-ceil hi a0-finite-ceil-hi accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=1e+308;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +a0-finite-ceil lo a0-finite-ceil-lo reject msuiter_error_engine `a0` must be a single finite number > 0 | got: Inf | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values diff --git a/bench/scenarios/out/cs16_laws.tsv b/bench/scenarios/out/cs16_laws.tsv new file mode 100644 index 0000000..cf57fca --- /dev/null +++ b/bench/scenarios/out/cs16_laws.tsv @@ -0,0 +1,41 @@ +arm mode cls msg +lj-name-upper reject msuiter_error_engine engine name must be a single lower-case snake_case string | engine names are registry keys (D9) | received: 'ARD' | use e.g. name = "nmf_kl" +lj-name-hyphen reject msuiter_error_engine engine name must be a single lower-case snake_case string | engine names are registry keys (D9) | received: 'a-b' | use e.g. name = "nmf_kl" +lj-name-empty reject msuiter_error_engine engine name must be a single lower-case snake_case string | engine names are registry keys (D9) | received: '' | use e.g. name = "nmf_kl" +lj-name-na reject msuiter_error_engine engine name must be a single lower-case snake_case string | engine names are registry keys (D9) | received: 'NA' | use e.g. name = "nmf_kl" +lj-mode-unknown reject msuiter_error_engine engine mode must be one of the known modes | known modes: extract, fit | received: 'transform' | declare whether the engine extracts signatures or fits exposures +lj-params-partial reject msuiter_error_engine engine params must be a (named) list | params carry the hyper-parameters of the spec | received: list | pass hyper-parameters as a named list +lj-params-null reject simpleError object properties are invalid: | - @params must be , not +lj-det-na reject msuiter_error_engine deterministic must be a single TRUE or FALSE | determinism is part of the engine contract (thread invariance) | received: 'NA' | declare whether the engine is seeded and thread invariant +lj-pkgs-na reject msuiter_error_engine packages must be a character vector of package names without NA | required_pkgs() reports these before an engine runs | received: 'rlang', 'NA' | list package names, or pass character(0) +lj-pkgs-empty reject msuiter_error_engine packages must be a character vector of package names without NA | required_pkgs() reports these before an engine runs | received: '' | list package names, or pass character(0) +lj-label-na reject msuiter_error_engine label must be a single string (empty allowed) | the label is an optional human-readable engine name | received: 'NA' | pass a short label, or leave it empty +lj-name-num reject simpleError object properties are invalid: | - @name must be , not +lj-mode-num reject simpleError object properties are invalid: | - @mode must be , not +lj-params-vec reject simpleError object properties are invalid: | - @params must be , not +lj-det-string reject simpleError object properties are invalid: | - @deterministic must be , not +lj-pkgs-list reject simpleError object properties are invalid: | - @packages must be , not +lj-label-num reject simpleError object properties are invalid: | - @label must be , not +lj-a0-zero reject msuiter_error_engine `a0` must be a single finite number > 0 | got: 0 | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values +lj-a0-neg reject msuiter_error_engine `a0` must be a single finite number > 0 | got: -1 | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values +lj-a0-inf reject msuiter_error_engine `a0` must be a single finite number > 0 | got: Inf | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values +lj-a0-nan reject msuiter_error_engine `a0` must be a single finite number > 0 | got: NaN | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values +lj-a0-na reject msuiter_error_engine `a0` must be a single finite number > 0 | got: NA | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values +lj-a0-len2 reject msuiter_error_internal msuiter_abort: bullet 'i' must be a non-empty string +lj-a0-str reject simpleError object properties are invalid: | - @a0 must be or , not +lj-b0-zero reject msuiter_error_engine `b0` must be a single finite number > 0 | got: 0 | the ARD prior property `b0` | construct with ms_ard(a0 = , b0 = ) using positive values +lj-b0-str reject simpleError object properties are invalid: | - @b0 must be or , not +lj-tol-zero reject msuiter_error_engine `tol` must be a single finite number > 0 | got: 0 | the ARD convergence-tolerance property `tol` | construct with a finite positive tolerance +lj-tol-neg reject msuiter_error_engine `tol` must be a single finite number > 0 | got: -1e-05 | the ARD convergence-tolerance property `tol` | construct with a finite positive tolerance +lj-tol-inf reject msuiter_error_engine `tol` must be a single finite number > 0 | got: Inf | the ARD convergence-tolerance property `tol` | construct with a finite positive tolerance +lj-tol-str reject simpleError object properties are invalid: | - @tol must be or , not +lj-mi-zero reject msuiter_error_engine `max_iter` must be a single positive whole number | got: 0 | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter +lj-mi-frac reject msuiter_error_engine `max_iter` must be a single positive whole number | got: 1.5 | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter +lj-mi-neg reject msuiter_error_engine `max_iter` must be a single positive whole number | got: -3 | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter +lj-mi-inf reject msuiter_error_engine `max_iter` must be a single positive whole number | got: Inf | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter +lj-mi-str reject simpleError object properties are invalid: | - @max_iter must be or , not +lj-seed-neg reject msuiter_error_engine `seed` must be a single whole number in [0, 2^31 - 1] | got: -1 | the ARD initializer-seed property `seed` | construct with a whole-number seed in range +lj-seed-frac reject msuiter_error_engine `seed` must be a single whole number in [0, 2^31 - 1] | got: 1.5 | the ARD initializer-seed property `seed` | construct with a whole-number seed in range +lj-seed-above reject msuiter_error_engine `seed` must be a single whole number in [0, 2^31 - 1] | got: 2147483648 | the ARD initializer-seed property `seed` | construct with a whole-number seed in range +lj-seed-str reject simpleError object properties are invalid: | - @seed must be or , not +lj-seed-len2 reject msuiter_error_internal msuiter_abort: bullet 'i' must be a non-empty string diff --git a/bench/scenarios/out/cs16_precedence.tsv b/bench/scenarios/out/cs16_precedence.tsv new file mode 100644 index 0000000..eb8da3d --- /dev/null +++ b/bench/scenarios/out/cs16_precedence.tsv @@ -0,0 +1,9 @@ +arm mode cls msg fires_ok anti_ok +prec-name-over-mode reject msuiter_error_engine engine name must be a single lower-case snake_case string | engine names are registry keys (D9) | received: 'ARD' | use e.g. name = "nmf_kl" TRUE TRUE +prec-mode-over-params reject msuiter_error_engine engine mode must be one of the known modes | known modes: extract, fit | received: 'transform' | declare whether the engine extracts signatures or fits exposures TRUE TRUE +prec-det-over-pkgs reject msuiter_error_engine deterministic must be a single TRUE or FALSE | determinism is part of the engine contract (thread invariance) | received: 'NA' | declare whether the engine is seeded and thread invariant TRUE TRUE +prec-pkgs-over-label reject msuiter_error_engine packages must be a character vector of package names without NA | required_pkgs() reports these before an engine runs | received: 'rlang', 'NA' | list package names, or pass character(0) TRUE TRUE +prec-shared-over-ard reject msuiter_error_engine label must be a single string (empty allowed) | the label is an optional human-readable engine name | received: 'NA' | pass a short label, or leave it empty TRUE TRUE +prec-a0-over-b0 reject msuiter_error_engine `a0` must be a single finite number > 0 | got: 0 | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values TRUE TRUE +prec-tol-over-mi reject msuiter_error_engine `tol` must be a single finite number > 0 | got: 0 | the ARD convergence-tolerance property `tol` | construct with a finite positive tolerance TRUE TRUE +prec-mi-over-seed reject msuiter_error_engine `max_iter` must be a single positive whole number | got: 1.5 | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter TRUE TRUE diff --git a/bench/scenarios/out/cs16_scalars.tsv b/bench/scenarios/out/cs16_scalars.tsv new file mode 100644 index 0000000..110e37d --- /dev/null +++ b/bench/scenarios/out/cs16_scalars.tsv @@ -0,0 +1,10 @@ +key value +validator-class msuiter_error_engine +clause-a0 `a0` must be a single finite number > 0 | got: 0 | the ARD prior property `a0` | construct with ms_ard(a0 = , b0 = ) using positive values +clause-b0 `b0` must be a single finite number > 0 | got: 0 | the ARD prior property `b0` | construct with ms_ard(a0 = , b0 = ) using positive values +clause-tol `tol` must be a single finite number > 0 | got: 0 | the ARD convergence-tolerance property `tol` | construct with a finite positive tolerance +clause-mi `max_iter` must be a single positive whole number | got: 1.5 | the ARD iteration-cap property `max_iter` | construct with a positive whole-number max_iter +clause-seed `seed` must be a single whole number in [0, 2^31 - 1] | got: -1 | the ARD initializer-seed property `seed` | construct with a whole-number seed in range +canonical-shape name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +rng-before FALSE +rng-after FALSE diff --git a/bench/scenarios/out/cs16_specs.tsv b/bench/scenarios/out/cs16_specs.tsv new file mode 100644 index 0000000..7b2882e --- /dev/null +++ b/bench/scenarios/out/cs16_specs.tsv @@ -0,0 +1,10 @@ +arm mode cls msg +sp-canonical accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +sp-ctor-identity accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +sp-integer-hyper accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1;mi=2000;seed=0;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +sp-mode-fit-legal accept s7:msuiter::MsArd name=ard;mode=fit;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: fit | deterministic +sp-params-named accept s7:msuiter::MsArd name=ard;mode=extract;np=1;pnames=algo;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +sp-params-unnamed-passes accept s7:msuiter::MsArd name=ard;mode=extract;np=2;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic +sp-label-empty accept s7:msuiter::MsArd name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=;a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ard (ard) | mode: extract | deterministic +sp-override-all accept s7:msuiter::MsArd name=ard_x;mode=fit;np=1;pnames=k;det=FALSE;npkg=1;pkgs=rlang;label=Custom ARD;a0=2;b0=3;tol=1e-08;mi=10;seed=0;fmt= Custom ARD (ard_x) | mode: fit | stochastic +sp-replay-identity accept s7:character name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic==name=ard;mode=extract;np=0;pnames=;det=TRUE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fmt= ARD-NMF (SignatureAnalyzer semantics) (ard) | mode: extract | deterministic diff --git a/bench/scenarios/run_ard_witness.R b/bench/scenarios/run_ard_witness.R new file mode 100644 index 0000000..92388a5 --- /dev/null +++ b/bench/scenarios/run_ard_witness.R @@ -0,0 +1,696 @@ +# run_ard_witness.R -- the CS-16 ard-witness scenario (pillar 3). +# +# Mandate: plant synthetic constructor calls (the D3 law: zero COSMIC +# numeric matrices, zero real-data bytes, zero downloads -- ARD/NMF ride +# only as FORMAT NAMES) and adjudicate the EXPORTED ms_ard() face: the +# shared engine admission laws, the S7 property-gate split against the +# validator, the ARD prior laws, the third abort class the len-2 hyper +# values reach, the precedence discriminators with their anti anchors, the +# degenerate boundaries and the acceptance specs. Every arm is driven +# through the exported constructors alone; the accepted returns, the abort +# classes and the fired bullets are the face's own. The scenario consumes +# no RNG, no network and no clock at the adjudication core; the benchmark +# runner and the DECLINED calibration family are never invoked here. +# +# Framing law: DECISION RECORD only. The witnesses under out/ are the +# committed verdict of what the shipped face SAID on planted truth. Float +# posture (D11): integer, label, logical, class and clause bytes are +# byte-committed; the face produces no float payload columns, so no float +# glyph rides any witness. +# +# Rails: this runner carries the same frozen block as the law file +# (tests/testthat/test-scenario-ard-witness.R), injected byte-identically +# from one minted source; every observed class, clause, shape and +# precedence order is rail-checked AS WE GO -- a drift fails the run +# before any witness is written. The witness bytes are written only after +# every payload census speaks; a byte-rerun must reproduce them identically. + +.script_dir <- local({ + a <- grep("^--file=(.*)$", commandArgs(FALSE), perl = TRUE, value = TRUE) + if (length(a) == 0L) return(getwd()) + f <- sub("^--file=", "", a[1L]) + if (!grepl("/", f, fixed = TRUE)) return(getwd()) + dirname(f) +}) +ROOT <- normalizePath(file.path(.script_dir, "..", ".."), mustWork = TRUE) +OUT <- file.path(ROOT, "bench", "scenarios", "out") + +if (requireNamespace("pkgload", quietly = TRUE) && + file.exists(file.path(ROOT, "DESCRIPTION"))) { + suppressWarnings(suppressMessages( + pkgload::load_all(ROOT, quiet = TRUE, export_all = TRUE))) +} else { + library(msuiter) +} +stopif <- function(cond, msg) if (isTRUE(cond)) stop(msg, call. = FALSE) +## RNG-STATE-RAIL: the adjudication core must never seed or consume RNG; +## the purity verdict rides the scalars witness (committed bytes below). +rng0 <- exists(".Random.seed", envir = globalenv(), inherits = TRUE) + +## <> (minted mechanically from the audited ledgers +## 2026-11-23; DO NOT hand-edit: regenerate via gen-frozen.cs16.R) ## +.CS16_LAW_ARMS <- c("lj-name-upper", "lj-name-hyphen", "lj-name-empty", "lj-name-na", "lj-mode-unknown", "lj-params-partial", "lj-params-null", "lj-det-na", "lj-pkgs-na", "lj-pkgs-empty", "lj-label-na", "lj-name-num", "lj-mode-num", "lj-params-vec", "lj-det-string", "lj-pkgs-list", "lj-label-num", "lj-a0-zero", "lj-a0-neg", "lj-a0-inf", "lj-a0-nan", "lj-a0-na", "lj-a0-len2", "lj-a0-str", "lj-b0-zero", "lj-b0-str", "lj-tol-zero", "lj-tol-neg", "lj-tol-inf", "lj-tol-str", "lj-mi-zero", "lj-mi-frac", "lj-mi-neg", "lj-mi-inf", "lj-mi-str", "lj-seed-neg", "lj-seed-frac", "lj-seed-above", "lj-seed-str", "lj-seed-len2") +.CS16_LAW_CLS <- c("msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "simpleError", "simpleError", "simpleError", "simpleError", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_internal", "simpleError", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_internal") +.CS16_LAW_CLAUSES <- list() +.CS16_LAW_CLAUSES[["lj-name-upper"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: 'ARD' | use e.g. name = \"nm", + "f_kl\"") +.CS16_LAW_CLAUSES[["lj-name-hyphen"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: 'a-b' | use e.g. name = \"nm", + "f_kl\"") +.CS16_LAW_CLAUSES[["lj-name-empty"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: '' | use e.g. name = \"nmf_k", + "l\"") +.CS16_LAW_CLAUSES[["lj-name-na"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: 'NA' | use e.g. name = \"nmf", + "_kl\"") +.CS16_LAW_CLAUSES[["lj-mode-unknown"]] <- paste0("engine mode must be one of the known modes | ", + "known modes: extract, fit | received: 'transf", + "orm' | declare whether the engine extracts si", + "gnatures or fits exposures") +.CS16_LAW_CLAUSES[["lj-params-partial"]] <- paste0("engine params must be a (named) list | params", + " carry the hyper-parameters of the spec | rec", + "eived: list | pass hyper-parameters as a name", + "d list") +.CS16_LAW_CLAUSES[["lj-params-null"]] <- paste0(" object properties are invali", + "d: | - @params must be , not ") +.CS16_LAW_CLAUSES[["lj-det-na"]] <- paste0("deterministic must be a single TRUE or FALSE ", + "| determinism is part of the engine contract ", + "(thread invariance) | received: 'NA' | declar", + "e whether the engine is seeded and thread inv", + "ariant") +.CS16_LAW_CLAUSES[["lj-pkgs-na"]] <- paste0("packages must be a character vector of packag", + "e names without NA | required_pkgs() reports ", + "these before an engine runs | received: 'rlan", + "g', 'NA' | list package names, or pass charac", + "ter(0)") +.CS16_LAW_CLAUSES[["lj-pkgs-empty"]] <- paste0("packages must be a character vector of packag", + "e names without NA | required_pkgs() reports ", + "these before an engine runs | received: '' | ", + "list package names, or pass character(0)") +.CS16_LAW_CLAUSES[["lj-label-na"]] <- paste0("label must be a single string (empty allowed)", + " | the label is an optional human-readable en", + "gine name | received: 'NA' | pass a short lab", + "el, or leave it empty") +.CS16_LAW_CLAUSES[["lj-name-num"]] <- paste0(" object properties are invali", + "d: | - @name must be , not ") +.CS16_LAW_CLAUSES[["lj-mode-num"]] <- paste0(" object properties are invali", + "d: | - @mode must be , not ") +.CS16_LAW_CLAUSES[["lj-params-vec"]] <- paste0(" object properties are invali", + "d: | - @params must be , not ") +.CS16_LAW_CLAUSES[["lj-det-string"]] <- paste0(" object properties are invali", + "d: | - @deterministic must be , not ", + "") +.CS16_LAW_CLAUSES[["lj-pkgs-list"]] <- paste0(" object properties are invali", + "d: | - @packages must be , not ") +.CS16_LAW_CLAUSES[["lj-label-num"]] <- paste0(" object properties are invali", + "d: | - @label must be , not ") +.CS16_LAW_CLAUSES[["lj-a0-zero"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `a0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_LAW_CLAUSES[["lj-a0-neg"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": -1 | the ARD prior property `a0` | construc", + "t with ms_ard(a0 = , b0 = ) using positive va", + "lues") +.CS16_LAW_CLAUSES[["lj-a0-inf"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": Inf | the ARD prior property `a0` | constru", + "ct with ms_ard(a0 = , b0 = ) using positive v", + "alues") +.CS16_LAW_CLAUSES[["lj-a0-nan"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": NaN | the ARD prior property `a0` | constru", + "ct with ms_ard(a0 = , b0 = ) using positive v", + "alues") +.CS16_LAW_CLAUSES[["lj-a0-na"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": NA | the ARD prior property `a0` | construc", + "t with ms_ard(a0 = , b0 = ) using positive va", + "lues") +.CS16_LAW_CLAUSES[["lj-a0-len2"]] <- paste0("msuiter_abort: bullet 'i' must be a non-empty", + " string") +.CS16_LAW_CLAUSES[["lj-a0-str"]] <- paste0(" object properties are invali", + "d: | - @a0 must be or , not", + " ") +.CS16_LAW_CLAUSES[["lj-b0-zero"]] <- paste0("`b0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `b0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_LAW_CLAUSES[["lj-b0-str"]] <- paste0(" object properties are invali", + "d: | - @b0 must be or , not", + " ") +.CS16_LAW_CLAUSES[["lj-tol-zero"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: 0 | the ARD convergence-tolerance property", + " `tol` | construct with a finite positive tol", + "erance") +.CS16_LAW_CLAUSES[["lj-tol-neg"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: -1e-05 | the ARD convergence-tolerance pro", + "perty `tol` | construct with a finite positiv", + "e tolerance") +.CS16_LAW_CLAUSES[["lj-tol-inf"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: Inf | the ARD convergence-tolerance proper", + "ty `tol` | construct with a finite positive t", + "olerance") +.CS16_LAW_CLAUSES[["lj-tol-str"]] <- paste0(" object properties are invali", + "d: | - @tol must be or , no", + "t ") +.CS16_LAW_CLAUSES[["lj-mi-zero"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 0 | the ARD iteration-cap propert", + "y `max_iter` | construct with a positive whol", + "e-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-frac"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 1.5 | the ARD iteration-cap prope", + "rty `max_iter` | construct with a positive wh", + "ole-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-neg"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: -3 | the ARD iteration-cap proper", + "ty `max_iter` | construct with a positive who", + "le-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-inf"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: Inf | the ARD iteration-cap prope", + "rty `max_iter` | construct with a positive wh", + "ole-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-str"]] <- paste0(" object properties are invali", + "d: | - @max_iter must be or , not ") +.CS16_LAW_CLAUSES[["lj-seed-neg"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: -1 | the ARD initializer-seed", + " property `seed` | construct with a whole-num", + "ber seed in range") +.CS16_LAW_CLAUSES[["lj-seed-frac"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: 1.5 | the ARD initializer-see", + "d property `seed` | construct with a whole-nu", + "mber seed in range") +.CS16_LAW_CLAUSES[["lj-seed-above"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: 2147483648 | the ARD initiali", + "zer-seed property `seed` | construct with a w", + "hole-number seed in range") +.CS16_LAW_CLAUSES[["lj-seed-str"]] <- paste0(" object properties are invali", + "d: | - @seed must be or , n", + "ot ") +.CS16_LAW_CLAUSES[["lj-seed-len2"]] <- paste0("msuiter_abort: bullet 'i' must be a non-empty", + " string") +.CS16_SPEC_ARMS <- c("sp-canonical", "sp-ctor-identity", "sp-integer-hyper", "sp-mode-fit-legal", "sp-params-named", "sp-params-unnamed-passes", "sp-label-empty", "sp-override-all", "sp-replay-identity") +.CS16_SPEC_CLS <- c("s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:character") +.CS16_SPEC_DETAILS <- list() +.CS16_SPEC_DETAILS[["sp-canonical"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SPEC_DETAILS[["sp-ctor-identity"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SPEC_DETAILS[["sp-integer-hyper"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1;mi=2000;seed=0;fm", + "t= ARD-NMF (SignatureAnalyzer seman", + "tics) (ard) | mode: extract | deterministic") +.CS16_SPEC_DETAILS[["sp-mode-fit-legal"]] <- paste0("name=ard;mode=fit;np=0;pnames=;det=TRUE;npkg=", + "0;pkgs=;label=ARD-NMF (SignatureAnalyzer sema", + "ntics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fm", + "t= ARD-NMF (SignatureAnalyzer seman", + "tics) (ard) | mode: fit | deterministic") +.CS16_SPEC_DETAILS[["sp-params-named"]] <- paste0("name=ard;mode=extract;np=1;pnames=algo;det=TR", + "UE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnaly", + "zer semantics);a0=10;b0=5;tol=1e-05;mi=2000;s", + "eed=1;fmt= ARD-NMF (SignatureAnalyz", + "er semantics) (ard) | mode: extract | determi", + "nistic") +.CS16_SPEC_DETAILS[["sp-params-unnamed-passes"]] <- paste0("name=ard;mode=extract;np=2;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SPEC_DETAILS[["sp-label-empty"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=;a0=10;b0=5;tol=1e-05;mi=20", + "00;seed=1;fmt= ard (ard) | mode: ex", + "tract | deterministic") +.CS16_SPEC_DETAILS[["sp-override-all"]] <- paste0("name=ard_x;mode=fit;np=1;pnames=k;det=FALSE;n", + "pkg=1;pkgs=rlang;label=Custom ARD;a0=2;b0=3;t", + "ol=1e-08;mi=10;seed=0;fmt= Custom A", + "RD (ard_x) | mode: fit | stochastic") +.CS16_SPEC_DETAILS[["sp-replay-identity"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic==name=ard;mode=extract;np=0;pnames=;det=TR", + "UE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnaly", + "zer semantics);a0=10;b0=5;tol=1e-05;mi=2000;s", + "eed=1;fmt= ARD-NMF (SignatureAnalyz", + "er semantics) (ard) | mode: extract | determi", + "nistic") +.CS16_PREC_ARMS <- c("prec-name-over-mode", "prec-mode-over-params", "prec-det-over-pkgs", "prec-pkgs-over-label", "prec-shared-over-ard", "prec-a0-over-b0", "prec-tol-over-mi", "prec-mi-over-seed") +.CS16_PREC_CLS <- c("msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine") +.CS16_PREC_FIRES <- c(paste0("engine name must be a single lower-case snake", + "_case string"), "engine mode must be one of the known modes", "deterministic must be a single TRUE or FALSE", paste0("packages must be a character vector of packag", + "e names without NA"), "label must be a single string (empty allowed)", "`a0` must be a single finite number > 0", "`tol` must be a single finite number > 0", paste0("`max_iter` must be a single positive whole nu", + "mber")) +.CS16_PREC_ANTI <- c("engine mode must be", "engine params must be a (named) list", paste0("packages must be a character vector of packag", + "e names without NA"), "label must be a single string (empty allowed)", "must be a single finite number > 0", "`b0` must be", "positive whole number", "whole number in [0") +.CS16_DEGEN_PAIR <- c("maxiter-floor", "maxiter-floor", "seed-floor", "seed-floor", "seed-ceiling", "seed-ceiling", "tol-floor", "tol-floor", "label-empty", "label-empty", "mode-domain", "mode-domain", "a0-finite-ceil", "a0-finite-ceil") +.CS16_DEGEN_SIDE <- c("hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo") +.CS16_DEGEN_ARMS <- c("maxiter-floor-hi", "maxiter-floor-lo", "seed-floor-hi", "seed-floor-lo", "seed-ceiling-hi", "seed-ceiling-lo", "tol-floor-hi", "tol-floor-lo", "label-empty-hi", "label-empty-lo", "mode-domain-hi", "mode-domain-lo", "a0-finite-ceil-hi", "a0-finite-ceil-lo") +.CS16_DEGEN_MODE <- c("accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject") +.CS16_DEGEN_CLS <- c("s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine") +.CS16_DEGEN_MSG <- list() +.CS16_DEGEN_MSG[["maxiter-floor-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=1;seed=1;f", + "mt= ARD-NMF (SignatureAnalyzer sema", + "ntics) (ard) | mode: extract | deterministic") +.CS16_DEGEN_MSG[["maxiter-floor-lo"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 0 | the ARD iteration-cap propert", + "y `max_iter` | construct with a positive whol", + "e-number max_iter") +.CS16_DEGEN_MSG[["seed-floor-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "0;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_DEGEN_MSG[["seed-floor-lo"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: -1 | the ARD initializer-seed", + " property `seed` | construct with a whole-num", + "ber seed in range") +.CS16_DEGEN_MSG[["seed-ceiling-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "2147483647;fmt= ARD-NMF (SignatureA", + "nalyzer semantics) (ard) | mode: extract | de", + "terministic") +.CS16_DEGEN_MSG[["seed-ceiling-lo"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: 2147483648 | the ARD initiali", + "zer-seed property `seed` | construct with a w", + "hole-number seed in range") +.CS16_DEGEN_MSG[["tol-floor-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-300;mi=2000;seed", + "=1;fmt= ARD-NMF (SignatureAnalyzer ", + "semantics) (ard) | mode: extract | determinis", + "tic") +.CS16_DEGEN_MSG[["tol-floor-lo"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: 0 | the ARD convergence-tolerance property", + " `tol` | construct with a finite positive tol", + "erance") +.CS16_DEGEN_MSG[["label-empty-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=;a0=10;b0=5;tol=1e-05;mi=20", + "00;seed=1;fmt= ard (ard) | mode: ex", + "tract | deterministic") +.CS16_DEGEN_MSG[["label-empty-lo"]] <- paste0("label must be a single string (empty allowed)", + " | the label is an optional human-readable en", + "gine name | received: 'NA' | pass a short lab", + "el, or leave it empty") +.CS16_DEGEN_MSG[["mode-domain-hi"]] <- paste0("name=ard;mode=fit;np=0;pnames=;det=TRUE;npkg=", + "0;pkgs=;label=ARD-NMF (SignatureAnalyzer sema", + "ntics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fm", + "t= ARD-NMF (SignatureAnalyzer seman", + "tics) (ard) | mode: fit | deterministic") +.CS16_DEGEN_MSG[["mode-domain-lo"]] <- paste0("engine mode must be one of the known modes | ", + "known modes: extract, fit | received: 'transf", + "orm' | declare whether the engine extracts si", + "gnatures or fits exposures") +.CS16_DEGEN_MSG[["a0-finite-ceil-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=1e+308;b0=5;tol=1e-05;mi=2000;s", + "eed=1;fmt= ARD-NMF (SignatureAnalyz", + "er semantics) (ard) | mode: extract | determi", + "nistic") +.CS16_DEGEN_MSG[["a0-finite-ceil-lo"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": Inf | the ARD prior property `a0` | constru", + "ct with ms_ard(a0 = , b0 = ) using positive v", + "alues") +.CS16_SCAL_KEYS <- c("validator-class", "clause-a0", "clause-b0", "clause-tol", "clause-mi", "clause-seed", "canonical-shape", "rng-before", "rng-after") +.CS16_SCAL_VALS <- list() +.CS16_SCAL_VALS[["validator-class"]] <- "msuiter_error_engine" +.CS16_SCAL_VALS[["clause-a0"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `a0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_SCAL_VALS[["clause-b0"]] <- paste0("`b0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `b0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_SCAL_VALS[["clause-tol"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: 0 | the ARD convergence-tolerance property", + " `tol` | construct with a finite positive tol", + "erance") +.CS16_SCAL_VALS[["clause-mi"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 1.5 | the ARD iteration-cap prope", + "rty `max_iter` | construct with a positive wh", + "ole-number max_iter") +.CS16_SCAL_VALS[["clause-seed"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: -1 | the ARD initializer-seed", + " property `seed` | construct with a whole-num", + "ber seed in range") +.CS16_SCAL_VALS[["canonical-shape"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SCAL_VALS[["rng-before"]] <- "FALSE" +.CS16_SCAL_VALS[["rng-after"]] <- "FALSE" +.CS16_SCAL_REFIRE <- list( +"clause-a0" = "ms_ard(a0 = 0)", +"clause-b0" = "ms_ard(b0 = 0)", +"clause-tol" = "ms_ard(tol = 0)", +"clause-mi" = "ms_ard(max_iter = 1.5)", +"clause-seed" = "ms_ard(seed = -1)", +"validator-class" = "MsArd(name = \"ARD\")", +"canonical-shape" = "ms_ard()" +) +.CS16_ARM <- list( +"sp-canonical" = "ms_ard()", +"sp-ctor-identity" = "MsArd()", +"sp-integer-hyper" = paste0("ms_ard(a0 = 10, b0 = 5, tol = 1, max_iter = 2", + "000, seed = 0)"), +"sp-mode-fit-legal" = "MsArd(mode = \"fit\")", +"sp-params-named" = "MsArd(params = list(algo = \"kl\"))", +"sp-params-unnamed-passes" = "MsArd(params = list(1, 2))", +"sp-label-empty" = "MsArd(label = \"\")", +"sp-override-all" = paste0("MsArd(name = \"ard_x\", mode = \"fit\", params = ", + "list(k = 1), deterministic = FALSE, packages ", + "= c(\"rlang\"), label = \"Custom ARD\", a0 = 2, b", + "0 = 3, tol = 1e-08, max_iter = 10, seed = 0)"), +"sp-replay-identity" = paste0("paste0(.cs16_shape(ms_ard()), \"==\", .cs16_sha", + "pe(ms_ard()))"), +"lj-name-upper" = "MsArd(name = \"ARD\")", +"lj-name-hyphen" = "MsArd(name = \"a-b\")", +"lj-name-empty" = "MsArd(name = \"\")", +"lj-name-na" = "MsArd(name = NA_character_)", +"lj-mode-unknown" = "MsArd(mode = \"transform\")", +"lj-params-partial" = "MsArd(params = list(1, k = 2))", +"lj-params-null" = "MsArd(params = NULL)", +"lj-det-na" = "MsArd(deterministic = NA)", +"lj-pkgs-na" = "MsArd(packages = c(\"rlang\", NA))", +"lj-pkgs-empty" = "MsArd(packages = \"\")", +"lj-label-na" = "MsArd(label = NA_character_)", +"lj-name-num" = "MsArd(name = 123)", +"lj-mode-num" = "MsArd(mode = 7)", +"lj-params-vec" = "MsArd(params = \"kl\")", +"lj-det-string" = "MsArd(deterministic = \"yes\")", +"lj-pkgs-list" = "MsArd(packages = list())", +"lj-label-num" = "MsArd(label = 5)", +"lj-a0-zero" = "ms_ard(a0 = 0)", +"lj-a0-neg" = "ms_ard(a0 = -1)", +"lj-a0-inf" = "ms_ard(a0 = Inf)", +"lj-a0-nan" = "ms_ard(a0 = NaN)", +"lj-a0-na" = "ms_ard(a0 = NA_real_)", +"lj-a0-len2" = "ms_ard(a0 = c(1, 2))", +"lj-a0-str" = "ms_ard(a0 = \"10\")", +"lj-b0-zero" = "ms_ard(b0 = 0)", +"lj-b0-str" = "ms_ard(b0 = \"5\")", +"lj-tol-zero" = "ms_ard(tol = 0)", +"lj-tol-neg" = "ms_ard(tol = -1e-05)", +"lj-tol-inf" = "ms_ard(tol = Inf)", +"lj-tol-str" = "ms_ard(tol = \"1e-5\")", +"lj-mi-zero" = "ms_ard(max_iter = 0)", +"lj-mi-frac" = "ms_ard(max_iter = 1.5)", +"lj-mi-neg" = "ms_ard(max_iter = -3)", +"lj-mi-inf" = "ms_ard(max_iter = Inf)", +"lj-mi-str" = "ms_ard(max_iter = \"2000\")", +"lj-seed-neg" = "ms_ard(seed = -1)", +"lj-seed-frac" = "ms_ard(seed = 1.5)", +"lj-seed-above" = "ms_ard(seed = 2147483648)", +"lj-seed-str" = "ms_ard(seed = \"1\")", +"lj-seed-len2" = "ms_ard(seed = c(1, 2))", +"prec-name-over-mode" = "MsArd(name = \"ARD\", mode = \"transform\")", +"prec-mode-over-params" = paste0("MsArd(mode = \"transform\", params = list(1, k ", + "= 2))"), +"prec-det-over-pkgs" = paste0("MsArd(deterministic = NA, packages = c(\"rlang", + "\", NA))"), +"prec-pkgs-over-label" = paste0("MsArd(packages = c(\"rlang\", NA), label = NA_c", + "haracter_)"), +"prec-shared-over-ard" = "MsArd(label = NA_character_, a0 = 0)", +"prec-a0-over-b0" = "ms_ard(a0 = 0, b0 = 0)", +"prec-tol-over-mi" = "ms_ard(tol = 0, max_iter = 0)", +"prec-mi-over-seed" = "ms_ard(max_iter = 1.5, seed = -1)", +"maxiter-floor-hi" = "ms_ard(max_iter = 1)", +"maxiter-floor-lo" = "ms_ard(max_iter = 0)", +"seed-floor-hi" = "ms_ard(seed = 0)", +"seed-floor-lo" = "ms_ard(seed = -1)", +"seed-ceiling-hi" = "ms_ard(seed = 2147483647)", +"seed-ceiling-lo" = "ms_ard(seed = 2147483648)", +"tol-floor-hi" = "ms_ard(tol = 1e-300)", +"tol-floor-lo" = "ms_ard(tol = 0)", +"label-empty-hi" = "MsArd(label = \"\")", +"label-empty-lo" = "MsArd(label = NA_character_)", +"mode-domain-hi" = "MsArd(mode = \"fit\")", +"mode-domain-lo" = "MsArd(mode = \"transform\")", +"a0-finite-ceil-hi" = "ms_ard(a0 = 1e308)", +"a0-finite-ceil-lo" = "ms_ard(a0 = Inf)" +) +.CS16_CENSUS <- c("msuiter_error_engine=41", "msuiter_error_internal=2", "s7:character=1", "s7:msuiter::MsArd=15", "simpleError=12") +## <> ## + +## <> (single source: injected byte-identically into +## the law file and the runner; edit /tmp/p6gate/cs16-shared.R and +## re-splice via splice-cs16.R -- never hand-edit in place) +.cs16_describe <- function(e) trimws(gsub("\n", " | ", + paste(as.character(conditionMessage(e)), collapse = " | "), fixed = TRUE)) +.cs16_strip <- function(s) { + for (b in c("ℹ ", "i ")) s <- gsub(b, "", s, fixed = TRUE) + s +} +.cs16_shape <- function(x) { + pn <- names(x@params) + if (is.null(pn)) pn <- character(0L) + paste0( + "name=", x@name, + ";mode=", x@mode, + ";np=", length(x@params), + ";pnames=", paste0(pn, collapse = ","), + ";det=", format(x@deterministic), + ";npkg=", length(x@packages), + ";pkgs=", paste0(x@packages, collapse = ","), + ";label=", x@label, + ";a0=", format(x@a0), + ";b0=", format(x@b0), + ";tol=", format(x@tol), + ";mi=", format(x@max_iter), + ";seed=", format(x@seed), + ";fmt=", format(x)) +} +.cs16_eval1 <- function(txt, tag) { + if (is.na(txt) || !nzchar(txt)) stop(".cs16_eval1: no text for ", tag) + ex <- parse(text = txt) + if (length(ex) != 1L) { + stop(".cs16_eval1: ", tag, " is not a single expression") + } + tryCatch(list(ok = TRUE, v = eval(ex[[1L]])), error = identity) +} +.cs16_verdict <- function(arm, r) { + if (inherits(r, "error")) { + list(arm = arm, mode = "reject", cls = class(r)[1L], + msg = gsub("\t", " ", .cs16_strip(.cs16_describe(r)), fixed = TRUE)) + } else { + rendered <- if (is.character(r)) r else .cs16_shape(r) + list(arm = arm, mode = "accept", cls = paste0("s7:", class(r)[1L]), + msg = gsub("\t", " ", rendered, fixed = TRUE)) + } +} +.cs16_fire <- function(arm) { + r <- .cs16_eval1(.CS16_ARM[[arm]], arm) + .cs16_verdict(arm, if (inherits(r, "error")) r else r$v) +} +.cs16_clean <- function(df) { + ## witness bytes round-trip nameless through read.csv; strip any vapply + ## residue names so identical() compares columns byte-true + for (cnm in names(df)) attr(df[[cnm]], "names") <- NULL + df +} +.cs16_rows <- function(arms) { + vs <- lapply(arms, function(a) .cs16_fire(a)) + .cs16_clean(data.frame(arm = arms, + mode = vapply(vs, function(z) z$mode, character(1L)), + cls = vapply(vs, function(z) z$cls, character(1L)), + msg = vapply(vs, function(z) z$msg, character(1L)), + stringsAsFactors = FALSE)) +} +.cs16_lawrows <- function() .cs16_rows(.CS16_LAW_ARMS) +.cs16_specrows <- function() .cs16_rows(.CS16_SPEC_ARMS) +.cs16_precrows <- function() { + base <- .cs16_rows(.CS16_PREC_ARMS) + base$fires_ok <- unname(vapply(seq_along(base$arm), function(i) { + paste0(grepl(.CS16_PREC_FIRES[i], base$msg[i], fixed = TRUE)) + }, character(1L))) + base$anti_ok <- unname(vapply(seq_along(base$arm), function(i) { + paste0(!grepl(.CS16_PREC_ANTI[i], base$msg[i], fixed = TRUE)) + }, character(1L))) + base +} +.cs16_degenrows <- function() { + vs <- lapply(.CS16_DEGEN_ARMS, function(a) .cs16_fire(a)) + .cs16_clean(data.frame(pair = .CS16_DEGEN_PAIR, side = .CS16_DEGEN_SIDE, + arm = .CS16_DEGEN_ARMS, + mode = vapply(vs, function(z) z$mode, character(1L)), + cls = vapply(vs, function(z) z$cls, character(1L)), + msg = vapply(vs, function(z) z$msg, character(1L)), + stringsAsFactors = FALSE)) +} +.cs16_scalval <- function(k) { + txt <- .CS16_SCAL_REFIRE[[k]] + if (is.null(txt)) return(NA_character_) + res <- .cs16_eval1(txt, k) + if (inherits(res, "error")) { + if (identical(k, "validator-class")) return(paste0(class(res)[1L])) + return(.cs16_strip(.cs16_describe(res))) + } + r <- res$v + if (identical(k, "canonical-shape")) return(.cs16_shape(r)) + paste0(r) +} +.cs16_scalref_keys <- function() names(.CS16_SCAL_REFIRE) +.cs16_plant_text <- function() { + ord <- c(.CS16_LAW_ARMS, .CS16_SPEC_ARMS, .CS16_PREC_ARMS, .CS16_DEGEN_ARMS) + paste0(vapply(ord, function(a) + paste0(a, "=", .CS16_ARM[[a]]), character(1L)), collapse = ";") +} +.cs16_spec_text <- function() paste0(.CS16_SPEC_ARMS, collapse = ";") +## <> (do not hand-edit in place: edit the source and +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## + +## --------------------------------------------------------------------------- +## writers, census and the dual-kernel hash rail +## --------------------------------------------------------------------------- +.wtab <- function(nm, df) { + con <- file(file.path(OUT, nm), open = "wb") + on.exit(close(con)) + write.table(df, con, sep = "\t", quote = FALSE, row.names = FALSE, na = "") + invisible(nm) +} +.census <- function(nm, df, want.rows, key.col = 1L) { + stopif(nrow(df) != want.rows, paste0("census ", nm, ": rows ", nrow(df))) + stopif(any(duplicated(df[[key.col]])), paste0("census ", nm, ": duplicate keys")) + for (cnm in names(df)) { + col <- df[[cnm]] + bad <- !is.character(col) || any(is.na(col)) || any(!nzchar(col)) || + any(grepl("\t", col, fixed = TRUE)) + stopif(bad, paste0("census ", nm, ".", cnm, ": non-character/NA/empty/tab")) + } + invisible(TRUE) +} +.ck <- function(bytes, tag) { + a <- .ms_fit_sha256(bytes) + b <- digest::digest(bytes, algo = "sha256", serialize = FALSE) + stopif(!identical(a, b), paste0("ck: kernel disagreement on ", tag)) + stopif(!grepl("^[0-9a-f]{64}$", a), paste0("ck: hex policy on ", tag)) + stopif(nchar(a) != 64L, paste0("ck: length on ", tag)) + a +} +.file.sha <- function(nm) { + p <- file.path(OUT, nm) + con <- file(p, open = "rb") + on.exit(close(con)) + bytes <- readBin(con, what = raw(), n = file.size(p)) + .ck(bytes, nm) +} + +## --------------------------------------------------------------------------- +## build the five witness tables, rail-checked against the frozen block +## --------------------------------------------------------------------------- +dir.create(OUT, showWarnings = FALSE, recursive = TRUE) + +laws <- .cs16_lawrows() +stopif(!identical(laws$arm, .CS16_LAW_ARMS), "laws: roster drift") +stopif(!identical(laws$mode, rep("reject", 40L)), "laws: a mode drift") +stopif(!identical(laws$cls, .CS16_LAW_CLS), "laws: a class drift") +stopif(!identical(laws$msg, unname(vapply(.CS16_LAW_ARMS, + function(a) .CS16_LAW_CLAUSES[[a]], character(1L)))), "laws: clause byte drift") +.census("laws", laws, 40L) + +specs <- .cs16_specrows() +stopif(!identical(specs$arm, .CS16_SPEC_ARMS), "specs: roster drift") +stopif(!identical(specs$mode, rep("accept", 9L)), "specs: a mode drift") +stopif(!identical(specs$cls, .CS16_SPEC_CLS), "specs: a class drift") +stopif(!identical(specs$msg, unname(vapply(.CS16_SPEC_ARMS, + function(a) .CS16_SPEC_DETAILS[[a]], character(1L)))), "specs: detail byte drift") +.census("specs", specs, 9L) + +prec <- .cs16_precrows() +stopif(!identical(prec$arm, .CS16_PREC_ARMS), "prec: roster drift") +stopif(!identical(prec$mode, rep("reject", 8L)), "prec: a mode drift") +stopif(!identical(prec$cls, .CS16_PREC_CLS), "prec: a class drift") +stopif(!all(prec$fires_ok == "TRUE"), "prec: a fired anchor missing") +stopif(!all(prec$anti_ok == "TRUE"), "prec: an anti anchor present") +for (i in seq_len(8L)) { + stopif(!grepl(.CS16_PREC_FIRES[i], prec$msg[i], fixed = TRUE), + paste0("prec: fire anchor absent in ", .CS16_PREC_ARMS[i])) + stopif(grepl(.CS16_PREC_ANTI[i], prec$msg[i], fixed = TRUE), + paste0("prec: anti anchor present in ", .CS16_PREC_ARMS[i])) +} +.census("prec", prec, 8L) + +degen <- .cs16_degenrows() +stopif(!identical(degen$pair, .CS16_DEGEN_PAIR), "degen: pair drift") +stopif(!identical(degen$side, .CS16_DEGEN_SIDE), "degen: side drift") +stopif(!identical(degen$arm, .CS16_DEGEN_ARMS), "degen: arm drift") +stopif(!identical(degen$mode, .CS16_DEGEN_MODE), "degen: mode drift") +stopif(!identical(degen$cls, .CS16_DEGEN_CLS), "degen: class drift") +stopif(!identical(degen$msg, unname(vapply(.CS16_DEGEN_ARMS, + function(a) .CS16_DEGEN_MSG[[a]], character(1L)))), "degen: msg byte drift") +stopif(!all(degen$mode[degen$side == "hi"] == "accept"), "degen: a hi side rejects") +stopif(!all(degen$mode[degen$side == "lo"] == "reject"), "degen: a lo side accepts") +.census("degen", degen, 14L, key.col = 3L) + +rng1 <- exists(".Random.seed", envir = globalenv(), inherits = TRUE) +scal.vals <- vapply(.CS16_SCAL_KEYS, function(k) { + if (identical(k, "rng-before")) return(format(rng0)) + if (identical(k, "rng-after")) return(format(rng1)) + v <- .cs16_scalval(k) + stopif(is.na(v) || !nzchar(v), paste0("scalars: empty re-fire for ", k)) + stopif(!identical(v, .CS16_SCAL_VALS[[k]]), paste0("scalars: drift for ", k)) + v +}, character(1L)) +scalars <- data.frame(key = .CS16_SCAL_KEYS, value = unname(scal.vals), + stringsAsFactors = FALSE) +stopif(!identical(scalars$value[match("rng-before", .CS16_SCAL_KEYS)], + .CS16_SCAL_VALS[["rng-before"]]), "scalars: rng-before drift") +stopif(!identical(scalars$value[match("rng-after", .CS16_SCAL_KEYS)], + .CS16_SCAL_VALS[["rng-after"]]), "scalars: rng-after drift") +.census("scalars", scalars, 9L) + +## dual-kernel hashes over the frozen corpora (written nowhere, attested) +plant.sha <- .ck(charToRaw(.cs16_plant_text()), "plant-corpus") +spec.sha <- .ck(charToRaw(.cs16_spec_text()), "spec-corpus") + +## --------------------------------------------------------------------------- +## all censuses spoke: commit the five witnesses +## --------------------------------------------------------------------------- +.wtab("cs16_laws.tsv", laws) +.wtab("cs16_specs.tsv", specs) +.wtab("cs16_precedence.tsv", prec) +.wtab("cs16_degenerates.tsv", degen) +.wtab("cs16_scalars.tsv", scalars) + +cat("[attest] at=", format(Sys.time(), "%Y-%m-%dT%H:%M:%OS3Z", tz = "UTC"), + " out=", OUT, "\n", sep = "") +for (nm in c("cs16_laws.tsv", "cs16_specs.tsv", "cs16_precedence.tsv", + "cs16_degenerates.tsv", "cs16_scalars.tsv")) { + cat("[attest] sha256 ", nm, "=", .file.sha(nm), "\n", sep = "") +} +cat("[attest] plant_sha256=", plant.sha, " spec_sha256=", spec.sha, + " files=", length(list.files(OUT, pattern = "^cs16_")), "\n", sep = "") +cat("OVERALL PASS\n") +quit(save = "no", status = 0L) diff --git a/tests/testthat/test-scenario-ard-witness.R b/tests/testthat/test-scenario-ard-witness.R new file mode 100644 index 0000000..c2a71a9 --- /dev/null +++ b/tests/testthat/test-scenario-ard-witness.R @@ -0,0 +1,795 @@ +# test-scenario-ard-witness.R -- the CS-16 ard-witness law units +# (pillar 3). The scenario plants synthetic constructor calls (the D3 law: +# zero COSMIC numeric matrices, zero real-data bytes, zero downloads -- +# ARD/NMF/SBS ride only as FORMAT NAMES) and adjudicates the EXPORTED +# ms_ard() face: the shared engine admission laws (name/mode/params/ +# deterministic/packages/label), the S7 property-gate split against the +# validator, the ARD prior laws (a0/b0 positive-finite, tol positive-finite, +# max_iter positive whole, seed whole in [0, 2^31 - 1]), the third abort +# class the len-2 hyper values reach when the got:/format() bullet +# vectorises, the precedence discriminators with their anti anchors, the +# degenerate boundaries and the acceptance specs. The witness bytes under +# bench/scenarios/out/ (cs16_laws.tsv, cs16_specs.tsv, cs16_precedence.tsv, +# cs16_degenerates.tsv, cs16_scalars.tsv) are the committed verdict: a +# drift in a fired clause, an observed error class, an accepted shape or +# the precedence order reddens here before print. The plants are synthetic +# -- no RNG consumption, no network, no COSMIC bytes; the lane NEVER calls +# the benchmark driver, the declined calibration family, the registry face +# or any validator internal (banned words, grepped over the runner source). +# Framing law: DECISION RECORD only. What the face says on planted truth -- +# the accepted shapes, the abort classes, the fired bullets -- is an +# OBSERVED, COMMITTED record, never a fidelity claim beyond what was +# measured. Cross-platform posture (D11): integer, label, logical, class +# and clause bytes are byte-committed; the face produces no float payload +# columns (hyper values ride to the validator as verdicts, not prints), so +# no float glyph rides any witness. +# The frozen block and the shared code block below are MINTED mechanically +# from the audited probe ledger (gen-frozen.cs16.R / probe-cs16.R); neither +# is ever hand-edited in place. + +.rs_out16 <- function(fname) { + file.path(.ms_root, "bench", "scenarios", "out", fname) +} + +# The committed tables are written quote-free; quote = "" keeps every +# double quote inside the clauses literal on read. +.rs_tsv16 <- function(fname) { + read.csv(.rs_out16(fname), header = TRUE, sep = "\t", + stringsAsFactors = FALSE, na.strings = "", colClasses = "character", + quote = "") +} + +## <> (minted mechanically from the audited ledgers +## 2026-11-23; DO NOT hand-edit: regenerate via gen-frozen.cs16.R) ## +.CS16_LAW_ARMS <- c("lj-name-upper", "lj-name-hyphen", "lj-name-empty", "lj-name-na", "lj-mode-unknown", "lj-params-partial", "lj-params-null", "lj-det-na", "lj-pkgs-na", "lj-pkgs-empty", "lj-label-na", "lj-name-num", "lj-mode-num", "lj-params-vec", "lj-det-string", "lj-pkgs-list", "lj-label-num", "lj-a0-zero", "lj-a0-neg", "lj-a0-inf", "lj-a0-nan", "lj-a0-na", "lj-a0-len2", "lj-a0-str", "lj-b0-zero", "lj-b0-str", "lj-tol-zero", "lj-tol-neg", "lj-tol-inf", "lj-tol-str", "lj-mi-zero", "lj-mi-frac", "lj-mi-neg", "lj-mi-inf", "lj-mi-str", "lj-seed-neg", "lj-seed-frac", "lj-seed-above", "lj-seed-str", "lj-seed-len2") +.CS16_LAW_CLS <- c("msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "simpleError", "simpleError", "simpleError", "simpleError", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_internal", "simpleError", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "simpleError", "msuiter_error_internal") +.CS16_LAW_CLAUSES <- list() +.CS16_LAW_CLAUSES[["lj-name-upper"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: 'ARD' | use e.g. name = \"nm", + "f_kl\"") +.CS16_LAW_CLAUSES[["lj-name-hyphen"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: 'a-b' | use e.g. name = \"nm", + "f_kl\"") +.CS16_LAW_CLAUSES[["lj-name-empty"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: '' | use e.g. name = \"nmf_k", + "l\"") +.CS16_LAW_CLAUSES[["lj-name-na"]] <- paste0("engine name must be a single lower-case snake", + "_case string | engine names are registry keys", + " (D9) | received: 'NA' | use e.g. name = \"nmf", + "_kl\"") +.CS16_LAW_CLAUSES[["lj-mode-unknown"]] <- paste0("engine mode must be one of the known modes | ", + "known modes: extract, fit | received: 'transf", + "orm' | declare whether the engine extracts si", + "gnatures or fits exposures") +.CS16_LAW_CLAUSES[["lj-params-partial"]] <- paste0("engine params must be a (named) list | params", + " carry the hyper-parameters of the spec | rec", + "eived: list | pass hyper-parameters as a name", + "d list") +.CS16_LAW_CLAUSES[["lj-params-null"]] <- paste0(" object properties are invali", + "d: | - @params must be , not ") +.CS16_LAW_CLAUSES[["lj-det-na"]] <- paste0("deterministic must be a single TRUE or FALSE ", + "| determinism is part of the engine contract ", + "(thread invariance) | received: 'NA' | declar", + "e whether the engine is seeded and thread inv", + "ariant") +.CS16_LAW_CLAUSES[["lj-pkgs-na"]] <- paste0("packages must be a character vector of packag", + "e names without NA | required_pkgs() reports ", + "these before an engine runs | received: 'rlan", + "g', 'NA' | list package names, or pass charac", + "ter(0)") +.CS16_LAW_CLAUSES[["lj-pkgs-empty"]] <- paste0("packages must be a character vector of packag", + "e names without NA | required_pkgs() reports ", + "these before an engine runs | received: '' | ", + "list package names, or pass character(0)") +.CS16_LAW_CLAUSES[["lj-label-na"]] <- paste0("label must be a single string (empty allowed)", + " | the label is an optional human-readable en", + "gine name | received: 'NA' | pass a short lab", + "el, or leave it empty") +.CS16_LAW_CLAUSES[["lj-name-num"]] <- paste0(" object properties are invali", + "d: | - @name must be , not ") +.CS16_LAW_CLAUSES[["lj-mode-num"]] <- paste0(" object properties are invali", + "d: | - @mode must be , not ") +.CS16_LAW_CLAUSES[["lj-params-vec"]] <- paste0(" object properties are invali", + "d: | - @params must be , not ") +.CS16_LAW_CLAUSES[["lj-det-string"]] <- paste0(" object properties are invali", + "d: | - @deterministic must be , not ", + "") +.CS16_LAW_CLAUSES[["lj-pkgs-list"]] <- paste0(" object properties are invali", + "d: | - @packages must be , not ") +.CS16_LAW_CLAUSES[["lj-label-num"]] <- paste0(" object properties are invali", + "d: | - @label must be , not ") +.CS16_LAW_CLAUSES[["lj-a0-zero"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `a0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_LAW_CLAUSES[["lj-a0-neg"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": -1 | the ARD prior property `a0` | construc", + "t with ms_ard(a0 = , b0 = ) using positive va", + "lues") +.CS16_LAW_CLAUSES[["lj-a0-inf"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": Inf | the ARD prior property `a0` | constru", + "ct with ms_ard(a0 = , b0 = ) using positive v", + "alues") +.CS16_LAW_CLAUSES[["lj-a0-nan"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": NaN | the ARD prior property `a0` | constru", + "ct with ms_ard(a0 = , b0 = ) using positive v", + "alues") +.CS16_LAW_CLAUSES[["lj-a0-na"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": NA | the ARD prior property `a0` | construc", + "t with ms_ard(a0 = , b0 = ) using positive va", + "lues") +.CS16_LAW_CLAUSES[["lj-a0-len2"]] <- paste0("msuiter_abort: bullet 'i' must be a non-empty", + " string") +.CS16_LAW_CLAUSES[["lj-a0-str"]] <- paste0(" object properties are invali", + "d: | - @a0 must be or , not", + " ") +.CS16_LAW_CLAUSES[["lj-b0-zero"]] <- paste0("`b0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `b0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_LAW_CLAUSES[["lj-b0-str"]] <- paste0(" object properties are invali", + "d: | - @b0 must be or , not", + " ") +.CS16_LAW_CLAUSES[["lj-tol-zero"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: 0 | the ARD convergence-tolerance property", + " `tol` | construct with a finite positive tol", + "erance") +.CS16_LAW_CLAUSES[["lj-tol-neg"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: -1e-05 | the ARD convergence-tolerance pro", + "perty `tol` | construct with a finite positiv", + "e tolerance") +.CS16_LAW_CLAUSES[["lj-tol-inf"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: Inf | the ARD convergence-tolerance proper", + "ty `tol` | construct with a finite positive t", + "olerance") +.CS16_LAW_CLAUSES[["lj-tol-str"]] <- paste0(" object properties are invali", + "d: | - @tol must be or , no", + "t ") +.CS16_LAW_CLAUSES[["lj-mi-zero"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 0 | the ARD iteration-cap propert", + "y `max_iter` | construct with a positive whol", + "e-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-frac"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 1.5 | the ARD iteration-cap prope", + "rty `max_iter` | construct with a positive wh", + "ole-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-neg"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: -3 | the ARD iteration-cap proper", + "ty `max_iter` | construct with a positive who", + "le-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-inf"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: Inf | the ARD iteration-cap prope", + "rty `max_iter` | construct with a positive wh", + "ole-number max_iter") +.CS16_LAW_CLAUSES[["lj-mi-str"]] <- paste0(" object properties are invali", + "d: | - @max_iter must be or , not ") +.CS16_LAW_CLAUSES[["lj-seed-neg"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: -1 | the ARD initializer-seed", + " property `seed` | construct with a whole-num", + "ber seed in range") +.CS16_LAW_CLAUSES[["lj-seed-frac"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: 1.5 | the ARD initializer-see", + "d property `seed` | construct with a whole-nu", + "mber seed in range") +.CS16_LAW_CLAUSES[["lj-seed-above"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: 2147483648 | the ARD initiali", + "zer-seed property `seed` | construct with a w", + "hole-number seed in range") +.CS16_LAW_CLAUSES[["lj-seed-str"]] <- paste0(" object properties are invali", + "d: | - @seed must be or , n", + "ot ") +.CS16_LAW_CLAUSES[["lj-seed-len2"]] <- paste0("msuiter_abort: bullet 'i' must be a non-empty", + " string") +.CS16_SPEC_ARMS <- c("sp-canonical", "sp-ctor-identity", "sp-integer-hyper", "sp-mode-fit-legal", "sp-params-named", "sp-params-unnamed-passes", "sp-label-empty", "sp-override-all", "sp-replay-identity") +.CS16_SPEC_CLS <- c("s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:msuiter::MsArd", "s7:character") +.CS16_SPEC_DETAILS <- list() +.CS16_SPEC_DETAILS[["sp-canonical"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SPEC_DETAILS[["sp-ctor-identity"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SPEC_DETAILS[["sp-integer-hyper"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1;mi=2000;seed=0;fm", + "t= ARD-NMF (SignatureAnalyzer seman", + "tics) (ard) | mode: extract | deterministic") +.CS16_SPEC_DETAILS[["sp-mode-fit-legal"]] <- paste0("name=ard;mode=fit;np=0;pnames=;det=TRUE;npkg=", + "0;pkgs=;label=ARD-NMF (SignatureAnalyzer sema", + "ntics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fm", + "t= ARD-NMF (SignatureAnalyzer seman", + "tics) (ard) | mode: fit | deterministic") +.CS16_SPEC_DETAILS[["sp-params-named"]] <- paste0("name=ard;mode=extract;np=1;pnames=algo;det=TR", + "UE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnaly", + "zer semantics);a0=10;b0=5;tol=1e-05;mi=2000;s", + "eed=1;fmt= ARD-NMF (SignatureAnalyz", + "er semantics) (ard) | mode: extract | determi", + "nistic") +.CS16_SPEC_DETAILS[["sp-params-unnamed-passes"]] <- paste0("name=ard;mode=extract;np=2;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SPEC_DETAILS[["sp-label-empty"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=;a0=10;b0=5;tol=1e-05;mi=20", + "00;seed=1;fmt= ard (ard) | mode: ex", + "tract | deterministic") +.CS16_SPEC_DETAILS[["sp-override-all"]] <- paste0("name=ard_x;mode=fit;np=1;pnames=k;det=FALSE;n", + "pkg=1;pkgs=rlang;label=Custom ARD;a0=2;b0=3;t", + "ol=1e-08;mi=10;seed=0;fmt= Custom A", + "RD (ard_x) | mode: fit | stochastic") +.CS16_SPEC_DETAILS[["sp-replay-identity"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic==name=ard;mode=extract;np=0;pnames=;det=TR", + "UE;npkg=0;pkgs=;label=ARD-NMF (SignatureAnaly", + "zer semantics);a0=10;b0=5;tol=1e-05;mi=2000;s", + "eed=1;fmt= ARD-NMF (SignatureAnalyz", + "er semantics) (ard) | mode: extract | determi", + "nistic") +.CS16_PREC_ARMS <- c("prec-name-over-mode", "prec-mode-over-params", "prec-det-over-pkgs", "prec-pkgs-over-label", "prec-shared-over-ard", "prec-a0-over-b0", "prec-tol-over-mi", "prec-mi-over-seed") +.CS16_PREC_CLS <- c("msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine", "msuiter_error_engine") +.CS16_PREC_FIRES <- c(paste0("engine name must be a single lower-case snake", + "_case string"), "engine mode must be one of the known modes", "deterministic must be a single TRUE or FALSE", paste0("packages must be a character vector of packag", + "e names without NA"), "label must be a single string (empty allowed)", "`a0` must be a single finite number > 0", "`tol` must be a single finite number > 0", paste0("`max_iter` must be a single positive whole nu", + "mber")) +.CS16_PREC_ANTI <- c("engine mode must be", "engine params must be a (named) list", paste0("packages must be a character vector of packag", + "e names without NA"), "label must be a single string (empty allowed)", "must be a single finite number > 0", "`b0` must be", "positive whole number", "whole number in [0") +.CS16_DEGEN_PAIR <- c("maxiter-floor", "maxiter-floor", "seed-floor", "seed-floor", "seed-ceiling", "seed-ceiling", "tol-floor", "tol-floor", "label-empty", "label-empty", "mode-domain", "mode-domain", "a0-finite-ceil", "a0-finite-ceil") +.CS16_DEGEN_SIDE <- c("hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo", "hi", "lo") +.CS16_DEGEN_ARMS <- c("maxiter-floor-hi", "maxiter-floor-lo", "seed-floor-hi", "seed-floor-lo", "seed-ceiling-hi", "seed-ceiling-lo", "tol-floor-hi", "tol-floor-lo", "label-empty-hi", "label-empty-lo", "mode-domain-hi", "mode-domain-lo", "a0-finite-ceil-hi", "a0-finite-ceil-lo") +.CS16_DEGEN_MODE <- c("accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject", "accept", "reject") +.CS16_DEGEN_CLS <- c("s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine", "s7:msuiter::MsArd", "msuiter_error_engine") +.CS16_DEGEN_MSG <- list() +.CS16_DEGEN_MSG[["maxiter-floor-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=1;seed=1;f", + "mt= ARD-NMF (SignatureAnalyzer sema", + "ntics) (ard) | mode: extract | deterministic") +.CS16_DEGEN_MSG[["maxiter-floor-lo"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 0 | the ARD iteration-cap propert", + "y `max_iter` | construct with a positive whol", + "e-number max_iter") +.CS16_DEGEN_MSG[["seed-floor-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "0;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_DEGEN_MSG[["seed-floor-lo"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: -1 | the ARD initializer-seed", + " property `seed` | construct with a whole-num", + "ber seed in range") +.CS16_DEGEN_MSG[["seed-ceiling-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "2147483647;fmt= ARD-NMF (SignatureA", + "nalyzer semantics) (ard) | mode: extract | de", + "terministic") +.CS16_DEGEN_MSG[["seed-ceiling-lo"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: 2147483648 | the ARD initiali", + "zer-seed property `seed` | construct with a w", + "hole-number seed in range") +.CS16_DEGEN_MSG[["tol-floor-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-300;mi=2000;seed", + "=1;fmt= ARD-NMF (SignatureAnalyzer ", + "semantics) (ard) | mode: extract | determinis", + "tic") +.CS16_DEGEN_MSG[["tol-floor-lo"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: 0 | the ARD convergence-tolerance property", + " `tol` | construct with a finite positive tol", + "erance") +.CS16_DEGEN_MSG[["label-empty-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=;a0=10;b0=5;tol=1e-05;mi=20", + "00;seed=1;fmt= ard (ard) | mode: ex", + "tract | deterministic") +.CS16_DEGEN_MSG[["label-empty-lo"]] <- paste0("label must be a single string (empty allowed)", + " | the label is an optional human-readable en", + "gine name | received: 'NA' | pass a short lab", + "el, or leave it empty") +.CS16_DEGEN_MSG[["mode-domain-hi"]] <- paste0("name=ard;mode=fit;np=0;pnames=;det=TRUE;npkg=", + "0;pkgs=;label=ARD-NMF (SignatureAnalyzer sema", + "ntics);a0=10;b0=5;tol=1e-05;mi=2000;seed=1;fm", + "t= ARD-NMF (SignatureAnalyzer seman", + "tics) (ard) | mode: fit | deterministic") +.CS16_DEGEN_MSG[["mode-domain-lo"]] <- paste0("engine mode must be one of the known modes | ", + "known modes: extract, fit | received: 'transf", + "orm' | declare whether the engine extracts si", + "gnatures or fits exposures") +.CS16_DEGEN_MSG[["a0-finite-ceil-hi"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=1e+308;b0=5;tol=1e-05;mi=2000;s", + "eed=1;fmt= ARD-NMF (SignatureAnalyz", + "er semantics) (ard) | mode: extract | determi", + "nistic") +.CS16_DEGEN_MSG[["a0-finite-ceil-lo"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": Inf | the ARD prior property `a0` | constru", + "ct with ms_ard(a0 = , b0 = ) using positive v", + "alues") +.CS16_SCAL_KEYS <- c("validator-class", "clause-a0", "clause-b0", "clause-tol", "clause-mi", "clause-seed", "canonical-shape", "rng-before", "rng-after") +.CS16_SCAL_VALS <- list() +.CS16_SCAL_VALS[["validator-class"]] <- "msuiter_error_engine" +.CS16_SCAL_VALS[["clause-a0"]] <- paste0("`a0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `a0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_SCAL_VALS[["clause-b0"]] <- paste0("`b0` must be a single finite number > 0 | got", + ": 0 | the ARD prior property `b0` | construct", + " with ms_ard(a0 = , b0 = ) using positive val", + "ues") +.CS16_SCAL_VALS[["clause-tol"]] <- paste0("`tol` must be a single finite number > 0 | go", + "t: 0 | the ARD convergence-tolerance property", + " `tol` | construct with a finite positive tol", + "erance") +.CS16_SCAL_VALS[["clause-mi"]] <- paste0("`max_iter` must be a single positive whole nu", + "mber | got: 1.5 | the ARD iteration-cap prope", + "rty `max_iter` | construct with a positive wh", + "ole-number max_iter") +.CS16_SCAL_VALS[["clause-seed"]] <- paste0("`seed` must be a single whole number in [0, 2", + "^31 - 1] | got: -1 | the ARD initializer-seed", + " property `seed` | construct with a whole-num", + "ber seed in range") +.CS16_SCAL_VALS[["canonical-shape"]] <- paste0("name=ard;mode=extract;np=0;pnames=;det=TRUE;n", + "pkg=0;pkgs=;label=ARD-NMF (SignatureAnalyzer ", + "semantics);a0=10;b0=5;tol=1e-05;mi=2000;seed=", + "1;fmt= ARD-NMF (SignatureAnalyzer s", + "emantics) (ard) | mode: extract | determinist", + "ic") +.CS16_SCAL_VALS[["rng-before"]] <- "FALSE" +.CS16_SCAL_VALS[["rng-after"]] <- "FALSE" +.CS16_SCAL_REFIRE <- list( +"clause-a0" = "ms_ard(a0 = 0)", +"clause-b0" = "ms_ard(b0 = 0)", +"clause-tol" = "ms_ard(tol = 0)", +"clause-mi" = "ms_ard(max_iter = 1.5)", +"clause-seed" = "ms_ard(seed = -1)", +"validator-class" = "MsArd(name = \"ARD\")", +"canonical-shape" = "ms_ard()" +) +.CS16_ARM <- list( +"sp-canonical" = "ms_ard()", +"sp-ctor-identity" = "MsArd()", +"sp-integer-hyper" = paste0("ms_ard(a0 = 10, b0 = 5, tol = 1, max_iter = 2", + "000, seed = 0)"), +"sp-mode-fit-legal" = "MsArd(mode = \"fit\")", +"sp-params-named" = "MsArd(params = list(algo = \"kl\"))", +"sp-params-unnamed-passes" = "MsArd(params = list(1, 2))", +"sp-label-empty" = "MsArd(label = \"\")", +"sp-override-all" = paste0("MsArd(name = \"ard_x\", mode = \"fit\", params = ", + "list(k = 1), deterministic = FALSE, packages ", + "= c(\"rlang\"), label = \"Custom ARD\", a0 = 2, b", + "0 = 3, tol = 1e-08, max_iter = 10, seed = 0)"), +"sp-replay-identity" = paste0("paste0(.cs16_shape(ms_ard()), \"==\", .cs16_sha", + "pe(ms_ard()))"), +"lj-name-upper" = "MsArd(name = \"ARD\")", +"lj-name-hyphen" = "MsArd(name = \"a-b\")", +"lj-name-empty" = "MsArd(name = \"\")", +"lj-name-na" = "MsArd(name = NA_character_)", +"lj-mode-unknown" = "MsArd(mode = \"transform\")", +"lj-params-partial" = "MsArd(params = list(1, k = 2))", +"lj-params-null" = "MsArd(params = NULL)", +"lj-det-na" = "MsArd(deterministic = NA)", +"lj-pkgs-na" = "MsArd(packages = c(\"rlang\", NA))", +"lj-pkgs-empty" = "MsArd(packages = \"\")", +"lj-label-na" = "MsArd(label = NA_character_)", +"lj-name-num" = "MsArd(name = 123)", +"lj-mode-num" = "MsArd(mode = 7)", +"lj-params-vec" = "MsArd(params = \"kl\")", +"lj-det-string" = "MsArd(deterministic = \"yes\")", +"lj-pkgs-list" = "MsArd(packages = list())", +"lj-label-num" = "MsArd(label = 5)", +"lj-a0-zero" = "ms_ard(a0 = 0)", +"lj-a0-neg" = "ms_ard(a0 = -1)", +"lj-a0-inf" = "ms_ard(a0 = Inf)", +"lj-a0-nan" = "ms_ard(a0 = NaN)", +"lj-a0-na" = "ms_ard(a0 = NA_real_)", +"lj-a0-len2" = "ms_ard(a0 = c(1, 2))", +"lj-a0-str" = "ms_ard(a0 = \"10\")", +"lj-b0-zero" = "ms_ard(b0 = 0)", +"lj-b0-str" = "ms_ard(b0 = \"5\")", +"lj-tol-zero" = "ms_ard(tol = 0)", +"lj-tol-neg" = "ms_ard(tol = -1e-05)", +"lj-tol-inf" = "ms_ard(tol = Inf)", +"lj-tol-str" = "ms_ard(tol = \"1e-5\")", +"lj-mi-zero" = "ms_ard(max_iter = 0)", +"lj-mi-frac" = "ms_ard(max_iter = 1.5)", +"lj-mi-neg" = "ms_ard(max_iter = -3)", +"lj-mi-inf" = "ms_ard(max_iter = Inf)", +"lj-mi-str" = "ms_ard(max_iter = \"2000\")", +"lj-seed-neg" = "ms_ard(seed = -1)", +"lj-seed-frac" = "ms_ard(seed = 1.5)", +"lj-seed-above" = "ms_ard(seed = 2147483648)", +"lj-seed-str" = "ms_ard(seed = \"1\")", +"lj-seed-len2" = "ms_ard(seed = c(1, 2))", +"prec-name-over-mode" = "MsArd(name = \"ARD\", mode = \"transform\")", +"prec-mode-over-params" = paste0("MsArd(mode = \"transform\", params = list(1, k ", + "= 2))"), +"prec-det-over-pkgs" = paste0("MsArd(deterministic = NA, packages = c(\"rlang", + "\", NA))"), +"prec-pkgs-over-label" = paste0("MsArd(packages = c(\"rlang\", NA), label = NA_c", + "haracter_)"), +"prec-shared-over-ard" = "MsArd(label = NA_character_, a0 = 0)", +"prec-a0-over-b0" = "ms_ard(a0 = 0, b0 = 0)", +"prec-tol-over-mi" = "ms_ard(tol = 0, max_iter = 0)", +"prec-mi-over-seed" = "ms_ard(max_iter = 1.5, seed = -1)", +"maxiter-floor-hi" = "ms_ard(max_iter = 1)", +"maxiter-floor-lo" = "ms_ard(max_iter = 0)", +"seed-floor-hi" = "ms_ard(seed = 0)", +"seed-floor-lo" = "ms_ard(seed = -1)", +"seed-ceiling-hi" = "ms_ard(seed = 2147483647)", +"seed-ceiling-lo" = "ms_ard(seed = 2147483648)", +"tol-floor-hi" = "ms_ard(tol = 1e-300)", +"tol-floor-lo" = "ms_ard(tol = 0)", +"label-empty-hi" = "MsArd(label = \"\")", +"label-empty-lo" = "MsArd(label = NA_character_)", +"mode-domain-hi" = "MsArd(mode = \"fit\")", +"mode-domain-lo" = "MsArd(mode = \"transform\")", +"a0-finite-ceil-hi" = "ms_ard(a0 = 1e308)", +"a0-finite-ceil-lo" = "ms_ard(a0 = Inf)" +) +.CS16_CENSUS <- c("msuiter_error_engine=41", "msuiter_error_internal=2", "s7:character=1", "s7:msuiter::MsArd=15", "simpleError=12") +## <> ## + +## <> (single source: injected byte-identically into +## the law file and the runner; edit /tmp/p6gate/cs16-shared.R and +## re-splice via splice-cs16.R -- never hand-edit in place) +.cs16_describe <- function(e) trimws(gsub("\n", " | ", + paste(as.character(conditionMessage(e)), collapse = " | "), fixed = TRUE)) +.cs16_strip <- function(s) { + for (b in c("ℹ ", "i ")) s <- gsub(b, "", s, fixed = TRUE) + s +} +.cs16_shape <- function(x) { + pn <- names(x@params) + if (is.null(pn)) pn <- character(0L) + paste0( + "name=", x@name, + ";mode=", x@mode, + ";np=", length(x@params), + ";pnames=", paste0(pn, collapse = ","), + ";det=", format(x@deterministic), + ";npkg=", length(x@packages), + ";pkgs=", paste0(x@packages, collapse = ","), + ";label=", x@label, + ";a0=", format(x@a0), + ";b0=", format(x@b0), + ";tol=", format(x@tol), + ";mi=", format(x@max_iter), + ";seed=", format(x@seed), + ";fmt=", format(x)) +} +.cs16_eval1 <- function(txt, tag) { + if (is.na(txt) || !nzchar(txt)) stop(".cs16_eval1: no text for ", tag) + ex <- parse(text = txt) + if (length(ex) != 1L) { + stop(".cs16_eval1: ", tag, " is not a single expression") + } + tryCatch(list(ok = TRUE, v = eval(ex[[1L]])), error = identity) +} +.cs16_verdict <- function(arm, r) { + if (inherits(r, "error")) { + list(arm = arm, mode = "reject", cls = class(r)[1L], + msg = gsub("\t", " ", .cs16_strip(.cs16_describe(r)), fixed = TRUE)) + } else { + rendered <- if (is.character(r)) r else .cs16_shape(r) + list(arm = arm, mode = "accept", cls = paste0("s7:", class(r)[1L]), + msg = gsub("\t", " ", rendered, fixed = TRUE)) + } +} +.cs16_fire <- function(arm) { + r <- .cs16_eval1(.CS16_ARM[[arm]], arm) + .cs16_verdict(arm, if (inherits(r, "error")) r else r$v) +} +.cs16_clean <- function(df) { + ## witness bytes round-trip nameless through read.csv; strip any vapply + ## residue names so identical() compares columns byte-true + for (cnm in names(df)) attr(df[[cnm]], "names") <- NULL + df +} +.cs16_rows <- function(arms) { + vs <- lapply(arms, function(a) .cs16_fire(a)) + .cs16_clean(data.frame(arm = arms, + mode = vapply(vs, function(z) z$mode, character(1L)), + cls = vapply(vs, function(z) z$cls, character(1L)), + msg = vapply(vs, function(z) z$msg, character(1L)), + stringsAsFactors = FALSE)) +} +.cs16_lawrows <- function() .cs16_rows(.CS16_LAW_ARMS) +.cs16_specrows <- function() .cs16_rows(.CS16_SPEC_ARMS) +.cs16_precrows <- function() { + base <- .cs16_rows(.CS16_PREC_ARMS) + base$fires_ok <- unname(vapply(seq_along(base$arm), function(i) { + paste0(grepl(.CS16_PREC_FIRES[i], base$msg[i], fixed = TRUE)) + }, character(1L))) + base$anti_ok <- unname(vapply(seq_along(base$arm), function(i) { + paste0(!grepl(.CS16_PREC_ANTI[i], base$msg[i], fixed = TRUE)) + }, character(1L))) + base +} +.cs16_degenrows <- function() { + vs <- lapply(.CS16_DEGEN_ARMS, function(a) .cs16_fire(a)) + .cs16_clean(data.frame(pair = .CS16_DEGEN_PAIR, side = .CS16_DEGEN_SIDE, + arm = .CS16_DEGEN_ARMS, + mode = vapply(vs, function(z) z$mode, character(1L)), + cls = vapply(vs, function(z) z$cls, character(1L)), + msg = vapply(vs, function(z) z$msg, character(1L)), + stringsAsFactors = FALSE)) +} +.cs16_scalval <- function(k) { + txt <- .CS16_SCAL_REFIRE[[k]] + if (is.null(txt)) return(NA_character_) + res <- .cs16_eval1(txt, k) + if (inherits(res, "error")) { + if (identical(k, "validator-class")) return(paste0(class(res)[1L])) + return(.cs16_strip(.cs16_describe(res))) + } + r <- res$v + if (identical(k, "canonical-shape")) return(.cs16_shape(r)) + paste0(r) +} +.cs16_scalref_keys <- function() names(.CS16_SCAL_REFIRE) +.cs16_plant_text <- function() { + ord <- c(.CS16_LAW_ARMS, .CS16_SPEC_ARMS, .CS16_PREC_ARMS, .CS16_DEGEN_ARMS) + paste0(vapply(ord, function(a) + paste0(a, "=", .CS16_ARM[[a]]), character(1L)), collapse = ";") +} +.cs16_spec_text <- function() paste0(.CS16_SPEC_ARMS, collapse = ";") +## <> (do not hand-edit in place: edit the source and +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## +## re-splice) ## + +# =========================================================================== +# U1 -- rails: the runner exists and speaks the exported face, never an +# internal (banned-word grep over its full source). +# =========================================================================== +test_that("runner speaks the exported-face rails", { + if (is.na(.ms_root)) skip("repository checkout not locatable (R CMD check context)") + runner <- file.path(.ms_root, "bench", "scenarios", "run_ard_witness.R") + expect_true(file.exists(runner)) + src <- paste(readLines(runner, warn = FALSE), collapse = "\n") + for (need in c("--file=", "[attest]", "OVERALL PASS", "ms_ard(", "cs16_", + "commandArgs", "digest::digest", "serialize = FALSE", + "charToRaw", "open = \"wb\"", "na = \"\"", "quote = FALSE", + "row.names = FALSE", "RNG-STATE-RAIL", ".ms_fit_sha256")) { + expect_true(grepl(need, src, fixed = TRUE), info = need) + } + ## The bans govern the hand-written region: the minted frozen block is + ## OBSERVED DATA and legitimately quotes the face's own bytes (the + ## internal-class clause names msuiter_abort and the packages clause + ## cites required_pkgs). Slice the two injected regions out before the + ## absence scan; marker integrity itself is rail-checked here. + lines <- strsplit(src, "\n", fixed = TRUE)[[1L]] + .region <- function(beg, end) { + b <- which(vapply(lines, function(l) grepl(beg, l, fixed = TRUE), logical(1L))) + e <- which(vapply(lines, function(l) grepl(end, l, fixed = TRUE), logical(1L))) + expect_identical(length(b), 1L, info = beg) + expect_identical(length(e), 1L, info = end) + c(b, e) + } + drop <- c(seq(.region("## < 625: the CS-16 scenario row +# (test-scenario-ard-witness.R, 1 s integer weight, 246 expects) joined +# the T0 roster; witness: local run nb=246 failed=0 error=0 warning=0, measured +# manifest sum 625 (generator refusal witnessed at the pre-seal re-mint +# attempt, the verbatim DEFECT line naming 625 against the sealed 624). key value note -t0-measured 624 measured 2026-11-23 (integer manifest seconds, tier T0; 2026-11-23 seal 623 superseded by the CS-15 row) +t0-measured 625 measured 2026-11-23 (integer manifest seconds, tier T0; 2026-11-23 seal 624 superseded by the CS-16 row) t0-ceiling 800 t0-measured + one drift class; re-seal deliberately with a witness diff --git a/tools/ci/shard-manifest.tsv b/tools/ci/shard-manifest.tsv index a89791c..0b136fc 100644 --- a/tools/ci/shard-manifest.tsv +++ b/tools/ci/shard-manifest.tsv @@ -3,78 +3,28 @@ shard file seconds tier 1 test-check-layout-sim-sentry.R 1250 T2 2 test-check-layout-sim-stale.R 1231 T2 3 test-xval-m2-extract.R 948 T1 -4 test-calibrate.R 0 T0 -4 test-capability-matrix-truth.R 0 T0 4 test-catalog-currency.R 1 T0 -4 test-catalog-tally.R 0 T0 -4 test-channels-reference.R 0 T0 -4 test-channels-structure.R 0 T0 -4 test-channels-sync.R 0 T0 -4 test-check-layout-sim-gen.R 0 T0 -4 test-check-layout-sim-sdkroot.R 0 T0 -4 test-classes-benchmark.R 0 T0 -4 test-classes-catalog.R 0 T0 -4 test-classes-engines.R 0 T0 -4 test-classes-fit.R 0 T0 -4 test-classes-refdb.R 0 T0 -4 test-classes-roundtrip.R 0 T0 -4 test-classes-signature.R 0 T0 -4 test-classes-utils.R 0 T0 -4 test-classes-variants.R 0 T0 4 test-docs-get-started.R 7 T0 4 test-docs-scenarios-prose.R 1 T0 -4 test-docs-sync.R 0 T0 -4 test-engines-registry.R 0 T0 -4 test-extend-contract.R 0 T0 -4 test-ffi-probes.R 0 T0 -4 test-ffi-surface-drift.R 0 T0 -4 test-ffi-tally.R 0 T0 4 test-fit-bootstrap.R 3 T0 -4 test-fit.R 0 T0 -4 test-gitignore-hygiene.R 0 T0 -4 test-hrd-reference.R 0 T0 -4 test-hrd-report.R 0 T0 -4 test-io-segments.R 0 T0 -4 test-io-sv.R 0 T0 -4 test-io-variants.R 0 T0 -4 test-islam-xval.R 0 T0 4 test-kernel-bit-identity.R 79 T0 -4 test-kernel-cli.R 0 T0 -4 test-kernel-gate-evidence.R 0 T0 -4 test-kernel-pipeline-batch.R 0 T0 -4 test-kernel-pipeline-parse.R 0 T0 -4 test-kernel-pipeline-status.R 0 T0 -4 test-ms-cluster.R 0 T0 -4 test-ms-convert.R 0 T0 -4 test-ms-exposure-test.R 0 T0 -4 test-ms-simulate.R 0 T0 -4 test-pkgdown-citation.R 0 T0 4 test-pkgdown-coherence.R 1 T0 -4 test-pkgdown-reference-map.R 0 T0 -4 test-r-floor-ops.R 0 T0 4 test-refdb.R 373 T1 -4 test-release-materials.R 0 T0 -4 test-reproduce-link.R 0 T0 -4 test-rng-hygiene.R 0 T0 -4 test-scenario-cluster-witness.R 1 T0 -4 test-scenario-exposure-witness.R 1 T0 -4 test-scenario-hrd-baselines.R 0 T0 -4 test-scenario-reconstruction.R 1 T0 -4 test-scenario-sparse-spec-witness.R 1 T0 +4 test-scenario-calibration-verdict.R 1 T0 +4 test-scenario-downsample.R 1 T0 +4 test-scenario-qc-artifacts.R 1 T0 +4 test-scenario-segments-witness.R 1 T0 +4 test-scenarios-gallery.R 1 T0 4 test-site-deploy-bundle.R 3 T0 -4 test-sitrep.R 0 T0 -4 test-stratify.R 0 T0 -4 test-vendor-gate-law.R 0 T0 4 test-viz-batch2.R 2 T0 -4 test-viz-bootstrap.R 0 T0 4 test-viz-first-batch.R 11 T0 -4 test-viz-kselect.R 0 T0 4 test-xval-sigminer.R 10 T0 5 test-calibrate-real.R 1 T0 5 test-check-layout-sim.R 15 T0 5 test-docs-extending-surface.R 1 T0 5 test-docs-tour-executable.R 10 T0 5 test-extract.R 16 T0 +5 test-hrd-independent.R 0 T0 5 test-kernel-pipeline-farm.R 5 T0 5 test-kernel-trace-shape.R 1 T0 5 test-ms-compare.R 9 T0 @@ -82,29 +32,80 @@ shard file seconds tier 5 test-ms-embed.R 2 T0 5 test-ms-qc-report.R 112 T0 5 test-ms-qc-sentries.R 280 T1 +5 test-scenario-ard-witness.R 1 T0 5 test-scenario-atlas.R 2 T0 -5 test-scenario-calibration-verdict.R 1 T0 -5 test-scenario-downsample.R 1 T0 +5 test-scenario-currency-witness.R 1 T0 5 test-scenario-hrd.R 0 T0 -5 test-scenario-qc-artifacts.R 1 T0 -5 test-scenario-segments-witness.R 1 T0 -5 test-scenarios-gallery.R 1 T0 +5 test-scenario-io-interop-witness.R 1 T0 +5 test-scenario-refdb-witness.R 1 T0 +5 test-scenario-stratify.R 1 T0 6 test-calibrate-plot.R 1 T0 +6 test-calibrate.R 0 T0 +6 test-capability-matrix-truth.R 0 T0 +6 test-catalog-tally.R 0 T0 +6 test-channels-reference.R 0 T0 +6 test-channels-structure.R 0 T0 +6 test-channels-sync.R 0 T0 +6 test-check-layout-sim-gen.R 0 T0 +6 test-check-layout-sim-sdkroot.R 0 T0 6 test-ci-shard-map.R 8 T0 6 test-cjk-census.R 9 T0 +6 test-classes-benchmark.R 0 T0 +6 test-classes-catalog.R 0 T0 +6 test-classes-engines.R 0 T0 +6 test-classes-fit.R 0 T0 +6 test-classes-refdb.R 0 T0 +6 test-classes-roundtrip.R 0 T0 +6 test-classes-signature.R 0 T0 +6 test-classes-utils.R 0 T0 +6 test-classes-variants.R 0 T0 6 test-docs-bridge.R 1 T0 -6 test-hrd-independent.R 0 T0 +6 test-docs-sync.R 0 T0 +6 test-engines-registry.R 0 T0 +6 test-extend-contract.R 0 T0 +6 test-ffi-probes.R 0 T0 +6 test-ffi-surface-drift.R 0 T0 +6 test-ffi-tally.R 0 T0 +6 test-fit.R 0 T0 +6 test-gitignore-hygiene.R 0 T0 +6 test-hrd-reference.R 0 T0 +6 test-hrd-report.R 0 T0 +6 test-io-segments.R 0 T0 +6 test-io-sv.R 0 T0 +6 test-io-variants.R 0 T0 +6 test-islam-xval.R 0 T0 6 test-kernel-attest-route.R 1 T0 6 test-kernel-batch-bridge.R 172 T0 +6 test-kernel-cli.R 0 T0 +6 test-kernel-gate-evidence.R 0 T0 +6 test-kernel-pipeline-batch.R 0 T0 +6 test-kernel-pipeline-parse.R 0 T0 +6 test-kernel-pipeline-status.R 0 T0 6 test-kselect.R 28 T0 6 test-m2-e2e.R 2 T0 6 test-ms-benchmark-driver.R 208 T1 +6 test-ms-cluster.R 0 T0 6 test-ms-compare-boundary.R 2 T0 +6 test-ms-convert.R 0 T0 +6 test-ms-exposure-test.R 0 T0 +6 test-ms-simulate.R 0 T0 6 test-peer-evidence.R 3 T0 +6 test-pkgdown-citation.R 0 T0 6 test-pkgdown-msu-map.R 1 T0 -6 test-scenario-currency-witness.R 1 T0 -6 test-scenario-io-interop-witness.R 1 T0 -6 test-scenario-refdb-witness.R 1 T0 -6 test-scenario-stratify.R 1 T0 +6 test-pkgdown-reference-map.R 0 T0 +6 test-r-floor-ops.R 0 T0 +6 test-release-materials.R 0 T0 +6 test-reproduce-link.R 0 T0 +6 test-rng-hygiene.R 0 T0 +6 test-scenario-cluster-witness.R 1 T0 +6 test-scenario-exposure-witness.R 1 T0 +6 test-scenario-hrd-baselines.R 0 T0 +6 test-scenario-reconstruction.R 1 T0 +6 test-scenario-sparse-spec-witness.R 1 T0 6 test-site-claim-gate.R 42 T0 +6 test-sitrep.R 0 T0 +6 test-stratify.R 0 T0 6 test-treatment-report.R 13 T0 +6 test-vendor-gate-law.R 0 T0 +6 test-viz-bootstrap.R 0 T0 +6 test-viz-kselect.R 0 T0 diff --git a/tools/ci/shard-weights.tsv b/tools/ci/shard-weights.tsv index f94691e..e6047cc 100644 --- a/tools/ci/shard-weights.tsv +++ b/tools/ci/shard-weights.tsv @@ -122,3 +122,4 @@ test-scenario-io-interop-witness.R 1 254 T0 test-scenario-sparse-spec-witness.R 1 323 T0 test-scenario-segments-witness.R 1 1704 T0 test-scenario-refdb-witness.R 1 273 T0 +test-scenario-ard-witness.R 1 246 T0 diff --git a/vignettes/articles/devlog-2026-11-23-p3-cs16-ard-witness.qmd b/vignettes/articles/devlog-2026-11-23-p3-cs16-ard-witness.qmd new file mode 100644 index 0000000..47d4db1 --- /dev/null +++ b/vignettes/articles/devlog-2026-11-23-p3-cs16-ard-witness.qmd @@ -0,0 +1,172 @@ +--- +title: "P3-CS-16 ard-witness: the shipped ARD engine face adjudicated over planted constructor calls" +format: html-vignette +--- + +## Decision record: what the engine face promises, and what its receipts look like + +::: {.callout .callout-note} +**Decision.** CS-16 is a witness, not a specification: it freezes what the +exported `ms_ard()` factory and the `MsArd` constructor actually +adjudicate over planted calls, so future drift speaks immediately. It +commits only machine-stable facts: the error CLASS always, and the message +CLAUSES verbatim -- every one of them. The face is pure R with no path, +clock, RNG or locale in its output, so the ledger was DET-proved +byte-stable across probe reruns and no arm needed the `stable3` +bullet-subset posture that CS-13/CS-14 required for their file paths. +::: + +### The face + +`ms_ard(a0, b0, tol, max_iter, seed)` is the exported constructor of the +ARD-NMF engine descriptor: an S7 class (eleven ALL-defaulted properties, +`label` speaking "ARD-NMF (SignatureAnalyzer semantics)") behind TWO +admission gates -- the S7 property gates and the validators (the shared +engine validator, then `msuiter_validate_ard`). CS-16 fires 57 observation +arms at it plus seven boundary pairs: 40 law arms, 9 acceptance specs, +8 precedence discriminators, 7 degenerate pairs (14 rows), 9 scalars. The +committed lane replays every arm live: the law file adjudicates 246 +expectations across 10 units (0 failed, 0 errors, 0 warnings) and the +runner rails every row against the frozen block before any witness byte +is written. + +### The double gate -- measured, and its surprise third voice + +The property gates and the validator split is committed as measured: of +the 40 law arms, 12 die as `simpleError` at the property gates (" +is not or " for the five numeric hyper-properties, +"@params must be ", "@deterministic must be "), 26 speak +the validator's own `msuiter_error_engine`, and TWO arms uncovered a +third voice: a length-2 vector for `a0` or `seed` passes the property +gate (numeric vector), reaches the validator's whole-number clause -- and +dies inside the abort machinery itself as `msuiter_error_internal`: +"msuiter_abort: bullet 'i' must be a non-empty string", because the +got:/format(v) bullet vectorises with the two-element value. The face +still refuses the input; it refuses it from the plumbing, and the witness +records that too rather than laundering it. + +### The laws the face demonstrates + +- **Shared engine laws.** The name must be a single lower-case snake_case + string; the mode is one of {extract, fit}; `params` must be a list -- + and MEASURED, the "(named)" in the clause is permissive: a fully + unnamed list passes (the `names()` short-circuit), a PARTIALLY named + one is refused. `deterministic` is a bare TRUE/FALSE; `packages` a + character vector without NA and no empty names; `label` a single + string, empty allowed. +- **The ARD priors.** `a0`/`b0` must be single finite numbers > 0 (zero, + negative, Inf, NaN, NA each refused with the got:/value bullet); `tol` + the same positive-finite law -- closing at exactly the kernel's domain, + so an R-side pass can never hand the Rust kernel an illegal tolerance; + `max_iter` a single positive WHOLE number; `seed` a whole number in + [0, 2^31 - 1], the boundary pair committing both ends (0 and + 2147483647 accepted, -1 and 2147483648 refused). +- **Precedence.** Eight discriminators with fires AND anti anchors: + name before mode, mode before params, deterministic before packages, + packages before label (the shared roster, and a defective object whose + SHARED fields are wrong proves the shared validator runs over the ARD + fields), then a0 before b0, tol before max_iter, max_iter before seed. +- **The format contract.** The accepted rendering is the format method's + own line, ` ARD-NMF (SignatureAnalyzer semantics) (ard) | + mode: extract | deterministic ...`, carried verbatim in the specs + witness; the replay-identity spec welds two renders of one object with + `==`. + +### The receipts + +| receipt | committed bytes | +|---|---| +| `cs16_specs.tsv` | 9 accepted arms: class token `s7:msuiter::MsArd` plus the shape rendering (roster, hyper values, format line), and the `s7:character` replay identity | +| `cs16_laws.tsv` | 40 arms: class census MEASURED 26 validator + 12 property-gate + 2 internal-plumbing, every clause verbatim, every mode `reject` | +| `cs16_precedence.tsv` | 8 discriminators, each with its fires anchor PRESENT and its anti anchor ABSENT in the live message | +| `cs16_degenerates.tsv` | 7 boundary pairs (14 rows): max_iter floor, seed floor and ceiling, tol floor, empty label, mode domain, finite a0 ceiling -- hi accepts, lo rejects, by the committed law | +| `cs16_scalars.tsv` | 9 keys: the validator's own class token, five clause re-fires, the canonical shape, and both RNG-purity rails (the adjudication core never seeds) | + +The 71-row class census (41 engine, 12 simpleError, 2 internal, 15 +MsArd, 1 character) is recomputed from the frozen vectors inside the law +file -- a silent class shift reddens the lane, not the reader. All five +witnesses byte-reproduce on consecutive runner invocations, the plant and +spec corpora hash identically under BOTH governed SHA-256 kernels +(`.ms_fit_sha256` and digest), and the lane never touches the RNG, the +network, the benchmark driver, the declined calibration family, the +registry face, or any unexported internal (banned-word rails over the +hand-written region, marker-scoped and grepped). + +### What the lane-building itself caught (the honest section) + +The live replay is not decoration -- it killed an entire defect family +before one witness byte was trusted. (1) The minter's thunk-body +extractor took the LAST slot of a parsed function literal; on this base +that slot is an extra NULL, so all 57 arm texts minted as the string +"NULL" -- and both existing self-checks passed VACUOUSLY (parse("NULL") +is one expression; the double-mint determinism only proved the garbage +was stable). The live-replay mirror caught it as an arm rejecting with +`@params` on NULL. The extractor now pins slot [[3]] by measurement and +every arm text must speak a face token to mint. (2) The fire wrapper +projected `$v` off a tryCatch result that had taken the ERROR branch -- +a condition object has no `$v`, so rejects were silently demoted to +accepts-of-NULL; fixed by branching on `inherits(., "error")` first. +(3) The fires-anchor derivation ran `regexpr` over a VECTOR and pulled +`attr(., "match.start")`, which is NULL there, feeding +`ifelse(logical(0), .)` -- the whole 8-entry anchor vector evaporated to +`character(0)` and emit minted an empty roster silently; the runner's own +fire-check died on the invalid pattern, and the minter now asserts each +fires anchor is a substring of its own message. (4) Three fork-semantics +rails fell over loudly instead of quietly: `vapply` refuses +logical-to-character coercion (the fires/anti columns are minted as +"TRUE"/"FALSE" strings at source), `vapply`'s names attribute made +`identical()` reddle against the nameless witness columns (row builders +now strip), and `grepl` takes only pattern element one of a vector +pattern (face-token guards speak three explicit tests). (5) The +banned-word rails initially hit the face's OWN quoted bytes inside the +frozen block (the internal clause names msuiter_abort; the packages +clause cites required_pkgs()) -- rails govern the hand-written region; +the minted regions are observed data, sliced out before the absence +scan, with marker integrity itself rail-checked. (6) The governance-file +surgery caught its own tooling twice: a sub() backreference landed a raw +0x01 control byte into the sealed row, and the line-multiset guard +refused two successive editor bugs of mine before letting the file +settle. The T0 seal moved 624 -> 625 with the generator's refusal +witnessed verbatim (the DEFECT line naming 625 against the sealed 624) +before the deliberate re-seal, per the budget law; the reified manifest +carries 109 files, the new law file on shard 5, byte-deterministic on +re-mint. + +### Provenance + +The frozen block and the shared code block in both hosts are minted +mechanically from the audited probe ledger (audit green: 57 arms, 14 +degen rows, 9 scalars, 8/8 anti anchors); neither is ever hand-edited in +place. The plants' canonical texts hash to the committed dual-kernel +checksum; reifying the lane reproduces every witness byte for byte. +Differentiation from CS-12 (the engine-spec factory): CS-12 adjudicated +the SPEC-CONSTRUCTION factory surface; CS-16 adjudicates the descriptor +CLASS itself -- its property gates, its validator chain and the +abort-plumbing class beneath both. + +### Gate forensics -- one self-caught leg defect and one exempted NOTE + +The first full local burn reddened inside the vignette build: the new +scenarios leg reached for two precedence-witness columns that the committed +TSV never carried (`fires_anchor`/`anti_anchor` live only in the frozen +roster, and the vignette cannot source it -- self-containedness law). On this +base a missing data.frame column reads NULL and surfaced at the call site as +an invalid `pattern` argument. The fix re-expresses the precedence +adjudication over committed bytes only -- witness-row equality +(`identical(pr$msg, sh)`) plus literals read off the table dump -- and both +the standalone render and a direct chunk evaluation print all seven +adjudications TRUE before the gate was re-ignited. The parse-only pre-check +passed while render caught it: the pre-ignition render gate is mandatory +procedure, not the full burn's job. + +The second burn completed clean (exit 0) but its Status carried a second +NOTE: `checking for future file timestamps ... unable to verify current +time`. Forensics located the carrier (`tools:::.check_packages`): the probe +verifies mtimes against an EXTERNAL clock fetched over HTTP from +worldclockapi.com, which currently answers empty on both endpoints, so the +probe self-declares inability. It reproduced identically across two full +burns while the same posture said OK earlier the same day -- the external +service changed state, not the tree -- and every CS-16 mtime is proven +strictly past. The sealed baseline stays the frozen 2W/1N; the NOTE receives +a documented environmental exemption, evidence-anchored, reported not +suppressed: a probe that admits it could not verify never becomes a green. diff --git a/vignettes/articles/paper-draft.qmd b/vignettes/articles/paper-draft.qmd index 269c65a..c1d8bfc 100644 --- a/vignettes/articles/paper-draft.qmd +++ b/vignettes/articles/paper-draft.qmd @@ -574,6 +574,26 @@ contract behavior on planted truth -- no extraction, benchmark or reference-content claim. Zero new machinery. Authority: vignettes/articles/devlog-2026-11-23-p3-cs15-refdb-witness.qmd. +- **CS-16 ard-witness, decision record** (`bench/scenarios/run_ard_witness.R`): +the exported ARD engine descriptor `ms_ard()`/`MsArd` -- the eleven-default +S7 class behind the shipped fit -- adjudicated over planted constructor +calls. The double-gate split is committed as measured (12 property-gate +arms die as `simpleError` before any validator runs; 26 speak the +validator's `msuiter_error_engine`), and the lane uncovered a THIRD voice +it committed rather than laundered: length-2 hyper values pass the gates, +reach the validator, and die inside the abort plumbing itself as +`msuiter_error_internal` (the got:/format() bullet vectorises); the +"(named)" params clause is MEASURED permissive (fully unnamed lists pass +via the names() short-circuit, partially named ones are refused); the +seed domain is welded at both ends (0 and 2147483647 accepted, -1 and +2147483648 refused); eight precedence discriminators each pinned +fires-anchor-present/anti-anchor-absent; seven degenerate boundary pairs +(246 expectations across 10 units, rerun byte-identical 5/5, zero +failures/errors/warnings). Decision-record posture: the descriptor's +contract behavior on planted truth -- no extraction, benchmark or +kernel-execution claim. Zero new machinery. Authority: +vignettes/articles/devlog-2026-11-23-p3-cs16-ard-witness.qmd. + [FILLED — three-in-one selection] Of the three editor-offered paths that turn the case studies from decorative to forceful (vignettes/articles/review-05-nature-editor.qmd §5: (a) a treatment-history cohort with real treatment-record concordance; (b) an @@ -777,7 +797,7 @@ the reference database reaches users through the governed mirror path only | Fig. 2 | Architecture block diagram (two-tier core, FFI shell, kernel CLI boundary) | to be drawn from vignettes/articles/architecture.qmd §2 by the controller's illustrator; DRY law: no new claims | | Fig. 3 | Table 1 as a visual verdict board (MEASURED-false rows shown as such) | data FILLED §3.3 | | Fig. 4 | O5 census heat strip (8 faces x 21 classes = 168 cells, color=cpu-ratio) | data FILLED §3.3 Table 2 (log banked) | -| Fig. 5 | Scenario adjudication panels (CS-1 atlas, CS-2 dual-oracle, CS-3 treatment, CS-4 artifact forensics, CS-5 stratification decision, CS-6 downsample frontier, CS-7 reconstruction witness, CS-8 cluster witness, CS-9 currency witness, CS-10 exposure witness, CS-11 calibration witness, CS-12 sparse-spec witness, CS-13 io-interop witness, CS-14 segments-witness, CS-15 refdb-witness) | data FILLED §3.4, outputs bench/scenarios/out/* | +| Fig. 5 | Scenario adjudication panels (CS-1 atlas, CS-2 dual-oracle, CS-3 treatment, CS-4 artifact forensics, CS-5 stratification decision, CS-6 downsample frontier, CS-7 reconstruction witness, CS-8 cluster witness, CS-9 currency witness, CS-10 exposure witness, CS-11 calibration witness, CS-12 sparse-spec witness, CS-13 io-interop witness, CS-14 segments-witness, CS-15 refdb-witness, CS-16 ard-witness) | data FILLED §3.4, outputs bench/scenarios/out/* | | Suppl. | Calibration curves 198-cell; reproduction protocol; law-family inventories | committed faces cited §4.5, §3.5 | ## 9. Bibliography diff --git a/vignettes/docs-bridge.Rmd b/vignettes/docs-bridge.Rmd index afc4bc6..9e13a02 100644 --- a/vignettes/docs-bridge.Rmd +++ b/vignettes/docs-bridge.Rmd @@ -166,3 +166,4 @@ guides), start at [Get started](get-started.html) and the [tour](tour.html). | [CS-13 io-interop-witness — the shipped import/export face adjudicated over planted TSV plants: the WTSI deferral clause, the reader-coercion law split, the locked provenance pair, and the 17-significant-digit round-trip drill (reified, paper-grade)](devlog-2026-11-22-p3-cs13-io-interop-witness.html) | `devlog-2026-11-22-p3-cs13-io-interop-witness` | | [CS-14 segments-witness — the shipped segment face adjudicated over planted TSV bytes: the caller-routed column law, the declared-role law, the mutation_type legality law, the Battenberg block law, the Sequenza sum law, and four precedence discriminators (reified, paper-grade)](devlog-2026-11-23-p3-cs14-segments-witness.html) | `devlog-2026-11-23-p3-cs14-segments-witness` | | [CS-15 refdb-witness — the shipped reference-container factory adjudicated over planted R objects: the label-key law, the FFI no-NA ban, the first-matrix channel authority, the A13 cross-field clause, the lowercase-only digest policy, and four precedence discriminators (reified, paper-grade)](devlog-2026-11-23-p3-cs15-refdb-witness.html) | `devlog-2026-11-23-p3-cs15-refdb-witness` | +| [CS-16 ard-witness — the shipped ARD engine descriptor adjudicated over planted constructor calls: the double-gate split as measured, the discovered abort-plumbing class, the (named)-params permissiveness, the welded seed domain, and eight precedence discriminators (reified, paper-grade)](devlog-2026-11-23-p3-cs16-ard-witness.html) | `devlog-2026-11-23-p3-cs16-ard-witness` | diff --git a/vignettes/scenarios.Rmd b/vignettes/scenarios.Rmd index 84a7d93..6cb4f9c 100644 --- a/vignettes/scenarios.Rmd +++ b/vignettes/scenarios.Rmd @@ -43,14 +43,15 @@ knitr::opts_chunk$set(collapse = TRUE, comment = "#>") msuiter's paper pillar 3 is the application-scenario layer: end-to-end workflows that adjudicate against planted truth or an independent oracle and -persist their evidence tables. The fifteen executable drivers live under +persist their evidence tables. The sixteen executable drivers live under `bench/scenarios/` (`run_atlas.R`, `run_hrd.R`, `run_treatment.R`, `run_qc_artifacts.R`, `run_stratify.R`, `run_downsample.R`, `run_reconstruction.R`, `run_cluster_witness.R`, `run_currency_witness.R`, `run_exposure_witness.R`, `run_calibration_verdict.R`, `run_sparse_spec_witness.R`, `run_io_interop_witness.R`, `run_segments_witness.R`, -`run_refdb_witness.R`; committed +`run_refdb_witness.R`, +`run_ard_witness.R`; committed evidence under `bench/scenarios/out/`, each driver ends in its own OVERALL PASS or OVERALL FAIL verdict line). This page runs one reduced, runnable snippet of each against the same committed fixture generators the @@ -919,6 +920,76 @@ contract on the exported surface and the declined-scope rails -- are the manual pages (`?ms_refdb`) and the scenario devlog under `vignettes/articles/devlog-*-p3-cs15-*.qmd`. +## The ARD engine descriptor as a governed witness + +The fifteenth scenario adjudicates the EXPORTED `ms_ard()` face -- the +descriptor of the ARD-NMF engine behind the shipped fit -- over synthetic +constructor plants: the shared engine laws (the snake_case name, the mode +domain, the MEASURED permissiveness of the "(named)" params clause -- a +fully unnamed list passes, a partially named one is refused -- the +deterministic bool, the packages no-NA roster, the empty-legal label), +the ARD priors (a0/b0/tol positive-finite, max_iter a positive whole +number, seed a whole number in [0, 2^31 - 1]), the double-gate split -- +12 property-gate `simpleError` deaths against 26 validator +`msuiter_error_engine` refusals -- plus the third voice the lane uncovered +and committed rather than laundered: length-2 hyper values die inside the +abort plumbing itself as `msuiter_error_internal`. Eight precedence +discriminators with fires-anchor-present/anti-anchor-absent rails and +seven degenerate boundary pairs complete the census. + +```{r ard-witness, message = FALSE} +out <- file.path(PKG, "bench", "scenarios", "out") +if (dir.exists(out)) { + rd <- function(f) read.table(file.path(out, f), header = TRUE, sep = "\t", + quote = "", colClasses = "character", + na.strings = "", stringsAsFactors = FALSE) + lw <- rd("cs16_laws.tsv"); sp <- rd("cs16_specs.tsv") + pc <- rd("cs16_precedence.tsv"); dg <- rd("cs16_degenerates.tsv") + sc <- rd("cs16_scalars.tsv") + sv <- setNames(as.character(sc$value), as.character(sc$key)) + cnt <- tabulate(match(lw$cls, c("msuiter_error_engine", "simpleError", + "msuiter_error_internal"))) + split_ok <- identical(as.integer(cnt), c(26L, 12L, 2L)) && + nrow(lw) == 40L && all(lw$mode == "reject") + roster_ok <- identical(sv[["validator-class"]], "msuiter_error_engine") && + grepl("whole number in [0, 2^31 - 1]", sv[["clause-seed"]], fixed = TRUE) && + grepl("positive whole number", sv[["clause-mi"]], fixed = TRUE) && + grepl("finite number > 0", sv[["clause-a0"]], fixed = TRUE) + pr <- pc[pc$arm == "prec-mi-over-seed", ] + sh <- lw$msg[lw$arm == "lj-mi-frac"] + prec_ok <- nrow(pc) == 8L && all(pc$fires_ok == "TRUE") && + all(pc$anti_ok == "TRUE") && length(sh) == 1L && length(pr$msg) == 1L && + identical(pr$msg, sh) && + grepl("`max_iter` must be", sh, fixed = TRUE) && + !grepl("seed", sh, fixed = TRUE) + dg_ok <- nrow(dg) == 14L && sum(dg$mode == "accept") == 7L && + grepl("seed=2147483647;", + dg$msg[dg$arm == "seed-ceiling-hi"], fixed = TRUE) + canon <- sp$msg[sp$arm == "sp-canonical"] + rep1 <- sp$msg[sp$arm == "sp-replay-identity"] + spec_ok <- nrow(sp) == 9L && length(canon) == 1L && length(rep1) == 1L && + grepl(" ARD-NMF", canon, fixed = TRUE) && + grepl("==", rep1, fixed = TRUE) + rng_ok <- identical(sv[["rng-before"]], "FALSE") && + identical(sv[["rng-after"]], "FALSE") + cat("the 40-law class census splits 26/12/2 between validator, property", + "gates and the discovered abort-plumbing class exactly as committed:", + split_ok, "| the seed, max_iter and a0 clauses speak verbatim:", + roster_ok, "\n") + cat("the precedence row cannot trade clauses under both anchors:", prec_ok, + "| the seven boundary pairs stand (7 accepted, 7 refused):", dg_ok, + "| the canonical rendering and the replay identity hold:", spec_ok, + "| the adjudication core is RNG-free:", rng_ok, "\n") +} +``` + +The committed tables for this leg: `bench/scenarios/out/cs16_specs.tsv`, +`cs16_laws.tsv`, `cs16_precedence.tsv`, `cs16_degenerates.tsv` and +`cs16_scalars.tsv`. The certified backing -- the face's documented +contract on the exported surface and the declined-scope rails -- are the +manual pages (`?ms_ard`) and the scenario devlog under +`vignettes/articles/devlog-*-p3-cs16-*.qmd`. + ## Reproducing the full verdicts Each driver prints its own adjudication lines and exits zero only on @@ -940,4 +1011,5 @@ Rscript bench/scenarios/run_sparse_spec_witness.R Rscript bench/scenarios/run_io_interop_witness.R Rscript bench/scenarios/run_segments_witness.R Rscript bench/scenarios/run_refdb_witness.R +Rscript bench/scenarios/run_ard_witness.R ```