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
+31
View File
@@ -197,3 +197,34 @@ the pod-side checks (ready, listener bound) could not show this. Decision:
Service UDP 7400 -> NetworkPolicy UDP 7400 -> evo-region M10 listener`, with the dev CA
and issuer key read from the authorized cluster Secret without printing or persisting
them. Until that is recorded in VALIDATION.md the route is not declared working.
## Amendment 2026-10-27: Session windows in SQL, opened from the admin portal
Maintainer decision (ADR-0182 discussion). Committing the window to Git meant a push and a
full Argo sync for every opening or extension, and an expired window made the region exit
and crash-loop until the next sync. The window moves to the database:
- **Record.** Schema 62 adds the append-only `evolution.session_windows` (world, region,
activation id, absolute UTC expiry or none, author, reason, time written). A row with an
expiry opens or replaces the window until then; a row without one closes it. The table
refuses updates, deletes and truncation, and a window may end at most **four hours** after
it is written (the maximum is unchanged).
- **Writing.** Only the admin group role, through `admin_set_session_window_v1`, from the
admin portal (Open or Extend for 30 min to 4 h, Close). The author is the signed-in
admin's email and Keycloak subject. The runtime group may only read the newest row
(`load_session_window_v1`).
- **Reading.** The cellular region runs with `--session-window-source db` and reads the newest
row every 5 s on its session-ledger connection. A newer activation replaces the window
without disturbing open sessions; a closing, expired, over-long or missing row closes it.
Each admitted window keeps its own absolute deadline, a window once closed never reopens
(only a newer activation opens sessions again), and an unreadable database leaves the
current window to close at its deadline.
- **Closed means closed.** While no window is open, every Hello is refused with `shutdown`
before signature work, and closing closes the open sessions. Previously the cellular
bridge closed the sessions once at expiry but still admitted new ones. The region keeps
running while closed instead of exiting.
- **Git.** `REGION_SESSION_WINDOW` and the pre-push refresh are removed; the policy check
requires `--session-window-source db` and refuses a committed window. A fixed
`--session-window` remains for the lineage/primitive bridge and process tests.
The elapsed-time guard of the 2026-10-08 clock amendment is still pending.