Repository navigation
fix(http): retry naturally idempotent cleanup operations - #588
kieugiathinhphat wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughHttpClient now supports explicitly opted-in transport retries for tunnel deletion and run cancellation. The changes also configure tunnel cleanup callers and add tests for retry behavior, retry limits, conflicts, and abort handling. ChangesCleanup transport retries
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant runTunnelStart
participant HttpClient
participant TunnelAPI
runTunnelStart->>HttpClient: deleteTunnel
HttpClient->>TunnelAPI: DELETE tunnel
TunnelAPI-->>HttpClient: ECONNRESET
HttpClient->>TunnelAPI: Retry DELETE tunnel
TunnelAPI-->>HttpClient: 204 response
HttpClient-->>runTunnelStart: Cleanup completes
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
|
🏆 Season 4 CLI Improvement Bonus: entry recorded. Thanks, @kieugiathinhphat! To be counted, this PR needs the following by Oct 29, 11:59 PM PT:
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. |
|
@kieugiathinhphat thanks, the fix is right and the tests are good. One change before merge: #624 (for #490) adds a |
What does this PR do?
Restore safe transport retries for naturally idempotent cleanup operations after transient network failures, without weakening the existing replay protection for arbitrary keyless mutations.
The shared HTTP client currently retries transport failures for GET/HEAD requests and writes with an
Idempotency-Key. However, run cancellation and tunnel deletion are safe to repeat by their server contracts, but do not carry an idempotency key.This PR:
transportRetrySaferequest option, honored bycanRetryTransport.cancelRun()anddeleteTunnel().client.delete()calls used bydeleteTunnelForCleanup()insrc/commands/test.tsandsrc/commands/tunnel.ts.No runtime dependencies were added.
Related issue
Closes #520
This implementation follows the scope accepted by @zeshi-du in #520.
Season 4 CLI Improvement Bonus
Discord username:
kieugiathinhphatType of change
Checklist
mainbranch.npm run lintandnpm run format:checkpass.npm run typecheckpasses.npm testpasses and coverage stays at or above the 80% gate.Validation
Local validation on Ubuntu/WSL, Node.js 22, using the v0.15.0 codebase:
RED → GREEN regression evidence
Test:
cleanup transport retry invariants > honours the original four-attempt transport retry capRED — unmodified base
d61e6df(v0.15.0):GREEN — fixed branch:
The same regression test passes, with four transport attempts as expected. All seven cleanup retry invariant tests pass.
Additional regression tests cover cancellation, tunnel deletion, teardown cleanup following
ECONNRESET, bare HTTP 502 responses, unsafe generic mutations, terminal HTTP 409 responses, disabled retries, attempt limits and shutdown behavior.Notes for reviewers
The change is intentionally limited to transport retry eligibility and the four approved cleanup call sites.
It preserves:
Local checks passed on Linux/WSL. GitHub CI, including the Windows job, remains to be verified on this PR.
Summary by CodeRabbit