Repository navigation
Apply the coordinator schema as goose migrations - #1328
Conversation
Replace the boot-time DDL loop in PostgresStore.migrate with pressly/goose v3. Version 1 is the 255 statements the loop ran, unchanged and in order, outside a transaction. Versions 2 to 5 are the retired-backfill guard and the three concurrent index builds, with their code unchanged. Goose records each version in goose_db_version and holds a session advisory lock, so a second coordinator applies nothing. The migration session sets lock_timeout 3s and statement_timeout 10min, and migrate retries a lock timeout up to three times. Check in the pg_dump of the pre-goose schema as coordinator/store/schema/schema.sql. Tests prove that goose builds that schema on a fresh database, leaves a legacy database unchanged apart from goose_db_version, applies once under two concurrent runners, and retries a lock timeout. goose v3.28.0 needs Go 1.26 and the coordinator image builds with Go 1.25, so this pins v3.27.3 and raises the go directive to 1.25.7. Refs DBLM-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project d-inference with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 87/325 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.4793 reported, $0.0000 reserved with unknown cost; 4 paid request(s), 5 reused batch(es), 60291 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. |
docs-check treats an inline-code repo path as a citation; the placeholder file name failed Docs Lint. Refs DBLM-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project eigen-homepages-darkbloom with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-console-ui-dev with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-landing with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
A CREATE INDEX CONCURRENTLY in an SQL migration that fails (for example on the 3 s lock_timeout) leaves an invalid index; with IF NOT EXISTS the next attempt skips it and goose records the version. The how-to now shows index builds as Go migrations through ensureConcurrentIndex, and TestSQLMigrationsDoNotBuildIndexesConcurrently fails on an SQL file that builds one. Docs: destructive migrations must wait until no pre-goose fallback image can start; migrations and the baseline repairs run once; the startup diagram shows the unlocked pending check before the advisory lock; the 5 min lock wait and the fail-safe first deploy under long reads. Refs DBLM-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docs/architecture/schema-lifecycle.md as the explanation of how the schema changes: the startup path from NewPostgres through goose, the migration kinds, the locks and timeouts, the retired-backfill guard, invariants, failure modes and a code map. storage.md now links to it instead of holding the migration mechanism. Rewrite docs/developer/database-migrations.md around a decision table, steps for each migration kind, expand and contract in two releases, and the pre-goose fallback rule. Add docs/operations/schema-migration.md: scope, Cloud SQL backup, long query check, --migrate-only with its real log lines, verification queries, troubleshooting, rollback rules and the first cut-over checklist. coordinator-deploy.md links to it. Refs DBLM-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Found 5 test failures on Blacksmith runners: Failures
|
Replace the copied row-scan loops in TestMigrationsLeaveLegacyDatabaseUnchanged with queryLines, and rename assertSameSchema to assertSameLines because it also compares row lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Takes the base's index-validity refactor and #1328's queryLines and assertSameLines migration test helpers. No conflicts; this branch adds index versions 19 and 20 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the goose migration runner onto the #1324 layout. - The runner moves to coordinator/store/postgres/migrations.go and replaces the boot-time statement slice there. The SQL baseline and the pg_dump move to coordinator/store/postgres/schema/. The baseline is unchanged: its 255 blocks equal, byte for byte, the statements that master's migrate executes on a fresh database (pgx trace of master and of the old merge base are identical). - The DDL constants that only the old slice used are deleted, including the internal cachemigrations package, privacysql and profilesql/schema.go; tests read those statements from the baseline. - The migration tests and their harness (baselineStatement, forgetMigrationVersions, replayMigrations, loadSchemaFile, schemaSnapshot, queryLines, assertSameLines) move to coordinator/tests/store/postgres/ and use NewPostgres through the fixture. TestConcurrentMigrationsApplyOnce now holds the goose advisory lock while two coordinators start, so it fails at once when the runner does not take the lock. - The DAR-349 dedupe guard also scans the SQL migrations. - Docs and the docs-impact rules use the new paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring in master's coordinator layout through the ported #1328 head. The sqlc layer moves next to the Postgres backend: sqlc.yaml, queries/ and the generated storedb package live in coordinator/store/postgres/, and the api_keys adapter replaces coordinator/store/postgres/apikey.go. storedb is regenerated with sqlc v1.31.1 and is byte-identical. TestAPIKeyLifecycleOnEveryBackend moves to coordinator/tests/store/contracts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Deployment failed for project darkbloom-status with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
jonathan308
left a comment
There was a problem hiding this comment.
No blocking findings at b08a7b7.
Read-only review covered the full diff and startup call paths, baseline/schema parity, version ordering/bootstrap, advisory locking, transaction boundaries, retries/idempotency, historical markers/backfills, concurrent-index validity, and rollback documentation, with three independent focused reviews. Existing exact-head CI and integration runs passed; the PostgreSQL 16 CI artifact confirms the migration/upgrade/concurrency/retry regressions passed. No builds, tests, migrations, or production queries were run during this review. PostgreSQL 17 validation is author-reported, not independently rerun.
Remaining evidence gaps: E2E Benchmarks is waiting; darkbloom-status preview failed for Vercel permissions; the advisory threat review is incomplete due to its spending limit. Lock-session loss during a separate Go-migration connection is not covered by the concurrency tests.
For the later ORM rollout, land and stabilize #1328 first and renumber stacked migrations after version 9. After soft-deleted duplicate identities are possible, require fallback application read/write compatibility as well as Goose boot compatibility; #1328's unfiltered identity reads alone are not a safe soft-delete fallback guarantee.
Brings in master through #1328 (goose migrations, store in store/postgres/), #1344, #1351, #1352 and others. Conflicts: - ci.yml (Report coverage): master inlined the empty-profile, coordinator-row and statement-format checks (#1252). This PR moved the same checks into scripts/coordinator-statement-coverage.sh, which ci.yml and integration.yml both call. Keep the script call. - docs/developer/test.md (coverage command): keep the script call. - docs/developer/test.md (CI workflow map): keep master's ci.yml row (adds the provider coverage table) and this PR's integration.yml row (adds the e2e coverage row and artifact). The #1284 store contract tests and coverage tests build and vet against master's store layout with no change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
The coordinator currently replays its schema DDL on every startup. This change uses numbered Goose migrations, records successful versions in
goose_db_version, and serializes pending upgrades with a PostgreSQL advisory lock. An unchanged database skips completed migrations on later starts.Required schema changes now fail closed: the baseline no longer catches every SQL exception. A refused or timed-out statement leaves that version pending and prevents startup from accepting an incomplete schema. Four pre-create
usagestatements retain only their necessaryundefined_tablehandling.Linear: DBLM-552.
Before
After
flowchart TD A["NewPostgres"] --> B["migrate / migrateOnce: Goose Provider.Up"] B --> C{"Pending versions?"} C -- "No" --> D["Serve requests"] C -- "Yes" --> E["Acquire advisory lock and recheck versions"] E --> F["Apply ordered SQL and Go migrations"] F -- "Success" --> G["Record completed version"] G --> D F -- "SQL lock timeout" --> H["Bounded retry; failed version stays pending"] H --> B F -- "Other error / retries exhausted" --> I["Return startup error"] classDef process fill:#dbeafe,stroke:#2563eb,color:#172554 classDef success fill:#dcfce7,stroke:#16a34a,color:#052e16 classDef failure fill:#fee2e2,stroke:#dc2626,color:#450a0a classDef retry fill:#fef3c7,stroke:#d97706,color:#451a03 class A,B,C,E,F process class D,G success class H retry class I failureBlue denotes control flow, green successful state, amber bounded retry, and red failure. The retry loop permits three total attempts; it does not repeat indefinitely.
Migration layout and compatibility
schema_migrationsretains its existing data-repair marker role. Goose uses a separate version table.coordinator --migrate-onlyremains available. No consumer API or provider protocol changes.Review and regression coverage
Fresh reviewers examined the full implementation and repository structure. A separate fresh refactor pass corrected documentation structure and ownership; no broad runtime rewrite was warranted. A fresh final reviewer then examined the complete integrated diff.
desired_modelsregistration frame before setting verified state, and the enrollment CLI expectation includes the current eligibility notice while retaining its process-exit and no-network assertions. Fresh refactor and correctness reviews cover these follow-up changes.Validation
All database validation used disposable local databases, never production.
make coordinator-testwith local PostgreSQL 16: complete coordinator suite and runner guards passed (112.7 seconds for the suite).make coordinator-build coordinator-build-linux: host and Linux/amd64 builds passed.golangci-lint run ./coordinator/...using v2.1.6 and Go 1.25.7: zero issues.--migrate-onlyalso passed during schema generation.python3 scripts/test-docs-impact-check.py: 13 tests passed.make docs-impact-check BASE=origin/master,make docs-check(337 files), and whole-PRgit diff --check: passed.go mod verify: all modules verified.Final-head remote validation: CI and Integration Tests passed for
b08a7b74ebc37d13dfdcf98f99442f3c6674eb72. Approval and gated benchmark status remain separate.Operational considerations
The first production cutover executes pending schema work and still needs the documented backup, lock inspection, schema verification, and separately approved deployment. Goose does not make DDL or index construction cost-free. No production database, service, or deployment was changed during this review.
There are no down migrations. Application rollback must follow the documented schema-compatibility rules; pre-Goose fallback images can replay legacy DDL. New schema changes belong in new numbered migrations, with the target schema snapshot regenerated afterward.