crates/gunnar-recipe/tests/one_monetize_front.rs
//! **The metered front medium carries gunnar's OWN front, built `metered`** (owner 13:35Z
//! 2026-10-10, ONE monetize): no estate runs a monetize, so the paid front is the console's
//! paid half and nothing more — no shop, no `Linked::commercial()`, no build from
//! monetize-impl. The 2026-10-08 commercial front (`gunnar-front-commercial`) is LEGACY.
use gunnar_recipe::GunnarBuildThing;
use nornir_build_thing::plugin::BuildThing as _;
#[test]
fn the_metered_front_medium_is_gunnars_own_front_built_metered() {
let set = GunnarBuildThing.variants();
let payload = |installer: &str| {
let i = set
.installers
.iter()
.find(|i| i.name == installer)
.unwrap_or_else(|| panic!("no installer {installer}"));
set.variants
.iter()
.find(|v| v.name == i.variant)
.unwrap_or_else(|| panic!("{installer}: no payload row {}", i.variant))
.clone()
};
let metered = payload("gunnar-front-installer-metered");
assert_eq!(
(
metered.package.as_deref(),
metered.bin.as_deref(),
metered.manifest_dir.as_deref()
),
(
Some("gunnar-front"),
Some("gunnar-front"),
Some("crates/gunnar-front")
),
"{metered:?}"
);
assert!(
metered.no_default_features
&& metered.features
== [
"dhcp-client",
"metered",
"public-site",
"forges",
"clock-fetch",
"resolver-probe",
"acme",
"egress-door",
"mail",
"sso"
],
"{:?}",
metered.features
);
assert!(
metered.siblings.is_empty(),
"a row of this workspace takes the toolchain's siblings: {:?}",
metered.siblings
);
let narrate = set
.variants
.iter()
.find(|v| v.name == "gunnar-front-metered-narrate")
.expect("the dev row");
assert_eq!(
(narrate.package.as_deref(), narrate.manifest_dir.as_deref()),
(Some("gunnar-front"), Some("crates/gunnar-front")),
"the dev medium is the same program"
);
assert_eq!(
narrate.features,
[
"dhcp-client",
"metered",
"public-site",
"forges",
"clock-fetch",
"resolver-probe",
"acme",
"egress-door",
"mail",
"sso",
"dev-narrate"
]
);
let open = payload("gunnar-front-installer-open");
assert_eq!(
(open.package.as_deref(), open.manifest_dir.as_deref()),
(Some("gunnar-front"), Some("crates/gunnar-front"))
);
for v in &set.variants {
assert!(
!v.manifest_dir
.as_deref()
.unwrap_or("")
.contains("monetize-impl"),
"{}: no gunnar row builds from monetize-impl",
v.name
);
assert!(
!v.siblings.iter().any(|s| s == "monetize-impl"),
"{}: no gunnar row loads monetize-impl",
v.name
);
}
}
/// ★ **The open/metered rule, explicit** (owner 2026-10-11): the OPEN front carries no money
/// code (no `metered` feature: no selling console); the METERED front sells through the ONE
/// box only — `gunnar-front` links no monetize-server, shop or monetize-impl outside its tests.
#[test]
fn the_open_front_has_no_money_code_and_the_metered_front_sells_only_through_the_one_box() {
let set = GunnarBuildThing.variants();
let payload = |installer: &str| {
let i = set
.installers
.iter()
.find(|i| i.name == installer)
.unwrap_or_else(|| panic!("no installer {installer}"));
set.variants
.iter()
.find(|v| v.name == i.variant)
.unwrap_or_else(|| panic!("{installer}: no payload row {}", i.variant))
.clone()
};
let open = payload("gunnar-front-installer-open");
assert!(
!open.features.iter().any(|f| f.contains("metered")),
"the open front sells nothing: {:?}",
open.features
);
assert!(payload("gunnar-front-installer-metered")
.features
.iter()
.any(|f| f == "metered"));
let manifest = std::fs::read_to_string(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../gunnar-front/Cargo.toml"
))
.expect("gunnar-front's manifest");
let shipped = manifest
.split("[dev-dependencies]")
.next()
.unwrap_or_default();
for embedded in ["monetize-server", "monetize-shop-pairing", "monetize-impl"] {
assert!(
!shipped.lines().filter(|l| !l.trim_start().starts_with('#')).any(|l| l.contains(embedded)),
"gunnar-front ships {embedded}: a metered front sells through the ONE box, it embeds no monetize"
);
}
}