fix(scripts): tolerate N/A entries in benchmark download#438
Merged
Conversation
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.
Member
Eomm
reviewed
Jun 4, 2026
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com> Signed-off-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
Eomm
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
The benchmark dataset in fastify/benchmarks now contains entries with
requests: "N/A"(e.g. restify) when a framework cannot be benchmarked. This broke the build in two ways:isValidBenchmarkrejected the whole file because one tracked framework had a non-numeric value (every→somefix).Changes
isValidBenchmark:every→some— passes when at least one tracked framework has a numeric value.buildBenchmarksJSON: coerces non-numericrequeststo0so the sort comparator stays deterministic; guardsmaxSpeedagainst an empty numeric set.getDataAsJSON: addsAbortSignal.timeout(10000)to each HTTP request so a slow GitHub API call fails in 10s instead of hanging the workflow.Root cause trace
Test
Ran the script locally against the live data —
restifynow appears inbenchmarks.jsonwithrequests: 0and all other frameworks are unaffected.Closes the build failures on
deploy-website.yml(last 10 runs all failing).Unlocks to #437