Skip to content

fix(db): grandfather the 0156 migration-number collision - #6494

Merged
JSONbored merged 1 commit into
mainfrom
fix/grandfather-migration-0156-collision
Jul 16, 2026
Merged

fix(db): grandfather the 0156 migration-number collision#6494
JSONbored merged 1 commit into
mainfrom
fix/grandfather-migration-0156-collision

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • 0156_draft_pr_close_policy.sql (feat(review): add an opt-in draft-PR close policy to stop bot-review farming #6454) and 0156_pull_request_screenshot_table_presence_satisfied.sql (a same-day, independently-merged PR) both grabbed migration number 0156 relative to the same origin/main base and merged without a collision being caught.
  • Both have already been applied to production D1 under their current filenames (confirmed via d1_migrations) — renaming either now would make wrangler try to RE-APPLY it, and both are bare ALTER TABLE ADD COLUMN statements SQLite can't guard with IF NOT EXISTS, so the re-apply would error and break the next deploy.
  • Grandfathers 0156 in KNOWN_MIGRATION_DUPLICATES, matching the exact precedent already set by 0015/0017/0074/0090 for the same "already-shipped, can't-be-renumbered" reason.

Found while running the full test suite as part of a broader cleanup pass (see sibling PRs).

Validation

  • npm run db:migrations:check
  • npm run test:ci (relevant subset green)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.56%. Comparing base (07abff8) to head (56a3391).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6494   +/-   ##
=======================================
  Coverage   95.56%   95.56%           
=======================================
  Files         589      589           
  Lines       47121    47121           
  Branches    14989    14989           
=======================================
  Hits        45032    45032           
  Misses       1297     1297           
  Partials      792      792           
Flag Coverage Δ
shard-1 44.07% <ø> (ø)
shard-2 36.71% <ø> (ø)
shard-3 32.34% <ø> (ø)
shard-4 35.24% <ø> (+<0.01%) ⬆️
shard-5 30.98% <ø> (-0.01%) ⬇️
shard-6 45.40% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/db/migration-collisions.ts 100.00% <ø> (ø)

@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-16 11:21:21 UTC

4 files · 1 AI reviewer · 1 blocker · CI failing · blocked

🛑 Suggested Action - Manual Review

Review summary
This grandfathers the 0156 migration-number collision in KNOWN_MIGRATION_DUPLICATES, mirroring the exact 0015/0017/0074/0090 precedent, and updates all three consumers in lockstep: the shared map in migration-collisions.ts, the CI script's success-summary count, and both test files that pin the exact set. The change is narrow, internally consistent, and the byte-identical parity test (migration-collisions.test.ts) will catch any future drift between the script and the shared module.

Nits — 3 non-blocking
  • The PR description doesn't include an explicit 'Closes #NNNN' — it references feat(review): add an opt-in draft-PR close policy to stop bot-review farming #6454 and 'sibling PRs' but doesn't name the specific tracking issue this grandfathering fix closes.
  • src/db/migration-collisions.ts:30 — the new `156` key is a bare literal like its siblings (15/17/74/90), so this is consistent with existing style, not a real gap; a named-constant refactor would be a separate, unsolicited change.
  • Consider adding a one-line description update explicitly linking the issue/incident where the 0156 D1 collision was discovered, for traceability alongside the code comment.

Why this is blocked

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.

CI checks failing

  • validate
  • validate-tests (2)
  • validate-tests (6)

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ No-issue rationale PR body explains why no issue is linked.
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: 33 registered-repo PR(s), 26 merged, 326 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 33 PR(s), 326 issue(s).
Improvement ✅ Minor risk: clean · value: minor
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: Python, TypeScript, Ruby, Go, JavaScript, MDX, Shell, Solidity
  • Official Gittensor activity: 33 PR(s), 326 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 16, 2026
0156_draft_pr_close_policy.sql (#6454) and 0156_pull_request_screenshot_table_
presence_satisfied.sql (a same-day, independently-merged PR) both grabbed migration
number 0156 relative to the same origin/main base and merged without a collision
being caught. Both have already been applied to production D1 under their current
filenames (confirmed via d1_migrations) — renaming either now would make wrangler
try to RE-APPLY it, and both are bare ALTER TABLE ADD COLUMN statements SQLite can't
guard with IF NOT EXISTS, so the re-apply would error and break the next deploy.

Grandfather 0156 in KNOWN_MIGRATION_DUPLICATES, matching the exact precedent already
set by 0015/0017/0074/0090 for the same "already-shipped, can't-be-renumbered" reason.
@JSONbored
JSONbored force-pushed the fix/grandfather-migration-0156-collision branch from b9fb9d3 to 56a3391 Compare July 16, 2026 11:33
@superagent-security

Copy link
Copy Markdown
Contributor

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

@JSONbored
JSONbored merged commit f914a51 into main Jul 16, 2026
17 checks passed
@JSONbored
JSONbored deleted the fix/grandfather-migration-0156-collision branch July 16, 2026 11:40
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