Skip to content

fix(update): clearer error on unsupported release platform (android/termux) - #603

Merged
kevincodex1 merged 3 commits into
Gitlawb:mainfrom
PierrunoYT:fix/android-update-platform-error
Jul 9, 2026
Merged

fix(update): clearer error on unsupported release platform (android/termux)#603
kevincodex1 merged 3 commits into
Gitlawb:mainfrom
PierrunoYT:fix/android-update-platform-error

Conversation

@PierrunoYT

@PierrunoYT PierrunoYT commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #598. zero update/zero upgrade on Android/Termux failed with the opaque error unsupported release platform: android, including for --check, which is documented as a safe, read-only operation.

Change

releasePlatform in internal/update/update.go now returns a clear, actionable error when the running GOOS has no published release archive: it names the platform, lists the supported platforms (linux, macos, windows), and tells the user to rebuild from source. The command still fails (exit 1) rather than silently reporting "up to date," but does so gracefully — a clean stderr message via the existing writeAppError path, no panic or stack trace.

Before:

[zero] Could not install update: unsupported release platform: android

After:

[zero] Could not install update: zero does not publish release builds for platform "android" (supported: linux, macos, windows) — update/upgrade checks aren't available; rebuild from source instead

Testing

  • go build ./...
  • go test ./internal/update/... ./internal/cli/...

Summary by CodeRabbit

  • Bug Fixes
    • Improved the error shown when checking for updates on an unsupported platform.
    • The new message explains that prebuilt release archives aren’t available for that platform, that self-updating/release naming guidance isn’t provided, and offers clear next steps (use the documented update path or rebuild from source).
    • Improved the unsupported-platform error when resolving release naming to list the supported platforms explicitly (linux, macos, windows).

…ermux)

zero update/upgrade fails on Android/Termux because GOOS "android" has
no published release archive. Replace the generic "unsupported release
platform: android" error with a clear, actionable message explaining
that no release builds are published for the platform, listing the
supported platforms, and suggesting a rebuild from source. The command
still fails gracefully (clean stderr message, exit 1, no panic/stack
trace) rather than crashing.

Fixes Gitlawb#598
Copilot AI review requested due to automatic review settings July 8, 2026 14:32
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a8366b00-f52c-4a35-b0aa-b86fc8cedb33

📥 Commits

Reviewing files that changed from the base of the PR and between d8017e4 and 539b70d.

📒 Files selected for processing (2)
  • internal/release/release.go
  • internal/update/update.go
✅ Files skipped from review due to trivial changes (1)
  • internal/release/release.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/update/update.go

Walkthrough

Both release platform helpers now return more specific errors for unsupported GOOS values, replacing the prior generic message and clarifying that published release artifacts are unavailable on those platforms.

Changes

Error message update

Layer / File(s) Summary
Detailed unsupported platform error
internal/update/update.go, internal/release/release.go
Replaces the generic unsupported-platform error with detailed messages that identify the platform and state which release platforms are supported.
Estimated code review effort: 1 (Trivial) ~2 minutes

Suggested reviewers: Vasanthdev2004, kevincodex1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The change improves the error text, but it does not add Android/Termux support or skip zero update --check gracefully as required by #598. Return a no-op for unsupported Android/Termux update checks or add android/termux to the release map so zero update --check never fails.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the release-platform error message change.
Out of Scope Changes check ✅ Passed The edits stay focused on release-platform handling and related user-facing messaging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the UX of zero update / zero upgrade on unsupported platforms (notably Android/Termux) by replacing the generic “unsupported release platform” error with a clearer, actionable message explaining that official release archives are only published for linux/macos/windows.

Changes:

  • Update releasePlatform to return an explicit, user-actionable error message on unsupported GOOS values (e.g., android).
  • Add inline rationale comments documenting why the updater fails loudly on unsupported platforms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/update/update.go Outdated
Comment thread internal/update/update.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
internal/update/update.go (2)

364-371: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Condense the comment block.

