Commit Graph

2 Commits

Author SHA1 Message Date
28aa04d5e4 Add the first-run setup wizard UI (#81)
All checks were successful
CI / Lint, typecheck, test (push) Successful in 3m6s
CI / Build container images (push) Has been skipped
CD / Build and push images (push) Successful in 3m13s
CD / Deploy to Test (push) Successful in 12s
CD / Smoke tests against Test (push) Successful in 1m14s
CD / Promote to Int (push) Successful in 10s
CI / Auth e2e pack (push) Successful in 5m6s
CI / Import/export fidelity gate (push) Successful in 45s
The SPA now probes GET /setup on boot: while setup is pending it
renders only the wizard at /setup, the login page (to resume a started
wizard as the Site Admin), and a "setup pending" notice on every other
route — without the regular chrome, whose pond/search queries would
all 503. If the probe itself fails (offline reload), the app falls
through to the normal routes. Once completed, /setup just goes home.

The wizard walks six steps against the #80 api: welcome with language
choice (drives i18n immediately and pre-fills the admin/instance
locales), Site Admin account (signs in via the step-1 session cookie),
instance basics, SMTP with live-test-before-save plus an explicit skip,
registration mode, and a summary whose finish unlocks the app
logged-in-ready. Every step validates through the shared Zod schemas
before advancing; entered values live in the parent component, so Back
preserves them, and re-submitting a step on a second forward pass just
overwrites the same settings. A wizard someone else started shows a
sign-in hand-off instead of dead admin-gated steps. New `setup` i18n
namespace in de and en.

Two #80 touch-ups fell out of verifying this end to end: the SMTP
port's NaN case now maps to the translated required-message, and
GET /setup's smtpConfigured uses `||` instead of `??` so the empty
strings compose passes for unset vars fall through to the secret store.

The e2e pack (setup.spec.ts) needs an instance where setup is still
pending, so the CI job provisions a second api + static web against a
virgin database on their own ports and runs the full wizard journey
there, including the failing-relay path and both languages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwZ4jR4KFAPvpjWevfUGX1
2026-07-11 16:05:01 +02:00
f0a82bad20 Add the first-run setup wizard API with env-backed secret store (#80)
Some checks failed
CD / Build and push images (push) Successful in 3m16s
CI / Lint, typecheck, test (push) Successful in 3m5s
CD / Deploy to Test (push) Successful in 13s
CD / Smoke tests against Test (push) Failing after 3m35s
CD / Promote to Int (push) Has been skipped
CI / Auth e2e pack (push) Successful in 5m6s
CI / Import/export fidelity gate (push) Successful in 43s
CI / Build container images (push) Has been skipped
When the api runs against a database without the setup.completedAt
marker, a global SetupGuard answers every non-exempt route with 503
setup_required; only /setup/*, health probes, and the session routes
stay reachable. The wizard steps (POST /setup/admin|instance|smtp|
registration|complete) write straight to their production homes; the
Site Admin step signs its creator in, later steps require that session.
Completing sets the marker and locks every step permanently (410, also
across restarts, and not reopenable via PATCH /admin/settings).

SMTP entered in the wizard is verified with a live delivery test first
(failure blocks the step with the transport error as detail) and then
persisted to the new env-backed secret store: a mode-600 dotenv file on
the new `secrets` volume (SECRETS_FILE). Explicit container env always
wins over the store; empty compose-passed strings count as unset. The
mail transport now resolves lazily through SmtpConfigService so wizard
changes apply without a restart.

SETUP_ADMIN_* env pre-seeds the whole wizard at boot for automated
deploys; a backfill migration marks instances that already have a Site
Admin as completed, and seed/vitest global-setup do the same for
fixture databases. The setup e2e suite provisions its own fresh
database (CREATE DATABASE + migrate deploy) per run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwZ4jR4KFAPvpjWevfUGX1
2026-07-11 15:10:28 +02:00