Storage Engineering Lab
TypeScript · Node 24 · Supabase StorageReleased v1.0.0

A cancelled upload still published its bytes.

FileBackend.uploadObject accepted an AbortSignal but never passed it to the pipeline that copies the request body to disk. A cancelled call could keep reading, publish the file and report success. This lab reproduces that on real files, proposes a small fix upstream, and is explicit about what the evidence does not prove.

Node.js 24TypeScriptSupabase StorageVitestPostgreSQLGitHub ActionsApache-2.0
src/storage/backend/file.ts · proposed fix
+    if (signal?.aborted) {
+      throw ERRORS.Aborted('Upload was aborted')
+    }
     ...
-      await pipeline(body, fs.createWriteStream(stagedFile))
+      await pipeline(body, fs.createWriteStream(stagedFile), { signal })
     ...
       await fsp.unlink(stagedFile).catch(() => {})
+      if (err instanceof Error && err.name === 'AbortError') {
+        throw ERRORS.AbortedTerminate('Upload was aborted', err)
+      }

Why it exists

An HTTP success is not proof that the right bytes are on disk.

Without it

A client gives up on an upload, the server-side adapter keeps streaming anyway, renames the staging file into place and reports success. If an object already existed at that destination, the transfer the client had abandoned replaces it anyway.

With it

Pre-aborted calls are rejected before staging, an abort mid-transfer stops the pipeline, the old object is preserved and the staging file is removed. Five focused regression tests pin the behaviour.

Try it · runs in your browser

Replay the native reproduction

The real terminal output of scripts/demo.mjs against a pinned Supabase Storage checkout, using actual files and extended attributes (evidence/closure/demo-terminal.txt). Step through it, or replay it all.

node scripts/demo.mjs ../supabase-storage · recorded 2026-10-30

Recorded on macOS arm64 with Node 24.22.2. Full logs stay local because they include machine paths; the transcript is an excerpt of the actual output.

How it works

From a symptom to an upstream pull request

01

Native reproduction

Real files and xattrs on a pinned Storage checkout, before and after the patch, in a temporary worktree that is cleaned up.

02

Red, then green

Five regression and control cases: 2 fail and 3 pass on the original code, all 5 pass with the fix.

03

A small, reviewable fix

8 lines added and 1 removed in production code, proposed as Supabase PR #1616 (draft, unmerged).

04

Honest limits

Normal-upload performance is inconclusive: five timed pairs were slower with the fix, but controls were unstable. No hosted-service impact is claimed.

The flow, step by step

01
Symptomsignal accepted, not used
02
Reproducenative files and xattrs
03
Red tests2 of 5 fail on the original
04
Fix+8 / −1 lines
05
Verify5 of 5 pass, upstream suites green

Evidence

What is real, and what is not

45
lab tests
plus 130 retained measurement groups
3,304
upstream Linux unit passes
with 2 root-permission skips
−16.7%
median paired throughput
inconclusive: identical-code controls were unstable

REAL Built and verified

  • Native before/after reproduction on real files and extended attributes
  • Regression tests that fail on the original code and pass with the fix
  • 1,379 PostgreSQL tests and five HTTP checks against the patched build
  • Released v1.0.0 with archive verification and four successful CI runs

SIMULATED Mocked or not built yet

  • Proves an adapter cancellation gap, not data loss in the hosted Supabase service
  • The upstream pull request is a draft without review feedback yet
  • Performance impact of the fix is not established either way

Run it yourself

Run it locally

Node 24.x and Git. The native reproduction needs a pinned Supabase Storage checkout and its xattr dependency.

git clone --branch v1.0.0 https://github.com/phlppgdfry/storage-engineering-lab.git
cd storage-engineering-lab
npm run check
npm test                  # 45 lab tests, no npm dependencies

# native reproduction (see docs/reproduction.md for the pinned checkout)
npm run doctor -- --checkout ../supabase-storage
node scripts/demo.mjs ../supabase-storage

Go deeper

Read the source