Skip to content

Navigation Menu

Sign in
Sign up

fix(install): resolve latest tag from the releases/latest redirect, not API JSON - #33

Merged
sumerc merged 1 commit into
main from
fix-latest-tag-name-parsing-on-flattened-json
Aug 17, 2026
Merged

fix(install): resolve latest tag from the releases/latest redirect, not API JSON #33
sumerc merged 1 commit into
main from
fix-latest-tag-name-parsing-on-flattened-json

Conversation

@sumerc

@sumerc sumerc commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Problem

A user's install failed every time with:

==> Downloading Zee-https://api.github.com/repos/sumerc/zee/releases/361182589.dmg...
error: download failed: https://github.com/sumerc/zee/releases/download/https://api.github.com/...

361182589 is v0.4.0's release id. Version resolution parsed the releases/latest API JSON with awk -F'"' '/"tag_name"/ {print 4ドル; exit}', which silently assumes GitHub's pretty-printed one-field-per-line layout. The user's machine (TLS-inspecting security software) re-served the same JSON minified onto one line — awk then matched the whole object and 4ドル was the value of its first quoted field, "url". The resulting garbage VERSION 404s deterministically, so re-running never helps.

Reproduced locally by piping the API response through jq -c: output matches the user's report byte-for-byte.

Fix

Resolve the tag from the https://github.com/<repo>/releases/latest redirect instead:

VERSION="$(curl -fsS -o /dev/null -w '%{redirect_url}' "https://github.com/${REPO}/releases/latest")"
VERSION="${VERSION##*/}"
  • No JSON, so no shape to mangle — a Location header survives any middlebox.
  • Drops the api.github.com dependency, which also removes its 60 req/hour unauthenticated rate limit (the old error message had to apologize for exactly that).
  • Guard tightened from non-empty to v* so a future resolution failure errors at the source instead of producing a nonsense URL.

Not affected: update/check.go uses encoding/json (whitespace-immune). Audited every other download — model manifest.txt and checksums.txt are line-oriented by design; ggufs/DMG/update-zip are SHA256-gated. The awk was the only shape-dependent parse.

Testing

  • Fixed script run end-to-end locally: resolves v0.4.0 from the redirect, downloads the DMG, checksum verifies, installs.
  • bash -n clean.
  • Design-notes entry added recording the incident and the rejected alternative (shape-tolerant JSON grep).

🤖 Generated with Claude Code

...ot API JSON
Version resolution parsed the GitHub API response with
awk -F'"' '/"tag_name"/ {print 4ドル; exit}', which assumes pretty-printed
one-field-per-line JSON. A TLS-inspecting middlebox on a user's machine
re-served the response minified onto one line; awk then matched the whole
object and 4ドル was the value of its first quoted field ("url"), so VERSION
became .../releases/<release-id> and the DMG download 404ed —
deterministically, so re-running never helped.
Resolve the tag from the https://github.com/<repo>/releases/latest
redirect instead (curl -w '%{redirect_url}', basename). No JSON to parse,
no shape to mangle, and no api.github.com unauthenticated rate limit.
The Go-side check (update/check.go) uses encoding/json and was never
affected; all other downloads are line-oriented text or SHA256-gated.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sumerc merged commit edc00f8 into main Aug 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /