Skip to content

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

Merged
DizzyMii merged 1 commit into
mainfrom
fix/landlord-maxretries-validation
Jun 1, 2026
Merged

fix(landlord): validate maxRetries as a positive integer#6
DizzyMii merged 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).
@DizzyMii DizzyMii merged commit 75bbc7e into main Jun 1, 2026
2 checks passed
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