Files
git.stella-ops.org/docs/qa/authority-default-tenant-20260422/01-create-session.json
master 47665927ab feat(authority): seed default + installation tenants via migration (SPRINT_20260422_005)
Closes the bootstrap gap two parallel QA agents surfaced on 2026-04-22:
fresh Authority DBs lacked the `default` tenant row so setup-wizard admin
creation failed with users_tenant_id_fkey and /connect/token returned
invalid_grant. Fix is on the migration path per AGENTS.md §2.7; the init
script stays seeds-only as established in SPRINT_20260422_003.

- New embedded migration 003_seed_default_tenants.sql performs
  `INSERT ... ON CONFLICT (tenant_id) DO NOTHING` for `default` and
  `installation`. Numeric prefix (not S-prefix) so the migration runner's
  Startup category auto-applies it; S-prefix files route to Seed category
  which is intentionally manual-only per
  StartupMigrationHost.cs:158.
- `default` is strictly required (Authority's
  StandardPluginBootstrapper.DefaultTenantId; /internal/users bootstrap
  inserts under this FK). `installation` is not Authority-FK-referenced
  today but matches the empirical workaround both QA agents converged on
  and serves as defense for cross-service inserts that join
  authority.tenants.tenant_id.

Fresh-volume verification (docs/qa/authority-default-tenant-20260422/):
1. docker compose down -v (20 volumes removed incl. compose_postgres-data)
2. docker compose up -d — 62 containers, Authority healthy in ~15s.
3. Startup log: applying 001 (144ms) → 002 (13ms) → 003 (7ms).
   authority.tenants contains default + installation.
4. POST /api/v1/setup/sessions → 201; database/valkey/migrations prereqs
   ran; admin/execute with admin/Admin@Stella2026! → 200 "Bootstrap
   administrator 'admin' ensured successfully."
5. POST /connect/token (password, stellaops-cli, ui.admin openid) → 200
   + JWT carrying role=admin, stellaops:tenant=default.
6. docker compose restart authority → "Database is up to date for
   Authority." Clean no-op.

Docs: docs/modules/authority/architecture.md §1.1 "Seeded bootstrap
tenants (migration-owned)". Cross-link added to the archived prior
sprint's Decisions & Risks so the lineage is traceable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 17:41:23 +03:00

3 lines
4.0 KiB
JSON

{"session":{"sessionId":"setup-installation-20260422143427","scopeKey":"installation","tenantId":"installation","status":"InProgress","currentStepId":"Database","definitionVersion":"2026-04-control-plane-v1","steps":[{"stepId":"Database","status":"Pending","completedAtUtc":null,"skippedAtUtc":null,"skippedReason":null,"lastProbedAtUtc":null,"lastProbeSucceeded":null,"checkResults":[],"appliedConfig":{},"errorMessage":null},{"stepId":"Valkey","status":"Pending","completedAtUtc":null,"skippedAtUtc":null,"skippedReason":null,"lastProbedAtUtc":null,"lastProbeSucceeded":null,"checkResults":[],"appliedConfig":{},"errorMessage":null},{"stepId":"Migrations","status":"Pending","completedAtUtc":null,"skippedAtUtc":null,"skippedReason":null,"lastProbedAtUtc":null,"lastProbeSucceeded":null,"checkResults":[],"appliedConfig":{},"errorMessage":null},{"stepId":"Admin","status":"Pending","completedAtUtc":null,"skippedAtUtc":null,"skippedReason":null,"lastProbedAtUtc":null,"lastProbeSucceeded":null,"checkResults":[],"appliedConfig":{},"errorMessage":null},{"stepId":"Crypto","status":"Pending","completedAtUtc":null,"skippedAtUtc":null,"skippedReason":null,"lastProbedAtUtc":null,"lastProbeSucceeded":null,"checkResults":[],"appliedConfig":{},"errorMessage":null},{"stepId":"Sources","status":"Pending","completedAtUtc":null,"skippedAtUtc":null,"skippedReason":null,"lastProbedAtUtc":null,"lastProbeSucceeded":null,"checkResults":[],"appliedConfig":{},"errorMessage":null}],"draftValues":{},"createdAtUtc":"2026-04-22T14:34:27Z","updatedAtUtc":"2026-04-22T14:34:27Z","completedAtUtc":null,"createdBy":"setup-wizard","updatedBy":"setup-wizard","dataAsOfUtc":"2026-04-22T14:34:27Z","secretDrafts":[]},"readiness":{"status":"blocked","readyToProceed":false,"requiredDependencyCount":7,"requiredReadyCount":2,"optionalDependencyCount":0,"optionalReadyCount":0,"blockingDependencyCount":5,"message":"Required dependencies blocking setup: Admin Bootstrap, Cache, Crypto Profile, Database, Migrations.","checkedAt":"2026-04-22T14:34:27.7166984+00:00","dependencies":[{"service":"admin-bootstrap","displayName":"Admin Bootstrap","category":"bootstrap","required":true,"blocksSetup":true,"status":"blocked","endpoint":null,"version":"setup-session","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Admin Bootstrap step is pending.","latencyMs":null},{"service":"authority","displayName":"Authority","category":"core-services","required":true,"blocksSetup":true,"status":"ready","endpoint":"http://authority.stella-ops.local/health","version":"unknown","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Authority health probe returned 200.","latencyMs":178.2831},{"service":"cache","displayName":"Cache","category":"bootstrap","required":true,"blocksSetup":true,"status":"blocked","endpoint":null,"version":"setup-session","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Cache step is pending.","latencyMs":null},{"service":"crypto-profile","displayName":"Crypto Profile","category":"bootstrap","required":true,"blocksSetup":true,"status":"blocked","endpoint":null,"version":"setup-session","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Crypto Profile step is pending.","latencyMs":null},{"service":"database","displayName":"Database","category":"bootstrap","required":true,"blocksSetup":true,"status":"blocked","endpoint":null,"version":"setup-session","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Database step is pending.","latencyMs":null},{"service":"frontdoor","displayName":"Front Door","category":"core-services","required":true,"blocksSetup":true,"status":"ready","endpoint":"http://router.stella-ops.local:8080/health/ready","version":"unknown","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Front-door readiness probe returned 200.","latencyMs":221.1342},{"service":"migrations","displayName":"Migrations","category":"bootstrap","required":true,"blocksSetup":true,"status":"blocked","endpoint":null,"version":"setup-session","checkedAt":"2026-04-22T14:34:27.7166984+00:00","message":"Migrations step is pending.","latencyMs":null}]}}
---HTTP 201---