Phase 9, part 5: file storage, a folder or an S3 bucket

internal/storage keeps files that must outlast the app's disk (exports,
uploads) behind one interface: a folder (<data>/files) or an S3-compatible
bucket (minio-go, path-style, for Garage). Names that would reach outside
the store are refused. An S3 store is checked at start; supermarket config
checks the storage and Postgres for real. The same tests run on a folder
and on Garage (SUPERMARKET_TEST_S3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 07:42:11 -07:00
co-authored by Claude Opus 5.5
parent c76a7791ee
commit d2f1658708
13 changed files with 718 additions and 8 deletions
+21
View File
@@ -1947,6 +1947,27 @@ than planned: rather than helpers in every query, the SQL stays as it is
the value last read is used.
- On Postgres, the web tests run with this store.
**Part 5 built 2026-11-25** on `phase9`.
- `internal/storage`: one interface (put, get, stat, list, delete) with
two stores, a folder (`<data>/files` by default) and an S3 bucket
(minio-go, path-style, so Garage needs no wildcard DNS). File names are
checked so none reaches outside the store. A folder store writes through
a temporary file and a rename, readable only by the app's user.
- An S3 store is checked when the app starts (write, read, delete a small
file), so a wrong key stops the start. `supermarket config` checks the
file storage, and Postgres, for real.
- The same tests run on a folder and on Garage (`SUPERMARKET_TEST_S3`),
checked on Garage v2.1 in Docker.
- What goes in it: nothing yet. Looking through the code, nothing the app
writes today needs it:
- SQLite's backups are the local edition's own.
- The sites' clones and previews are a cache.
- The files Hermes and CoreDesktop share with the app (`crm-state`,
`hermes-ai.json`, `mcp-token`, `ai-servers.json`) are for the local
edition only: on a server, Hermes reaches the app over MCP (Phase 10).
The first users: exports (part 7), then uploads and images.
Nothing changes for the local user; this makes the rest possible. A
commit after each part; the whole test suite runs against both SQLite and
Postgres from part 2 on.