From 436460b25089f08ae2454455090d2bd899f52bcb Mon Sep 17 00:00:00 2001 From: ghost <49853598+JSONbored@users.noreply.github.com> Date: Fri, 26 Jun 2026 16:37:22 -0700 Subject: [PATCH] fix(migrations): report all grandfathered duplicates --- scripts/check-migrations.mjs | 5 ++++- test/unit/check-migrations-script.test.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/unit/check-migrations-script.test.ts diff --git a/scripts/check-migrations.mjs b/scripts/check-migrations.mjs index 8b62f65366..f8d5862ba0 100644 --- a/scripts/check-migrations.mjs +++ b/scripts/check-migrations.mjs @@ -76,4 +76,7 @@ for (let i = 1; i < numbers.length; i += 1) { const first = String(numbers[0]).padStart(4, "0"); const last = String(numbers.at(-1)).padStart(4, "0"); -process.stdout.write(`check-migrations: ${files.length} migrations OK — contiguous ${first}..${last} (2 grandfathered duplicates: 0015, 0017), no new duplicates. Next free: ${nextFree()}\n`); +const grandfatheredNumbers = [...KNOWN_DUPLICATES.keys()] + .sort((a, b) => a - b) + .map((number) => String(number).padStart(4, "0")); +process.stdout.write(`check-migrations: ${files.length} migrations OK — contiguous ${first}..${last} (${grandfatheredNumbers.length} grandfathered duplicates: ${grandfatheredNumbers.join(", ")}), no new duplicates. Next free: ${nextFree()}\n`); diff --git a/test/unit/check-migrations-script.test.ts b/test/unit/check-migrations-script.test.ts new file mode 100644 index 0000000000..f91e7c7d2d --- /dev/null +++ b/test/unit/check-migrations-script.test.ts @@ -0,0 +1,10 @@ +import { execFileSync } from "node:child_process"; +import { describe, expect, it } from "vitest"; + +describe("check-migrations script", () => { + it("reports every grandfathered duplicate migration number in the success summary", () => { + const output = execFileSync(process.execPath, ["scripts/check-migrations.mjs"], { encoding: "utf8" }); + + expect(output).toContain("(3 grandfathered duplicates: 0015, 0017, 0074)"); + }); +});