Skip to content

Commit 9df67ed

Browse files
kai392RealDiligentclaude
authored
fix(db): drop the stale migration-90 grandfather entry (its second file was renumbered to 0092) (#9099)
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 #8897 Co-authored-by: RealDiligent <brave.challenge007@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3c1173e commit 9df67ed

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/db/migration-collisions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export const KNOWN_MIGRATION_DUPLICATES: ReadonlyMap<number, ReadonlySet<string>
2626
[15, new Set(["0015_github_agent_command_feedback.sql", "0015_product_usage_events.sql"])],
2727
[17, new Set(["0017_agent_recommendation_outcomes.sql", "0017_product_usage_role_retention_rollups.sql"])],
2828
[74, new Set(["0074_ai_review_cache.sql", "0074_orb_self_enrollment_disabled.sql"])],
29-
[90, new Set(["0090_contributor_cap_label.sql", "0090_pull_request_detail_sync_head_sha.sql"])],
29+
// #8897: 0090_pull_request_detail_sync_head_sha.sql was later renumbered to migrations/0092_*, so only
30+
// 0090_contributor_cap_label.sql exists at 0090 today — a single file, no real collision, so no entry here.
3031
[156, new Set(["0156_draft_pr_close_policy.sql", "0156_pull_request_screenshot_table_presence_satisfied.sql"])],
3132
]);
3233

test/unit/check-migrations-script.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("check-migrations script", () => {
3737
it("reports every grandfathered duplicate migration number in the success summary", () => {
3838
const output = execFileSync(TSX_BIN, ["scripts/check-migrations.ts"], { encoding: "utf8" });
3939

40-
expect(output).toContain("(5 grandfathered duplicates: 0015, 0017, 0074, 0090, 0156)");
40+
expect(output).toContain("(4 grandfathered duplicates: 0015, 0017, 0074, 0156)");
4141
});
4242

4343
it.each([

test/unit/migration-collisions.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,19 @@ describe("KNOWN_MIGRATION_DUPLICATES (#2550)", () => {
7575
it("stays byte-identical to scripts/check-migrations.ts's grandfathered list", () => {
7676
// A drift here would mean the CI script and the live premerge recheck disagree about what's grandfathered
7777
// — this pins the exact set so a future addition to one side without the other is caught immediately.
78-
expect([...KNOWN_MIGRATION_DUPLICATES.keys()].sort((a, b) => a - b)).toEqual([15, 17, 74, 90, 156]);
79-
expect(KNOWN_MIGRATION_DUPLICATES.get(90)).toEqual(new Set(["0090_contributor_cap_label.sql", "0090_pull_request_detail_sync_head_sha.sql"]));
78+
expect([...KNOWN_MIGRATION_DUPLICATES.keys()].sort((a, b) => a - b)).toEqual([15, 17, 74, 156]);
8079
expect(KNOWN_MIGRATION_DUPLICATES.get(156)).toEqual(
8180
new Set(["0156_draft_pr_close_policy.sql", "0156_pull_request_screenshot_table_presence_satisfied.sql"]),
8281
);
8382
});
83+
84+
it("no longer grandfathers migration 90 — only 0090_contributor_cap_label.sql exists there (#8897)", () => {
85+
// 0090_pull_request_detail_sync_head_sha.sql was renumbered to 0092, so 0090 is a single-file number now.
86+
expect(KNOWN_MIGRATION_DUPLICATES.has(90)).toBe(false);
87+
// detectMigrationCollisions is unaffected: a single real file at 0090 is not a collision, with or without a
88+
// grandfather entry (the guard only consults the list when files.length > 1).
89+
expect(detectMigrationCollisions(["0090_contributor_cap_label.sql"], KNOWN_MIGRATION_DUPLICATES)).toEqual([]);
90+
// And the renumbered file at its new number is likewise a lone, non-colliding entry.
91+
expect(detectMigrationCollisions(["0092_pull_request_detail_sync_head_sha.sql"], KNOWN_MIGRATION_DUPLICATES)).toEqual([]);
92+
});
8493
});

0 commit comments

Comments
 (0)