Skip to content

feat: merge settings-and-admin-ui — construction complete - #95

Merged
MichielDean merged 4 commits into
mainfrom
feature/settings-and-admin-ui
Jul 25, 2026
Merged

MichielDean merged 4 commits into
mainfrom
feature/settings-and-admin-ui

Conversation

@MichielDean

Copy link
Copy Markdown
Owner

Auto-merged from devteam construction phase for feature settings-and-admin-ui

@MichielDean
MichielDean force-pushed the feature/settings-and-admin-ui branch 2 times, most recently from 1a00166 to cd71f1c Compare July 25, 2026 19:31
Lobsterdog Contributors added 4 commits July 25, 2026 13:51
Delta over the sibling feature's CI baseline (bdbb7da + f6cbc1f + a7b859b).
The 2.2 team-practices 'no CI' finding is now stale: ci.yml, deploy.sh,
rollback.sh, ci-config.md, and quality-gates.md already exist on main.

This feature's CI delta is small:
- ci.yml: widen go vet scope to cover the feature's new + extended
  packages (internal/repos, internal/settings, internal/opencode,
  internal/config). The 5-job structure, triggers, toolchain pins,
  and gate aggregate are unchanged — the feature's Go/TS code flows
  through the existing gates automatically.
- ci-config.md: rewritten as the settings-and-admin-ui delta over
  the inherited pipeline. Records the baseline shift, the migration
  renumbering (017 is taken by the sibling feature -> this feature
  is 018), the E2E non-blocking posture retained for v1, and the
  migration-round-trip test CI behavior.
- quality-gates.md: rewritten as the settings-and-admin-ui gate set.
  G1-G9 inherited unchanged; G10 (migration 018 round-trip), G11
  (config write path linchpin), G12 (auth guard fail-closed) are
  new MVP gates that run inside the existing G3/G4 jobs. G13 (repos
  concurrent-write) is the Bolt 1 MVP gate. G14-G16 are fast-follow
  within this feature; G17 (opencode builder) and G18 (CI/CD
  vaporware) are deferred to sibling features per the 1.7-gate
  strict scope (MVP = admin shell + repos tab only).

MVP sign-off gate: G9 green + G10 + G11 + G12 + G13 green + 4.1
review verifies R-AUTH-ABSENT (G12) and R-REPOS-LOCK (G13).
Revision 2 of ci-config.md and quality-gates.md — realigns the pipeline
delta to the revised upstream artifacts (bolt-plan rev2, test-results
rev2, quality-report rev2) which honored human input Q7/Q8 strictly:

- MVP scope corrected from 'shell + repos' (Bolts 0-1) to
  'shell + repos + defaults' (Bolts 0-2). Defaults is MVP-complete per
  bolt-plan rev2 Bolt 2, not a fast-follow.
- Bolt numbering renumbered to rev2 sequence: Bolt 2 = Defaults (MVP),
  Bolt 3 = Server, Bolt 4 = Audit, Bolt 5 = Providers (gated fast-follow
  on sibling feature reaching 2.6). Bolt 6 (CI/CD) removed entirely —
  CI/CD is a separate ci-cd-platform-config feature.
- internal/opencode removed from vet scope. The builder package is owned
  by the sibling feature multi-provider-llm-configuration (Q7 scope cut);
  there is no internal/opencode/ in this feature's v1.
- internal/config added to the fast backend unit gate so the linchpin
  (U-CONFIG-01) fails fast (~3-4 min) instead of waiting for
  backend-full (~10-12 min).
- -race gate added as a binding CI step on the concurrency-touching
  packages (internal/repos, internal/config, internal/settings) per
  quality-report rev2 QO-14. Revision 1 had -race as 'recommended';
  rev2 elevates it to binding.
- Gate renumbering: G13 = audit constants structural (4 constants, no
  PROVIDER_*/CI_* — scope-creep canary), G14 = repos concurrent-write,
  G15 = defaults precedence (MVP sign-off), G16 = server DSN, G17 =
  audit index, G18 = scope-creep structural grep, G19 = race. Old G17
  (opencode builder) and G18 (CI/CD vaporware) removed — those risks
  are resolved by scope cut, not deferred.
- Risk matrix updated: R-PROVIDER-KEYS, R-PROVIDER-COPILOT,
  R-CICD-VAPORWARE marked 'resolved by scope cut' (not 'deferred').
  8 v1 risks remain, all with enforcing gates.
- Migration test count aligned to test-results rev2: T-MIG-01..07
  (was 01..03). Config tests aligned to T-CONFIG-01..11 (was 01..06).
  Auth tests aligned to T-AUTH-01..08 (was 01..05).
- E2E admin.spec.ts scope aligned to 5 v1 describe groups + 2
  placeholder assertions (was 2 describe blocks for MVP only).

Net effect on ci.yml: vet scope drops internal/opencode, fast unit gate
adds internal/config, new -race step in backend job.
…ults)

Settings and Admin UI — MVP per bolt-plan rev2 (honors human input Q7/Q8
strict scope cut: Providers deferred to sibling feature, CI/CD cut to
separate feature).

Bolt 0 — Walking Skeleton:
- Migration 018: feature_defaults, server_config tables; audit_events.actor
  column; idx_audit_events_type_time index. Drops the audit_events.feature_id
  FK so platform-level config-mutation events (feature_id='platform') can be
  recorded without a sentinel feature row.
