Skip to content

Serve every Android download link from one permanent latest-APK release - #25312

Closed
brennanb2025 wants to merge 3 commits into
mainfrom
brennanb2025/mobile-android-latest-apk
Closed

brennanb2025 wants to merge 3 commits into
mainfrom
brennanb2025/mobile-android-latest-apk

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​31
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​206 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​184

ELI5

Every "download the Android app" link (the READMEs in seven languages, the docs site, and two places in the desktop app) names one specific version, so each one has to be edited by hand after every Android release. They keep getting missed: the desktop app and the docs site were still sending people to 0.0.48 after 0.0.50 and 0.0.52 shipped. This gives Android one permanent download link that a workflow keeps pointing at the newest build, and moves every link to it, so nobody edits them again.

What Changed

  • Before: links were .../releases/download/mobile-android-v0.0.52/app-release.apk (or older). Each Android release needed a follow-up edit to ~17 links, and the copies built into the desktop app stayed stale on every installed desktop until its next update.
  • After: every link is https://github.com/stablyai/orca/releases/download/mobile-android-latest/app-release.apk, which always serves the newest Android APK. Link text drops the version number, since the link no longer promises one.
  • Mechanism: a new workflow, mobile-android-latest-apk.yml, copies the newest Android APK onto a dedicated mobile-android-latest release. It runs after every Android release (the Android release workflow calls it), once when this PR merges (it creates the release then), once a day, and by hand.
    • It always publishes the newest mobile-android-v* release that has an APK, not the build of the run that called it, so re-running an older release can never roll the link back. It looks each version up as a published release; it moves on to an older version only when GitHub says that version has no published release (HTTP 404, which also covers drafts). Any other error, such as a GitHub outage, fails the run and leaves the link as it was, instead of quietly serving an older APK.
    • It decides whether the link is already current by comparing file contents, not version names: GitHub records a SHA-256 digest for every release file, and the run leaves the files alone when the served APK's digest matches the newest release's APK, and the served checksum file matches that release's checksum (or both are absent). In that case it only rewrites the release notes, and only if they don't describe that release. So a version re-published with a new build still reaches the link, and a missing or stale checksum is repaired. Files uploaded before GitHub recorded digests are hashed by the run instead.
    • It downloads everything first, so a failed download changes nothing. Then it uploads the new APK under a temporary name, deletes the old one, and renames the new one. The link is down only between the delete and the rename, not during the ~134 MB upload, and a failed upload leaves the previous APK serving. The checksum file is replaced alongside it and is never left beside a different APK.
    • If a run fails partway (after deleting the old APK but before the rename, before uploading the checksum, or before updating the notes), the next run finishes the job: it sees the missing or mismatched file and swaps again, or sees notes naming the wrong version and rewrites them. The next run is the daily one at the latest, or sooner on the next Android release or a manual run. Until then, a run that died between the delete and the rename leaves the link returning 404.
    • Only one run swaps at a time (a job-level concurrency group). Forks never run it.
    • The mobile-android-latest release is a pre-release created with --latest=false, so it never takes the desktop app's Latest badge. Its tag is never moved. The release policy now knows this tag: it is a pre-release that the workflow's built-in token publishes, so even a manual edit that marks it Latest is put back.

Why

GitHub's built-in releases/latest/download/... URL can't be used: in this repo "latest" is the desktop app. A dedicated release gives Android a URL of its own.

Alternatives considered:

  • Have the release workflow open a link-bump PR. That still leaves the links built into every installed desktop app stale until it updates, which is exactly what went wrong twice.
  • Move the mobile-android-latest tag on each release. That needs CI to force-push a tag, for no benefit to a download link.
  • Compare version names to decide the link is current. A same-version rebuild (the release workflow can re-publish a version in place) would then never reach the link, and its checksum would no longer match the served APK.

