fix(release): bound cross-os discord fetches

This commit is contained in:
Vincent Koc
2026-06-03 08:29:08 +02:00
parent ed4c4afc0f
commit 2c92973398
3 changed files with 57 additions and 20 deletions

View File

@@ -20,6 +20,7 @@ import {
agentOutputHasExpectedOkMarker,
agentTurnUsedEmbeddedFallback,
buildCrossOsReleaseSmokePluginAllowlist,
buildDiscordFetchInit,
buildPackagedUpgradeUpdateArgs,
buildReleaseOnboardArgs,
buildWindowsDevUpdateToolchainCheckScript,
@@ -41,6 +42,7 @@ import {
CROSS_OS_WINDOWS_PACKAGED_UPGRADE_WRAPPER_TIMEOUT_MS,
CROSS_OS_DASHBOARD_FETCH_TIMEOUT_MS,
CROSS_OS_DASHBOARD_SMOKE_TIMEOUT_MS,
CROSS_OS_DISCORD_FETCH_TIMEOUT_MS,
CROSS_OS_AGENT_TURN_TIMEOUT_SECONDS,
CROSS_OS_COMMAND_HEARTBEAT_SECONDS,
isImmutableReleaseRef,
@@ -204,9 +206,7 @@ describe("scripts/openclaw-cross-os-release-checks", () => {
});
it("rejects malformed cross-OS positive integer environment values", () => {
expect(parsePositiveIntegerEnv("OPENCLAW_CROSS_OS_COMMAND_HEARTBEAT_SECONDS", 60, {})).toBe(
60,
);
expect(parsePositiveIntegerEnv("OPENCLAW_CROSS_OS_COMMAND_HEARTBEAT_SECONDS", 60, {})).toBe(60);
expect(
parsePositiveIntegerEnv("OPENCLAW_CROSS_OS_COMMAND_HEARTBEAT_SECONDS", 60, {
OPENCLAW_CROSS_OS_COMMAND_HEARTBEAT_SECONDS: "25",
@@ -1215,6 +1215,28 @@ describe("scripts/openclaw-cross-os-release-checks", () => {
});
});
it("bounds Discord API calls with a timeout signal", () => {
expect(CROSS_OS_DISCORD_FETCH_TIMEOUT_MS).toBeGreaterThanOrEqual(10_000);
const init = buildDiscordFetchInit("discord-token", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: "{}",
});
expect(init).toMatchObject({
method: "POST",
body: "{}",
headers: {
Authorization: "Bot discord-token",
"Content-Type": "application/json",
},
});
expect(init.signal).toBeInstanceOf(AbortSignal);
});
it("keeps the dev-update lane for main only", () => {
expect(shouldRunMainChannelDevUpdate("main")).toBe(true);
expect(shouldRunMainChannelDevUpdate("08753a1d793c040b101c8a26c43445dbbab14995")).toBe(false);