Commit 379deda
authored
feat: retry Vite+ install on transient network failures (#47)
## Summary
- Wrap the Vite+ install command (`curl | bash` on \*nix, `irm` on
Windows) in a retry loop — 3 attempts with 2s/4s backoff — so transient
network failures like `curl: (6) Could not resolve host: viteplus.dev`
no longer fail the action on the first try.
- Switch to `ignoreReturnCode: true` and catch thrown exec errors too,
so both non-zero exits and spawn failures are retryable.
- Emit a `warning()` between attempts with the failure reason and
attempt counter; final error reports "after 3 attempts".
## Test plan
- [x] `vp run test` — 97 passed (4 new cases in
`src/install-viteplus.test.ts` covering first-try success,
retry-then-success, exhaustion, and thrown exec errors)
- [x] `vp run check:fix` clean
- [x] `vp run build` — `dist/index.mjs` refreshed
- [ ] Observe a real CI run with the new action reference
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: adds a bounded retry/backoff loop around the installer
command; main behavior change is potentially longer runtime and slightly
different failure messaging when installs consistently fail.
>
> **Overview**
> Makes `installVitePlus` resilient to transient network/process
failures by retrying the Vite+ install command up to 3 times with linear
backoff, treating both non-zero exit codes and thrown `exec` errors as
retryable.
>
> Adds warnings between attempts with the failure reason and improves
the final error to include the attempt count; includes new unit tests
covering success, retry-then-success, retry exhaustion, and thrown
`exec` errors.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6903c25. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent cebe252 commit 379deda
3 files changed
Lines changed: 174 additions & 75 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
19 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
21 | 56 | | |
22 | | - | |
| 57 | + | |
23 | 58 | | |
24 | 59 | | |
25 | | - | |
| 60 | + | |
26 | 61 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 62 | | |
34 | | - | |
35 | | - | |
| 63 | + | |
36 | 64 | | |
37 | 65 | | |
38 | 66 | | |
| |||
0 commit comments