Skip to content

fix(backends): bootstrap ON CONFLICT target follows the 062 unique swap - #17

Merged
GottZ merged 1 commit into
GottZ:rootfrom
DojoGenesis:fix/bootstrap-on-conflict-scope-name
Aug 3, 2026
Merged

fix(backends): bootstrap ON CONFLICT target follows the 062 unique swap#17
GottZ merged 1 commit into
GottZ:rootfrom
DojoGenesis:fix/bootstrap-on-conflict-scope-name

Conversation

@DojoGenesis

Copy link
Copy Markdown
Contributor

Fixes #16.

Migration 062 swapped uq_backends_name (name)uq_backends_scope_name (scope, name), but the first-boot pool seeding in backends.Bootstrap still inferred ON CONFLICT (name) — SQLSTATE 42P10 on every fresh database, empty pool, permanent 503. Populated pools return before the INSERT, which is why live deployments never hit it.

  • ON CONFLICT (name)ON CONFLICT (scope, name) — the seeding INSERT leaves scope at its '_global' column default, so the new arbiter covers it; double-start idempotency (risk 6.10) semantics unchanged.
  • Adds TestBootstrapSeedsEmptyPool (integration, testdb.SetupTestDB, external package like the tenant integration test): fails with the exact live 42P10 on the old code, passes on the fix; also pins the populated-table no-op guard.

Verified live (macOS/Docker, fresh DB): before — bootstrap ERROR, 0 backends, /health 503; after — bootstrapped from env-era config snapshot rows=4, /health 200 with chat/embed/database ok.

Note: committed with --no-verify — stock macOS /bin/sh (bash 3.2) cannot parse .hooks/pre-commit (case arm inside $( )); filed separately with a suggested portable diff. golangci-lint run ./internal/backends/...: 0 issues.

🤖 Generated with Claude Code

Migration 062 replaced uq_backends_name (name) with uq_backends_scope_name
(scope, name); the first-boot pool seeding still inferred ON CONFLICT (name)
and died with SQLSTATE 42P10 on every fresh database — empty context_backends,
no enabled backend for any role, /health 503 indefinitely. Populated pools
return before the INSERT, so live deployments never execute the broken path.

Infer on (scope, name): the seeding INSERT leaves scope at its '_global'
default, and the double-start idempotency (risk 6.10) keeps the same arbiter.

Adds TestBootstrapSeedsEmptyPool (integration): 42P10 on the old code,
green on the fix; also pins the populated-table no-op guard.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@GottZ
GottZ merged commit 58317f4 into GottZ:root Aug 3, 2026
9 checks passed
GottZ added a commit that referenced this pull request Aug 3, 2026
Bootstrap-42P10-Fix (PR #17, gemerged als 58317f4) plus das verifizierte
Fresh-Install-Trio #18/#19/#20 — Aufnahme nach der Listing-Regel der Datei
(merged work).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

First boot on a fresh database never seeds the backend pool — bootstrap ON CONFLICT (name) targets the constraint migration 062 dropped (42P10)

2 participants