Repository navigation
test(purchase): hold back later migrations when staging 000127 - #1060
Conversation
stagedMigrations ran every migration but 000127 first, so any later migration (LeanerCloud#1020's 000128, LeanerCloud#1022's 000129) moved the schema past 127 and golang-migrate never applied it on the second run. Stage only migrations that sort before 000127 and add it together with every later one. Closes LeanerCloud#1059 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 1
✨ Finishing Touches
Comment |
Independent review verdict: CLEAN at 501f8d7Reviewer: fresh Claude agent (Sonnet 5.5, high effort), not the author, cold brief. The PR body and #1059 were treated as claims. Coordinator: claude-cc-reviewer. Blocking findings: none. Verified
Fail before / pass after. Run with Docker and
Other tests: no other test uses this staging pattern. Non-blocking: the Gate
Merge: the owner authorized the merge drivers to ready and merge drafts that meet the gate. This PR is p1, and it unblocks #1020 and #1022, so I am marking it ready and merging. |
Problem
TestMigration_NeverStartedLegacyRampsBecomeNew(from #905) stages every migration except000127_never_started_legacy_ramps_to_new, runs the migrator, then adds 000127 and runs it again. When a migration newer than 000127 exists, the first run already takes the schema past 127. golang-migrate never applies a version below the current one, so 000127 is skipped and the test fails:This is the Integration Tests failure on #1022 (000129). #1020 (000128) and every later migration would hit it too.
Fix
stagedMigrationsnow copies only the migrations that sort before 000127 (zero-padded prefixes sort in version order).addTargetthen copies 000127 and every later migration. The test still checks an upgrade from just before 000127 with the real runner, however many migrations follow. This is a test-only change.Closes #1059
Verification
Integration tests on testcontainers Postgres, run with
AWS_CONFIG_FILE=/dev/null:000999_tmp_probe(up/downSELECT 1;) and ran the test on the old helper. It fails with the sameexpected "new", actual "legacy"seen on fix(scheduler): record partial multi-subscription sweeps in collection state #1022.go vet -tags integration ./internal/purchase/and golangci-lint (--build-tags integration, 0 issues) are clean.Once this merges, #1020 and #1022 need
mainmerged in to pick it up.Please mirror the issue's labels: priority/p1, severity/medium, urgency/now, impact/few, effort/xs, type/bug.
🤖 Generated with Claude Code