Description
Discord Username / User ID
anonymous0_01
What does this improvement do?
The --request-timeout help text documents "Range: 1–600", but values
outside that range are silently clamped (src/lib/client-factory.ts,
clampRequestTimeout) with no notice to the user. Someone passing
--request-timeout 3600 gets a 600-second timeout and no indication their
input was ignored.
Reproduction
Verified against commit 988c0355bb05631e9c6c1785e443937ff2a88c0e (v0.14.0),
built from source, Node v24.20.0, Linux x86_64.
$ testsprite project list --dry-run --request-timeout 601
[dry-run] sample response — not from the server
ID NAME TYPE FROM CREATED DEFAULT ENV ENVS
... # exit 0 — 601 accepted silently
$ testsprite project list --dry-run --request-timeout 0
Error: Invalid request.
Flag `--request-timeout` is invalid: "0" is not valid — must be a positive number of seconds.
# exit 5 — 0 is rejected, but 601 is silently clamped to 600The same silent clamping applies to TESTSPRITE_REQUEST_TIMEOUT_MS
(e.g. 999999999 is clamped to 600000 without notice).
Expected
Either reject out-of-range values with a clear error (matching the
documented "Range: 1–600"), or print a warning to stderr when clamping
(e.g. --request-timeout 3600 clamped to the 600s maximum).
The current behavior is inconsistent: 0 is rejected outright while 601
is silently rewritten. A user debugging a hanging request with a large
timeout would have no idea their value was discarded.
Actual
resolveRequestTimeoutMs → clampRequestTimeout applies
Math.min(Math.max(Math.round(ms), MIN), MAX) with no feedback. The help
text's "Range: 1–600" reads as a validated bound, but only the lower bound
is enforced.
Suggested fix
In resolveRequestTimeoutMs, when the input is outside
[REQUEST_TIMEOUT_MIN_MS, REQUEST_TIMEOUT_MAX_MS], either throw a
localValidationError (consistent with how 0 is already rejected) or
emit a stderr warning noting the clamped value. Keep the clamping as the
fallback so existing scripts don't break.
Environment
- CLI version: 0.14.0 (built from source at
988c035) - Node: v24.20.0
- OS: Linux x86_64
Activity
jangjos-128 commentedon Oct 30, 2026
Thanks @Vinayak19112003, the silence is real, but the clamp is deliberate (documented in
parseRequestTimeoutFlag, pinned by two cases inclient-factory.test.ts) and both bounds behave identically —--request-timeout 0.5is clamped up to 1s as quietly as601is clamped down — so there's no lower/upper asymmetry to fix, and we'll reword the "Range: 1–600" help text rather than add a warning. Closing as not planned.