Skip to content

fix(site): serve release data from a build-time snapshot, not the live API#3

Merged
Muawiya-contact merged 1 commit into
mainfrom
fix/cache-release-data-static
Jul 21, 2026
Merged

fix(site): serve release data from a build-time snapshot, not the live API#3
Muawiya-contact merged 1 commit into
mainfrom
fix/cache-release-data-static

Conversation

@Muawiya-contact

Copy link
Copy Markdown
Member

The real cause (confirmed live, not guessed)

The download section fetched api.github.com/repos/Coding-Moves/diskern/releases/latest
on every page load. Captured from the deployed site's own origin:

  • HTTP 403, x-ratelimit-remaining: 0 / limit 60, body: "API rate limit exceeded".
  • Not CORS, not 404, not a parse error, not a wrong URL.
  • v0.1.1 is published (web /releases/latest → 302 → /releases/tag/v0.1.1).

GitHub's anonymous REST limit is 60 req/hour per IP, shared across a NAT — so a few
refreshes or a busy network exhausts it and everyone gets the error fallback. It self-heals
hourly, which is why it looked intermittent.

Fix

  • Deploy workflow fetches the release server-side with GITHUB_TOKEN (authenticated,
    far higher limit) and bakes it into public/latest-release.json.
  • The hook reads that same-origin snapshot first (no CORS, no rate limit) and only falls
    back to the live API when the snapshot is missing (local dev / failed generation).
  • Snapshot stays fresh via new release: published + daily schedule triggers.
  • Fallback UI now shows the real error (e.g. "GitHub API responded 403 (rate limit…)").
  • Generated snapshot is gitignored.

Verified locally

  • Snapshot present → renders v0.1.1 with per-OS buttons, zero api.github.com calls.
  • Snapshot absent → falls back to the live API correctly (guards against the SPA-shell HTML
    that Pages serves for a missing file).

The download section fetched api.github.com/.../releases/latest on every
page load. GitHub's anonymous REST limit is 60 req/hour PER IP (shared
across a NAT), so a few refreshes or a busy network exhausted it and the
site showed the generic error fallback (confirmed live: HTTP 403,
x-ratelimit-remaining 0). The v0.1.1 release itself is fine and published.

Fix: the deploy workflow now fetches the release server-side with
GITHUB_TOKEN (authenticated, far higher limit) and bakes it into the site
as public/latest-release.json. The hook reads that same-origin snapshot
first — no CORS, no rate limit — and only falls back to the live API when
the snapshot is missing (local dev, or a deploy where the fetch failed).
The snapshot stays fresh via new `release: published` + daily `schedule`
triggers on the deploy workflow.

Also surface the real error (e.g. "GitHub API responded 403 (rate
limit…)") in the fallback UI so future failures are self-diagnosing, and
gitignore the generated snapshot.

Verified locally: with the snapshot present the site renders v0.1.1 with
per-OS buttons and makes zero api.github.com calls; with it removed it
falls back to the live API correctly.

@Muawiya-contact Muawiya-contact left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@Muawiya-contact
Muawiya-contact merged commit 249330e into main Jul 21, 2026
1 check 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.

1 participant