fix(ci): reject unsafe boundary shard specs

This commit is contained in:
Vincent Koc
2026-06-16 23:46:37 +02:00
parent 5a251bc54c
commit 4747e949c7
2 changed files with 5 additions and 4 deletions

View File

@@ -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

View File

@@ -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", () => {