Skip to content

Fix duplicate migration 000036: renumber stashes to 000037 - #977

Merged
keyxmakerx merged 1 commit into
mainfrom
claude/project-thread-7x37z4
Oct 3, 2026
Merged

keyxmakerx merged 1 commit into
mainfrom
claude/project-thread-7x37z4

Conversation

@keyxmakerx

Copy link
Copy Markdown
Owner

Requested by Key Maker · project thread

Fixes: none
Security implication: none (migration file renumber only)
Consumer-verified: n/a
Mockup: n/a

What this changes

Before: #969 (000036_campaign_book_edits) and #974 (000036_stashes) both merged with core migration number 36. Main fails TestMigrations_GaplessSequence (full sequence: [... 35 36 36]), and golang-migrate refuses two migrations with one version, so a server built from main would not migrate.

After: the stashes migration is 000037_stashes and ExpectedCoreMigrationVersion is 37. File contents are unchanged.

Why

The two PRs were open at the same time and each took the next free number. Renumbering is safe because neither migration has been applied anywhere (nothing deployed since they merged). Merge this before deploying.

Test plan

  • Reproduced on main: go test -short ./internal/database/ fails TestMigrations_GaplessSequence
  • With this change: go test -short ./internal/database/ ok
  • CHRONICLE_TEST_DB_DSN='root@tcp(127.0.0.1:13306)/' go test ./internal/database/ ./cmd/...: ok (fresh-DB replay in cmd/server included)
  • go build ./...
  • CI passes

Tenet self-check

  • T-B1 security: n/a
  • T-B2 plugin isolation: n/a
  • T-B3 production UI: n/a
  • T-B4 docs: n/a

🤖 Generated with Claude Code

https://claude.ai/code/session_01W8zrackYDNg1g6gV6czVhv


Generated by Claude Code

#969 and #974 both added core migration 000036 and merged together, so
main has two migrations with one number: TestMigrations_GaplessSequence
fails and golang-migrate refuses a duplicate version. The stashes tables
move to 000037; neither migration has been applied anywhere yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8zrackYDNg1g6gV6czVhv

Copy link
Copy Markdown
Owner Author

Build & Test is red on purpose-built grounds: the migration immutability guard. tools/check-migration-immutability.sh fails any PR that deletes a migration file present on main, and renumbering 000036_stashes to 000037_stashes shows up as a delete. The guard has no override.

The guard protects databases that may already have applied the migration. That can't be the case here. Main currently has two migrations numbered 36 (000036_campaign_book_edits from #969 and 000036_stashes from #974). golang-migrate refuses a duplicate version, so no server built from main since those merges can have applied either file.

Options:

  1. Merge this PR with the guard check red. It is diff-scoped, so other PRs are unaffected afterwards. This is my recommendation.
  2. Add a one-time allowance for this file to the guard. I haven't done that, because it would mean a PR loosening its own safety check without the operator's say-so.

Steps after the guard did not run in CI. Locally, go test -short ./internal/database/ and the fresh-DB replay (go test ./cmd/server against MariaDB) pass with this change and fail on main.


Generated by Claude Code

keyxmakerx pushed a commit that referenced this pull request Oct 3, 2026
Main carries two core migrations numbered 000036, which fails the gapless
check and the fresh-database replay. Same change as #977 (stashes renumbered
to 000037); it becomes a no-op once #977 merges.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LRXHkzaU3FMF7PAvtf2Lse
@keyxmakerx
keyxmakerx marked this pull request as ready for review October 3, 2026 05:16
@keyxmakerx
keyxmakerx merged commit 4bb3644 into main Oct 3, 2026
9 of 10 checks passed
@keyxmakerx
keyxmakerx deleted the claude/project-thread-7x37z4 branch October 3, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants