diff --git a/static/node-deno.svg b/static/node-deno.svg index 205934d..c5fcee5 100644 --- a/static/node-deno.svg +++ b/static/node-deno.svg @@ -22,7 +22,8 @@ cy="127.5" rx="37" ry="10.5" - > + > + + > + + > + + > + + > + + > + + > + + > + + > + + > + + > + @@ -100,7 +111,8 @@ id="Path" fill="#FFFFFF" mask="url(#mask-2)" - > + > + + > + diff --git a/static/node.svg b/static/node.svg index 96c854b..7ec3a13 100644 --- a/static/node.svg +++ b/static/node.svg @@ -19,7 +19,8 @@ cy="227.547695" rx="66" ry="19" - > + > + + > + + > + + > + + > + + > + + > + + > + + > + + > + diff --git a/util/report.ts b/util/report.ts index 627ac7e..2ac9936 100644 --- a/util/report.ts +++ b/util/report.ts @@ -16,8 +16,30 @@ const NOT_FOUND = Symbol("NOT_FOUND"); const reportCache = new WeakValueMap(); const summaryCache = new WeakValueMap(); +const SHARD_COUNT = 3; + +async function fetchSingleReport( + url: string, +): Promise { + try { + const res = await fetch(url); + if (res.status === 404) { + return undefined; + } + const report = await toJson( + res.body!.pipeThrough(new DecompressionStream("gzip")), + ); + return report as TestReport; + } catch (e) { + console.error(e); + return undefined; + } +} + /** * Fetch the report for a specific date and OS. + * Fetches sharded reports and merges them, with fallback to the old + * unsharded format for historical data. * * @param date The date e.g. 2025-04-02 * @param os The os @@ -28,21 +50,42 @@ export async function fetchReport( os: "linux" | "windows" | "darwin", ): Promise { console.log("fetching", date, os); - try { - const res = await fetch( - `https://dl.deno.land/node-compat-test/${date}/report-${os}.json.gz`, + // Fetch all shard reports and merge them + const shardReports: TestReport[] = []; + for (let i = 0; i < SHARD_COUNT; i++) { + const report = await fetchSingleReport( + `https://dl.deno.land/node-compat-test/${date}/report-${os}-${i}.json.gz`, ); - if (res.status === 404) { - return NOT_FOUND; + if (report) { + shardReports.push(report); } - const report = await toJson( - res.body!.pipeThrough(new DecompressionStream("gzip")), + } + // Fall back to unsharded report name for older reports + if (shardReports.length === 0) { + const report = await fetchSingleReport( + `https://dl.deno.land/node-compat-test/${date}/report-${os}.json.gz`, ); - return report as TestReport; - } catch (e) { - console.error(e); - return undefined; + return report ?? NOT_FOUND; + } + if (shardReports.length === 1) { + return shardReports[0]; + } + // Merge shard reports: combine results, recompute counts + const merged = { ...shardReports[0] }; + merged.results = { ...merged.results }; + for (let i = 1; i < shardReports.length; i++) { + const shard = shardReports[i]; + for (const [key, value] of Object.entries(shard.results)) { + merged.results[key] = value; + } } + // Recompute total/pass from merged results. + // Each result is a tuple [pass: bool | "IGNORE", error, info]. + const values = Object.values(merged.results); + merged.total = values.filter((v) => v[0] !== "IGNORE").length; + merged.pass = values.filter((v) => v[0] === true).length; + merged.ignore = values.filter((v) => v[0] === "IGNORE").length; + return merged; } /** Gets the report. Caches the response from the storage. */