Skip to content

fix(db): stop documenting 0090 as a grandfathered migration duplicate - #9832

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
shin-core:fix/check-migrations-0090-grandfather-9653-retry
Jul 29, 2026
Merged

fix(db): stop documenting 0090 as a grandfathered migration duplicate#9832
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
shin-core:fix/check-migrations-0090-grandfather-9653-retry

Conversation

@shin-core

Copy link
Copy Markdown
Contributor

What & why

KNOWN_MIGRATION_DUPLICATES (src/db/migration-collisions.ts) is already correct — 0090 is not a key, because #8897 renumbered 0090_pull_request_detail_sync_head_sha to 0092, leaving a single 0090_contributor_cap_label file at 0090. But scripts/check-migrations.ts's header still documented 0090 as a grandfathered duplicate and cross-referenced "same reasoning as 0074/0090", so a future reader could re-add the dead entry straight from git history.

The fix

Tests (test/unit/migration-collisions.test.ts)

Two guards so the header comment and the data can't silently diverge again:

  • Every filename in KNOWN_MIGRATION_DUPLICATES exists in the real migrations/ directory — a re-added 0090 entry (naming the renumbered-away file) fails this (verified by injecting one).
  • Every on-disk migration number with more than one file is a key of KNOWN_MIGRATION_DUPLICATES — the reverse direction, so a new un-grandfathered collision surfaces here, not only at premerge.

Validation

  • npm run db:migrations:check green; npm run typecheck green; the migration-collisions and check-migrations-script suites green.
  • scripts/** is outside Codecov's include, so the comment change carries no coverage obligation; the new tests import src/db/migration-collisions.ts, so coverage collection sees real src/** files.
  • git diff --check <base> HEAD clean; diff is two files, no src/** source or migration change.

Closes #9653

`KNOWN_MIGRATION_DUPLICATES` (src/db/migration-collisions.ts) is already correct —
0090 is not a key, because JSONbored#8897 renumbered 0090_pull_request_detail_sync_head_sha
to 0092, leaving a single 0090_contributor_cap_label file. But check-migrations.ts's
header still listed 0090 as a grandfathered duplicate and cross-referenced
"0074/0090", so a future reader could re-add the dead entry from git history.

Replace the 0090 bullet with a note that it was renumbered (not grandfathered) and
correct the 0156 cross-reference to name only real grandfathers (0074). No script
or KNOWN_MIGRATION_DUPLICATES behaviour change.

Add two guards so the header and the data cannot silently diverge again: every
filename in KNOWN_MIGRATION_DUPLICATES must exist in migrations/ (a re-added 0090
fails this), and every on-disk migration number with more than one file must be a
key (a new un-grandfathered collision fails this).

Closes JSONbored#9653
@shin-core
shin-core requested a review from JSONbored as a code owner July 29, 2026 12:22
@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-29 12:45:22 UTC

2 files · 1 AI reviewer · no blockers · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This is a narrow documentation-and-test PR: it corrects a stale comment block in scripts/check-migrations.ts that mislabeled migration 0090 as a grandfathered duplicate (it's actually a single file today, per #8897's renumbering), and adds two bidirectional guard tests to migration-collisions.test.ts so the comment and KNOWN_MIGRATION_DUPLICATES can't silently diverge again. No src/** production logic is touched, and the diff matches its stated intent and closes #9653. One thing I can't fully reconcile: the reference snapshot of src/db/migration-collisions.ts shown to me still lists `90` as a key with both filenames, which would fail the new `has(90)).toBe(false)` assertion — but CI passed on this commit, so I'm treating that reference snapshot as stale rather than a real contradiction in the PR itself.

Nits — 3 non-blocking
  • The bidirectional coverage test in test/unit/migration-collisions.test.ts (readdirSync("migrations")) assumes the test runner's cwd is the repo root — confirm that's guaranteed elsewhere in the suite rather than incidental.
  • The reverse-direction test duplicates the same group-by-number logic already in scripts/check-migrations.ts; consider extracting a shared helper if this pattern grows, though for two call sites it's fine as-is.
  • Consider a one-line comment cross-referencing fix(db): stale KNOWN_MIGRATION_DUPLICATES entry for migration 90 references a file that no longer exists #8897 directly next to the `has(90)` assertion in the test (as the header comment does) so a future reader hitting a failure has the same renumbering context without opening check-migrations.ts.

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 #9653
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 ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 63 registered-repo PR(s), 46 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor shin-core; Gittensor profile; 63 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR removes the stale 0090 grandfather bullet with an explanatory note about #8897's renumbering, corrects the 0156 cross-reference to name only 0074, and adds both required bidirectional guard tests (dead-entry check and reverse on-disk-collision check) mirroring the requested pattern without touching KNOWN_MIGRATION_DUPLICATES.

Review context
  • Author: shin-core
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is registered but has no active allocation in the current snapshot.
  • Public profile languages: not available
  • Official Gittensor activity: 63 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Await review-lane availability.
  • Then work through the remaining 2 steps in the Signals table above.
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

@superagent-security

Copy link
Copy Markdown
Contributor

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

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

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.59%. Comparing base (9d7f567) to head (4637c0c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9832   +/-   ##
=======================================
  Coverage   91.59%   91.59%           
=======================================
  Files         915      915           
  Lines      112700   112700           
  Branches    27077    27077           
=======================================
  Hits       103229   103229           
  Misses       8144     8144           
  Partials     1327     1327           
Flag Coverage Δ
backend 95.58% <ø> (ø)

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

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 1b3ca31 into JSONbored:main Jul 29, 2026
8 checks passed
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

db: check-migrations' grandfathered-duplicate list documents a 0090 collision that no longer

1 participant