Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/monetize

crates/monetize-server/src/estate_order/tests/relay_site_feed.rs

//! ★ **RA5-17 (OX-MONHUNT 2026-10-28): a site's box laid again keeps its site's public
//! repositories.** The guardian's relay (and a plan change that adds machines) built its
//! install request with `site: None`, so a relayed main of holger.rs was fed as a sold estate's
//! box: no `public_repositories`, every repository private, the public registry answering 401.

use super::*;

#[test]
fn a_sites_main_laid_again_is_fed_the_sites_public_repositories() {
    let holger = crate::config::EstateConfig {
        product: "holger".into(),
        vendor: "holdpay".into(),
        site: "holger.rs".into(),
        owner: "ignalina".into(),
        operator_site: true,
        public_repositories: vec!["crates".into(), "npm".into()],
        ..Default::default()
    };
    let rig = site_rig_with_sites("ra5-17-relay", false, cfg(), vec![("holger-rs", holger)]);
    let (state, pay, kit) = (&rig.0, &rig.1, &rig.3);
    kit.bundles.store(true, Ordering::SeqCst);
    let run = site::start_site(
        state,
        "holger-rs",
        "first-admin@mock.invalid",
        &EstateSizes::default(),
    )
    .unwrap();
    pay.authorize(&run.handle.clone().unwrap().id);
    drive(state, "holgerrs");
    assert_eq!(
        state.estates.get("holgerrs").unwrap().phase,
        phase::CAPTURED,
        "{:#?}",
        state.estates.get("holgerrs").unwrap().history
    );
    let at_lay = kit
        .sites
        .lock()
        .unwrap()
        .last()
        .cloned()
        .expect("the lay fed the site");
    assert_eq!(at_lay.public_repositories, ["crates", "npm"]);
    let before = kit.sites.lock().unwrap().len();
    let laid = relay::relay_one(state, "holgerrs", "main");
    assert!(laid.is_ok(), "{laid:?}");
    let sites = kit.sites.lock().unwrap();
    assert_eq!(
        sites.len(),
        before + 1,
        "the relayed main was fed as the site's box, not as a sold estate's"
    );
    let relaid = sites.last().unwrap();
    assert_eq!(
        relaid.public_repositories,
        ["crates", "npm"],
        "its public repositories stay public"
    );
    assert_eq!(relaid.label, "holger-rs");
    assert!(
        relaid.bearer.is_empty(),
        "a relay mints no site bearer: the standing front keeps its own"
    );
}