mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-08 02:52:15 +00:00
fix(ci): reject unsafe boundary shard specs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user