Skip to content

fix(ci): make the performance benchmark actually run, and fail loudly if it does not (#987) - #995

Merged
thinkclay merged 1 commit into
mainfrom
fix/benchmark-actually-runs
Oct 6, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/benchmark-actually-runs

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #987.

The Performance Benchmarks job has been reporting success while producing nothing since roughly the Expo 55→56 upgrade. The comment it left on #990 — merged an hour ago — was literally this:

## 📊 Performance Benchmark Results

Three separate things had to be wrong for that to be the outcome, and all three are fixed here.

1. deno was reading a tsconfig from a different app

The bench ran with no --config, so deno's config discovery walked out of packages/supabase and landed on a sibling:

error: Unsupported 'jsx' compiler option value 'react-native'
  at apps/ui-storybook-native/tsconfig.json

"jsx": "react-native" is correct for React Native and unsupported by deno. continue-on-error: true swallowed the exit code, and the > redirect still created an empty benchmark-results.txt — so the artifact and the comment were empty rather than absent, which is exactly why nobody noticed.

Worth knowing beyond this job: any deno invocation from this repo without an explicit --config hits it. I reproduced it with a throwaway file in /tmp.

2. A real ReferenceError in a shared test fixture

With the config fixed, the bench still would not compile:

TS2552 [ERROR]: Cannot find name 'url'. Did you mean 'URL'?
          [...url.searchParams.keys()].join(", ") || "none"
    at functions/api/__tests__/setup.ts:305:15

Not a config artifact. #932 replaced new URL() with new URLSearchParams() named params and left this line reading a binding that no longer exists — so completeMagicLinkAuth's "missing token or type" branch, which is meant to log and return null, would have thrown instead. Fixed to [...params.keys()].

3. It could not have finished inside the job timeout

This is the part #987 did not anticipate, and it took three measurements to get right:

configuration wall time
file defaults (10 warmup / 100 measured) 389s
reduced requests per iteration (3 / 20) 180s
…plus a bounded sample count (n: 3) 83s

The middle row is the interesting one: cutting requests per iteration barely helped, because Deno.bench keeps sampling until it is statistically confident — it just took more samples. The knob that actually bounds total work is n, which is now set on all five benchmarks and env-overridable like the rest. Local runs keep the larger defaults; CI gets the bounded set.

timeout-minutes also goes 10 → 15. 83s is on an M4 Pro, and the job pays for checkout, pnpm install, the Supabase CLI and supabase start out of the same budget.

Silence is no longer an option

continue-on-error: true stays on the measurement — a slow benchmark should not block a PR. But "it ran and was slow" and "it never ran" are different states, and only the first deserves to be quiet, so a new step fails the job when benchmark-results.txt is empty or missing. That is the specific hole that let this last for months.

Verification

Run with exactly the env CI now uses, against a real local stack:

exit=0 elapsed=83s
bytes=4744 lines=54

| REST: GET /v1/jobs (paginated list)         |  2.6 s | 0.4 | (2.3 s … 3.3 s) |
| REST: GET /v1/jobs/:id (single job)         |  2.6 s | 0.4 | (2.2 s … 3.0 s) |
| REST: POST /v1/applications (create)        |  4.0 s | 0.2 | (3.7 s … 4.3 s) |
| REST: Concurrent GET /v1/jobs (10 parallel) |  4.3 s | 0.2 | (3.2 s … 5.4 s) |
| REST: GET /v1/jobs with multiple filters    |  2.5 s | 0.4 | (2.2 s … 2.7 s) |

Real figures where there were none. biome lint and deno fmt --check clean on both touched files (they are deno-fmt style, not biome-formatted — biome check would rewrite them wholesale, so don't), pnpm prepush green.

What I did not fix, and you should see before trusting these numbers

Making the benchmark run is what this PR does. Making its output worth reading is a different job, and three things stand in the way:

  1. There are no tRPC benchmarks. The file has exactly five Deno.bench calls and every one is REST:. rest-vs-trpc.bench.ts describes a comparison that either was never written or left with tRPC's retirement. The "vs" has no other half.
  2. The run logs 30 auth errors (isAuthError, status: 500, unexpected_failure) from the magic-link fixture, so some measurements are timing failure paths rather than the endpoint.
  3. The summary table reads wrong. "2.6 s" is one iteration of 20 requests, i.e. ~130ms each — not a 2.6-second response. I documented that in the file because it is actively misleading, but the table still invites the wrong reading.

So: this job will now produce numbers instead of an empty code block, and will shout if it ever stops. Whether it deserves ~4 minutes of CI on every packages/supabase PR is a judgement I would rather leave with you than quietly settle — #987's option 3 (delete the job) is still defensible, and if you want that instead, this PR is a clean revert.

🤖 Generated with Claude Code

… if it does not (#987)

The job has reported success while producing nothing since roughly the
Expo 55->56 upgrade. The comment it left on #990 was an empty code
block. Three things had to be wrong for that:

1. No --config, so deno's config discovery walked out of
   packages/supabase into apps/ui-storybook-native/tsconfig.json and
   refused its `"jsx": "react-native"`. continue-on-error swallowed the
   exit code, and the `>` redirect still created an empty
   benchmark-results.txt — so the artifact and the comment were empty
   rather than missing, which is why nobody noticed. Any deno
   invocation from this repo without --config hits it; reproduced with
   a throwaway file in /tmp.

2. functions/api/__tests__/setup.ts:305 read `url.searchParams` after
   #932 replaced `new URL()` with `new URLSearchParams()` named
   `params`. completeMagicLinkAuth's "missing token or type" branch
   would have thrown a ReferenceError instead of logging and returning
   null.

3. It could not finish in the time the job had. Measured: 389s at the
   file's defaults, 180s with fewer requests per iteration — barely
   better, because Deno.bench keeps sampling until it is confident and
   simply took more samples — and 83s once the sample count itself is
   bounded with `n`. All four knobs are env-overridable; CI takes the
   bounded set, local runs keep the larger defaults. timeout-minutes
   10 -> 15, since 83s is on an M4 Pro and the job also pays for
   checkout, install and `supabase start`.

continue-on-error stays on the measurement: a slow benchmark should not
block a PR. But "it ran and was slow" and "it never ran" are different
states and only the first deserves to be quiet, so a new step fails the
job when the results file is empty or missing.

Verified with CI's env against a real stack: exit 0, 83s, 54 lines, all
five summary rows carrying real figures.

Not fixed here, and worth seeing before trusting the output: there are
no tRPC benchmarks at all (all five are REST, so the rest-vs-trpc name
has no other half), the run logs 30 auth 500s from the magic-link
fixture, and the summary's "2.6 s" is one iteration of 20 requests
rather than a per-request time.

Co-Authored-By: Claude Opus 5 <[email protected]>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results

�[0m�[38;5;245m    CPU | INTEL(R) XEON(R) PLATINUM 8573C�[0m
�[0m�[38;5;245mRuntime | Deno 2.9.7 (x86_64-unknown-linux-gnu)�[0m

�[0m�[38;5;245mfile:///home/runner/work/SaaS/SaaS/packages/supabase/functions/api/__tests__/benchmarks/rest-vs-trpc.bench.ts�[0m

| benchmark                                     | time/iter (avg) |        iter/s |      (min … max)      |      p75 |      p99 |     p995 |
| --------------------------------------------- | --------------- | ------------- | --------------------- | -------- | -------- | -------- |

�[0m�[38;5;245mgroup�[0m �[0m�[32mjobs-list�[0m
�[0m�[38;5;245mREST: GET /v1/jobs (paginated list):�[0m   → Average response time: 84.36ms
�[0m�[38;5;245mREST: GET /v1/jobs (paginated list):�[0m   → Average response time: 77.54ms
�[0m�[38;5;245mREST: GET /v1/jobs (paginated list):�[0m   → Average response time: 77.55ms
�[0m�[38;5;245mREST: GET /v1/jobs (paginated list):�[0m   → Average response time: 78.74ms
�[0m�[38;5;245mREST: GET /v1/jobs (paginated list):�[0m   → Average response time: 75.83ms
| REST: GET /v1/jobs (paginated list)           | �[0m�[33m          3.1 s�[0m |           0.3 | (�[0m�[36m   3.1 s�[0m … �[0m�[35m   3.1 s�[0m) |�[0m�[35m    3.1 s |    3.1 s |    3.1 s |�[0m

�[0m�[38;5;245mgroup�[0m �[0m�[32mjob-details�[0m
�[0m�[38;5;245mREST: GET /v1/jobs/:id (single job):�[0m   → Average response time: 75.65ms
�[0m�[38;5;245mREST: GET /v1/jobs/:id (single job):�[0m   → Average response time: 77.40ms
�[0m�[38;5;245mREST: GET /v1/jobs/:id (single job):�[0m   → Average response time: 77.94ms
�[0m�[38;5;245mREST: GET /v1/jobs/:id (single job):�[0m   → Average response time: 121.33ms
�[0m�[38;5;245mREST: GET /v1/jobs/:id (single job):�[0m   → Average response time: 76.38ms
| REST: GET /v1/jobs/:id (single job)           | �[0m�[33m          3.3 s�[0m |           0.3 | (�[0m�[36m   3.0 s�[0m … �[0m�[35m   4.0 s�[0m) |�[0m�[35m    3.1 s |    4.0 s |    4.0 s |�[0m

�[0m�[38;5;245mgroup�[0m �[0m�[32mapplication-create�[0m
�[0m�[38;5;245mREST: POST /v1/applications (create):�[0m   → Average response time: 78.28ms
�[0m�[38;5;245mREST: POST /v1/applications (create):�[0m   → Average response time: 75.33ms
�[0m�[38;5;245mREST: POST /v1/applications (create):�[0m   → Average response time: 77.49ms
�[0m�[38;5;245mREST: POST /v1/applications (create):�[0m   → Average response time: 75.63ms
�[0m�[38;5;245mREST: POST /v1/applications (create):�[0m   → Average response time: 91.58ms
| REST: POST /v1/applications (create)          | �[0m�[33m          5.2 s�[0m |           0.2 | (�[0m�[36m   5.0 s�[0m … �[0m�[35m   5.8 s�[0m) |�[0m�[35m    5.1 s |    5.8 s |    5.8 s |�[0m

�[0m�[38;5;245mgroup�[0m �[0m�[32mconcurrency�[0m
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Throughput: 25.44 req/s
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Average time per batch: 393.03ms
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Throughput: 16.38 req/s
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Average time per batch: 610.39ms
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Throughput: 21.41 req/s
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Average time per batch: 466.97ms
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Throughput: 20.78 req/s
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Average time per batch: 481.31ms
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Throughput: 21.81 req/s
�[0m�[38;5;245mREST: Concurrent GET /v1/jobs (10 parallel):�[0m   → Average time per batch: 458.45ms
| REST: Concurrent GET /v1/jobs (10 parallel)   | �[0m�[33m          8.6 s�[0m |           0.1 | (�[0m�[36m   8.2 s�[0m … �[0m�[35m   9.4 s�[0m) |�[0m�[35m    8.4 s |    9.4 s |    9.4 s |�[0m

�[0m�[38;5;245mgroup�[0m �[0m�[32mfiltered-queries�[0m
�[0m�[38;5;245mREST: GET /v1/jobs with multiple filters:�[0m   → Average response time: 83.40ms
�[0m�[38;5;245mREST: GET /v1/jobs with multiple filters:�[0m   → Average response time: 81.98ms
�[0m�[38;5;245mREST: GET /v1/jobs with multiple filters:�[0m   → Average response time: 79.93ms
�[0m�[38;5;245mREST: GET /v1/jobs with multiple filters:�[0m   → Average response time: 79.13ms
�[0m�[38;5;245mREST: GET /v1/jobs with multiple filters:�[0m   → Average response time: 80.24ms
| REST: GET /v1/jobs with multiple filters      | �[0m�[33m          3.2 s�[0m |           0.3 | (�[0m�[36m   3.2 s�[0m … �[0m�[35m   3.3 s�[0m) |�[0m�[35m    3.2 s |    3.3 s |    3.3 s |�[0m


@thinkclay
thinkclay merged commit 288fdba into main Oct 6, 2026
18 of 20 checks passed
@thinkclay
thinkclay deleted the fix/benchmark-actually-runs branch October 6, 2026 03:08
thinkclay added a commit that referenced this pull request Oct 6, 2026
…nto a PR comment (#997)

#995 made the benchmark produce real figures, and the first comment it
posted wrapped every one of them in raw escape codes:

    ^[[0m^[[38;5;245mREST: GET /v1/jobs: ^[[0m → Average response time: 84.36ms

deno bench colourises even when stdout is a pipe, and benchmark-results.txt
is pasted verbatim into the comment body. NO_COLOR=1 fixes it at the source,
so the artifact is clean too.

Verified locally with CI's env: 0 escape sequences in the output, summary
rows unchanged.

Co-authored-by: Claude Opus 5 <[email protected]>
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.

Performance Benchmarks has never run: deno errors on a sibling tsconfig, continue-on-error hides it, and the PR comment is an empty code block

1 participant