Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/db/migration-collisions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const KNOWN_MIGRATION_DUPLICATES: ReadonlyMap<number, ReadonlySet<string>
[15, new Set(["0015_github_agent_command_feedback.sql", "0015_product_usage_events.sql"])],
[17, new Set(["0017_agent_recommendation_outcomes.sql", "0017_product_usage_role_retention_rollups.sql"])],
[74, new Set(["0074_ai_review_cache.sql", "0074_orb_self_enrollment_disabled.sql"])],
[90, new Set(["0090_contributor_cap_label.sql", "0090_pull_request_detail_sync_head_sha.sql"])],
// #8897: 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 — a single file, no real collision, so no entry here.
[156, new Set(["0156_draft_pr_close_policy.sql", "0156_pull_request_screenshot_table_presence_satisfied.sql"])],
]);

Expand Down
2 changes: 1 addition & 1 deletion test/unit/check-migrations-script.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("check-migrations script", () => {
it("reports every grandfathered duplicate migration number in the success summary", () => {
const output = execFileSync(TSX_BIN, ["scripts/check-migrations.ts"], { encoding: "utf8" });

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

it.each([
Expand Down
13 changes: 11 additions & 2 deletions test/unit/migration-collisions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,19 @@ describe("KNOWN_MIGRATION_DUPLICATES (#2550)", () => {
it("stays byte-identical to scripts/check-migrations.ts's grandfathered list", () => {
// A drift here would mean the CI script and the live premerge recheck disagree about what's grandfathered
// — this pins the exact set so a future addition to one side without the other is caught immediately.
expect([...KNOWN_MIGRATION_DUPLICATES.keys()].sort((a, b) => a - b)).toEqual([15, 17, 74, 90, 156]);
expect(KNOWN_MIGRATION_DUPLICATES.get(90)).toEqual(new Set(["0090_contributor_cap_label.sql", "0090_pull_request_detail_sync_head_sha.sql"]));
expect([...KNOWN_MIGRATION_DUPLICATES.keys()].sort((a, b) => a - b)).toEqual([15, 17, 74, 156]);
expect(KNOWN_MIGRATION_DUPLICATES.get(156)).toEqual(
new Set(["0156_draft_pr_close_policy.sql", "0156_pull_request_screenshot_table_presence_satisfied.sql"]),
);
});

it("no longer grandfathers migration 90 — only 0090_contributor_cap_label.sql exists there (#8897)", () => {
// 0090_pull_request_detail_sync_head_sha.sql was renumbered to 0092, so 0090 is a single-file number now.
expect(KNOWN_MIGRATION_DUPLICATES.has(90)).toBe(false);
// detectMigrationCollisions is unaffected: a single real file at 0090 is not a collision, with or without a
// grandfather entry (the guard only consults the list when files.length > 1).
expect(detectMigrationCollisions(["0090_contributor_cap_label.sql"], KNOWN_MIGRATION_DUPLICATES)).toEqual([]);
// And the renumbered file at its new number is likewise a lone, non-colliding entry.
expect(detectMigrationCollisions(["0092_pull_request_detail_sync_head_sha.sql"], KNOWN_MIGRATION_DUPLICATES)).toEqual([]);
});
});
Loading