Eight lines of comments for a single return statement is excessive and will become stale baggage. The core rationale fits in 2–3 lines.

♻️ Suggested condensation
 default:
-	// No prebuilt release archives are published for this GOOS (e.g. a
-	// binary built natively on Android/Termux reports GOOS "android").
-	// Fail loudly rather than silently no-op'ing so users don't mistake
-	// a skipped check for "you're already up to date" — `zero update
-	// --check` is documented as read-only, but "safe" doesn't mean
-	// "silently wrong". Building/installing zero on such a platform
-	// falls outside the release matrix, so `zero update`/`zero upgrade`
-	// can't check or install; rebuild from source instead.
+	// No prebuilt release archives exist for this GOOS (e.g. Android/Termux).
+	// Fail loudly so users don't mistake a skipped check for "up to date";
+	// rebuild from source instead.
 	return "", fmt.Errorf("zero does not publish release builds for platform %q (supported: linux, macos, windows) — update/upgrade checks aren't available; rebuild from source instead", goos)
🤖 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 `@internal/update/update.go` around lines 364 - 371, Condense the explanatory
comment in the update path so it stays maintainable: the block near the GOOS
release-matrix check in update.go is too verbose for the single early return it
documents. Shorten the comment around the logic in the update/upgrade flow to
2–3 lines while preserving the key point that unsupported platforms like
android/Termux should fail loudly rather than silently no-op, and keep the
rationale attached to the same return guard.

372-372: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the same unsupported-platform message in internal/release/release.go too. ReleasePlatform still returns unsupported release platform: %s, so the update and release flows give different guidance for the same case.

🤖 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 `@internal/update/update.go` at line 372, The unsupported-platform error
message is inconsistent between the update and release flows; `ReleasePlatform`
in `internal/release/release.go` still uses the older generic wording. Update
that path to use the same detailed unsupported-platform message as the update
check (the one tied to `goos` and supported platforms), so both
`ReleasePlatform` and the update/upgrade logic return identical guidance for the
same case.
🤖 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.

Inline comments:
In `@internal/update/update.go`:
- Around line 364-372: The unsupported-platform path in update handling still
returns an error from the release-archive check, which makes zero update --check
exit non-zero instead of skipping gracefully. Update the logic around the
platform validation in internal/update/update.go, especially the helper that
reports unsupported GOOS values and the caller that propagates it, so --check
can return a no-op/informational result while zero update and zero upgrade still
fail only when an actual install is requested. Use the existing update/check
flow and symbols like zero update, zero upgrade, and the GOOS validation branch
to separate read-only checks from install-capable operations.
- Line 372: The CLI error message in the update path uses a Unicode em dash,
which can display incorrectly in some terminals. Update the fmt.Errorf string in
the update/upgrade check logic to use plain ASCII punctuation such as “;” or
“--” instead of “—”, keeping the rest of the message unchanged. Locate the
message in the release-build/platform check near the update code path and
replace the non-ASCII separator there.

---

Nitpick comments:
In `@internal/update/update.go`:
- Around line 364-371: Condense the explanatory comment in the update path so it
stays maintainable: the block near the GOOS release-matrix check in update.go is
too verbose for the single early return it documents. Shorten the comment around
the logic in the update/upgrade flow to 2–3 lines while preserving the key point
that unsupported platforms like android/Termux should fail loudly rather than
silently no-op, and keep the rationale attached to the same return guard.
- Line 372: The unsupported-platform error message is inconsistent between the
update and release flows; `ReleasePlatform` in `internal/release/release.go`
still uses the older generic wording. Update that path to use the same detailed
unsupported-platform message as the update check (the one tied to `goos` and
supported platforms), so both `ReleasePlatform` and the update/upgrade logic
return identical guidance for the same case.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b09fd793-1e62-420d-bee7-dce38b3e44d8

📥 Commits

Reviewing files that changed from the base of the PR and between ba4c007 and 3d511cc.

