fix: S3Client singleton and R2 error logging
From the PR description
Summary
- Hoists
S3Clientto a module-level singleton (lazy-initialised on first use) - prevents a new client being allocated on every R2 operation and enables HTTP keep-alive connection reuse - Adds
console.errorlogging to thecatchblocks indownloadFileandgetSignedUrlso R2 outages appear in server logs rather than silently returning null - Removes stray
editResolutionLogging.test.tsthat was copied from an unrelated branch and caused test failures on this branch
Closes #101 Closes #102 Closes #115 Closes #116 Closes #125
Changes
backend/src/lib/storage.ts- singleton_client+ error logging in catch blocksbackend/src/lib/__tests__/storage.test.ts- basic storage module testsbackend/vitest.config.ts-isolate: trueadded for consistent module isolationbackend/package.json-"test": "vitest run"script added
Test plan
- Unit tests added and passing (3/3)
- Backend build passes
Our analysis
Hoist R2 S3Client to a module-level singleton — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-108.md from
inside the repo you want the changes in.