Skip to content

fix(scripts): tolerate N/A entries in benchmark download#438

Merged
Eomm merged 3 commits into
mainfrom
fix/download-benchmarks-n-a-tolerance
Jun 4, 2026
Merged

fix(scripts): tolerate N/A entries in benchmark download#438
Eomm merged 3 commits into
mainfrom
fix/download-benchmarks-n-a-tolerance

Conversation

@ilteoood
Copy link
Copy Markdown
Contributor

@ilteoood ilteoood commented Jun 3, 2026

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:

  1. isValidBenchmark rejected the whole file because one tracked framework had a non-numeric value (everysome fix).
  2. When the 10-commit fallback also failed, the step timed out at 30 minutes because there was no per-request timeout.

Changes

  • isValidBenchmark: everysome — passes when at least one tracked framework has a numeric value.
  • buildBenchmarksJSON: coerces non-numeric requests to 0 so the sort comparator stays deterministic; guards maxSpeed against an empty numeric set.
  • getDataAsJSON: adds AbortSignal.timeout(10000) to each HTTP request so a slow GitHub API call fails in 10s instead of hanging the workflow.

Root cause trace

download-benchmarks.js → throws "Unable to find a valid benchmark result"
  → static/generated/benchmarks.json is never written
    → docusaurus.config.js:15 → u.checkGeneratedData() throws "Missing generated file: static/generated/benchmarks.json"
      → Docusaurus catches and re-throws as "Docusaurus could not load module at path …/docusaurus.config.js"
        → Build step times out at 30 minutes (workflow run 26875115530)

Test

Ran the script locally against the live data — restify now appears in benchmarks.json with requests: 0 and all other frameworks are unaffected.

Closes the build failures on deploy-website.yml (last 10 runs all failing).
Unlocks to #437

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.
@Tony133
Copy link
Copy Markdown
Member

Tony133 commented Jun 4, 2026

The benchmarks page no longer works as it used to ( see screenshot )

screenshot

Comment thread scripts/download-benchmarks.js
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
Signed-off-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
@Eomm Eomm merged commit c492652 into main Jun 4, 2026
5 checks passed
@Eomm Eomm deleted the fix/download-benchmarks-n-a-tolerance branch June 4, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants