Repository navigation
ci(release): verify every stable Sparkle feed delivers an update #26922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
d399842
b1f26cb
8dc5266
8ad136d
02327be
d87b23d
ac828c3
54e95cc
5d6617a
d762227
6bd4f65
d4e3b11
cac86c0
0fbce10
1f3cbf7
1138db6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1059,3 +1059,40 @@ jobs: | |
| ./scripts/ci/signing-keychain.sh delete --keychain build.keychain \ | ||
| || security delete-keychain build.keychain >/dev/null 2>&1 || true | ||
| rm -f /tmp/cert.p12 | ||
|
|
||
| # Fetch every stable feed the way Sparkle does, plus this release's own, and | ||
| # every DMG they list. v0.65.2.2 went out green with 0 assets on the | ||
| # published release, so every update check failed | ||
| # (https://github.com/manaflow-ai/cmux/issues/26729). Its own job: the | ||
| # Homebrew cask gates on build-sign-notarize alone, so a red check here stays | ||
| # visible without holding the cask. stable-feed-watch.yml checks the default | ||
| # feeds hourly from main regardless of which branch published them; it does | ||
| # not check non-latest backports' own tag feeds. Those are covered only by | ||
| # each tag's release workflow when it includes this job. | ||
| verify-stable-feed: | ||
| needs: build-sign-notarize | ||
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
| permissions: | ||
| contents: read | ||
| runs-on: ${{ github.repository_owner != 'manaflow-ai' && 'ubuntu-24.04' || 'blacksmith-2vcpu-ubuntu-2404' }} | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| # A backport tag (for example v0.62.1 after v0.63.1) never becomes latest, | ||
| # so it answers only for its own feeds. | ||
| - name: Verify stable feeds deliver an update | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -euo pipefail | ||
| latest="$(gh release list --repo "$GITHUB_REPOSITORY" --exclude-drafts --exclude-pre-releases \ | ||
| --json tagName -q '.[].tagName' | sort -V | tail -1)" | ||
| scope=() | ||
| if [ "$latest" != "$GITHUB_REF_NAME" ]; then | ||
| echo "$GITHUB_REF_NAME is not the latest stable release ($latest); checking only its own feeds" | ||
| scope=(--tag-only) | ||
| fi | ||
| python3 scripts/ci/verify_stable_feed.py --repo "$GITHUB_REPOSITORY" --tag "$GITHUB_REF_NAME" \ | ||
| --settle-seconds 600 "${scope[@]+"${scope[@]}"}" | ||
|
Comment on lines
+1097
to
+1098
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Stable feed watch | ||
|
|
||
| # Every stable install checks releases/latest/download/appcast.xml (or its | ||
| # per-architecture rewrite). On 2026-10-27 v0.65.2.2 was tagged from a hotfix | ||
| # branch whose release.yml still published by tag: the published release had 0 | ||
| # assets, every feed URL 404ed, and every 0.65.2 install showed "error | ||
| # retrieving update information" behind a green release run | ||
| # (https://github.com/manaflow-ai/cmux/issues/26729). A tag runs the workflow | ||
| # file at that tag, so an older branch may omit release.yml's feed check. This | ||
| # schedule runs from main and checks the default stable feeds regardless of | ||
| # which branch published them. A non-latest backport's own tag feeds are checked | ||
| # only by its release workflow when it includes the check. The script probes | ||
| # every listed enclosure (scripts/ci/verify_stable_feed.py, tested by | ||
| # tests/test_verify_stable_feed.py) and goes red on any problem. | ||
| on: | ||
| schedule: | ||
| - cron: "23 * * * *" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: stable-feed-watch | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| watch: | ||
| if: github.repository_owner == 'manaflow-ai' | ||
| runs-on: ${{ github.repository_owner != 'manaflow-ai' && 'ubuntu-24.04' || 'blacksmith-2vcpu-ubuntu-2404' }} | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Check every stable feed and its enclosures | ||
| # A feed uploaded minutes ago can still serve GitHub's cached 404. | ||
| run: python3 scripts/ci/verify_stable_feed.py --settle-seconds 180 | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| #!/usr/bin/env python3 | ||
| """Fail when a stable Sparkle feed cannot deliver an update. | ||
|
|
||
| Installed stable apps check releases/latest/download/appcast.xml (thin builds | ||
| rewrite it to appcast-<arch>.xml), and files.cmux.com/stable/ serves the same | ||
| feeds from R2. On 2026-10-27 v0.65.2.2 was tagged from a hotfix branch that | ||
| still carried the publish-by-tag release workflow: the published release had 0 | ||
| assets while all 12 sat on a hidden draft, so every latest/download feed URL | ||
| 404ed and every 0.65.2 install showed "error retrieving update information" | ||
| (https://github.com/manaflow-ai/cmux/issues/26729). The release run was green. | ||
|
|
||
| Each feed must load, parse, and list at least one enclosure carrying an EdDSA | ||
| signature. Every enclosure must return the requested byte. Its reported full | ||
| size must match the feed's declared length; when the response reports no full | ||
| size, the enclosure passes without a length comparison. This probe does not | ||
| verify complete DMG contents or cryptographically validate the signature. | ||
| release.yml runs it after publishing with --tag, which adds the new release's | ||
| own feed URLs. stable-feed-watch.yml checks the default feeds hourly from main, | ||
| regardless of which branch published the release. A non-latest backport's own | ||
| feeds are checked only by its release workflow when it includes this check. | ||
|
|
||
| Right after an upload GitHub can serve a cached 404 for a few minutes, so | ||
| --settle-seconds retries failing feeds in rounds, 404 included, within one | ||
| shared window. The deadline limits retry starts; HTTP calls already running | ||
| can finish afterward, and the workflows enforce their own job timeouts. | ||
|
|
||
| usage: verify_stable_feed.py [--feed URL ...] [--tag vX.Y.Z [--tag-only]] [--attempts 3] [--settle-seconds 0] | ||
| Exits 1 with one line per problem. | ||
| """ | ||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import http.client | ||
| import re | ||
| import sys | ||
| import time | ||
| import urllib.error | ||
| import urllib.request | ||
| import xml.etree.ElementTree as ET | ||
|
|
||
| SPARKLE_NS = "http://www.andymatuschak.org/xml-namespaces/sparkle" | ||
| DEFAULT_FEEDS = ( | ||
| "https://github.com/manaflow-ai/cmux/releases/latest/download/appcast.xml", | ||
| "https://github.com/manaflow-ai/cmux/releases/latest/download/appcast-arm64.xml", | ||
| "https://github.com/manaflow-ai/cmux/releases/latest/download/appcast-x86_64.xml", | ||
| "https://files.cmux.com/stable/appcast.xml", | ||
| "https://files.cmux.com/stable/appcast-arm64.xml", | ||
| "https://files.cmux.com/stable/appcast-x86_64.xml", | ||
| ) | ||
| FEED_NAMES = ("appcast.xml", "appcast-arm64.xml", "appcast-x86_64.xml") | ||
| USER_AGENT = "cmux-stable-feed-check" | ||
|
|
||
|
|
||
| class FetchError(Exception): | ||
| pass | ||
|
|
||
|
|
||
| def http_get(url: str) -> bytes: | ||
| request = urllib.request.Request(url, headers={"Cache-Control": "no-cache", "User-Agent": USER_AGENT}) | ||
| try: | ||
| with urllib.request.urlopen(request, timeout=30) as response: | ||
| return response.read() | ||
| except urllib.error.HTTPError as error: | ||
| raise FetchError(f"HTTP {error.code}") from error | ||
| except (urllib.error.URLError, OSError, http.client.HTTPException, ValueError) as error: | ||
| raise FetchError(str(getattr(error, "reason", error))) from error | ||
|
|
||
|
|
||
| def served_length(status: int, content_range: str | None, content_length: str | None) -> int | None: | ||
| """The full size from a one-byte range response, or None if unknown.""" | ||
| if status == 206 and content_range: | ||
| match = re.fullmatch(r"bytes \d+-\d+/(\d+)", content_range.strip()) | ||
| return int(match.group(1)) if match else None | ||
| return int(content_length) if content_length and content_length.isdigit() else None | ||
|
|
||
|
|
||
| def http_content_length(url: str) -> int | None: | ||
| """Asks for one byte and returns the full size the server reports. | ||
|
|
||
| urllib turns a redirected HEAD into a GET, so a HEAD to GitHub's release | ||
| URL would start a full DMG download; a range request follows the redirect | ||
| and transfers one byte.""" | ||
| request = urllib.request.Request(url, headers={"Range": "bytes=0-0", "User-Agent": USER_AGENT}) | ||
| try: | ||
| with urllib.request.urlopen(request, timeout=30) as response: | ||
| if not response.read(1): | ||
| raise FetchError("response closed before the requested byte") | ||
| return served_length(response.status, response.headers.get("Content-Range"), | ||
| response.headers.get("Content-Length")) | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| except urllib.error.HTTPError as error: | ||
| raise FetchError(f"HTTP {error.code}") from error | ||
| except (urllib.error.URLError, OSError, http.client.HTTPException, ValueError) as error: | ||
| raise FetchError(str(getattr(error, "reason", error))) from error | ||
|
|
||
|
|
||
| def with_retries(attempts: int, call, *args): | ||
| """GitHub's release CDN returns a transient 5xx or reset now and then; a | ||
| 404 is the failure this check exists for, so it is never retried.""" | ||
| for attempt in range(1, attempts + 1): | ||
| try: | ||
| return call(*args) | ||
| except FetchError as error: | ||
| if attempt == attempts or str(error).startswith("HTTP 4"): | ||
| raise | ||
| time.sleep(2 * attempt) | ||
|
|
||
|
|
||
| def enclosures(feed_xml: bytes) -> list[dict[str, str]]: | ||
| """Returns each item's enclosure attributes; raises ValueError on bad XML.""" | ||
| try: | ||
| root = ET.fromstring(feed_xml) | ||
| except ET.ParseError as error: | ||
| raise ValueError(f"does not parse as XML ({error})") from error | ||
| found = [] | ||
| for item in root.iter("item"): | ||
| enclosure = item.find("enclosure") | ||
| if enclosure is None: | ||
| continue | ||
| found.append({ | ||
| "url": enclosure.get("url", ""), | ||
| "length": enclosure.get("length", ""), | ||
| "signature": enclosure.get(f"{{{SPARKLE_NS}}}edSignature", ""), | ||
| }) | ||
| return found | ||
|
|
||
|
|
||
| def check_feed(feed_url: str, attempts: int, get=http_get, content_length=http_content_length) -> list[str]: | ||
| """Returns one line per problem with the feed or any enclosure it lists.""" | ||
| try: | ||
| body = with_retries(attempts, get, feed_url) | ||
| except FetchError as error: | ||
| return [f"{feed_url}: feed did not load ({error})"] | ||
| try: | ||
| items = enclosures(body) | ||
| except ValueError as error: | ||
| return [f"{feed_url}: feed {error}"] | ||
| if not items: | ||
| return [f"{feed_url}: feed lists no item with an enclosure"] | ||
| problems = [] | ||
| for item in items: | ||
| url = item["url"] | ||
| if not url: | ||
| problems.append(f"{feed_url}: an enclosure has no url") | ||
| continue | ||
| if not item["signature"]: | ||
| problems.append(f"{feed_url}: {url} has no sparkle:edSignature") | ||
| try: | ||
| if not (item["length"].isascii() and item["length"].isdigit()): | ||
| raise ValueError("length must contain ASCII digits") | ||
| declared_length = int(item["length"]) | ||
| except ValueError: | ||
| problems.append(f"{feed_url}: {url} has no numeric length") | ||
| continue | ||
| try: | ||
| served = with_retries(attempts, content_length, url) | ||
| except FetchError as error: | ||
| problems.append(f"{feed_url}: {url} does not download ({error})") | ||
| continue | ||
| if served is not None and served != declared_length: | ||
| problems.append(f"{feed_url}: {url} serves {served} bytes, the feed declares {item['length']}") | ||
| return problems | ||
|
|
||
|
|
||
| def main(argv: list[str] | None = None) -> int: | ||
| parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) | ||
| parser.add_argument("--feed", action="append", help="feed URL to check (repeatable; default: every stable feed)") | ||
| parser.add_argument("--tag", help="also check this release's own feeds (releases/download/TAG/...)") | ||
| parser.add_argument("--tag-only", action="store_true", help="check only the --tag feeds (a backport release)") | ||
| parser.add_argument("--repo", default="manaflow-ai/cmux") | ||
| parser.add_argument("--attempts", type=int, default=3) | ||
| parser.add_argument("--settle-seconds", type=int, default=0, | ||
| help="retry failing feeds in rounds within this shared window (404 included)") | ||
| args = parser.parse_args(argv) | ||
| if args.tag_only and not args.tag: | ||
| parser.error("--tag-only needs --tag") | ||
| feeds = [] if args.tag_only else list(args.feed or DEFAULT_FEEDS) | ||
| if args.tag: | ||
| feeds += [f"https://github.com/{args.repo}/releases/download/{args.tag}/{name}" for name in FEED_NAMES] | ||
| deadline = time.monotonic() + max(0, args.settle_seconds) | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| results = [check_feed(feed_url, max(1, args.attempts)) for feed_url in feeds] | ||
| while any(results): | ||
| remaining = deadline - time.monotonic() | ||
| if remaining <= 0: | ||
| break | ||
| time.sleep(min(15, remaining)) | ||
| for index, feed_url in enumerate(feeds): | ||
| if results[index] and time.monotonic() < deadline: | ||
| print(f"wait {feed_url}: {results[index][0]}") | ||
| results[index] = check_feed(feed_url, max(1, args.attempts)) | ||
| problems = [] | ||
| for feed_url, found in zip(feeds, results): | ||
| print(f"{'FAIL' if found else 'ok '} {feed_url}") | ||
|
Comment on lines
+238
to
+244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| problems.extend(found) | ||
| for problem in problems: | ||
| print(f"::error::{problem}") | ||
| return 1 if problems else 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: manaflow-ai/cmux
Length of output: 1497
Script executed:
Repository: manaflow-ai/cmux
Length of output: 29289
Web query:
GitHub CLI gh release list default limit order latest releases 30 official manualResult:
Script executed:
Repository: manaflow-ai/cmux
Length of output: 25420
Web query:
GitHub cli gh release list source default limit 30 GraphQL releases order created_at latest first gh cli v2Result:
Web query:
GitHub Actions ubuntu-24.04 runner image gh cli version 2026 GitHub CLI installedResult:
Script executed:
Repository: manaflow-ai/cmux
Length of output: 10392
Web query:
github cli cli v2.103.3 pkg cmd release list http.go orderBy CREATED_AT default limit 30 sourceResult:
Paginate releases before classifying backports.
If the highest-version release falls outside the 30 returned releases, a backport can be classified as latest. The job then checks default feeds and can fail on an unrelated feed problem. Fetch all stable releases before selecting the highest version.