Pin workflow index downloads to the release asset ID

Include the selected asset ID in the download URL so GitHub cannot serve a
cached redirect to the previous upload during successive index updates.

Reproduced the stale download after the live rebuild and stats refresh, then
extended the offline regression check to cover it. Publication, recovery and
complete-catalog rebuild checks pass.

Refs #575
This commit is contained in:
Alessandro committed 2026-09-22 10:23:53 +02:00
1 parent 581001338f
commit c6aaa8ea15
3 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -137,7 +137,7 @@ If we detect malicious behavior (including but not limited to malware, credentia
## Index maintenance
The `generated-index` release serves `index.json`. The shared publisher uploads and verifies `index.json.next` before renaming the current index to `index.json.previous` and promoting the new index. The previous copy is retained for recovery. These renames are not atomic; the downloader can use a completed recovery asset if the main file is missing, and the next publisher restores it before continuing. Keep the existing workflow serialization enabled.
The `generated-index` release serves `index.json`. The shared publisher uploads and verifies `index.json.next` before renaming the current index to `index.json.previous` and promoting the new index. The previous copy is retained for recovery. These renames are not atomic; the downloader can use a completed recovery asset if the main file is missing, and the next publisher restores it before continuing. Workflow downloads include the asset ID to avoid cached redirects to an older upload. Keep the existing workflow serialization enabled.
If the release or all usable index assets are missing, manually run **Generate Plugin State** on `main` with **rebuild_index** enabled. This starts a complete index from repository metadata, ignores plugin/diff/offset/cleanup selections, and verifies that all eligible plugins are included before publishing. `max_plugins` remains a safety limit and must cover the whole catalog. Normal runs still require a valid existing index. Rebuilds also sync plugin discussions; repository statistics are refreshed by the existing stats workflow.
+3 -2
View File
@@ -125,8 +125,9 @@ def main() -> int:
for a in assets:
if not isinstance(a, dict):
continue
if a.get("name") == name and a.get("state") == "uploaded" and isinstance(a.get("browser_download_url"), str):
download_url = cast(str, a.get("browser_download_url"))
if a.get("name") == name and a.get("state") == "uploaded" and isinstance(a.get("id"), int) and isinstance(a.get("browser_download_url"), str):
# Avoid cached redirects to a previous upload.
download_url = f"{a['browser_download_url']}?asset_id={a['id']}"
if name != asset_name:
print(f"WARN: {asset_name} missing; downloading recovery asset {name}")
break
+2
View File
@@ -47,6 +47,8 @@ def check(initial: dict[str, bytes], fault: str = "", content: bytes = NEW) -> N
if method != "GET":
mutations.append(method)
if url.hostname == "download.test":
if not url.query:
return io.BytesIO(OLD)
return io.BytesIO(contents[int(url.path.strip("/"))])
if "/releases/assets/" in url.path:
asset_id = int(url.path.rsplit("/", 1)[1])