Files
orca/cloud/apps
Neil 7e2fb7c922 relay: edge rollout per region and country exclusion (dark) (#41904)
* relay: edge rollout per region, country exclusion per region, region recorded on edge moves

director/edge.json gains regionRolloutPermille (a listed region is in scope at its own share),
regionExcludeCountries and regionExcludeUnknownCountry (checked after host allow, before account
allow and the share, for the requested region only). The leave ceiling must cover every regional
share; mayBeOnEdge's ceiling includes them. All absent: every decision is as before.

The director reads the ask's country from an offline IP table (ORCA_RELAY_IP_COUNTRY_DB, loaded at
boot) by the last X-Forwarded-For hop, keeps only the country, and logs per-minute region x country
counts (orca_relay_edge_region_country). Edge moves record the judged region in
relay_assignment_region_preferences inside their transaction; the evacuation sweep judges that
region when it has its own share, else 'any' (the highest in-scope share). The edge Worker's metric
place adds the country.

* relay: record edge regions only while a regional share is set; sweep judges a recorded region by its effective share

With no regionRolloutPermille key the edge path writes nothing extra and the sweep judges every
host 'any', as before. With one, edge moves record their region and the sweep judges a host with a
recorded region by that region's effective share (its own value, else the global share when
env-scoped, else out of scope); unrecorded hosts stay 'any'.

* relay: edge region record in its own table; dark sweep SQL unchanged; lenient country codes; hex IPv4-mapped lookups

Edge moves record the judged region in relay_edge_host_regions (created at director boot like
relay_edge_fence_pending), always on a move and on a kept host only when the region changed; the
row is deleted when the host is placed off the edge. The sweep reads only that table, and only
while a regional share is set, so a stale cell-path preference never drives drains and the dark
page query is unchanged. The cell-path region preferences are no longer written by the edge path.
Country codes in edge.json are upper-cased before validation, and hex-spelled IPv4-mapped IPv6
addresses are looked up as IPv4.

* relay: braces on every if/for body and T[] array types on the regional edge change (changed-lines lint)
2026-11-13 01:05:19 -08:00
..