- Audit: 4 v1 config-mutation event constants (CONFIG_UPDATED,
  CONFIG_VALIDATION_FAILED, REPOS_REGISTRY_MUTATED, FEATURE_DEFAULTS_MUTATED)
  + RecordAuditEventWithActor overload (backward-compat: legacy
  RecordAuditEvent inserts actor=NULL).
- GetAuditEventsFiltered: cross-feature filtered+paginated read backed by
  idx_audit_events_type_time (FR-AUDIT-01/02).
- AdminGuard middleware: localhost-or-shared-secret, fail-closed when env
  unset + non-localhost (ADR-D6, FR-ROUTE-03, R-AUTH-ABSENT).

Bolt 1 — Repos (MVP slice 1):
- POST/PUT/DELETE /api/repos handlers on the existing DB repo_store,
  guarded by AdminGuard, emitting REPOS_REGISTRY_MUTATED.
- listRepos refactored to read from DB store (FR-REPOS-01); GET shape
  [{name,url,description,primary}] preserved (C-INTEG-03).
- Delete-guard: 409 repo_in_use when features reference the repo.
- Removed broken config.ReposConfig slice parser + dead LoadReposConfig
  (FR-CONFIG-07). RepoEntry retained for repo/manager.

Bolt 2 — Defaults (MVP complete):
- internal/settings/defaults.Store: DB CRUD on feature_defaults (global +
  per-repo), emitting FEATURE_DEFAULTS_MUTATED.
- createFeature precedence wiring: explicit > per-repo > global >
  scope-derived (ADR-DEFAULTS-PRECEDENCE, FR-DEF-02). needsRepos guard
  consults global default scope too.
- /api/settings/defaults handlers (GET/PUT global/PUT per-repo/DELETE
  per-repo), reads unguarded, writes guarded.

Admin UI:
- /admin route + AdminPage shell with 4 v1 tabs (Repos, Defaults, Server,
  Audit) + 2 disabled 'coming soon' placeholders (Providers, CI/CD).
  URL-synced tab state; header Admin link with aria-current.
- ReposTab: full CRUD with add/edit modal + delete confirm.
- DefaultsTab: global defaults form + per-repo overrides list.
- ServerTab: read-only restart-classification table (Bolt 3 writable
  surface is post-MVP).
- AuditTab: filtered+paginated read-only audit event list.
- types/admin.ts + API client additions.
- E2E: admin.spec.ts covers shell navigation, tab order, URL sync,
  disabled tabs, and each tab's smoke render.

Tests: Go unit tests for migration 018, audit actor overload, filtered
read, auth guard (6 cases), repos write handlers (8 cases), defaults store
(9 cases), defaults handlers (7 cases), createFeature precedence (3
cases). Full suite green (-p 1; packages share Postgres test DBs).
Three defects discovered while verifying stage 3.7 artifacts against the
actual codebase:

1. ci.yml vet + race steps referenced ./internal/repos/... (plural) but the
   actual Go package is ./internal/repo (singular). Both G2 (vet) and G19
   (race) would fail in CI with 'lstat ./internal/repos/: no such file or
   directory'. Corrected to ./internal/repo/...

2. ci.yml test-DB creation loop omitted devteam_test_defaults, the dedicated
   DB used by internal/settings/defaults/store_test.go to avoid truncate
   races with internal/db's shared devteam_test_db. The defaults package
   tests would fail in CI's fresh postgres container with 'database does
   not exist'. Added devteam_test_defaults to both the backend and
   backend-full job DB-creation loops.

3. go vet (widened scope G2) surfaced 9 'using resp before checking for
   errors' warnings in the new test files (defaults_handlers_test.go,
   repos_handlers_test.go) where http.Get/http.DefaultClient.Do errors were
   discarded with _ and the response used before any error check. Fixed all
   sites to check the error explicitly before using the response.

Also drops an unused import (Tabs) in AdminPage.tsx and splits a mixed
type-import in ReposTab.tsx that broke tsc's verbatimModuleSyntax.

Verification:
- go vet ./internal/db/... ./internal/api/... ./internal/repo/...
  ./internal/settings/... ./internal/config/... — clean
- go test ./internal/db/... ./internal/api/... ./internal/config/...
  -count=1 — green
- go test -race ./internal/repo/... ./internal/config/...
  ./internal/settings/... -count=1 — green
- go test ./... -count=1 -p 1 — green
- npm run build (ui) — green
@MichielDean
MichielDean force-pushed the feature/settings-and-admin-ui branch from cd71f1c to 795f9e6 Compare July 25, 2026 19:55
@MichielDean
MichielDean merged commit 53a8086 into main Jul 25, 2026
8 of 10 checks passed
MichielDean added a commit that referenced this pull request Jul 26, 2026
## Summary
Enforces the 4-level testing mandate on recently merged features:
- **E2E**: `providers.spec.ts` covers `AdminProvidersPage`
(multi-provider-llm feature) — page renders, effect-timing banner,
operator section, tier matrix, role overrides, navigation
- **Smoke**: `smoke_test.go` verifies server starts on a random port and
key API endpoints respond (features, repos, settings/defaults,
config/providers)

## Why
Audit of the 5 merged features (#90, #93, #94, #95) showed:
- Unit tests: 543 — good
- Integration tests: handler-level httptest tests — good
- E2E tests: admin.spec.ts covered settings/admin-ui but NOT
multi-provider-llm or github-auth
- Smoke tests: no dedicated smoke test verifying server starts and
responds

This PR closes the e2e and smoke gaps.

Co-authored-by: Lobsterdog Contributors <noreply@lobsterdog.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant