feat(admin): session windows in SQL, opened from the admin portal (schema 62)
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m33s
Foundation / postgres-tools (push) Successful in 2m14s
Foundation / server-image (push) Successful in 5m21s
Foundation / image (push) Successful in 6m18s

The dev session window moves from Git to SQL (ADR-0087 amendment): the admin
portal opens, extends (30 min to 4 h from now) and closes it, and the cellular
region re-reads it every 5 s with --session-window-source db. No push, sync or
restart per window; a closed window keeps the region running instead of
crash-looping.

- Schema 62: append-only session_windows (4 h cap, no rewrites),
  load_session_window_v1 for the runtime group, admin_set_session_window_v1
  and admin_session_windows_v1 for a dedicated admin group role, granted and
  audited each migration run when EVO_PG_ADMIN_ROLE is set (aevolution_admin in
  DEV). Schema 61's views are revoked from the runtime group.
- RegionSessions admission switch: while closed every Hello is refused before
  signature work and closing closes open sessions (new sessions were still
  admitted after expiry before).
- Admin API: GET/POST /api/regions/<n>/session-window, window state in the
  regions list; the portal's session-window card with history.
- Git: REGION_SESSION_WINDOW and the pre-push refresh rule are removed; the
  policy check requires the database source and refuses a committed window.

Needs the new image and the aevolution_admin role (with the portal's login in
aevolution-admin-pg) before a sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-27 15:13:02 -04:00
co-authored by Claude Opus 5.5
parent 510ecaee80
commit 46c106409e
31 changed files with 807 additions and 93 deletions
+8 -18
View File
@@ -44,8 +44,9 @@ import re
# restart after expiry, delayed application, extend/close races, clock movement,
# synthetic inputs stopping while commits drain). The runtime contract and focused
# expiry tests are now implemented in the M10 QUIC
# bridge. The route remains constrained to the dev overlay and a committed absolute
# window; delayed application fails closed in the server.
# bridge. The route remains constrained to the dev overlay. Since the ADR-0087 amendment of
# 2026-10-27 the window lives in SQL (evolution.session_windows, set from the admin portal)
# and the region re-reads it; Git carries no window.
ROUTE_ENABLING_PERMITTED = True
# Addresses the route may use: RFC 1918 plus internal ranges the maintainer has
# explicitly approved in ADR-0087 (none yet; the cluster LAN 172.10.0.0/16 is not
@@ -703,22 +704,11 @@ for overlay, docs in renders.items():
check(env.get('REGION_SESSION_LISTEN') == listen,
f'{where}: REGION_SESSION_LISTEN must be {listen} (route {"on" if route_active else "off"})')
check(text.count('--m10-listen') == 1 and '--m10-listen "$REGION_SESSION_LISTEN"' in text
and '--session-window "$REGION_SESSION_WINDOW"' in text,
f'{where}: one M10 listener and absolute session window, addressed only by GitOps env')
# The server refuses a window ending more than 4 h after it starts
# (SessionWindow::max_duration_seconds) and exits in a loop. The id carries
# its UTC activation (dev-YYYYMMDDTHHMMSS-...); the expiry must fall within
# 4 h of it. Checked here because the server sees it only at startup.
window = env.get('REGION_SESSION_WINDOW') or ''
if route_active and window:
import calendar, re, time
m = re.fullmatch(r'[0-9A-Za-z._-]*?(\d{8}T\d{6})Z?[0-9A-Za-z._-]*:(\d+)', window)
ok = False
if m:
start = calendar.timegm(time.strptime(m.group(1), '%Y%m%dT%H%M%S'))
ok = start < int(m.group(2)) <= start + 4 * 60 * 60
check(ok, f'{where}: REGION_SESSION_WINDOW must name its UTC activation and end '
'within 4 h of it (the server maximum)')
and '--session-window-source db' in text and '--session-window ' not in text,
f'{where}: one M10 listener whose session window is read from SQL (ADR-0087)')
# The window lives in SQL; a Git-committed one would never be read.
check('REGION_SESSION_WINDOW' not in env,
f'{where}: the session window lives in SQL, not in REGION_SESSION_WINDOW')
else:
check('--m10-listen' not in text and '--synthetic-inputs' not in text,
f'{where}: only evo-server may listen for sessions')