From b080e9838871532b975ed24e5eff81c172f4e2fa Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 14 Oct 2026 14:03:53 +0000 Subject: [PATCH] Exclude seeded account revision from migration target occupancy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: U3 seeds a directory revision in every new target database, which made an empty PostgreSQL target look occupied to the migration guard. Evidence: Isolated PostgreSQL cmd/storage-migrate integration tests passed after the previously failing cases reproduced the error. Impact: A fresh target remains eligible for migration; existing business rows and foreign migration identities still block it. Refs: IAM U3 Stage 7; docs/proposals/2026-10-14-iam-u3-account-contract-and-plan.md ยง10 --- cmd/storage-migrate/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/storage-migrate/main.go b/cmd/storage-migrate/main.go index 496e5f7..84543fc 100644 --- a/cmd/storage-migrate/main.go +++ b/cmd/storage-migrate/main.go @@ -451,6 +451,11 @@ func guardIdentity(db *sql.DB, migrationID, snapID string, srcVersion int) error func businessRows(db *sql.DB) (int64, error) { var total int64 for _, t := range copyOrder { + // Schema setup seeds this singleton before a migration starts. It is + // replaced from the source during copying and is not target business data. + if t == "account_directory_revision" { + continue + } var n int64 if err := db.QueryRow(`SELECT COUNT(*) FROM "` + t + `"`).Scan(&n); err != nil { if strings.Contains(err.Error(), "does not exist") {