mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-07 21:30:36 -05:00
[GH-ISSUE #2848] newtUpdateAvailable shows false for outdated sites due to v-prefixed duplicate tags #9022
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @strausmann on GitHub (Apr 13, 2026).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/2848
Describe the Bug
The
newtUpdateAvailablefield in the Sites API response (GET /org/{orgId}/sites) incorrectly showsfalsefor sites running outdated Newt versions. Two root causes were identified:Bug 1 (primary): Tag sorting + duplicate tags
The code in
server/routers/site/listSites.tsfetches/repos/fosrl/newt/tagsand takestags[0].nameas the latest version. However, the Newt repo has duplicate tags with and withoutvprefix for versions 1.8.0–1.10.3. The GitHub Tags API returnsv-prefixed tags before unprefixed ones:Result:
latestNewtVersion = "v1.10.3"instead of"1.11.0"semver.lt("1.10.1", "v1.10.3")→ true (correct for 1.10.1 sites)semver.lt("1.10.3", "v1.10.3")→ false (wrong — 1.11.0 is available)Bug 2 (secondary): Cache invalidation without fallback
The cached version has a 1-hour TTL. After expiry, if the GitHub fetch times out (1.5s limit), the cache returns
nulland ALL sites default tonewtUpdateAvailable: false. A stale-while-revalidate pattern would preserve the last known value until a successful fetch.Suggested fixes:
semver.rcompare()and deduplicate before selectingtags[0]/repos/fosrl/newt/releases/latestinstead of/tags(returns the actual latest release, not affected by tag ordering)v-prefixed tags in the Newt repoEnvironment
To Reproduce
GET /org/{orgId}/sitesnewtUpdateAvailable: falsecurl https://api.github.com/repos/fosrl/newt/tags | jq '.[0].name'— returnsv1.10.3not1.11.0Expected Behavior
All sites running Newt < 1.11.0 should show
newtUpdateAvailable: true, since 1.11.0 is the latest release.@strausmann commented on GitHub (Apr 13, 2026):
Related discussion with additional analysis and code suggestions: https://github.com/fosrl/pangolin/discussions/2847