• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 46407341497
89%

Build:
DEFAULT BRANCH: master
Ran 30 Nov 2026 11:15AM UTC
Jobs 2
Files 403
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Nov 2026 11:13AM UTC coverage: 88.698% (+0.006%) from 88.692%
46407341497

push

github

web-flow
fix: invalidate local tenant jwks cache after admin tenant writes (#1777)

## What

Fixes the flaky `src/test/tenant-jwks.test.ts > Tenant jwks configs >
Ensure url signing jwk is idempotent` (`expected +0 to be 1`), seen on
Postgres 17 in
https://github.com/supabase/storage/actions/runs/46388256595 (attempt
1).

## Root cause

The admin tenant routes write `tenants_jwks` rows in the same
transaction as the tenant row (POST/PUT generate the url signing JWK,
DELETE removes them via `ON DELETE CASCADE`). They already drop the
local tenant config cache right after the write, but the local JWKS
cache was only invalidated when the `tenants_jwks_update` NOTIFY came
back over the pubsub LISTEN connection, which happens asynchronously.

Every test in `tenant-jwks.test.ts` reuses tenant `abc123`, recreated in
`beforeEach` and deleted in `afterEach`. The test before the flaky one
deactivates the signing key and leaves `{ keys: [] }` in the JWKS cache.
When the runner is slow, the next test calls `getJwksTenantConfig`
before either NOTIFY (from the DELETE or the POST) is processed, and
gets the stale empty config back.

Reproduced locally by delaying delivery of `tenants_jwks_update` by 300
ms in the test process. Before the fix the idempotent test fails with
exactly `expected +0 to be 1`, along with three other tests that had the
same hidden race:

- `Add rsa jwk via tenant patch (legacy)`
- `Cannot deactivate the current url signing key`
- `Roll url signing key atomically replaces existing key`

With the fix, all 54 tests pass with the delay set to 300 ms and to 1 s.

## Fix

- The admin tenant POST, PUT and DELETE routes now also drop this
process's cached JWKS for the tenant after the write. This is the same
read-your-writes behaviour the tenant config cache already had. Other
processes still rely on the NOTIFY.
- Following review, `JWKSManager` also drops the local cache itself
after each of its writes: add, toggle, standby generate, swap, roll and
url sign... (continued)

10285 of 12180 branches covered (84.44%)

Branch coverage included in aggregate %.

16 of 16 new or added lines in 2 files covered. (100.0%)

17653 of 19318 relevant lines covered (91.38%)

1281.91 hits per line

Jobs
ID Job ID Ran Files Coverage
1 rest-pg18 - 46407341497.1 30 Nov 2026 11:20AM UTC 376
68.63
GitHub Action Run
2 unit - 46407341497.2 30 Nov 2026 11:15AM UTC 395
72.49
GitHub Action Run
Source Files on build 46407341497
  • Tree
  • List 403
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #46407341497
  • 3b66bac9 on github
  • Prev Build on master (#46396605657)
  • Next Build on master (#46429358629)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc