package regionname import "regexp" // HomeRegion is the engine region of the home placement (home-region parks, // part 1, Paul 2026-10-11). The home's placement code is "", and "" already // means unset to the engine and to the claim: an engine, view, chore or // admission with region "" is refused or read as "holds nothing anywhere". // So home is never "" here. It is this token, mapped once from the placement // code by PlacementRegion where a box's or a record's code becomes an engine // region. // // The "@" is outside the placement-code alphabet (provision.ValidRegion: // lowercase a-z, 0-9 and hyphen), so no named region, one named "home" // included, can ever equal it. It reaches the claim's obligation region, its // "region:" owner, its quiet_after key and one control key, the home lane's // staging lease (control/staging-leases/@home/, keyed in the host's // wiring). It never reaches an archive path: the archive is // parked////. const HomeRegion = "@home" // placementCode is a named placement code: provision.ValidRegion without the // empty code. TestHomeRegionIsReserved holds the two together. var placementCode = regexp.MustCompile(`^[a-z0-9-]{1,16}$`) // PlacementRegion is the engine region of a placement code: HomeRegion for // the home's "", a named code unchanged, and "" (unset, which every engine // entry refuses) for anything that is not a placement code, HomeRegion // itself included. func PlacementRegion(code string) string { switch { case code == "": return HomeRegion case placementCode.MatchString(code): return code } return "" } func HomePlacementCode(home, region string) string { if home != "" && region == home { return "" } return region } // SameRegion preserves exact stored identities. The only alias is a verified // home roster name and @home. Empty always means unset at this boundary. func SameRegion(home, a, b string) bool { if a == "" || b == "" { return false } if a == b { return true } return home != "" && PlacementRegion(home) == home && ((a == home && b == HomeRegion) || (a == HomeRegion && b == home)) }