Retry E2E retryable service errors by default#1709
Conversation
Change-Id: I3f0254523cd55ed24c2e87e6ac19116af59c212f
📝 WalkthroughWalkthroughRunCmd is refactored to delegate execution to RunCmdWithRetry, retrying only when output contains a structured retryable service error. A new runCmdOnce helper holds single-execution logic. JSON payload extraction is centralized via new helpers, and tests cover retry and non-retry paths. ChangesCLI Retry Behavior
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant RunCmd
participant RunCmdWithRetry
participant runCmdOnce
participant ResultHasRetryableError
Caller->>RunCmd: invoke command
RunCmd->>RunCmdWithRetry: delegate with retry condition
loop attempts
RunCmdWithRetry->>runCmdOnce: execute command once
runCmdOnce-->>RunCmdWithRetry: Result
RunCmdWithRetry->>ResultHasRetryableError: check result
ResultHasRetryableError-->>RunCmdWithRetry: retryable true/false
end
RunCmdWithRetry-->>Caller: final Result
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/cli_e2e/core_test.go (1)
383-394: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
useFastDefaultRetrymutates package-level globals — not parallel-safe.Overwriting
defaultRetryInitialDelay/defaultRetryMaxDelayand restoring viat.Cleanupworks only because these tests run serially. If any test in this package is later markedt.Parallel(), this becomes a data race under-race. Consider documenting the serial-only assumption here (or gating retry timing through injectedRetryOptions) to prevent a future footgun.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/cli_e2e/core_test.go` around lines 383 - 394, The helper useFastDefaultRetry mutates package-level retry globals, so it is not safe if tests in this package ever run in parallel. Update the helper to avoid shared-state overrides where possible, ideally by threading retry timing through injected RetryOptions or similar test-scoped configuration; if that refactor is too large, add an explicit comment near useFastDefaultRetry noting the serial-only assumption so future t.Parallel() usage does not introduce a race.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/cli_e2e/core_test.go`:
- Around line 383-394: The helper useFastDefaultRetry mutates package-level
retry globals, so it is not safe if tests in this package ever run in parallel.
Update the helper to avoid shared-state overrides where possible, ideally by
threading retry timing through injected RetryOptions or similar test-scoped
configuration; if that refactor is too large, add an explicit comment near
useFastDefaultRetry noting the serial-only assumption so future t.Parallel()
usage does not introduce a race.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fca14ddb-be9b-4e39-b7ab-93d8c8e0f309
📒 Files selected for processing (2)
tests/cli_e2e/core.gotests/cli_e2e/core_test.go
What changed
RunCmdhelper automatically retry structured service errors when the CLI returnserror.retryable: true.runCmdOncesoRunCmdWithRetryremains a custom retry entrypoint and does not nest the defaultRunCmdretry policy.Why
Live E2E ownership is now distributed across feature owners. Transient server contention, such as Drive delete returning
1061045withretryable: true, should be handled by the framework by default instead of depending on every test author remembering to callRunCmdWithRetry.Summary by CodeRabbit