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.
+ 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.
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.
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.
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
Native reproduction
Real files and xattrs on a pinned Storage checkout, before and after the patch, in a temporary worktree that is cleaned up.
Red, then green
Five regression and control cases: 2 fail and 3 pass on the original code, all 5 pass with the fix.
A small, reviewable fix
8 lines added and 1 removed in production code, proposed as Supabase PR #1616 (draft, unmerged).
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
Evidence
What is real, and what is not
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