package console import ( "context" "sort" ) // instanceChoices lists, under their names, the regions an EXPLICIT // request for this same socket-backed instance would pass right now (codex // plan-R4 2): the manifest's allow-list as the door reads it (each code // normalized through homeRegionIn first), the armed gate's reachable and // hosting bars, and R9's refusal. These are the explicit door's rules, not // automatic eligibility. except, the region just refused, is left out. // // The home joins the list only when CONSOLE_HOME_REGION names it: an // unnamed home has no name a caller could pass. The bars are // explicitGate.refusal, the same predicate the app-region doors use, so no // door lists a region another would refuse. func (s *Server) instanceChoices(ctx context.Context, allowed []string, cands []regionCandidate, except string) []string { g := explicitGate{cands: cands} g.caps, g.published = placements(ctx, s.cfg.Releases) codes := map[string]bool{} if s.cfg.HomeRegion != "" { codes[""] = true } for c := range g.caps { if code := s.homeRegionIn(c); code != "" { codes[code] = true } } for _, c := range allowed { if code := s.homeRegionIn(c); code != "" { codes[code] = true } } var out []string for code := range codes { if code == except || !instanceRegionAllowed(allowed, code) || g.refusal(code) != "" { continue } out = append(out, s.homeRegionOut(code)) } sort.Strings(out) return out }