Skip to content

fix(landlord): validate maxRetries as a positive integer#6

Open
DizzyMii wants to merge 1 commit into
mainfrom
fix/landlord-maxretries-validation
Open

fix(landlord): validate maxRetries as a positive integer#6
DizzyMii wants to merge 1 commit into
mainfrom
fix/landlord-maxretries-validation

Conversation

@DizzyMii
Copy link
Copy Markdown
Owner

@
ContractSchema.maxRetries was an unconstrained z.number(). The orchestrator uses it as for (let attempt = 0; attempt < contract.maxRetries; attempt++), so:

  • 0 or negative → the loop never runs, and the tenant escalates without ever attempting its work.
  • fractional values (e.g. 2.5) → an unexpected extra attempt.

This constrains the field to z.number().int().min(1), guaranteeing at least one attempt and rejecting invalid plans at parse time. The default of 3 is unchanged.

Verification

  • pnpm --filter landlord typecheck
  • pnpm --filter landlord test ✓ (40 tests, incl. a new case rejecting 0, -1, and 2.5)
  • biome lint clean on changed files
    @

maxRetries was an unconstrained z.number(). Negative or zero values made a
tenant escalate without ever running (the attempt < maxRetries loop never
executes), and fractional values produced an extra attempt. Constrain it to
int().min(1).
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