xtask/tests/the_siblings_patch_what_holger_needs.rs
//! **holger-ui patches every monetize crate holger reaches through its sibling patches**
//! (P4c, 2026-10-25). browser-tests links holger and holger's front from the sibling checkout.
//! holger names some open monetize crates by version only (`monetize-estate-side`,
//! `monetize-mail`, absent from crates.io) and reaches them through ITS
//! `.cargo/estate-siblings.toml`; a cargo run here loads holger-ui's patches instead (the estate
//! patches, or browser-tests' own `[patch.crates-io]`), so each of those must be patched here
//! too, or the lock cannot resolve ("no matching package", P4c's monetize-mail, 670f81f).
//! Reads the tree only; without the holger sibling it says so and checks nothing.
use std::path::Path;
/// The open monetize crates holger names by VERSION that are not on crates.io (holger's
/// `xtask/src/lone_clone.rs` publish list): only a sibling patch resolves them.
const UNPUBLISHED: &[&str] = &["monetize-estate-side", "monetize-mail"];
fn patched(text: &str) -> Vec<String> {
text.lines().filter_map(|l| l.split_once('=').map(|(k, _)| k.trim().to_string())).filter(|k| k.starts_with("monetize-")).collect()
}
#[test]
fn every_monetize_crate_holger_patches_is_patched_here_too() {
let root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap();
let Ok(holger) = std::fs::read_to_string(root.join("../holger/.cargo/estate-siblings.toml")) else {
eprintln!("NOT RUN: no ../holger sibling beside holger-ui");
return;
};
let ours = std::fs::read_to_string(root.join(".cargo/estate-siblings.toml")).unwrap() + &std::fs::read_to_string(root.join("browser-tests/Cargo.toml")).unwrap();
let ours = patched(&ours);
let theirs = patched(&holger);
let missing: Vec<String> = UNPUBLISHED.iter().map(|k| k.to_string()).filter(|k| theirs.contains(k) && !ours.contains(k)).collect();
assert!(missing.is_empty(), "holger patches {missing:?} from ../monetize and holger-ui does not: browser-tests cannot resolve holger");
}