fix(db): preserve renamed migration compatibility - #959
Conversation
AmirF194
left a comment
There was a problem hiding this comment.
e2a-prober validate's own docstring says it checks "migrations applied", but it calls migrationsApplied(), which runs RunMigrations(ModeVerify). With this PR, ModeVerify hard-errors whenever migrationFilenameCompatibilityRepairs finds a current-only alias pair (migrate.go:192-197), even though the schema itself is fully migrated, just missing the defensive legacy tracker row.
ModeVerify never performs that repair, and none of e2a-prober's subcommands run ModeAuto, so validate has no way to clear this state by itself. Only cmd/e2a's own startup (default ModeAuto) resolves it. Meanwhile cmd/e2a's /readyz check, updated in this PR, is alias-aware via the ANY($1) query at readyz.go:293 and does not hit this.
Is the intent that e2a-prober validate only ever runs after cmd/e2a has started at least once at this version? If it can run first, for example as a manual check against a database migrated by an older binary, the error text "rollback compatibility repair pending" reads as a real migration gap when the schema is actually complete.
Summary
Follow-up to #958 for databases that already recorded the sending-protection migrations under their former filenames.
Verification
go test -p 1 ./...make test-integration