Serve release downloads from R2 instead of GitHub for IPv6 hosts - #207
Conversation
github.com and api.github.com have no AAAA record, so IPv6-only hosts (no NAT64) can check /versions/v1/latest for an update but can never download it. FOSSBilling/FOSSBilling now mirrors every release archive to R2 under download.fossbilling.org, which is IPv6-reachable. getReleases() now looks up each release's R2 mirror and prefers its download_url and digest (the digest is R2 custom metadata set by CI from the exact uploaded file, so it's read rather than recomputed). Releases without a mirror - published before this existed, or on a failed R2 lookup - fall back to the GitHub asset as before. Fixes FOSSBilling/FOSSBilling#2479
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
api | 09b394f | Commit Preview URL Branch Preview URL |
Aug 30 2026, 07:15 PM |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- getReleases now requires downloadBucket instead of it being optional. stats/v1 was passing undefined, and since it writes to the exact same RELEASE_CACHE_KEY the versions service reads, a stats-triggered cache refresh could overwrite that shared cache with GitHub-only download URLs for up to 24h - silently undoing the R2 preference for IPv6-only hosts until something refreshed it again. stats/v1 now threads c.env.DOWNLOAD_BUCKET through so every writer resolves R2 consistently. - Fixed a test assertion left out of sync with a manually-edited mock digest (61 vs 64 hex chars) from the previous review round. - Updated the versions/v1 README: download_url/digest now documented as R2-preferred with a GitHub fallback, and DOWNLOAD_BUCKET is listed as a required binding.
|
Addressed cubic's findings in 7edd9ff:
Two items I'm not changing:
|
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
- The GET / example in the versions README keyed its sample release as 0.5.0, which (per the fallback note added last commit) would predate R2 mirroring and show a GitHub URL - contradicting the R2 download_url shown right next to it. Swapped the example to 0.6.0. - Added a regression test for the stats/v1 cache-poisoning fix: seeds DOWNLOAD_BUCKET, forces /stats/v1/data through a fresh release fetch, and asserts the shared gh-fossbilling-releases cache it writes carries the R2 download_url/digest rather than the GitHub asset. Confirmed it fails against the pre-fix code (undefined bucket) before restoring the real fix.
|
Addressed both findings from the latest round in 09b394f:
|
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
Summary
github.comandapi.github.comhave no AAAA record, so IPv6-only hosts (no NAT64) can check/versions/v1/latestfor an update but can never download it. FOSSBilling/FOSSBilling now mirrors every release archive to R2 underdownload.fossbilling.org, which is IPv6-reachable.getReleases()now looks up each release's R2 mirror and prefers itsdownload_urlanddigestover the GitHub asset.digestis read from R2 custom metadata set by CI from the exact uploaded file, rather than recomputed here.stats/v1skips the R2 lookup entirely since it never readsdownload_url/digest.previewbranch endpoint already returns adownload.fossbilling.orgURL and needed no change.Fixes FOSSBilling/FOSSBilling#2479.