Skip to content

Comments

Add test for retry policy falling back to defaults for invalid values#306

Merged
jamescmartinez merged 1 commit intomainfrom
add-retry-logic-test
Feb 14, 2026
Merged

Add test for retry policy falling back to defaults for invalid values#306
jamescmartinez merged 1 commit intomainfrom
add-retry-logic-test

Conversation

@jamescmartinez
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 14, 2026 21:00
@jamescmartinez jamescmartinez merged commit 581c462 into main Feb 14, 2026
8 of 10 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a test case to verify that the resolveRetryPolicy function falls back to default values when invalid runtime values are provided. The test checks behavior for invalid inputs including NaN, negative numbers, and invalid duration strings.

Changes:

  • Added a test case "falls back to defaults for invalid runtime values" to verify validation behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1819 to +1829

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);
});
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant