Repository navigation
Commit 34b854a
authored
fix(update): ship and fetch native binaries from the GitHub release (#355)
## Requirement or Bug
Native `pythinker update` fails with `native binary download returned
HTTP 404`, and the 2.4.0 and 2.4.1 release runs on main end red.
Related: #354.
## Bug Reproduction Steps
1. Install 2.1.0 with the native installer.
2. Run `pythinker update` and accept 2.4.0 (or 2.4.1).
3. `error: failed to download update 2.4.0: native binary download
returned HTTP 404`.
On 2.2.0–2.4.1 the same command fails earlier, because `manifest.json`
comes back as an HTML page.
Release runs 36917123003 (2.4.0) and 36942551995 (2.4.1) fail in `Update
Homebrew tap` and `Release lane summary`.
## Root Cause
Three separate defects. All three are fixed at the root, with no
workarounds.
1. **Missing release asset (affects 2.1.0 clients).**
`produce-manifest.mjs` writes `manifest.json` and `latest.json` entries
that point at the bare binary `pythinker-code-<target>[.exe]`. It hashes
that binary and then deletes it, so only `.zip`, `.zst` and `.tar.gz`
get uploaded. A 2.1.0 client downloads the bare file and gets a 404.
2. **Wrong download base (affects 2.2.0–2.4.1 clients).** #323 moved the
manifest and binary URLs to
`code.pythinker.com/pythinker-code/binaries/<v>/…`. That route has never
served a file: the site answers it with its SPA page and HTTP 200. These
clients cannot update, and only a reinstall fixes them (#354).
3. **Brew job race (the red X).** `assertPublishedNpmVersion` ran `npm
view` once, 24 s after `changeset publish`. npm showed 2.4.1 at
23:56:55, about 4 minutes after the check at 23:53:10. The job failed,
and `Release lane summary` fails whenever `BREW_RESULT` is not success.
## Code Changes
- `produce-manifest.mjs`: copy the binary into the upload set under the
name the manifest uses, with a `.sha256` sidecar. The existing
`dist-native-release/*` upload step then ships it.
- `constant/app.ts`, `native-manifest.ts`, `native-stage.ts`: replace
`pythinkerCodeCdnBinariesBase()` with
`pythinkerCodeReleaseAssetUrl(version, filename)`. It returns the GitHub
release URL with the encoded tag, which is the same shape as 2.1.0 and
as `latest.json`. The `.zst`-first staging path does not change.
- `update-brew-formula.mjs`: delete the one-shot `npm view` check.
`downloadNpmTarball` already polls for 600 s, retries on 404, and
refuses when the budget runs out, so it is the only gate now.
- `cdn-consistency.mjs` + `verify-release-consistency.mjs`: the release
gate now HEADs every URL that `latest.json` and the release
`manifest.json` advertise, and fails on anything unreachable. It retries
403/429. Against the live 2.4.1 release it reports the 6 missing bare
binaries, so it would have caught defect 1 on 2.3.0.
- `README.md`: a pointer for stuck native installs to #354.
## Behavior Changes and Affected Users
| Behavior | Before | After | Who relies on the old behavior | Escape
hatch |
|---|---|---|---|---|
| Native release assets | `.zip`, `.zst`, `.tar.gz` (+ sidecars) | also
the bare binary + `.sha256` | nobody; it adds an asset that manifests
already named | n/a |
| Native client download URLs (built from this tree) |
`code.pythinker.com/pythinker-code/binaries/<v>/…` |
`github.com/PyModel/pythinker-code/releases/download/<encoded tag>/…` |
nobody: the CDN route never returned a file (SPA HTML, 200) | n/a |
| Brew tap job when npm is slow to show the version | fails at once |
polls the tarball up to 600 s | nobody; the old failure was a false
negative | `RELEASE_LANE_BREW=disabled` (unchanged) |
| Release consistency gate | checks version strings only | also fails on
any unreachable advertised download | release operators | none needed;
it only reports real 404s |
Populations:
- Native installs on 2.1.0 and earlier: they update normally from the
next release on (defect 1).
- Native installs on 2.2.0–2.4.1: they need one reinstall, because their
own updater has the dead URL built in (defect 2, #354).
- npm and Homebrew installs: not affected.
Contract file touched: `apps/pythinker-code/src/cli/update/*` (CLI
tripwire). The removed `/binaries/` base never served data, so no client
from a previous release loses anything.
Test coverage:
- `release-artifacts.test.ts`: every file the manifest names exists in
the upload set. Failed before the fix, passes after.
- `native-manifest.test.ts`: exact encoded GitHub URLs.
- `cdn-consistency.test.mjs`: URL collection, 404s, 403/429 retry.
- `update-brew-formula.test.mjs`: the poll is the only gate.
- `pnpm test:release` 54/54; app update suites 325/325; `tsc` clean;
`pnpm lint` 0 errors.
## Checklist
- [x] I have read the
[CONTRIBUTING](https://github.com/PyModel/pythinker-code/blob/main/CONTRIBUTING.md)
document.
- [x] I have linked a related issue (external PRs: issue must have a
maintainer's `/approve`).
- [x] I have added tests that prove my feature works.
- [x] The behavior-change table above is complete, and every removed
behavior or flipped default is named in the changeset and either has an
escape hatch or was explicitly approved by a maintainer in this PR.
- [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**
* Native `pythinker update` now downloads the latest binary from the
GitHub release, restoring updates for supported native installations.
* If you’re using a native install on version 2.2.0–2.4.1, rerun the
installation command once to receive a version that can update normally.
After reinstalling, use `pythinker update` for future updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 5d166ef commit 34b854a
13 files changed
Lines changed: 236 additions & 69 deletions
File tree
- .changeset
- apps/pythinker-code
- scripts/native
- src
- cli/update
- constant
- test
- cli/update
- scripts/native
- 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 | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
74 | | - | |
75 | | - | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
443 | | - | |
| 444 | + | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
203 | 201 | | |
204 | 202 | | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
171 | 178 | | |
172 | 179 | | |
173 | 180 | | |
| |||
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
| 209 | + | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 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 | + | |
| 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 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
0 commit comments