Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/openworkflow/worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,17 @@
maximumAttempts: 3,
});
});

test("falls back to defaults for invalid runtime values", () => {
const result = resolveRetryPolicy({
maximumAttempts: Number.NaN,
backoffCoefficient: -1,
initialInterval: "-1s" as "1s",
maximumInterval: "invalid" as "1s",
});

expect(result).toEqual(DEFAULT_WORKFLOW_RETRY_POLICY);

Check failure on line 1828 in packages/openworkflow/worker.test.ts

View workflow job for this annotation

GitHub Actions / ci

packages/openworkflow/worker.test.ts > resolveRetryPolicy > falls back to defaults for invalid runtime values

AssertionError: expected { initialInterval: '-1s', …(3) } to deeply equal { initialInterval: '1s', …(3) } - Expected + Received { - "backoffCoefficient": 2, - "initialInterval": "1s", - "maximumAttempts": 1, - "maximumInterval": "100s", + "backoffCoefficient": -1, + "initialInterval": "-1s", + "maximumAttempts": NaN, + "maximumInterval": "invalid", } ❯ packages/openworkflow/worker.test.ts:1828:20

Check failure on line 1828 in packages/openworkflow/worker.test.ts

View workflow job for this annotation

GitHub Actions / ci-bun

packages/openworkflow/worker.test.ts > resolveRetryPolicy > falls back to defaults for invalid runtime values

AssertionError: expected { initialInterval: '-1s', …(3) } to deeply equal { initialInterval: '1s', …(3) } - Expected + Received { - "backoffCoefficient": 2, - "initialInterval": "1s", - "maximumAttempts": 1, - "maximumInterval": "100s", + "backoffCoefficient": -1, + "initialInterval": "-1s", + "maximumAttempts": NaN, + "maximumInterval": "invalid", } ❯ packages/openworkflow/worker.test.ts:1828:20
});
Comment on lines +1819 to +1829
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test expects resolveRetryPolicy to validate and reject invalid runtime values (NaN, negative numbers, invalid duration strings), but the current implementation (worker.ts:324-329) simply spreads the partial object over defaults without validation. This means invalid values like Number.NaN, -1, "-1s", and "invalid" will be included in the result, causing the test to fail. The implementation needs to be updated to validate each field and fall back to defaults for invalid values, or this test should be removed/modified to match the actual behavior.

Suggested change
test("falls back to defaults for invalid runtime values", () => {
const result = resolveRetryPolicy({
maximumAttempts: Number.NaN,
backoffCoefficient: -1,
initialInterval: "-1s" as "1s",
maximumInterval: "invalid" as "1s",
});
expect(result).toEqual(DEFAULT_WORKFLOW_RETRY_POLICY);
});

Copilot uses AI. Check for mistakes.
});

async function createBackend(): Promise<BackendPostgres> {
Expand Down
Loading