carlos / platform Public

console: render app pages on a console with no deployment bucket

#720. Every app page panicked when Config.Releases was nil: appPage ->
assembleAppsNamed -> appFrame -> loadAppFrame called List/Get on the
nil release.Store (loadFrameChannels, release.GetProduction,
release.GetPipeline). loadAppFrame now returns the empty frame with no
store. Three further nil-store reads sat behind it on single tabs:
Overview's and Releases' version/tag/retention reads, instanceDomainFor
(Releases tab attach hint) and liveEdges (Instances tab region line),
each now guarded the way the surrounding NoBucket code already is.

TestNoBucketAppPagesRender replaces the template-only workaround: real
GETs of overview, releases, instances and every settings section answer
200 with their existing no-bucket banners, and the env form POST
answers 409 and writes nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 765095f539038abf36ed81e938a9e4905815def3 parent 8dff2d4
5 files changed, +122 −67
  • internal/console/appframe.go +9 −0
  • internal/console/appsettings_test.go +3 −7
  • internal/console/envform_test.go +43 −15
  • internal/console/reqmemo.go +10 −0
  • internal/console/server.go +57 −45

CI passed — run details

Intent

Attributed to this commit: 7.11 g CO₂e (911,626 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on nobucket-panic-720, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/internal/console/appframe.go b/internal/console/appframe.go
index 2a6c6ba48..6247e711d 100644
--- a/internal/console/appframe.go
+++ b/internal/console/appframe.go
@@ -104,8 +104,17 @@ func (f appFrame) clone() appFrame {
// pipelineStoreTimeout, as it always was). The three are independent and
// run at once, and the channels are read readConcurrency at a time, kept in
// name order.
+//
+// A console without a deployment bucket (Config.Releases nil) has none of
+// these objects, so its frame is the empty one: no channels, no production
+// flag, no pipeline. Every app page reads the frame, so this is the one
+// place a bucketless console must stop; the pages then say "no deployment
+// bucket" where a section needs one (#720).
func loadAppFrame(ctx context.Context, st release.Store, pub ed25519.PublicKey, acct, app string) appFrame {
var f appFrame
+ if st == nil {
+ return f
+ }
runConcurrently(
func() { f.Channels, f.ChannelsErr = loadFrameChannels(ctx, st, pub, acct, app) },
func() {
diff --git a/internal/console/appsettings_test.go b/internal/console/appsettings_test.go
index 2934a3b2c..043ed1f37 100644
--- a/internal/console/appsettings_test.go
+++ b/internal/console/appsettings_test.go
@@ -1117,13 +1117,9 @@ func TestSettingsPageShowsChannelFieldWhenOnlyRouteIsPlatform(t *testing.T) {
// would vanish from Settings.Domains the moment there was no bucket to
// check the never-shipped rename gate against.
//
-// This calls assembleSettings directly rather than through the HTTP page:
-// a bucketless console panics inside Assemble itself (assembleChannels,
-// view.go, calls release.Store.List on every app-page tab, Settings
-// included, with no nil guard) — a real, pre-existing gap, but one that
-// reaches every app page and is not Task 5's Settings-only bug. Fixing
-// assembleSettings's own early return is; isolating it here proves that fix
-// without the unit test tripping over the wider, separate one.
+// This calls assembleSettings directly, isolating its own early return.
+// The whole page on a bucketless console is TestNoBucketAppPagesRender
+// (envform_test.go; #720 fixed the app-frame panic it once hit).
func TestAssembleSettingsListsRoutedDomainsWithoutABucket(t *testing.T) {
fx := newConsoleFixture(t)
fx.srv.cfg.Releases = nil
diff --git a/internal/console/envform_test.go b/internal/console/envform_test.go
index f347ee67d..0ad4840dc 100644
--- a/internal/console/envform_test.go
+++ b/internal/console/envform_test.go
@@ -257,22 +257,50 @@ func TestEnvSectionDefaultFirst(t *testing.T) {
check(true)
}
-// A console without a deployment bucket cannot assemble an app page at
-// all, so the section's no-bucket branch is drawn straight from the
-// template, as assembleSettings leaves the view: NoBucket and no editing.
-// The POST door says 409 for the same console shape (handleEnvForm).
-func TestEnvSectionReadOnlyForNoBucket(t *testing.T) {
+// A console without a deployment bucket (Config.Releases nil) renders every
+// app page through the real handlers (#720: they used to panic in the app
+// frame's bucket reads). The overview and each settings section answer 200,
+// the sections that need the bucket say so, and the environments section is
+// read-only; its POST door refuses with 409 and writes nothing.
+func TestNoBucketAppPagesRender(t *testing.T) {
fx := newConsoleFixture(t)
- p := page{Nav: "/a/shop", SettingsSection: "environments", Detail: &AppView{App: "sprout"}, Account: &Account{Name: "shop", Sqid: "bab"}, AppName: "sprout",
- Settings: &SettingsView{NoBucket: true}}
- rec := httptest.NewRecorder()
- fx.srv.render(rec, http.StatusOK, "app_settings", p)
- body := rec.Body.String()
- if rec.Code != http.StatusOK {
- t.Fatalf("render = %d:\n%s", rec.Code, body)
- }
- mustContain(t, body, "no deployment bucket on this host", "No named environments", "carlos env set --app sprout")
- mustNotContain(t, body, `/settings/environments"`, "data-secret-input", `class="savebar"`)
+ freshApp(t, fx, "sprout")
+ fx.srv.cfg.Releases = nil
+ c := signInPaul(t, fx)
+
+ banners := map[string]string{
+ "environments": "no deployment bucket on this host — this console cannot read config",
+ "storage": "no deployment bucket on this host — this console cannot serve object storage",
+ "email": "no deployment bucket on this host — this console cannot serve email",
+ "features": "no deployment bucket on this host — this console cannot read features",
+ "general": "No deployment bucket on this host, so the never-shipped check cannot run.",
+ }
+ paths := map[string]string{"overview": "/apps/sprout", "releases": "/apps/sprout/releases", "instances": "/apps/sprout/instances"}
+ for section := range appSettingsSections {
+ paths[section] = "/apps/sprout/settings/" + section
+ }
+ for name, path := range paths {
+ status, _, body := get(t, c, fx.u(path))
+ if status != http.StatusOK {
+ t.Fatalf("%s on a bucketless console = %d:\n%s", name, status, body)
+ }
+ if want := banners[name]; want != "" {
+ mustContain(t, body, want)
+ }
+ }
+
+ _, _, envBody := get(t, c, fx.u("/apps/sprout/settings/environments"))
+ mustContain(t, envBody, "No named environments", "carlos env set --app sprout")
+ mustNotContain(t, envBody, "/settings/environments#after-save", "data-env-form", "data-secret-input", `class="savebar"`)
+
+ f := url.Values{"csrf": {sessionToken(t, fx, c)}, "op": {"add:default"},
+ "add.default.name": {"MODE"}, "add.default.value": {"fast"}}
+ status, _, body := postForm(t, c, fx.u("/apps/sprout/settings/environments"), f)
+ if status != http.StatusConflict {
+ t.Fatalf("env form POST on a bucketless console = %d, want 409:\n%s", status, body)
+ }
+ mustContain(t, body, banners["environments"])
+ mustNotContain(t, body, "MODE", "fast", `class="savebar"`)
}
func TestEnvFormCSRF(t *testing.T) {
diff --git a/internal/console/reqmemo.go b/internal/console/reqmemo.go
index 124494b63..e518be248 100644
--- a/internal/console/reqmemo.go
+++ b/internal/console/reqmemo.go
@@ -206,6 +206,10 @@ func (s *Server) loadBoxes(ctx context.Context, st release.Store, prefix string)
return l.boxes[:len(l.boxes):len(l.boxes)], l.complete, err
}
+// errLiveEdgesNoBucket is liveEdges' answer on a console with no
+// deployment bucket.
+var errLiveEdgesNoBucket = errors.New("console: no deployment bucket, so no edges to read")
+
// liveEdges is the one read every automatic-eligibility caller makes: the
// edges files joined with box liveness as of now (F1), once per request.
// The edges files and the box reports are read at once, each fan-out
@@ -214,7 +218,13 @@ func (s *Server) loadBoxes(ctx context.Context, st release.Store, prefix string)
// (console-slow-writes). Only the box reports are read when the edges
// files would not list, as that read made them after; the answer is still
// the listing's error.
+//
+// A console with no deployment bucket has no edges files to read: the
+// answer is errLiveEdgesNoBucket, which every caller treats as unread (#720).
func (s *Server) liveEdges(ctx context.Context) (edgesSnapshot, error) {
+ if s.cfg.Releases == nil {
+ return edgesSnapshot{}, errLiveEdgesNoBucket
+ }
return memoize(ctx, "edges", func() (edgesSnapshot, error) {
now := time.Now()
var (
diff --git a/internal/console/server.go b/internal/console/server.go
index 350057867..01f72f926 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -4686,12 +4686,17 @@ func (s *Server) handleApp(w http.ResponseWriter, r *http.Request) {
}
traffic <- &win
}()
- versions, err := Versions(r.Context(), s.cfg.Releases, acct.Sqid, app)
- if err != nil {
- log.Printf("console: versions %s: %v", app, err)
- p.FlashErr = "Could not list this app's releases."
+ // No deployment bucket (#720): no releases to list, and nothing failed.
+ var versions []VersionView
+ if s.cfg.Releases != nil {
+ var err error
+ versions, err = Versions(r.Context(), s.cfg.Releases, acct.Sqid, app)
+ if err != nil {
+ log.Printf("console: versions %s: %v", app, err)
+ p.FlashErr = "Could not list this app's releases."
+ }
+ p.Versions = versions
}
- p.Versions = versions
metrics := s.appResourceMetrics(r.Context(), p.Detail, acct)
// The Database tile's sizes are best-effort: a slow status read costs the
// tile its number (the em-dash), never the page.
@@ -4785,48 +4790,52 @@ func (s *Server) handleAppReleases(w http.ResponseWriter, r *http.Request) {
p.ReleaseSummary = assembleReleaseSummary(p.Detail.Channels, p.Detail.Routes, acct.Sqid)
p.PromoteChannels = promoteChannelOptions(p.Detail.Channels, p.Detail.Pipeline)
p.VersionsPageNum = versionsPageParam(r)
- versions, newest, more, err := versionsPage(r.Context(), s.cfg.Releases, acct.Sqid, p.AppName, p.VersionsPageNum)
- if err != nil {
- log.Printf("console: versions %s: %v", p.AppName, err)
- p.FlashErr = "Could not list this app's releases."
- }
- p.VersionsMore = more
- p.CanaryVersions = newest
- // Versions itself never reads ListTags (view.go), and neither does
- // assembleChannels any more — a full tag sweep thrown away by every
- // OTHER app-page tab and the account home page's whole app list would
- // be a needless read on every one of those renders (release versioning
- // spec, 2026-08-08; view.go's tagByRelease doc comment has the full
- // story). This tab is the one place that sweep pays for itself: ONE
- // ListTags read serves the Tags section below (raw records, changelog
- // and all, capped at tagsCap — ListTags' own semver-descending order),
- // the Releases table's pill (view.go's tagIndex, the pure fold with no
- // read of its own), and the Channels table's pill, backfilled onto
- // Assemble's already-built ChannelView rows since assembleChannels
- // itself leaves Tag "". A failed read degrades this tab's tag
- // decoration only; the page still renders.
- if tags, terr := release.ListTags(r.Context(), s.cfg.Releases, acct.Sqid, p.AppName); terr != nil {
- log.Printf("console: tags %s: %v", p.AppName, terr)
- } else {
- byRelease := tagIndex(tags)
- for i := range versions {
- versions[i].Tag = byRelease[versions[i].Version]
- }
- for i := range p.Detail.Channels {
- p.Detail.Channels[i].Tag = byRelease[p.Detail.Channels[i].Version]
+ // No deployment bucket (#720): no versions, tags or retention to read,
+ // and nothing failed, so the tab draws its empty states.
+ if s.cfg.Releases != nil {
+ versions, newest, more, err := versionsPage(r.Context(), s.cfg.Releases, acct.Sqid, p.AppName, p.VersionsPageNum)
+ if err != nil {
+ log.Printf("console: versions %s: %v", p.AppName, err)
+ p.FlashErr = "Could not list this app's releases."
+ }
+ p.VersionsMore = more
+ p.CanaryVersions = newest
+ // Versions itself never reads ListTags (view.go), and neither does
+ // assembleChannels any more — a full tag sweep thrown away by every
+ // OTHER app-page tab and the account home page's whole app list would
+ // be a needless read on every one of those renders (release versioning
+ // spec, 2026-08-08; view.go's tagByRelease doc comment has the full
+ // story). This tab is the one place that sweep pays for itself: ONE
+ // ListTags read serves the Tags section below (raw records, changelog
+ // and all, capped at tagsCap — ListTags' own semver-descending order),
+ // the Releases table's pill (view.go's tagIndex, the pure fold with no
+ // read of its own), and the Channels table's pill, backfilled onto
+ // Assemble's already-built ChannelView rows since assembleChannels
+ // itself leaves Tag "". A failed read degrades this tab's tag
+ // decoration only; the page still renders.
+ if tags, terr := release.ListTags(r.Context(), s.cfg.Releases, acct.Sqid, p.AppName); terr != nil {
+ log.Printf("console: tags %s: %v", p.AppName, terr)
+ } else {
+ byRelease := tagIndex(tags)
+ for i := range versions {
+ versions[i].Tag = byRelease[versions[i].Version]
+ }
+ for i := range p.Detail.Channels {
+ p.Detail.Channels[i].Tag = byRelease[p.Detail.Channels[i].Version]
+ }
+ if len(tags) > tagsCap {
+ tags = tags[:tagsCap]
+ }
+ p.Tags = tags
}
- if len(tags) > tagsCap {
- tags = tags[:tagsCap]
+ p.Versions = versions
+ // Read-only in v1: the policy is set via `carlos releases retention`;
+ // this line just keeps the page honest about why old versions vanish.
+ if ret, err := release.GetRetention(r.Context(), s.cfg.Releases, acct.Sqid, p.AppName); err != nil {
+ log.Printf("console: retention %s: %v", p.AppName, err)
+ } else if ret != nil {
+ p.RetentionKeep = ret.Keep
}
- p.Tags = tags
- }
- p.Versions = versions
- // Read-only in v1: the policy is set via `carlos releases retention`;
- // this line just keeps the page honest about why old versions vanish.
- if ret, err := release.GetRetention(r.Context(), s.cfg.Releases, acct.Sqid, p.AppName); err != nil {
- log.Printf("console: retention %s: %v", p.AppName, err)
- } else if ret != nil {
- p.RetentionKeep = ret.Keep
}
// The "how do I give this a URL" copy — not shared chrome (it's computed
// per app page, not carried by appPage), but the same fill the Instances
@@ -6788,6 +6797,9 @@ func (s *Server) handleNewCanary(w http.ResponseWriter, r *http.Request) {
// of a transient bucket error sends them at a door that will refuse them.
// Unreadable therefore renders the neutral form, never the enable step.
func (s *Server) instanceDomainFor(ctx context.Context, sqid, app string) (domain string, absent bool) {
+ if s.cfg.Releases == nil {
+ return "", false // no bucket (#720): nothing read, so nothing proven absent
+ }
m, err := s.instancesManifest(ctx, sqid, app)
switch {
case err == nil: