app: minimal root-layout shell - theme + env-config session providers (M3 slice 1, coreci-chat#16) #17

Merged
jonathan merged 1 commits from po/m3-slice-1-root-shell into main 2026-11-05 20:39:33 +00:00
Collaborator

TL;DR - M3 slice 1 (coreci-chat#16): ships the minimal shell - theme provider + session wrapper - behind Providers in the root layout. Additive only; SSR and /login behavior unchanged.

What changes

  • apps/control-plane/app/shell/_lib.ts - the pure decisions, node-testable (repo Wave-J convention): theme normalize/resolve/class logic; resolveApiBase for the env-based session client config (NEXT_PUBLIC_API_BASE_URL, default same-origin - no runner-image or deployment assumption); classifyMe for /api/me responses (200 → authenticated, 401/403 → guest, else error - the shell never redirects, so /login keeps rendering).
  • apps/control-plane/app/shell/providers.tsx - client providers, no new dependency: a light/dark/system theme provider (persisted, applied as a class on <html>) and the session wrapper over @coreci/auth's server session lane (reads the coreci_session identity via GET /api/me, env-based client config per the kickoff GO).
  • apps/control-plane/app/layout.tsx - wraps {children} in Providers (html gains suppressHydrationWarning - the theme class is client-applied).
  • apps/control-plane/vitest.config.ts - app/shell/_lib.ts registered in coverage.
  • apps/control-plane/tests/shell-lib.test.ts - units for all of the above (normalize/resolve/class/theme-class, api-base accepts/falls back, classifyMe on each status incl. malformed 200).

Scope limits kept (per the task + the line head's record)

  • No redirects or gates from the shell; SSR pages keep their server-side session resolution (getMe()).
  • No boot-time DDL, no DB access in the shell - deploy owns DDL, the app boots schema-check only (coreci-chat#1 comment 16428).

Verified

  • CI run on this branch (both jobs green, app build included) - run id lands in the linked task comment on coreci-chat#16.

Blast radius - 5 files, one app (control-plane). No API, schema, or gateway change. Failure modes degrade to the pre-slice behavior (context defaults; theme applies client-side only).

Asks - @coreci-cpo approval of the head + @jonathan's merge on protected main (the merge is the approval).

**TL;DR - M3 slice 1 (coreci-chat#16): ships the minimal shell - theme provider + session wrapper - behind `Providers` in the root layout. Additive only; SSR and /login behavior unchanged.** **What changes** - `apps/control-plane/app/shell/_lib.ts` - the pure decisions, node-testable (repo Wave-J convention): theme normalize/resolve/class logic; `resolveApiBase` for the env-based session client config (`NEXT_PUBLIC_API_BASE_URL`, default same-origin - no runner-image or deployment assumption); `classifyMe` for /api/me responses (200 → authenticated, 401/403 → guest, else error - the shell never redirects, so /login keeps rendering). - `apps/control-plane/app/shell/providers.tsx` - client providers, no new dependency: a light/dark/system theme provider (persisted, applied as a class on `<html>`) and the session wrapper over @coreci/auth's server session lane (reads the coreci_session identity via GET /api/me, env-based client config per the kickoff GO). - `apps/control-plane/app/layout.tsx` - wraps `{children}` in `Providers` (html gains `suppressHydrationWarning` - the theme class is client-applied). - `apps/control-plane/vitest.config.ts` - `app/shell/_lib.ts` registered in coverage. - `apps/control-plane/tests/shell-lib.test.ts` - units for all of the above (normalize/resolve/class/theme-class, api-base accepts/falls back, classifyMe on each status incl. malformed 200). **Scope limits kept (per the task + the line head's record)** - No redirects or gates from the shell; SSR pages keep their server-side session resolution (`getMe()`). - No boot-time DDL, no DB access in the shell - deploy owns DDL, the app boots schema-check only (coreci-chat#1 comment 16428). **Verified** - CI run on this branch (both jobs green, app build included) - run id lands in the linked task comment on coreci-chat#16. **Blast radius** - 5 files, one app (control-plane). No API, schema, or gateway change. Failure modes degrade to the pre-slice behavior (context defaults; theme applies client-side only). **Asks** - @coreci-cpo approval of the head + @jonathan's merge on protected main (the merge is the approval).
coreci-chat-po added 1 commit 2026-11-03 18:57:47 +00:00
feat(app): minimal root-layout shell - theme + env-config session providers
ci / test-pglite (PGlite, default) (push) Successful in 3m53s
ci / test-postgres (Postgres 16, G-022 RLS) (push) Successful in 2m21s
ci / test-pglite (PGlite, default) (pull_request) Successful in 3m44s
ci / test-postgres (Postgres 16, G-022 RLS) (pull_request) Successful in 2m3s
754222083c
M3 slice 1 (coreci-chat#16): wrap the root layout's children with a theme
provider (light/dark/system, persisted, no external dep) and a session
wrapper over @coreci/auth's session lane (identity via GET /api/me, client
config from NEXT_PUBLIC_API_BASE_URL, default same-origin). Additive only:
no redirects or gates, SSR pages keep server-side session resolution, and
no boot-time DDL (deploy owns DDL, app boots schema-check only). Pure
logic extracted to app/shell/_lib.ts + unit tests, repo Wave-J convention.
coreci-cpo approved these changes 2026-11-03 19:37:09 +00:00
coreci-cpo left a comment
First-time contributor

TL;DR — Product approval of this head: APPROVED. The slice matches the ordered M3 scope; the merge on protected main remains per this MR's own ask.

Verified at source this cycle (CPO seat, own reads):

  • Head 754222083c -> main bd3a7a5c; single commit, mergeable=true.
  • CI: run 84044 both gate jobs green (test-pglite 86426, test-postgres 86427); the second branch run 84045 also green.
  • Blast radius: exactly 5 files, additive (shell _lib.ts +108, providers.tsx +169, units +95, vitest +2, layout wrap +13/-8). No API, schema, or gateway files; no redirects; env-based client config per the kickoff GO.

Delivery landed pre-due on 2026-11-03; line-head receipt on thread. Product side holds.

**TL;DR — Product approval of this head: APPROVED. The slice matches the ordered M3 scope; the merge on protected main remains per this MR's own ask.** Verified at source this cycle (CPO seat, own reads): - Head `754222083c` -> main `bd3a7a5c`; single commit, `mergeable=true`. - CI: run 84044 both gate jobs green (test-pglite 86426, test-postgres 86427); the second branch run 84045 also green. - Blast radius: exactly 5 files, additive (shell `_lib.ts` +108, `providers.tsx` +169, units +95, vitest +2, layout wrap +13/-8). No API, schema, or gateway files; no redirects; env-based client config per the kickoff GO. Delivery landed pre-due on 2026-11-03; line-head receipt on thread. Product side holds.
jonathan merged commit 04b86c517f into main 2026-11-05 20:39:33 +00:00
jonathan deleted branch po/m3-slice-1-root-shell 2026-11-05 20:39:33 +00:00
Sign in to join this conversation.