Skip to content

Servy.psm1 [ValidateRange(1, 2147483647)] for -MaxRestartAttempts mismatches CLI limit of 100 #703

@Christophe-Rogiers

Description

@Christophe-Rogiers

Affected version: Servy 7.9.0 (Servy.psm1, Servy.psd1 ModuleVersion = '7.9.0')

Servy.psm1 declares:

[ValidateRange(1, 2147483647)]
[int] $MaxRestartAttempts,

but the CLI binary enforces [1, 100] via AppConfig.MaxMaxRestartAttempts. As a result, the PowerShell wrapper happily accepts values like 5000 or 999999999, passes them to servy-cli.exe, and the user gets a CLI-side failure that's much harder to diagnose than a clean PowerShell ValidateRange rejection would be.

Several other [int] parameters in Servy.psm1 use the same [ValidateRange(1, 2147483647)] or [ValidateRange(0, 2147483647)] pattern:

  • HeartbeatInterval
  • MaxFailedChecks
  • RotationSize
  • MaxRotations
  • StartTimeout
  • StopTimeout
  • PreLaunchTimeout
  • PreStopTimeout
  • PreLaunchRetryAttempts

All of them should be audited against their actual AppConfig bounds to confirm the module's declared range matches what the CLI will accept at runtime.

Request: Either have the PowerShell module read constants from a shared location (e.g. generate from AppConfig), or hard-code the correct per-parameter ranges in Servy.psm1 to match the CLI. Today the module over-promises what it accepts.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions