crates/gunnar-grpc/src/selling.rs
//! **Does this estate SELL room?** (2026-10-08, the free-room leak's last window.)
//!
//! A metered gunnar reads "no fact" as Free and UNCAPPED — right for a SOLD private estate
//! (its customer never sees a cap) and for the open build. At a SELLING shop (gunnar.rs,
//! test2) monetize gives every person's account a fact within a poll; until it lands, the
//! account would be uncapped. There the rule FAILS CLOSED: a person's own account with no
//! fact has NO room (no push, no employee) until the fact arrives. The seller's own
//! namespaces (their owner holds a server grant), groups, clans and machines keep today's
//! rule, and so does every estate the installer does not feed `sells_room = true`.
//!
//! The flag is ONE `Arc<AtomicBool>` per process (gunnar-server `serve`): the entitlement
//! slot's push gate and `ServiceContext::sells_room` read the same one, set LIVE from the feed.
/// Pure: **does an account with this standing hold NO room** (rather than be uncapped)? Only
/// at a selling estate, only with no fact, only a PERSON's own account, never the seller's.
pub fn no_room_yet(sells_room: bool, has_fact: bool, person: bool, seller: bool) -> bool {
sells_room && !has_fact && person && !seller
}
/// The words a push or an enrolment is refused with while the account's fact is on its way.
pub const NO_ROOM_YET: &str = "no room yet: the account's room is being set up at the shop (a minute at most) — try again shortly, or add room at the shop";
#[cfg(test)]
mod tests {
use super::*;
/// ★ **Only a person's account with no fact, at a SELLING estate, holds no room**; a sold
/// estate (or the open build: nothing fed), the seller's own, a group or a machine, and an
/// account that holds a fact keep today's rule.
#[test]
fn only_a_persons_account_with_no_fact_at_a_selling_estate_holds_no_room() {
assert!(no_room_yet(true, false, true, false));
assert!(
!no_room_yet(false, false, true, false),
"a sold estate / the open build: no fact is uncapped, as today"
);
assert!(!no_room_yet(true, true, true, false), "a fact rules");
assert!(
!no_room_yet(true, false, false, false),
"a group, a clan, a machine"
);
assert!(!no_room_yet(true, false, true, true), "the seller's own");
}
}