Skip to content

fix: enforce min/max bounds of 0 in duration flag @W-24935878@ - #755

Open
WillieRuemmele wants to merge 1 commit into
mainfrom
wr/duration-zero-bounds
Open

WillieRuemmele wants to merge 1 commit into
mainfrom
wr/duration-zero-bounds

Conversation

@WillieRuemmele

Copy link
Copy Markdown
Contributor

What does this PR do?

Flags.duration validated min/max with truthiness checks, so a bound of 0 was silently ignored. Commands that declare min: 0 (e.g. sf org resume scratch, sf org resume sandbox, sf apex run test) accepted negative values such as --wait=-5.

The checks now compare against undefined, so:

  • min: 0 rejects negative values (DurationBoundsMin, or DurationBounds when max is also set)
  • max: 0 rejects positive values (DurationBoundsMax, or DurationBounds when min is also set)
  • { min: 0, max: N } no longer falls through to DurationBoundsMax for out-of-range input

What issues does this PR fix or reference?

forcedotcom/cli#3689, @W-24935878@

Testing

Added unit tests for min: 0, min: 0 + max: 10, and max: 0. The new tests fail without the fix and pass with it. Lint, tsc, and the full unit suite pass (175 tests).

Behavior change

Commands that set min: 0 will now reject negative durations at flag-parse time instead of accepting them.

@WillieRuemmele
WillieRuemmele requested a review from a team as a code owner December 3, 2026 22:00
@WillieRuemmele WillieRuemmele changed the title fix: enforce min/max bounds of 0 in duration flag fix: enforce min/max bounds of 0 in duration flag @W-24935878@ Dec 3, 2026

This branch has not been deployed

No deployments
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