Nothing that reads Android releases sees the new release: the desktop updater ignores tags that aren't version numbers, the phone's update check (#23755) and the Android release-notes lookup only match mobile-android-v, and the release workflow only triggers on mobile-android-v* tags.

This supersedes #22894, which proposed the same permanent link.

Linked Issue

Fixes #7583

Visual Proof

N/A: only the destination of existing download links changes, plus the version number dropped from their text.

Testing

  • Offline dry run of the workflow's script (extracted from the YAML) against a stand-in gh that keeps release state in local files and never calls GitHub. Cases: first run creates the release and serves 0.0.52; a second run writes nothing; a same-version re-publish with new bytes is swapped in; a 502 on the newest version fails the run with no writes; a version with no release (404) or only a draft is skipped; a release without a checksum removes the old checksum and uploads none; a failed checksum download fails before any write; a leftover temporary APK from a dead run is cleaned up; a failed rename, a failed checksum upload and a failed notes update are each repaired by the next run; a failed tag listing fails with no writes; files with no recorded digest are hashed and not re-swapped.
  • One real read confirmed the digest field on the current 0.0.52 APK (sha256:68bd92…) and on the oldest one (0.0.14).
  • Added tests: the release policy restores mobile-android-latest to a pre-release when someone marks it Latest, and the shared tag patterns never classify it as a desktop or versioned mobile release. release-policy.test.mjs, release-tag-pattern-census.test.mjs and the workflow-reading tests pass.
  • Both workflow files parse; actionlint reports nothing on the new workflow; oxfmt --check passes on every changed file.
  • Searched README, translated READMEs, the docs site and src/ for versioned Android APK links: none left.
  • Not run on GitHub Actions: it first runs when this merges.

Rollout: no manual step. Merging runs the workflow, which creates mobile-android-latest and uploads the 0.0.52 APK as the workflow bot (no maintainer token: the release policy deletes a non-version release a person creates). The README and docs links 404 for the minute or two that first run takes. The links in the desktop app only reach users with the next desktop release, by which time the release exists. If that first run fails, the daily run (or a manual run) creates it.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

CI-only workflow change, a release-policy tag registration, and link updates; no effect on SSH, remote, or app behavior beyond where the download links go.

Author X/Twitter: @BrennanKB5

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The change adds a workflow that selects the newest versioned Android release with an APK and maintains a permanent prerelease with that APK and an optional checksum. The Android release workflow runs it when a release is published. README files, mobile documentation, and renderer links now use the permanent APK URL. The release policy classifies the rolling release tag as a prerelease.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to c5acc

A failed update can temporarily break the permanent download link or leave the served APK without its verification file. Both paths warrant correction, though a later successful run can restore them.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning #7583 requests a rolling android-latest release and the stable URL /download/android-latest/app-release.apk. The workflow and all updated links use mobile-android-latest instead. The PR implemen… Publish the rolling APK at the requested android-latest release URL, or provide that URL as a working alias, and update the download links to use it.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 6 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The workflow, release-policy changes, tests, and link updates support #7583’s Android download objective. No unrelated changes are evident.
Title check ✅ Passed The title clearly and concisely describes the main change: using one permanent release link for Android downloads.
Description check ✅ Passed The description covers the required sections with a clear explanation of the change, its rationale, the linked issue, visual proof, and detailed testing. Some checklist items remain unchecked, and the…
Full details: Linked Issues check

Explanation

#7583 requests a rolling android-latest release and the stable URL /download/android-latest/app-release.apk. The workflow and all updated links use mobile-android-latest instead. The PR implements automatic APK publication, preserves versioned releases, and marks the rolling release as a prerelease, but the requested URL is not provided by the described changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 6 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 565e9219-2dfa-4bd1-aff5-55135b218dd2
📥 Commits

Reviewing files that changed from the base of the PR and between ca77409 and 1e89430.

📒 Files selected for processing (12)
  • .github/workflows/mobile-android-latest-apk.yml
  • .github/workflows/mobile-android-release.yml
  • README.md
  • docs/readme/README.es.md
  • docs/readme/README.fr.md
  • docs/readme/README.ja.md
  • docs/readme/README.ko.md
  • docs/readme/README.pt.md
  • docs/readme/README.zh-CN.md
  • docs/site/content/docs/mobile.mdx
  • src/renderer/src/components/mobile/mobile-platform-copy.ts
  • src/renderer/src/components/settings/MobileSettingsPane.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Comment on lines +88 to +102
# Why: upload under a temporary name, then swap, so the link is down only between the
# delete and the rename rather than for the whole upload, and a failed upload leaves the
# previous APK serving.
gh release upload "$LATEST_TAG" "$dir/$next" --repo "$REPO"
release_json="$(gh api "repos/$REPO/releases/tags/$LATEST_TAG")"
old_id="$(jq -r --arg n "$ASSET" '.assets[] | select(.name == $n) | .id' <<<"$release_json")"
next_id="$(jq -r --arg n "$next" '.assets[] | select(.name == $n) | .id' <<<"$release_json")"
if [ -n "$old_id" ]; then
gh api -X DELETE "repos/$REPO/releases/assets/$old_id"
fi
gh api -X PATCH "repos/$REPO/releases/assets/$next_id" -f name="$ASSET" >/dev/null
if [ -f "$dir/$checksum" ]; then
gh release upload "$LATEST_TAG" "$dir/$checksum" --repo "$REPO"
fi
gh release edit "$LATEST_TAG" --repo "$REPO" --notes "$notes"

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,110p' .github/workflows/mobile-android-latest-apk.yml

Repository: stablyai/orca

Length of output: 5055


🏁 Script executed:

#!/bin/bash
set -e
file=.github/workflows/mobile-android-latest-apk.yml
git diff --no-ext-diff --unified=5 0971479866f2dc625b5c32dbc260ca568d1460dc 1e894304d65a471ff9a1940f206338c1c0e8c3e6 -- "$file"
printf '\n--- workflow callers ---\n'
rg -n -C 4 'mobile-android-latest-apk|workflow_call' .github/workflows
printf '\n--- file with line numbers ---\n'
nl -ba "$file" | sed -n '68,108p'

Repository: stablyai/orca

Length of output: 21246


🏁 Script executed:

#!/bin/bash
set -e
nl -ba .github/workflows/mobile-android-release.yml | sed -n '1,42p;220,252p'

Repository: stablyai/orca

Length of output: 2923


Recover the orphaned APK before stale-asset cleanup.

If the rename PATCH returns nonzero after the DELETE succeeds, set -euo pipefail stops the step with no app-release.apk. The next run deletes app-release.next.apk instead of restoring it, so the permanent URL can remain unavailable until a later run succeeds or someone dispatches the workflow. Promote the orphan before cleanup and refresh release_json. A trap can attempt immediate recovery, but the same API failure can also defeat that attempt.

Suggested recovery
           release_json="$(gh api "repos/$REPO/releases/tags/$LATEST_TAG")"
+          old_id="$(jq -r --arg n "$ASSET" '.assets[] | select(.name == $n) | .id' <<<"$release_json")"
+          next_id="$(jq -r --arg n "$next" '.assets[] | select(.name == $n) | .id' <<<"$release_json")"
+          if [ -z "$old_id" ] &amp;&amp; [ -n "$next_id" ]; then
+            gh api -X PATCH "repos/$REPO/releases/assets/$next_id" -f name="$ASSET" >/dev/null
+            release_json="$(gh api "repos/$REPO/releases/tags/$LATEST_TAG")"
+          fi
           if jq -e --arg asset "$ASSET" --arg src "Currently: $source_tag " \

…al itself

- Look up each candidate tag with releases/tags (published only) and skip a tag only on 404;
  any other error fails the run instead of serving an older APK.
- Decide "already current" from the source and served asset digests (APK and checksum), so a
  re-published build of the same version reaches the link and a checksum sits beside the APK
  exactly when the source has one. All downloads happen before any write.
- Run on push to main (creates the release on merge as the workflow bot) and daily, so a swap
  that died midway is repaired; concurrency moves to the job.
- Register mobile-android-latest as a prerelease tag in the release policy.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8e17cf21-8f53-4ec2-8b06-483b1f02863e
📥 Commits

Reviewing files that changed from the base of the PR and between 1e89430 and 52623df.

📒 Files selected for processing (5)
  • .github/workflows/mobile-android-latest-apk.yml
  • config/scripts/release-policy.mjs
  • config/scripts/release-policy.test.mjs
  • config/scripts/release-tag-pattern-census.test.mjs
  • config/scripts/release-tag-patterns.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

A run whose final notes edit failed left the notes naming the previous version, and the
digest-only no-op check never repaired them. The no-op path now rewrites the notes when they
differ from the ones the current source would produce.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Keep the old checksum until the temporary APK upload… · mobile-android-latest-apk.yml:135-140

.github/workflows/mobile-android-latest-apk.yml:135-140
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Keep the old checksum until the temporary APK upload succeeds.

If gh release upload "$LATEST_TAG" "$dir/$next" --repo "$REPO" fails, set -e stops the job after the stale-asset loop has deleted app-release.apk.sha256. The old app-release.apk remains served, but users cannot run the documented checksum check against it. Delete the old checksum after the temporary upload succeeds but before replacing the permanent APK. Deleting it only after the APK swap can leave the old checksum beside the new APK if publishing the new checksum then fails.

Suggested fix
-          for stale in "$next" "$checksum"; do
+          for stale in "$next"; do
             stale_id="$(jq -r --arg n "$stale" '.assets[] | select(.name == $n) | .id' "$dir/latest.json")"
             if [ -n "$stale_id" ]; then
               gh api -X DELETE "repos/$REPO/releases/assets/$stale_id"
@@
           old_id="$(jq -r --arg n "$ASSET" '.assets[] | select(.name == $n) | .id' "$dir/latest.json")"
           next_id="$(jq -r --arg n "$next" '.assets[] | select(.name == $n) | .id' "$dir/latest.json")"
+          old_sum_id="$(jq -r --arg n "$checksum" '.assets[] | select(.name == $n) | .id' "$dir/latest.json")"
+          if [ -n "$old_sum_id" ]; then
+            gh api -X DELETE "repos/$REPO/releases/assets/$old_sum_id"
+          fi
           if [ -n "$old_id" ]; then
             gh api -X DELETE "repos/$REPO/releases/assets/$old_id"
           fi

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 625dfa7d-1b70-40bd-9c37-b7d5978995f9
📥 Commits

Reviewing files that changed from the base of the PR and between 52623df and c5acc09.

📒 Files selected for processing (1)
  • .github/workflows/mobile-android-latest-apk.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/mobile-android-latest-apk.yml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Re-reviewed the newest commit — the only change since the prior review at 52623dfc99: the permanent-link workflow now re-derives its release notes when the served APK and checksum are already current but the notes still name an older version.

  • Heal stale release notes in the already-current path — mobile-android-latest-apk.yml:120-128 compares the served release body against the freshly computed notes and calls gh release edit only when they differ, so a run that swapped the APK and checksum but died before writing the notes is repaired on the next run without re-uploading the APK.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review summary (head c5acc09)

The problem. Every Android download link (the READMEs in seven languages, the docs site, the desktop pairing screen and Settings → Mobile) named one version, so each one had to be edited by hand after every Android release, and they kept going stale. Copies built into the desktop app stayed stale on every installed desktop until its next update (#7583).

What changes for users. Every Android download link now points at one permanent URL, https://github.com/stablyai/orca/releases/download/mobile-android-latest/app-release.apk, which always serves the newest Android APK. Link text no longer shows a version number. Nothing else that users see changes.

Rollout. No manual step is needed. When this PR merges, the workflow runs on main and creates the mobile-android-latest release with the built-in workflow token. The README and docs links return 404 for the minute or two that this first run takes. The desktop app's links change only with its next release. Do not create the release by hand with a personal token: the repo's release-policy workflow deletes a person-created release and its tag for any tag it doesn't recognise.

Fixed during review (two new commits on top of the original, 52623df and c5acc09):

  • The original bootstrap step (create the release with a maintainer token before merge) would have been deleted by release-policy within about a minute, leaving every link returning 404. The workflow now creates the release itself on merge, and mobile-android-latest is registered with the release policy as a pre-release, so even a manual "mark as Latest" is put back.
  • A temporary GitHub error (a 502 or a rate limit) while looking up the newest release made the run skip to an older version and swap the permanent link back to an older APK, with a green run. The run now moves on to an older version only on a 404 and fails on any other error. Drafts are never picked up.
  • The "already current" check compared only version names, so a version re-published with a new build never reached the link, and the checksum could sit beside a different APK. The check now compares the SHA-256 digests GitHub records for the APK and the checksum.
  • Nothing repaired the link after a run that died partway, for example after deleting the old APK but before renaming the new one. The workflow now also runs once a day, and every run re-checks the APK, the checksum and the release notes and repairs whichever is wrong. The daily run makes about four API calls and transfers nothing when the link is current.
  • Concurrency moved to the job inside the called workflow, so it can never share a concurrency group with the workflow that calls it.

Deferred (not fixed here):

  • P3: the README downloads badge will undercount. Each swap deletes the previous app-release.apk, and its download count goes with it.
  • P3, outside this repo: the website's download page (onorca.dev/download, Android) still links the versioned 0.0.52 APK and will go stale at 0.0.53.
  • Nits: a run that died after the APK swap but before the checksum upload re-swaps the whole APK instead of uploading only the checksum. A scheduled run that lands during a same-version re-publish can briefly serve the previous version until the release's own run swaps back. The new workflow isn't in the desktop-irrelevant list, so a PR touching only this workflow costs extra CI time. Two others are cosmetic.

Verified:

  • An offline dry run of the workflow script with a stand-in gh that performs real reads and only logs writes covered 22 runs. These included the first run, the already-current case, a same-version rebuild, a 502 and a 404 on the newest version, a draft-only version, a missing or failing checksum, a leftover temporary file, a failed rename and a failed notes edit. Each behaved as designed, including healing on the next run.
  • Read-only calls against stablyai/orca confirmed that the newest APK has a recorded digest and that gh reports a missing release as (HTTP 404).
  • Release-policy, tag-pattern census and workflow-contract tests pass (164/164 across 9 files), as does MobileHero.test.tsx. Both workflows parse, actionlint is clean, and the changed files pass oxfmt.
  • Nothing that reads releases picks up the new tag: the desktop updater, the phone's update check, the Android release-notes lookup, tag-triggered workflows and the docs deploy were all checked in code.
  • No versioned APK link is left in the READMEs, the docs site or src/.

Not verified:

  • The workflow has never run on GitHub Actions: a new workflow can't run until it is on main. After merge, check that the first run creates the release and serves 0.0.52, and that the next run logs "already serves". That second log confirms GitHub keeps a file's digest through the rename; if it doesn't, every daily run would re-swap.
  • No release, tag or asset was created in stablyai/orca during review.
  • No Electron or mobile QA. The desktop change is only the URL constant behind two existing buttons, and that URL returns 404 until the release exists at merge, so an app run would show nothing beyond the code diff. No phone code changed.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing as superseded: a merged PR already covers this change. #28143 (5a77f06) moved every README, docs and in-app APK link to one stable URL (onorca.dev/download/android) with a bump on release, solving the same stale per-version links

(Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.)

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.

[Feature]: Publish a rolling "android-latest" release for a stable APK download URL

1 participant