Hoist R2 S3Client to a module-level singleton

The Mike backend was allocating a fresh `S3Client` on every R2 operation. bmersereau's PR hoists it to a module-level singleton with lazy initialization, so the HTTP layer can reuse keep-alive connections instead of reopening sockets per request.

infrastructureknowledge-management

The change is small in scope: one module, its tests, and Vitest config. No behavioral change visible to callers.

The secondary fix is more useful operationally. The download and signed-URL paths previously caught R2 failures and returned null, with no logging. That made object-storage outages invisible from the server logs. Error logging is added to both catch blocks, so failures surface rather than disappear silently.

A stray test file copied from another branch was also removed, since it was breaking the suite here. Vitest is configured for module isolation and a proper test script is wired into the backend package.

The PR closes five tracked issues (#101, #102, #115, #116, #125), which suggests this consolidates a cluster of storage-reliability complaints that had accumulated separately.

So what Low-risk pickup. The singleton is a straightforward resource fix, and the added error logging is something you probably want regardless of whether your R2 traffic is high enough to care about connection reuse.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?