From 847964656a4b5c19c5b3410c9a01d1d63f8f2f88 Mon Sep 17 00:00:00 2001 From: Kpa-clawbot Date: Tue, 16 Jun 2026 19:18:02 +0000 Subject: [PATCH] chore(preflight): annotate small _async_migrations schema ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pr-preflight async-migration gate flags any new ALTER TABLE / CREATE TABLE in a migration-shaped file without an explicit annotation. Two sites are legitimately safe-at-scale but lacked the annotation: - cmd/ingestor/async_migration_progress.go ADD COLUMN on the bookkeeping table _async_migrations (single-digit rows; ADD COLUMN is O(rows)). - cmd/server/async_migrations_test.go CREATE TABLE on a fresh in-memory test DB (test setup, not a real schema migration). Annotation-only — no behavior change. Both call sites already had runtime safeguards (duplicate-column tolerance, test isolation). cross-stack: justified — annotations only; no functional change. PR #1735 already declares the frontend+backend coupling. --- cmd/ingestor/async_migration_progress.go | 1 + cmd/server/async_migrations_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/cmd/ingestor/async_migration_progress.go b/cmd/ingestor/async_migration_progress.go index 17ee349b..21721b0d 100644 --- a/cmd/ingestor/async_migration_progress.go +++ b/cmd/ingestor/async_migration_progress.go @@ -44,6 +44,7 @@ func ensureAsyncMigrationProgressColumns(db *sql.DB) error { {"last_update_at", "TEXT"}, } for _, c := range cols { + // PREFLIGHT: async=true reason="_async_migrations is the migration bookkeeping table itself — bounded to one row per known migration name (single-digit rows in practice, never grows with data). ALTER TABLE ADD COLUMN on this table is O(rows) and completes in microseconds even on prod-size DBs." _, err := db.Exec(fmt.Sprintf( `ALTER TABLE _async_migrations ADD COLUMN %s %s`, c.name, c.typ)) if err != nil && !isDuplicateColumnErr(err) { diff --git a/cmd/server/async_migrations_test.go b/cmd/server/async_migrations_test.go index 0a9c48eb..4a413da6 100644 --- a/cmd/server/async_migrations_test.go +++ b/cmd/server/async_migrations_test.go @@ -18,6 +18,7 @@ func openAsyncTestDB(t *testing.T) *sql.DB { t.Fatal(err) } t.Cleanup(func() { db.Close() }) + // PREFLIGHT: async=true reason="test fixture CREATE TABLE on a fresh in-memory SQLite DB — not a real schema migration; runs in test setup only." _, err = db.Exec(` CREATE TABLE _async_migrations ( name TEXT PRIMARY KEY,