fix: use nonempty() for retry array type to match runtime validation#1199
Open
claygeo wants to merge 1 commit intoquirrel-dev:mainfrom
Open
fix: use nonempty() for retry array type to match runtime validation#1199claygeo wants to merge 1 commit intoquirrel-dev:mainfrom
claygeo wants to merge 1 commit intoquirrel-dev:mainfrom
Conversation
The Zod schema enforces .min(1).max(10) on the retry array, but .min() does not change the inferred TypeScript type. This means the type allows empty arrays while the runtime rejects them with "body/retry must NOT have fewer than 1 items". Replace .min(1) with .nonempty() which both enforces the minimum at runtime AND narrows the inferred type to require at least one element, aligning the TypeScript type with the runtime behavior. Closes quirrel-dev#1167
👷 Deploy request for quirrel-development-ui pending review.Visit the deploys page to approve it
|
👷 Deploy request for quirrel-docs pending review.Visit the deploys page to approve it
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
EnqueueJobOptions.retryis typed as(number | string)[]which allows empty arrays, but the Zod schema atsrc/client/index.ts:132enforces.min(1)at runtime. Passing an empty retry array fails with:The type doesn't reflect this constraint because Zod's
.min()does not change the inferred type.Solution
Replace
.min(1)with.nonempty(), which both:[T, ...T[]](at least one element)The
.max(10)constraint is preserved.Changes
src/client/index.ts— Replaced.min(1)with.nonempty()on retry schemaCloses #1167