fix(gateway): gate FederationModule on tier === 'federated' (#1138) #1140

Merged
shaggy merged 7 commits from fix/1138-conditional-federation into next 2026-08-10 07:09:52 +00:00
Contributor

Fixes #1138 — the gateway could not boot outside the federation profile: CaService hard-requires STEP_CA_URL at construction, and FederationModule was unconditionally imported, so every standalone/local boot died with CaServiceError: STEP_CA_URL is not set.

Change: app.module.ts now spreads FederationModule into imports only when loadConfig().tier === 'federated', matching docker-compose.federated.yml's contract that the federation profile must not start in non-federated dev.

Safety: only app.module.ts imports FederationModule, and nothing outside it injects the module's exports, so conditional registration is DI-safe.

Verified in the mosaic-dev distrobox (Debian 13, from source on next):

  • tier standalone (postgres :5433): gateway boots, Gateway listening on port 14242
  • first-run bootstrap, better-auth sign-in, mosaic gateway login~/.mosaic/session.json, authenticated /api/auth/get-session, and a Socket.IO /chat CONNECT round-trip all pass
  • pnpm build 25/25 green; pre-push gates (preflight/typecheck/lint/format) pass

Found while executing the HANDOFF-SHAGGY incremental ladder (rung 3) with Jason.

Fixes #1138 — the gateway could not boot outside the federation profile: `CaService` hard-requires `STEP_CA_URL` at construction, and `FederationModule` was unconditionally imported, so every standalone/local boot died with `CaServiceError: STEP_CA_URL is not set`. **Change:** `app.module.ts` now spreads `FederationModule` into `imports` only when `loadConfig().tier === 'federated'`, matching docker-compose.federated.yml's contract that the federation profile must not start in non-federated dev. **Safety:** only `app.module.ts` imports `FederationModule`, and nothing outside it injects the module's exports, so conditional registration is DI-safe. **Verified in the mosaic-dev distrobox (Debian 13, from source on `next`):** - tier `standalone` (postgres :5433): gateway boots, `Gateway listening on port 14242` - first-run bootstrap, better-auth sign-in, `mosaic gateway login` → `~/.mosaic/session.json`, authenticated `/api/auth/get-session`, and a Socket.IO `/chat` CONNECT round-trip all pass - `pnpm build` 25/25 green; pre-push gates (preflight/typecheck/lint/format) pass Found while executing the HANDOFF-SHAGGY incremental ladder (rung 3) with Jason.
shaggy added 1 commit 2026-08-09 22:55:40 +00:00
CaService hard-requires STEP_CA_URL/provisioner config at construction, so an
unconditional FederationModule import makes every standalone/local boot die at
DI time. Gate the module on loadConfig().tier === federated, matching the
documented intent of the federation compose profile (must not start in
non-federated dev).

Verified in mosaic-dev box: standalone tier boots to "Gateway listening on
port 14242" with bootstrap/socket.io/auth surfaces responding; federated tier
path unchanged.
shaggy added 5 commits 2026-08-10 06:07:23 +00:00
shaggy added 1 commit 2026-08-10 06:44:26 +00:00
shaggy merged commit 8c27024d0e into next 2026-08-10 07:09:52 +00:00
Sign in to join this conversation.