diff --git a/scripts/run-additional-boundary-checks.mjs b/scripts/run-additional-boundary-checks.mjs index 097adada7039..6e22195feac9 100644 --- a/scripts/run-additional-boundary-checks.mjs +++ b/scripts/run-additional-boundary-checks.mjs @@ -105,11 +105,11 @@ export function parseShardSpec(value) { if (!match) { throw new Error(`Invalid shard spec '${value}' (expected N/TOTAL)`); } - const index = Number.parseInt(match[1], 10); - const count = Number.parseInt(match[2], 10); + const index = Number(match[1]); + const count = Number(match[2]); if ( - !Number.isInteger(index) || - !Number.isInteger(count) || + !Number.isSafeInteger(index) || + !Number.isSafeInteger(count) || index < 1 || count < 1 || index > count diff --git a/test/scripts/run-additional-boundary-checks.test.ts b/test/scripts/run-additional-boundary-checks.test.ts index 9aa3abf0b89a..6efcf60806ba 100644 --- a/test/scripts/run-additional-boundary-checks.test.ts +++ b/test/scripts/run-additional-boundary-checks.test.ts @@ -91,6 +91,7 @@ describe("run-additional-boundary-checks", () => { ); expect(new Set(shardedLabels).size).toBe(BOUNDARY_CHECKS.length); expect(() => parseShardSpec("5/4")).toThrow("Invalid shard spec"); + expect(() => parseShardSpec("9007199254740993/9007199254740994")).toThrow("Invalid shard spec"); }); it("keeps the raw HTTP/2 import guard in source boundary checks", () => {