📒 Files selected for processing (1)
  • internal/update/update.go

Comment thread internal/update/update.go Outdated
Comment thread internal/update/update.go Outdated
- Condense the explanatory comment for the unsupported GOOS branch.
- Replace the Unicode em dash with plain ASCII punctuation.
- Align internal/release.ReleasePlatform's error message with the
  updater's so both flows give identical guidance.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/release/release.go (1)

319-319: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider deduplicating the error message string.

The error message at line 319 is now character-for-character identical to the one in internal/update/update.go's releasePlatform(). Both the switch/case logic and the error string are duplicated across the two packages. If one message is updated in the future, the other can silently drift, re-introducing the inconsistency this PR just fixed.

Consider extracting the error message into a shared constant (e.g., in internal/release and imported by internal/update), or having internal/update.releasePlatform delegate to internal/release.ReleasePlatform directly to eliminate the duplicated function entirely.

🤖 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 `@internal/release/release.go` at line 319, The platform rejection message and
`releasePlatform` logic are duplicated between
`internal/release.ReleasePlatform` and `internal/update.releasePlatform`, so
refactor to keep a single source of truth. Either extract the shared error
string into a reusable constant/helper in `internal/release` that
`internal/update` imports, or make `internal/update.releasePlatform` delegate
directly to `internal/release.ReleasePlatform` so the identical message cannot
drift.
🤖 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 `@internal/release/release.go`:
- Line 319: The platform rejection message and `releasePlatform` logic are
duplicated between `internal/release.ReleasePlatform` and
`internal/update.releasePlatform`, so refactor to keep a single source of truth.
Either extract the shared error string into a reusable constant/helper in
`internal/release` that `internal/update` imports, or make
`internal/update.releasePlatform` delegate directly to
`internal/release.ReleasePlatform` so the identical message cannot drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9b88e112-dacb-4109-817e-35a1e2b456d5

📥 Commits

Reviewing files that changed from the base of the PR and between 3d511cc and d8017e4.

📒 Files selected for processing (2)
  • internal/release/release.go
  • internal/update/update.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/update/update.go

@anandh8x

anandh8x commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

The code change is a real UX win. The wording needs a tweak though.

"no published release for android (supported: linux, macos, windows). Rebuild from source instead" reads as if Termux isn't a supported platform. It is, just not as a self-updating release asset. PR #509, PR #455, PR #573, and the dictation recorder's PlatformTermux path are all in main. Termux runs Zero fine. A user reading the new message would reasonably conclude "this doesn't run here," which is wrong.

The actual distinction is "no release asset for this GOOS," not "platform unsupported." And the upgrade path shouldn't be "rebuild from source." That's hostile to a phone user without a Go toolchain. The right path is the npm wrapper (PR #455), which is the documented Termux install: npm i -g @gitlawb/zero to install, npm update -g @gitlawb/zero to upgrade.

Suggested wording:

no published release for %q (release assets: linux, macos, windows). Your build is the current version of record. Upgrade with `npm update -g @gitlawb/zero` to get the latest.

The parenthetical lists release platforms, not "supported platforms." And npm update is the actual one-line upgrade. No Go, no source build, works the same way it did on install.

Separate follow-up: the release-artifacts.yml matrix (line 26-31) doesn't include android-arm64. Adding it (cross-compile with GOOS=android, an Android-shaped install script, a smoke test on actual Termux) would make zero update stop failing on Android at all, instead of failing with a friendlier message. Not blocking this PR.

… assets

Address review feedback: the previous message implied Android/Termux was an unsupported platform and told users to rebuild from source. Termux runs zero fine via the npm wrapper; it just has no self-updating release archive. Point users at 'npm update -g @gitlawb/zero', the documented Termux install/upgrade path, instead.
@kevincodex1
kevincodex1 merged commit 1fc9b2d into Gitlawb:main Jul 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zero upgrade fails on Android/Termux: "unsupported release platform: android"

4 participants