Build and browser-verify the tenant-picker frontend page
web/src/routes/select-tenant now calls enterprise-auth's existing
GET /auth/memberships / POST /auth/select-tenant protocol (built earlier
this phase, previously called only from Go tests) via
fetch(..., {credentials: 'include'}) -- new listMemberships/selectTenant
functions in $lib/api.ts, using a dedicated request helper that reads
plain-text error bodies (loginhandler's http.Error responses), unlike
every other request helper in that file which expects JSON.
Credentialed cross-origin fetch needed CORS enterprise-auth didn't have:
api/httpserver.WithCORS's wildcard-friendly default can't be combined
with a credentialed request at all (browsers refuse to honor
Access-Control-Allow-Origin: "*" on one) -- added WithCredentialedCORS
(literal origin, Access-Control-Allow-Credentials: true) alongside it,
wired into enterprise-auth via a new CORS_ALLOWED_ORIGIN config var
defaulting to POST_LOGIN_REDIRECT_URL (web's own origin, the same
default pattern SELECT_TENANT_REDIRECT_URL already used).
adapter-static's route crawler doesn't discover a page nothing links to
(this one is only ever reached via enterprise-auth's redirect) -- fixed
with select-tenant/+page.ts's `export const prerender = true`, the same
declaration every other route already has.
Genuinely verified in a real browser in this environment, not just
type-checked: a throwaway Node server standing in for enterprise-auth's
exact wire contract (including its plain-text error bodies), driven
through the full flow via mcp__claude-in-chrome -- cross-origin
pending-login cookie set, credentialed preflight + GET/POST round trip,
a real click choosing a tenant, the post-selection redirect, and the
missing/expired-cookie error path rendering the backend's actual
message. No Docker or live Postgres/IdP needed, since the point was
exercising web's own fetch/CORS/cookie wiring, not enterprise-auth's
internals (already covered by loginhandler's own tests).
This closes the tenant-picker as the last named gap in Phase 4. What's
left is the already-disclosed live-verification caveat shared by every
Postgres/ClickHouse-backed piece and both SSO protocols: none of this
has run against a real database, external IdP, or multi-container
deployment in this environment.
This commit is contained in:
+10
-5
@@ -202,11 +202,16 @@ mutually-exclusive choice via `COMPOSE_PROFILES` (`.env` defaults to
|
||||
plain `api`), sharing a host-port/network-alias trick so `alerting`/
|
||||
`web` need no conditional config either way. With both storage engines'
|
||||
connection/index-layer mechanisms built, deployment topology enforced at
|
||||
both the Helm and docker-compose layers, and the two provisioning
|
||||
mechanisms unified, and both storage engines' write paths now
|
||||
per-tenant-routed too (see above), the largest remaining gap in this
|
||||
phase is the tenant-picker *frontend* page — the backend protocol is
|
||||
built, but `web` has no session/cookie-handling code yet to call it.
|
||||
both the Helm and docker-compose layers, the two provisioning
|
||||
mechanisms unified, both storage engines' write paths per-tenant-routed,
|
||||
and the tenant-picker frontend page now built and browser-verified
|
||||
(`web/src/routes/select-tenant`, `api/httpserver.WithCredentialedCORS`
|
||||
— see `/CLAUDE.md`'s Phase 4 section and `/web/README.md`'s "Tenant
|
||||
picker" section), the remaining gaps in this phase are entirely the
|
||||
already-disclosed live-verification caveats: the ClickHouse/Postgres-
|
||||
backed pieces have never run against a real database in this
|
||||
environment, and nothing here has been tried against a real external
|
||||
IdP or a real running multi-container deployment.
|
||||
|
||||
## Licensing boundary
|
||||
|
||||
|
||||
Reference in New Issue
Block a user