From cc72ec0f99970dd012dee8f963c2f7204c4b6020 Mon Sep 17 00:00:00 2001 From: Matteo Pietro Dazzi Date: Wed, 3 Jun 2026 21:37:51 +0200 Subject: [PATCH 1/3] fix(scripts): tolerate N/A entries in benchmark download MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The benchmarks dataset in fastify/benchmarks now contains entries with `requests: "N/A"` (e.g. restify) when a framework cannot be benchmarked. `isValidBenchmark` rejected the whole file as soon as a single tracked framework had a non-numeric value, and the 10-commit fallback then walked the entire history without finding a clean revision, throwing `Unable to find a valid benchmark result`. With `static/generated/benchmarks.json` never written, `docusaurus.config.utils.js#checkGeneratedData` failed at config load with `Missing generated file: static/generated/benchmarks.json`, which Docusaurus re-threw as `Docusaurus could not load module at path "…/docusaurus.config.js"` and the build timed out at 30 minutes. - `isValidBenchmark` now passes when at least one tracked framework has a numeric value (`some` instead of `every`). - `buildBenchmarksJSON` coerces non-numeric requests to `0` so the sort comparator stays deterministic. - `maxSpeed` falls back to `0` when no tracked framework reports a number, instead of an unguarded reduce. - Each `request(...)` call now carries a 10s `AbortSignal.timeout` so a slow GitHub API response fails the step in seconds rather than hanging until the workflow timeout. --- scripts/download-benchmarks.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/download-benchmarks.js b/scripts/download-benchmarks.js index fbf65157..f3966022 100644 --- a/scripts/download-benchmarks.js +++ b/scripts/download-benchmarks.js @@ -97,34 +97,32 @@ const getBlob = async (blobUrl) => { } function buildBenchmarksJSON(data, date = 'Unknown') { - const maxSpeed = data + const numericRequests = data + .filter((item) => frameworkTags.includes(item.name)) .filter(({ requests }) => !isNaN(requests)) .map(({ requests }) => parseInt(requests)) - .reduce((max, req) => (req > max ? req : max), 0) - const json = { + const maxSpeed = numericRequests.length ? numericRequests.reduce((max, req) => (req > max ? req : max), 0) : 0 + + return { date, reference: maxSpeed, frameworks: arrayDefaultFrameworks .map((framework) => { - const item = data.find(({ name }) => name == framework.tag) + const item = data.find(({ name }) => name === framework.tag) return { ...framework, - requests: item.requests, + requests: isNaN(item.requests) ? 0 : parseInt(item.requests), } }) - .sort((a, b) => { - return b.requests - a.requests - }), + .sort((a, b) => b.requests - a.requests), } - - return json } function isValidBenchmark(data) { return data .filter((item) => frameworkTags.includes(item.name)) // - .every((item) => !isNaN(item.requests)) + .some((item) => !isNaN(item.requests)) } async function getDataAsJSON(url) { @@ -140,6 +138,7 @@ async function getDataAsJSON(url) { const { body } = await request(url, { headers, + signal: AbortSignal.timeout(10000), }) return body.json() } From 0b101114cf70010274a4b40a16a7c35596ebc974 Mon Sep 17 00:00:00 2001 From: Matteo Pietro Dazzi Date: Thu, 4 Jun 2026 09:51:33 +0200 Subject: [PATCH 2/3] Update scripts/download-benchmarks.js Co-authored-by: Manuel Spigolon Signed-off-by: Matteo Pietro Dazzi --- scripts/download-benchmarks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/download-benchmarks.js b/scripts/download-benchmarks.js index f3966022..497845e7 100644 --- a/scripts/download-benchmarks.js +++ b/scripts/download-benchmarks.js @@ -115,6 +115,7 @@ function buildBenchmarksJSON(data, date = 'Unknown') { requests: isNaN(item.requests) ? 0 : parseInt(item.requests), } }) + .filter(f => f.requests > 0) .sort((a, b) => b.requests - a.requests), } } From a432699003019eccb2f90a3c07027c96d61ef466 Mon Sep 17 00:00:00 2001 From: Matteo Pietro Dazzi Date: Thu, 4 Jun 2026 14:14:21 +0200 Subject: [PATCH 3/3] fix: format --- scripts/download-benchmarks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download-benchmarks.js b/scripts/download-benchmarks.js index 497845e7..87429a78 100644 --- a/scripts/download-benchmarks.js +++ b/scripts/download-benchmarks.js @@ -115,7 +115,7 @@ function buildBenchmarksJSON(data, date = 'Unknown') { requests: isNaN(item.requests) ? 0 : parseInt(item.requests), } }) - .filter(f => f.requests > 0) + .filter((f) => f.requests > 0) .sort((a, b) => b.requests - a.requests), } }