Skip to content

fix(db): resolve migration number collision at 0131#4555

Closed
JSONbored wants to merge 2 commits into
mainfrom
fix/migration-0131-collision
Closed

fix(db): resolve migration number collision at 0131#4555
JSONbored wants to merge 2 commits into
mainfrom
fix/migration-0131-collision

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

db:migrations:check currently fails on main: two already-merged PRs each independently claimed migrations/0131

Both merged with the same number, so the sequence is no longer contiguous. This renumbers the more-recently-merged file (impact_map_query_cache, confirmed via git log) to 0133 — the next free slot — restoring a contiguous, collision-free sequence. No column/table/logic changes; a pure rename (git mv), and no test or source file references the old filename or number.

Discovered while working on an unrelated feature branch and fixed as its own small, dedicated change per repo convention (own commit for discovered drift, not folded into unrelated feature work).

Test plan

  • npm run db:migrations:check — now reports a clean, contiguous 0001..0133 sequence
  • npm run db:schema-drift:check — clean
  • npx tsc --noEmit — clean

Two already-merged PRs (#4544 impact-map query cache, #4545 screenshot-table
gate matrix) both claimed migrations/0131, so db:migrations:check fails on
main. Renumber the more-recently-merged file to 0133 (the next free slot,
since 0132 is claimed by an in-flight PR) to restore a contiguous sequence.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@0a7356d). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4555   +/-   ##
=======================================
  Coverage        ?   94.07%           
=======================================
  Files           ?      427           
  Lines           ?    37938           
  Branches        ?    13851           
=======================================
  Hits            ?    35692           
  Misses          ?     1586           
  Partials        ?      660           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The prior commit skipped straight to 0133, leaving a gap at 0132 -- CI
correctly caught it (db:migrations:check enforces a contiguous sequence with
no skipped numbers). 0132 is the actual next-free number in this branch
considered on its own.
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 10, 2026
@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-10 01:57:40 UTC

1 file · 1 AI reviewer · 3 blockers · readiness 93/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
  • Patch-less file(s) could not be fully scanned for secrets (1) — Ensure patch-less files are within scan limits or split the change so secrets can be verified.

Review summary
This is a narrow, well-justified maintenance fix: it renumbers migrations/0131_impact_map_query_cache.sql to migrations/0132_impact_map_query_cache.sql as a pure rename (0/-0 diff) to resolve the 0131 duplicate-number collision left by two independently-merged PRs (#4544, #4545), keeping the screenshot-table-gate-matrix migration at 0131. The migration content itself (CREATE TABLE IF NOT EXISTS) is unchanged and idempotent, which is what makes this rename safe even if the old-named file was already applied remotely. One inconsistency stands out: the PR description claims the file was renumbered 'to 0133 — the next free slot,' but the actual diff renames it to 0132 — worth a clarifying comment, though it doesn't change the correctness of the diff itself.

Nits — 6 non-blocking
  • The PR description says the file was renumbered 'to 0133' but migrations/0132_impact_map_query_cache.sql is the actual filename in the diff — please fix the description or confirm 0132 vs 0133 is intentional so reviewers aren't second-guessing which number is authoritative.
  • Per the schema-migrations convention, renaming an already-applied migration is normally unsafe because D1's ledger tracks applied migrations by filename — please confirm whether 0131_impact_map_query_cache.sql had already been deployed/applied to remote D1 before this rename; if so, note in the PR that the table's `CREATE TABLE IF NOT EXISTS` guard is what makes the re-application safe (an orphaned '0131_impact_map_query_cache.sql' ledger entry will remain on already-deployed environments, but no runtime break).
  • No linked/eligible open issue is referenced in the description — for narrow drift-fix housekeeping like this it's less critical than for feature work, but per repo convention it'd help to link the collision to an issue (or confirm this falls under maintainer-authorized drift-fix exception).
  • Add a one-line note in the PR description confirming whether 0131_impact_map_query_cache.sql was already applied to production D1, to preempt the 'never edit an applied migration' concern.
  • Reconcile the '0133' vs '0132' text in the description before merge so the history/changelog is accurate.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
  • Patch-less file(s) could not be fully scanned for secrets (1) — Ensure patch-less files are within scan limits or split the change so secrets can be verified.
Signal Result Evidence
Code review ❌ 3 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 48 registered-repo PR(s), 40 merged, 347 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 48 PR(s), 347 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 48 PR(s), 347 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 10, 2026
@JSONbored

Copy link
Copy Markdown
Owner Author

Superseded by #4554, which merged the identical fix (renumbering migrations/0131_impact_map_query_cache.sql -> 0132_impact_map_query_cache.sql) before this PR did. This branch is now stale against main and would have no effect (or regress newer migrations) if merged. Closing.

@JSONbored JSONbored closed this Jul 10, 2026
@JSONbored
JSONbored deleted the fix/migration-0131-collision branch July 19, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant