Skip to content

fix(db): drop the stale migration-90 grandfather entry (its second file was renumbered to 0092) - #9010

Closed
kai392 wants to merge 1 commit into
JSONbored:mainfrom
kai392:fix/critical-issue-migration90-grandfather
Closed

fix(db): drop the stale migration-90 grandfather entry (its second file was renumbered to 0092)#9010
kai392 wants to merge 1 commit into
JSONbored:mainfrom
kai392:fix/critical-issue-migration90-grandfather

Conversation

@kai392

@kai392 kai392 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

KNOWN_MIGRATION_DUPLICATES's [90, {0090_contributor_cap_label.sql, 0090_pull_request_detail_sync_head_sha.sql}]
entry is stale: 0090_pull_request_detail_sync_head_sha.sql was later renumbered to migrations/0092_*,
so only 0090_contributor_cap_label.sql exists at 0090 today. detectMigrationCollisions only consults
the list when a number has >1 file, so this changes no behavior — but it's factually wrong about what's
grandfathered.

  • Removes the [90, …] entry (check-migrations.ts imports this same constant, so both stay in lockstep).
  • Updates the two tests that pin the grandfather set: migration-collisions.test.ts (keys [15,17,74,156],
    plus a new assertion that 90 is no longer grandfathered and 0090's single file is not a collision) and
    check-migrations-script.test.ts (the success summary now reports 4 grandfathered duplicates: 0015, 0017, 0074, 0156).

The four remaining entries (15, 17, 74, 156) all still reference real duplicate files at those numbers.

Test plan

  • npm run db:migrations:check184 migrations OK — contiguous 0001..0180 (4 grandfathered duplicates: 0015, 0017, 0074, 0156)
  • npx vitest run test/unit/migration-collisions.test.ts — 15/15 pass; tsc --noEmit clean
  • Verified no other test/script references the old count/list (grep repo-wide)

Closes #8897

@kai392
kai392 requested a review from JSONbored as a code owner July 26, 2026 15:54
…le was renumbered to 0092)

KNOWN_MIGRATION_DUPLICATES's [90, {0090_contributor_cap_label.sql, 0090_pull_request_detail_sync_head_sha.sql}]
entry is stale: 0090_pull_request_detail_sync_head_sha.sql was later renumbered to 0092, so only
0090_contributor_cap_label.sql exists at 0090 today. detectMigrationCollisions only consults the list when a
number has >1 file, so this changes no behavior — but it's factually wrong about what's grandfathered. Remove
the entry (check-migrations.ts imports this same constant, so both stay in lockstep) and update the pinning
test; the four remaining entries (15, 17, 74, 156) all still reference real duplicate files.

Closes JSONbored#8897

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.56%. Comparing base (2f7104e) to head (2102a52).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9010      +/-   ##
==========================================
- Coverage   93.88%   90.56%   -3.32%     
==========================================
  Files         809       97     -712     
  Lines       80563    22510   -58053     
  Branches    24441     3889   -20552     
==========================================
- Hits        75638    20387   -55251     
+ Misses       3560     1945    -1615     
+ Partials     1365      178    -1187     
Flag Coverage Δ
backend 100.00% <ø> (+4.82%) ⬆️

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% <ø> (ø)

... and 712 files with indirect coverage changes

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

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-26 16:03:16 UTC

3 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This removes the stale [90, …] grandfather entry from KNOWN_MIGRATION_DUPLICATES now that 0090_pull_request_detail_sync_head_sha.sql was renumbered to 0092, and updates the two tests that pin the exact grandfathered set (key list and CLI summary text) plus adds a regression test asserting 90 is no longer grandfathered and that both the surviving 0090 file and the renumbered 0092 file are non-colliding singletons. The change is behaviorally inert as claimed — detectMigrationCollisions only consults the map when files.length > 1, so a single real file at 0090 was never going to collide with or without the entry — and the diff is fully consistent with itself: migration-collisions.ts, both test files, and the PR's own reported check-migrations output ("4 grandfathered duplicates: 0015, 0017, 0074, 0156") all agree.

Nits — 3 non-blocking
  • scripts/check-migrations.ts's header comment block (shown in the reference context, not touched by this diff) still describes 0090 as a two-file grandfathered pair with the old feat(agent-actions): auto-close a contributor's PR over the open-PR cap (#2270) #2479/fix(selfhost): cap historical PR file hydration and cache by head SHA #2527 rationale — since this PR is specifically about correcting that staleness and both files consume the same KNOWN_MIGRATION_DUPLICATES constant, leaving that comment unretouched will re-confuse the next reader; a one-line follow-up removing/updating the 0090 bullet there would keep the two files' commentary as in sync as their code now is.
  • The new test in migration-collisions.test.ts hardcodes the literal filename "0092_pull_request_detail_sync_head_sha.sql" rather than importing/asserting against an actual migrations/ directory listing, so if that file is ever renamed again this test won't catch the drift — acceptable for a unit test but worth knowing it's not a live filesystem check.
  • Consider updating scripts/check-migrations.ts's KNOWN_MIGRATION_DUPLICATES header comment (the 0090 bullet) in the same PR so the rationale text and the actual map stay aligned, per file:migration-collisions.ts's own stated goal of keeping the two in lockstep.

CI checks failing

  • validate
  • validate-code

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8897
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 130 registered-repo PR(s), 67 merged, 6 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kai392; Gittensor profile; 130 PR(s), 6 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff removes the stale [90, ...] entry from KNOWN_MIGRATION_DUPLICATES and adds a test explicitly verifying migration 90 is no longer grandfathered and that detectMigrationCollisions reports no collision for the single real 0090 file, matching the issue's requirements.

Review context
  • Author: kai392
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Cuda, JavaScript, Kotlin, Perl, TypeScript, Vue
  • Official Gittensor activity: 130 PR(s), 6 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing CI, closing.

@JSONbored JSONbored closed this Jul 26, 2026
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.

fix(db): stale KNOWN_MIGRATION_DUPLICATES entry for migration 90 references a file that no longer exists

3 participants