Files
reverse-engineering-anything/scripts/fixtures/harmony/fetch.mjs
T
morluto 53e892d43e fix(ci): retry transient release-host failures when fetching pinned fixtures (#15426)
* fix(ci): retry transient release-host failures when fetching pinned fixtures

The scheduled CI sweep on 0b7f2229b5 failed android_metadata because
GitHub's release host answered one ApiDemos APK request with HTTP 618;
the Android and Harmony fixture fetchers gave up on the first response.

Both now fetch through one helper that retries network errors, HTTP 429
and HTTP 5xx-or-above up to three attempts with a short backoff, and
fails at once on any other status. Size and SHA-256 verification are
unchanged, so a retry cannot admit different bytes.

* fix(ci): retry fixture downloads interrupted while reading the body

The retry covered only the response headers: a reset or timeout while
streaming the body surfaced from each caller's read loop and failed after
one request. downloadFixture now owns the whole download. Each attempt
streams into a fresh partial file and hash, and network errors before or
during the body are retried. A permanent HTTP status, a size or SHA-256
mismatch, and local file errors still fail at once. Both fetchers drop
their duplicated existing-file check, streaming, hashing and size checks.
2026-12-01 05:45:07 +00:00

24 lines
734 B
JavaScript

import { downloadFixture } from "../../lib/fixture-download.mjs";
import { mkdir } from "node:fs/promises";
import { resolve, join } from "node:path";
import { fileURLToPath } from "node:url";
import fixture from "./pipeline.json" with { type: "json" };
const args = process.argv.slice(2);
if (args.length > 1)
throw new Error("Usage: npm run fixtures:harmony -- [DIRECTORY]");
const directory = resolve(
args[0] ??
fileURLToPath(
new URL("../../../_reference/harmony-integration/", import.meta.url),
),
);
await mkdir(directory, { recursive: true });
await downloadFixture({
url: fixture.url,
path: join(directory, fixture.filename),
sha256: fixture.sha256,
bytes: fixture.bytes,
timeoutMs: 300_000,
});