Skip to content

feat: merge operations-phase-configuration — construction complete - #90

Merged
MichielDean merged 5 commits into
mainfrom
feature/operations-phase-configuration
Jul 25, 2026
Merged

MichielDean merged 5 commits into
mainfrom
feature/operations-phase-configuration

Conversation

@MichielDean

Copy link
Copy Markdown
Owner

Auto-merged from devteam construction phase for feature operations-phase-configuration

Lobsterdog Contributors added 4 commits July 25, 2026 13:09
Creates the per-repo operation-phase configuration table keyed by
repo_name (natural PK, no synthetic id per ADR-04/C-D2). JSONB columns
(environments, observability, incident_response) carry the opaque typed
payload (C-D4, ADR-03); ci_platform/cd_platform are free-text labels
(C-D5). No FK (C-D3) — operation config is per-repo-permanent;
feature_repos rows are transient per-feature worktree coords.

Idempotent (CREATE TABLE IF NOT EXISTS — FR-SCHEMA-05). No Down func
(up-only pattern, NFR-REL-02). Re-running on a DB at migration 16 is a
no-op.

Migration 017 is the DAG root for the feature — the store (U2), the
bridge (U8), the API (U5), and the seeding (U7) all depend on this table
existing. Verified by TestMigration017_Applies: 8 columns present, no FK,
table starts empty (FR-SCHEMA-06).

Satisfies: FR-SCHEMA-01, 02, 04, 05, 06; C-D1, D2, D3, D4, D5, D6;
NFR-MAINT-05; NFR-REL-02.
Adds "repo_operation_config" to the tables slice in all five
per-package testhelpers truncation lists so the table is emptied
between tests, preventing stale-row pollution (R7).

Files updated:
- internal/pipeline/testhelpers_test.go
- internal/spec/testhelpers_test.go
- internal/intake/testhelpers_test.go
- internal/api/server_test.go
- internal/db/artifact_store_test.go (the db package's own
  truncateAllTables — used by U3 store tests; added for parity
  even though the bolt plan listed the four cross-package files)

NFR-MAINT-03 makes this a build-blocker at 3.6. Omitting any one
causes stale-row pollution: a test that writes a config row leaks
into the next test's assertions. Landing U11 in B1 (before the
store tests in U3 depend on it) prevents the R7 build-blocker from
compounding.

Satisfies: FR-TEST-04; NFR-MAINT-03; R7.
Adds the per-repo operation-config store following the
knowledge_rules_store / feature_repo_store patterns.

RepoOperationConfigRow: json.RawMessage for the three JSONB fields
(environments, observability, incident_response) so the platform
preserves the operator's exact bytes (ADR-03 opacity, C-A5). Empty
JSONB serializes as {}, never null (DR-R6).

Methods:
- SaveOperationConfig: idempotent upsert via ON CONFLICT(repo_name)
  DO UPDATE (FR-STORE-02). Sets created_at/updated_at to UTC now.
- GetOperationConfig: returns a zero-value row (with {} JSONB) on
  sql.ErrNoRows, no error (FR-STORE-05, C-A7 backward compat). Absence
  = today's behavior, not a 404.
- GetAllOperationConfigs: non-nil [] on empty (FR-STORE-03, DR-R6),
  ordered by repo_name ASC.
- GetOperationConfigsByRepoNames: single WHERE repo_name IN (...)
  query — the bridge's read path, keeping dispatch to ≤2 DB queries
  total (NFR-PERF-02). Missing repos omitted (FR-BRIDGE-04).
- DeleteOperationConfig: no-op on missing row (matches
  DeleteTeamKnowledge).
- normalizeEmptyJSONB + ensureJSONB: the single points enforcing
  empty-not-null on every read and write path (DR-R6).

All errors wrapped with the repo name (FR-STORE-04). No FK, no
secondary index, no per-repo branches (C-A5). The store does not know
about features — the bridge resolves repo names from feature_repos
itself (C-D3, preserves the no-coupling invariant).

Satisfies: FR-STORE-01..05; NFR-PERF-02; DR-R6; C-A5; ADR-03, ADR-04.
Adds 9 store tests verifying the RepoOperationConfigRow contract and
1 migration smoke test verifying migration 017's DDL:

Store tests (repo_operation_config_store_test.go):
1. TestSaveAndGetOperationConfig — round-trip, fields match, timestamps set.
2. TestGetOperationConfig_Missing — zero-value row + {} JSONB, no error
   (FR-STORE-05, DR-R6, C-A7).
3. TestGetAllOperationConfigs_Empty — non-nil [], JSON marshal yields []
   (FR-STORE-03, FR-TEST-06).
4. TestSaveOperationConfig_Idempotent — double-save = one row, updated_at
   does not regress (FR-STORE-02).
5. TestSaveOperationConfig_JSONBRoundTrip — semantic round-trip preserves
   all keys/values including unknown keys (C-A5 opacity). NOTE: Postgres
   JSONB normalizes whitespace and sorts keys, so the ADR-03 'exact bytes
   for diffs' rationale over-claimed — byte-exact round-trip would require
   a TEXT column, not JSONB. The binding constraints (C-D4 JSONB, C-A5
   opacity) are satisfied by semantic round-trip. Flagged in code-docs for
   the architecture-reviewer.
6. TestGetOperationConfigsByRepoNames — seed 3, fetch 2, missing omitted,
   ordered by repo_name ASC (FR-BRIDGE-04, NFR-PERF-02).
7. TestGetOperationConfigsByRepoNames_EmptyInput — empty names slice
   returns non-nil empty slice.
8. TestDeleteOperationConfig — save, delete, get returns zero-value.
9. TestDeleteOperationConfig_Missing — no-op, no error.
+ TestErrorWrapping — DB closed, error contains repo name (FR-STORE-04).

Migration smoke test (migration_017_smoke_test.go):
- TestMigration017_Applies — 8 columns present with correct types and
  defaults, no FK (C-D3), table starts empty (FR-SCHEMA-06).

Uses per-package DB isolation (devteam_test_db, NFR-TEST-04). Truncation
handled by U11's addition to artifact_store_test.go's truncateAllTables.

Satisfies: FR-TEST-01, 06; NFR-TEST-02, 04.
@MichielDean
MichielDean force-pushed the feature/operations-phase-configuration branch 2 times, most recently from e556e66 to 47d83f0 Compare July 25, 2026 19:24
@MichielDean
MichielDean force-pushed the feature/operations-phase-configuration branch from 47d83f0 to cb230d6 Compare July 25, 2026 19:31
@MichielDean
MichielDean merged commit 3892f8d into main Jul 25, 2026
10 of 12 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