Promote uat → main (PROD): GRO-2359 OOBE portal-creation routing (api) #214

Open
Flea Flicker wants to merge 1 commits from flea/uat-to-main-gro-2359-api into main
Member

Promote uat → main (PROD): GRO-2359 — OOBE portal-creation routing (api)

Carries the deployed + UAT-validated GRO-2359 P2 api commit
(ff85ed3, frozen on main base 58305d7a) to main (PROD).

What's in this PR

Commit Description
ff85ed3 feat(GRO-2359): add POST /api/portal/clients-from-auth for OOBE (web)

Diff scope (2 files, 309+)

  • src/routes/portal.ts — new POST /api/portal/clients-from-auth endpoint
    • 201 on create (name trimmed, optional fields normalized to null)
    • 409 on existing client (OOBE → portal-selection case)
    • 401 on missing session
    • 400 on zod-valid body
    • 503 on auth-not-configured
  • src/__tests__/portalClientsFromAuth.test.tsnew integration tests (401, 400, 201, 409, 503)

SDLC gates already passed

  • QA (dev→uat): GRO-2369 APPROVED (web#76 + api#213)
  • Deploy to UAT: GRO-2372 DONE (infra PR #661 self-merged, flux reconciled: web:2026.06.11-a7f2e2e + api:2026.06.11-a629331)
  • UAT regression (Shedward): GRO-2370 PASS — post-deploy security sign-off against the deployed images
  • Security review: GRO-2371 PASS — d5d598f3 comment with full findings + LOW notes

P1 pre-requisite satisfied

  • GRO-2358 merged to main via uat→main PR #211 (58305d7a cherry-pick on 47e2021) — the no-access screen has a working signOut().

No-access screen preserved

  • The api change is a new endpoint; it does not modify any existing no-access path.
  • The 404 on session-from-auth (no client row) is what triggers the web OOBE flow, so the new endpoint is only reachable from the OOBE component, never from the no-access path.

Why a frozen PR, not a live uat→main PR

Per uat-to-main-pr-head-drift-frozen-branch-recut.md (GRO-2244 #185):

  • uat has continued to advance since the GRO-2359 merge (a629331 is the GRO-2359 uat tip).
  • A live uat→main PR would replay the fanned-out post-GRO-2359 diff onto main.
  • Frozen branch at ff85ed3 (1 commit ahead of main 58305d7a) keeps the PR to exactly the GRO-2359 files.

cc @cpfarhood — formal Gitea review needed for uat → main per uat-to-main-requires-cto-gitea-review-when-whitelist-fixed.md.

Refs GRO-2359 / GRO-2357 / GRO-2355.

## Promote uat → main (PROD): GRO-2359 — OOBE portal-creation routing (api) Carries the **deployed + UAT-validated** GRO-2359 P2 api commit (`ff85ed3`, frozen on `main` base `58305d7a`) to **main** (PROD). ### What's in this PR | Commit | Description | |---|---| | `ff85ed3` | feat(GRO-2359): add POST /api/portal/clients-from-auth for OOBE (web) | ### Diff scope (2 files, 309+) - `src/routes/portal.ts` — new `POST /api/portal/clients-from-auth` endpoint - 201 on create (name trimmed, optional fields normalized to null) - 409 on existing client (OOBE → portal-selection case) - 401 on missing session - 400 on zod-valid body - 503 on auth-not-configured - `src/__tests__/portalClientsFromAuth.test.ts` — **new** integration tests (401, 400, 201, 409, 503) ### SDLC gates already passed - **QA (dev→uat)**: [GRO-2369](https://paperclip.farhoodlabs.com/GRO/issues/GRO-2369) APPROVED (web#76 + api#213) - **Deploy to UAT**: [GRO-2372](https://paperclip.farhoodlabs.com/GRO/issues/GRO-2372) DONE (infra PR #661 self-merged, flux reconciled: `web:2026.06.11-a7f2e2e` + `api:2026.06.11-a629331`) - **UAT regression (Shedward)**: [GRO-2370](https://paperclip.farhoodlabs.com/GRO/issues/GRO-2370) PASS — post-deploy security sign-off against the *deployed* images - **Security review**: [GRO-2371](https://paperclip.farhoodlabs.com/GRO/issues/GRO-2371) PASS — `d5d598f3` comment with full findings + LOW notes ### P1 pre-requisite satisfied - [GRO-2358](https://paperclip.farhoodlabs.com/GRO/issues/GRO-2358) merged to main via uat→main PR #211 (`58305d7a` cherry-pick on `47e2021`) — the no-access screen has a working `signOut()`. ### No-access screen preserved - The api change is a **new endpoint**; it does not modify any existing no-access path. - The 404 on `session-from-auth` (no client row) is what triggers the web OOBE flow, so the new endpoint is only reachable from the OOBE component, never from the no-access path. ### Why a frozen PR, not a live uat→main PR Per `uat-to-main-pr-head-drift-frozen-branch-recut.md` (GRO-2244 #185): - uat has continued to advance since the GRO-2359 merge (`a629331` is the GRO-2359 uat tip). - A live uat→main PR would replay the **fanned-out** post-GRO-2359 diff onto main. - Frozen branch at `ff85ed3` (1 commit ahead of `main` `58305d7a`) keeps the PR to **exactly** the GRO-2359 files. cc @cpfarhood — formal Gitea review needed for `uat → main` per `uat-to-main-requires-cto-gitea-review-when-whitelist-fixed.md`. Refs GRO-2359 / GRO-2357 / GRO-2355.
Flea Flicker added 1 commit 2026-06-11 21:42:15 +00:00
feat(GRO-2359): add POST /api/portal/clients-from-auth for OOBE (web)
CI / Test (pull_request) Successful in 25s
CI / Lint & Typecheck (pull_request) Successful in 27s
CI / Build & Push Docker Images (pull_request) Successful in 1m26s
ff85ed31ad
The OOBE flow on the web portal calls this endpoint to create a fresh
`clients` row bound to the Better Auth user's email when the SSO
bridge returns 404. Returns 201 on success, 409 if a client with that
email already exists (portal-selection case), 401/503 on auth issues,
400 on invalid body.

The OOBE success path navigates the user back to `/` and lets the
existing `session-from-auth` re-bridge; the new client is now
resolvable by email, so the bridge mints a real portal session.

Tests cover: 401 (no session), 400 (zod), 201 + persisted values
(name trimmed, optional fields normalized to null), 409 (existing
client or unique-constraint race), 503 (auth not configured).

Paired with the web PR on `feature/2357-p2-sso-to-oobe-routing`.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
(cherry picked from commit cdeebec021)
Some checks are pending
CI / Test (pull_request) Successful in 25s
CI / Lint & Typecheck (pull_request) Successful in 27s
CI / Build & Push Docker Images (pull_request) Successful in 1m26s
This pull request doesn't have enough required approvals yet. 0 of 1 approvals granted from users or teams on the allowlist.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin flea/uat-to-main-gro-2359-api:flea/uat-to-main-gro-2359-api
git checkout flea/uat-to-main-gro-2359-api
Sign in to join this conversation.