Commit 26f3d18
authored
fix(release): self-heal a lost CDN rebuild and surface tap push errors (#77)
## Related Issue
No issue — the problem is described below.
## Problem
The CDN manifest at
`https://code.pythinker.com/pythinker-code/latest.json` is what every
installed
client polls for updates, and its correctness rested on exactly **one**
fire-and-forget webhook POST
in the `redeploy-cdn` job.
On the 0.18.0 release that POST hit four consecutive `curl: (28)`
60-second connect timeouts. The
job emitted only a `::warning::` (correctly — npm has already published
irreversibly by then), and
`verify-cdn-release` then polled a manifest that nobody had asked to
rebuild. It sat at 0.17.1 for
the full 600s budget and failed, and the release stayed invisible to
every installed client until a
human fired the webhook by hand.
The pipeline had no path from "the trigger was lost" back to "ask
again". 0.17.1 succeeded by
timing, not by design.
Separately, `scripts/release/update-brew-formula.mjs` ran `git push`
under `stdio: 'ignore'` and
replaced whatever git said with the constant string `Failed to push
Homebrew tap`. The tap bump has
now failed on 0.17.1 and 0.18.0 and GitHub's actual refusal has never
been seen, so the auth root
cause is still a guess.
## What changed
**CDN — the consistency poll now heals a lost trigger.**
`pollCdnUntilCaughtUp` takes an optional
`retrigger` callback and `retriggerEveryAttempts`;
`verify-release-consistency.mjs` supplies one
that re-POSTs the Dokploy deploy webhook every 8 attempts (~2 min at the
15s interval, matching the
Dokploy build time) while the CDN is behind. The poll is the only
pipeline stage that both knows the
CDN is still stale and is still running, so it is the right place for
the retry.
- A throwing `retrigger` is swallowed exactly like a failed fetch — a
trigger that cannot be sent is
lag, not a gate failure.
- Never fires on `match` or `ahead`: more rebuilds cannot fix a manifest
naming a release npm does
not have.
- The re-trigger count is reported in both the success and the timeout
message, which is what
distinguishes "we asked and the site never caught up" from "we never
managed to ask".
- Budget 600s → 900s (it now has to cover detecting a lost trigger
*plus* a fresh build), job
timeout 15 → 20 min.
- `redeploy-cdn` curl: `--connect-timeout 15 --max-time 45 --retry 5
--retry-delay 15`. On 0.18.0 a
single connect that never established consumed the whole 60s budget, so
3 attempts covered only
~3 minutes of a longer outage.
- `redeploy-cdn` keeps its warn-don't-fail posture. `verify-cdn-release`
stays the loud gate.
**Homebrew tap — git's real error now reaches the log.** Both the clone
and the push capture stdout
and stderr and rethrow with the actual message. A redaction helper
collapses the credentialed
userinfo (`//x-access-token:…@`) to `//***@` and replaces the raw token,
so the credential cannot
land in a public Actions log. No auth mechanism or credential is changed
here — this is the
diagnostic that tells us which fix the tap actually needs.
The dependency-injection shape of `cdn-consistency.mjs` is untouched, so
all of this is unit-tested
with no network and no real wait.
## Verification
- New tests fail RED against the unmodified module (6 failed / 12
passed) — the callback is never
invoked there — and GREEN after (18/18). Coverage: fires on cadence with
an exact call count,
never on immediate match, never on `ahead`, survives a throwing
callback, fires while the manifest
is unreachable, and reports `retriggers` on the timeout return.
- `node --check` on all three release scripts → `SYNTAX_OK`.
- Workflow assertion that `DOKPLOY_CDN_DEPLOY_WEBHOOK` and
`timeout-minutes: 20` landed inside the
`verify-cdn-release` block (red on the unchanged file, confirmed).
- `pnpm run lint` → exit 0. Full pre-push gate green: 402 tests,
typecheck, nix-hash-freshness.
## Checklist
- [x] I have read the CONTRIBUTING document.
- [x] I have linked a related issue, or explained the problem above.
- [x] I have added tests that prove my feature works.
- [x] Ran `gen-changesets` skill, or this PR needs no changeset.
- [x] Ran `gen-docs` skill, or this PR needs no doc update.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Bug Fixes**
- Improved release reliability when CDN rebuild requests are delayed or
temporarily lost.
- Release verification now polls longer and automatically retries CDN
rebuild requests.
- Releases remain available through the correct update channel during
deployment delays.
- Improved publishing error details while keeping access credentials out
of logs.
- Homebrew tap updates now use more secure, repository-scoped
authentication.
- **Tests**
- Added coverage for CDN recovery, retry behavior, continued polling,
and timeout reporting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 86a4f9a commit 26f3d18
7 files changed
Lines changed: 235 additions & 19 deletions
File tree
- .changeset
- .github/workflows
- apps/pythinker-code/test/scripts/release
- scripts/release
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
267 | 270 | | |
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
271 | | - | |
| 274 | + | |
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| |||
282 | 285 | | |
283 | 286 | | |
284 | 287 | | |
285 | | - | |
| 288 | + | |
286 | 289 | | |
287 | 290 | | |
288 | 291 | | |
| |||
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
| 309 | + | |
| 310 | + | |
306 | 311 | | |
307 | 312 | | |
308 | 313 | | |
| |||
320 | 325 | | |
321 | 326 | | |
322 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
323 | 341 | | |
324 | 342 | | |
325 | | - | |
| 343 | + | |
326 | 344 | | |
| 345 | + | |
327 | 346 | | |
328 | 347 | | |
329 | 348 | | |
| |||
Lines changed: 119 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
114 | 233 | | |
115 | 234 | | |
116 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | | - | |
91 | | - | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
95 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
96 | 113 | | |
97 | 114 | | |
98 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
25 | | - | |
| 30 | + | |
26 | 31 | | |
27 | | - | |
28 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| |||
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
62 | 96 | | |
63 | 97 | | |
64 | 98 | | |
| |||
75 | 109 | | |
76 | 110 | | |
77 | 111 | | |
| 112 | + | |
| 113 | + | |
78 | 114 | | |
79 | 115 | | |
80 | 116 | | |
| |||
87 | 123 | | |
88 | 124 | | |
89 | 125 | | |
90 | | - | |
| 126 | + | |
| 127 | + | |
91 | 128 | | |
92 | 129 | | |
93 | 130 | | |
94 | 131 | | |
95 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
96 | 136 | | |
97 | 137 | | |
0 commit comments