Phase 13, part 7: the platform's own admin

The people running the multi-tenant service (SUPERMARKET_PLATFORM_ADMINS,
with two-factor sign-in) see every team at /platform with its size, people
and what failed lately, and can suspend or restore a team, resend its
invitations and release its domain. They don't see a team's data unless
they view as it: with a reason, for at most an hour, read-only, recorded in
the team's own audit log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:35:53 -07:00
co-authored by Claude Opus 5.5
parent 76407cdea8
commit d35ed7cbb2
15 changed files with 459 additions and 10 deletions
+22 -1
View File
@@ -55,7 +55,7 @@ tools over MCP, approvals, limits and visibility, and the JSON API. Schema
39.
**Phase 13 (multi-tenant) is under way** on branch `phase13`, with a
Postgres schema per team (decided 2026-11-26); parts 1–6 are built.
Postgres schema per team (decided 2026-11-26); parts 1–7 are built.
**Phase 12 (signing in with the Core, OIDC) is set aside for now**
(2026-11-26): before it starts, the user will share the Federated Core's
@@ -2895,6 +2895,27 @@ stand.
and the hand setup are the local edition's. The platform never holds a
Core's admin credentials.
**Part 7 built 2026-11-26** on `phase13`.
- `SUPERMARKET_PLATFORM_ADMINS` lists the platform's admins by email
(multi-tenant only). They sign in like anyone, and may belong to no team:
their session then works in team 0, the platform, and everything but
`/platform` and their own account leads there. `/platform` needs their
two-factor sign-in on, and says so until it is.
- `/platform` lists every team: its status, domain (proved or not), people
and pending invitations, the size of its schema, what failed in the last
week (posts, outreach emails, agents' requests: counted, never read) and
its last activity. For each: *Suspend* (with why), *Restore*, *Resend
invitations*, *Release the domain*, *View as*.
- A suspended team (or one being deleted) is closed to its people: a page
says so; they can still switch teams and reach their account. Its jobs
wait (part 5).
- *View as* needs a reason and a length, at most an hour (schema 42:
`sessions.view_until` and `view_reason`). The admin's session points at
the team, read-only (every module to view; no Settings); a banner says so,
with *Stop viewing*; it ends by itself. The team's own audit log records
who looked, why and for how long, as it does a suspension, a restore, a
release and resent invitations.
1. **Teams everywhere.**
- Every table that holds a company's data gets `team_id`, and its
unique keys include it. The settings table's key becomes