Phase 13, part 9: running at scale, and the proof

The multi-tenant edition starts. compose.multi.yaml runs several copies
behind Caddy, with the managed Postgres and Garage outside. A test walks
every page and fragment, with ids filled in, and every MCP tool, as one
team, and none shows another team's data or changes it; another has three
copies share six teams' work, each team's turn once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:46:01 -07:00
co-authored by Claude Opus 5.5
parent b8a64e258a
commit f4c31c9fa3
13 changed files with 453 additions and 14 deletions
+13
View File
@@ -12,6 +12,7 @@ import (
"supermarket/internal/appmail"
"supermarket/internal/audit"
"supermarket/internal/content"
"supermarket/internal/storage"
"supermarket/internal/transfer"
"supermarket/internal/users"
@@ -297,3 +298,15 @@ func (s *Server) purgeTeam(ctx context.Context, id int64) error {
}
func teamFilesPrefix(id int64) string { return "teams/" + strconv.FormatInt(id, 10) }
// RecoverTeams marks each team's drafts left "publishing" by a stopped app
// as failed, for review (the multi-tenant edition's start).
func (s *Server) RecoverTeams(ctx context.Context) {
s.eachTeam(ctx, func(_ context.Context, ts *Server) {
if n, err := content.RecoverInterrupted(ts.DB); err != nil {
ts.Log.Error("recovering drafts", "team", ts.team(), "err", err)
} else if n > 0 {
ts.Log.Warn("drafts were being published when Supermarket stopped; marked failed for review", "team", ts.team(), "count", n)
}
})
}