Skip to content

fix(cli): warn on out-of-range --ttl for tunnel start - #413

Closed
892041548 wants to merge 1 commit into
TestSprite:mainfrom
892041548:fix/ttl-warning
Closed

892041548 wants to merge 1 commit into
TestSprite:mainfrom
892041548:fix/ttl-warning

Conversation

@892041548

@892041548 892041548 commented Oct 16, 2026 •

Copy link
Copy Markdown

Season 4 CLI Improvement Bonus

  • I'm entering this PR for the Season 4 CLI Improvement Bonus
  • Discord username: @zzzzzy

What's broken (Closes #408)

tunnel start --ttl accepts any positive integer and lets the server silently clamp it to 60–28800, so --ttl 5 yields a 60s tunnel with no feedback.

How you found it

Black-box probing of numeric flags against their documented ranges; --ttl 5 and --ttl 999999 both passed through silently.

Why it matters

Same class as #361 (--request-timeout silent clamping): the user's explicit request is changed without telling them. A one-line stderr warning closes the gap without changing accepted behavior.

Tests

  • 5 new unit tests in src/commands/tunnel.spec.ts (below-min warning, above-max warning, in-range silence, omitted silence, invalid still rejected)
  • tunnel.spec.ts: 97 passed; tsc --noEmit clean; eslint 0 errors

Summary by CodeRabbit

  • Bug Fixes
    • The tunnel start command now warns when the requested TTL is outside the server’s supported range and may be clamped. The requested value is still retained.
    • Invalid TTL values continue to be rejected with a validation error.

@github-actions

Copy link
Copy Markdown

Thanks for the PR, @892041548! It links an issue, but that issue isn't assigned to you yet: #408 (unassigned). Per our workflow, claim the issue first by commenting /assign on it (the triage bot assigns you automatically). If it's already assigned to someone else, please coordinate with them or pick another issue — unclaimed-issue PRs are not reviewed. After fixing it, edit the PR description or push a commit to re-run this check. See CONTRIBUTING → Contribution model.

@github-actions github-actions Bot added the needs-issue PR not linked to an issue yet — please open one first and claim it (see CONTRIBUTING) label Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: TestSprite/testsprite-cli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a943972f-ff07-4512-9185-1b8fb9c8b553
📥 Commits

Reviewing files that changed from the base of the PR and between 988c035 and 4e087a4.

📒 Files selected for processing: 2
  • src/commands/tunnel.spec.ts
  • src/commands/tunnel.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

parseTtl now warns when a valid requested TTL is outside the effective 60–28,800 second range. The tunnel start command passes its stderr logger to the parser. The parser retains the requested value and preserves existing validation.

Changes

Tunnel TTL warning behavior

Layer / File(s) Summary
Parse and report out-of-range TTL values
src/commands/tunnel.ts, src/commands/tunnel.spec.ts
parseTtl accepts an optional stderr callback and warns for valid values below 60 or above 28,800 seconds. tunnel start supplies its stderr logger. Tests cover warning and silent cases, retained values, and validation errors.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 4e087

This change adds a stderr warning when tunnel start --ttl is outside the server's effective range, and the requested value is still passed through. No actionable merge risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: warning users when tunnel start receives an out-of-range --ttl value.
Linked Issues check Passed Issue #408 requires a stderr warning for tunnel start --ttl values outside 60–28,800 seconds, while preserving the requested value and continuing. The PR summary states that parseTtl now warns bel…
Out of Scope Changes check Passed The changes stay within issue #408. The optional stderr logger and exported parseTtl support direct testing and command integration. The added tests verify the requested warning behavior and existin…
Full details: Linked Issues check

Explanation

Issue #408 requires a stderr warning for tunnel start --ttl values outside 60–28,800 seconds, while preserving the requested value and continuing. The PR summary states that parseTtl now warns below 60 and above 28,800, returns the requested value, and still rejects invalid values. The five added tests cover both warnings, inclusive in-range silence, omitted-value silence, and invalid input rejection.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #408. The optional stderr logger and exported parseTtl support direct testing and command integration. The added tests verify the requested warning behavior and existing validation behavior. No unrelated production behavior is identified.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

🏆 Season 4 CLI Improvement Bonus: entry recorded. Thanks, @892041548!

To be counted, this PR needs the following by Oct 29, 11:59 PM PT:

  • ⬜ A linked issue assigned to you: the issue this PR links isn't assigned to you yet. Claim it by commenting /assign on it.
  • ✅ Out of draft.
  • ✅ A Discord username in the description.

Rewards go to merged PRs judged a genuine improvement, and up to three bonus-eligible PRs count per person. Untick the box to withdraw the entry. This comment refreshes when you edit the PR. Full rules.

@github-actions github-actions Bot added the s4-cli-bonus Entered for the Season 4 CLI Improvement Bonus label Oct 22, 2026
@zeshi-du

zeshi-du commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR. #408 was closed as not planned: --help already documents the 60–28800 range and the server clamp, and tunnel start prints the effective expiry right after minting, so we won't add a warning.

@zeshi-du zeshi-du closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-issue PR not linked to an issue yet — please open one first and claim it (see CONTRIBUTING) s4-cli-bonus Entered for the Season 4 CLI Improvement Bonus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hackathon] fix(cli): warn when --ttl is outside the effective 60–28800 range instead of silently relying on server clamping

2 participants