console: CLI config door classifies with local facts only
The config PUT's restart notice now uses classifyConfigWriteLocal
(appconfig.ReachFacts{}): no records listing and no box reports, so the
CLI write is back inside its lock (10 S3) and time budget. The settings
page's Save and Retry keep reachFacts and still list record-only hosts.
TestConfigPutRestartBuckets now expects no unseen or starting hosts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/console/apiconfig.go+4 −2internal/console/apiconfigrestart_test.go+12 −8internal/console/configreach.go+26 −5
Intent
<task-notification> <task-id>b7m3rqan5</task-id> <tool-use-id>toolu_01JfivhWhaW7xhBDaC9SwJuM</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/b7m3rqan5.output</output-file> <status>completed</status> <summary>Background command "until [ -f .superpowers/sdd/2026-11-08-console-secrets/astra-t8-r2.done ]; do sleep 30; done; tail -2 .superpowers/sdd/2026-11-08-console-secrets/astra-t8-r2-findings.md" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>br5z0tp2k</task-id> <tool-use-id>toolu_01KDXhUoCxEWqCdPMiDKv8g9</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/br5z0tp2k.output</output-file> <status>completed</status> <summary>Background command "for i in $(seq 1 90); do amadan ci status carlos/platform -branch design-console-secrets >$HOME/.cache/console-secrets-copy/ci.txt 2>&1; rc=$?; [ $rc -eq 0 -o $rc -eq 1 ] && break; sleep 60; done; echo rc=$rc; cat $HOME/.cache/console-secrets-copy/ci.txt | head" completed (exit code 0)</summary> </task-notification>
diff --git a/internal/console/apiconfig.go b/internal/console/apiconfig.go| index cdae6687b..8dbb8b2be 100644 |
| --- a/internal/console/apiconfig.go |
| +++ b/internal/console/apiconfig.go |
| @@ -592,9 +592,11 @@ type apiConfigBlockedHost struct { |
| // the other boxes' routes are not represented here — the same blind spot |
| // handleAPIRoutes documents at the top of apiroutes.go, and internal/ |
| // fleetapi (#145) is the eventual fix. The CLI says what it looked at |
| -// rather than letting a short list read as a complete one. |
| +// rather than letting a short list read as a complete one. It classifies |
| +// over local facts only (classifyConfigWriteLocal): no records listing and |
| +// no box reports on a CLI write. |
| func (s *Server) configRestartNotice(ctx context.Context, acct, app, envName string, keys []string) apiConfigRestart { |
| - r, ok := s.classifyConfigWrite(ctx, acct, app, envName, keys) |
| + r, ok := s.classifyConfigWriteLocal(ctx, acct, app, envName, keys) |
| if !ok { |
| return apiConfigRestart{} |
| } |
diff --git a/internal/console/apiconfigrestart_test.go b/internal/console/apiconfigrestart_test.go| index 394256603..9b83a0d7e 100644 |
| --- a/internal/console/apiconfigrestart_test.go |
| +++ b/internal/console/apiconfigrestart_test.go |
| @@ -216,9 +216,12 @@ func TestAPIConfigPutAcceptsOneByteSecret(t *testing.T) { |
| // TestConfigPutRestartBuckets: the door's answer carries the shared |
| // classifier's buckets beside the legacy fields. A socket route is |
| // restarted by delivery (self); an opted-in addr route and a sidecar no |
| -// report says is managed are the operator's to restart (yours); a host |
| -// with a provision record and no route on this box is unseen. The legacy |
| -// hosts list says what it always said: the addr route only. |
| +// report says is managed are the operator's to restart (yours). The CLI |
| +// door classifies over local facts only (classifyConfigWriteLocal): a host |
| +// with a provision record and no route on this box is NOT listed as unseen, |
| +// because this door reads no records (the page's Save does, and lists it: |
| +// TestEnvSaveOutcomeBuckets). The legacy hosts list says what it always |
| +// said: the addr route only. |
| func TestConfigPutRestartBuckets(t *testing.T) { |
| fx, token := configFixture(t, "code-restart-buckets") |
| ctx := context.Background() |
| @@ -265,16 +268,17 @@ func TestConfigPutRestartBuckets(t *testing.T) { |
| return l |
| } |
| for name, want := range map[string][]string{ |
| - "self": {"sock.shop.example.com/<nil><nil>"}, |
| - "yours": {"addr.shop.example.com/addr<nil>", "worker.shop.example.com/sidecar<nil>"}, |
| - "unseen": {"remote.shop.example.com"}, |
| + "self": {"sock.shop.example.com/<nil><nil>"}, |
| + "yours": {"addr.shop.example.com/addr<nil>", "worker.shop.example.com/sidecar<nil>"}, |
| } { |
| if got := bucket(name); !reflect.DeepEqual(got, want) { |
| t.Errorf("%s = %v, want %v", name, got, want) |
| } |
| } |
| - if _, ok := r["starting"]; ok { |
| - t.Errorf("starting = %v, want it omitted when empty", r["starting"]) |
| + for _, name := range []string{"starting", "unseen"} { |
| + if _, ok := r[name]; ok { |
| + t.Errorf("%s = %v, want it omitted: the CLI door reads no records or reports", name, r[name]) |
| + } |
| } |
| if got := restartHosts(t, r); !reflect.DeepEqual(got, []string{"addr.shop.example.com"}) { |
| t.Errorf("legacy hosts = %v, want just the addr route", got) |
diff --git a/internal/console/configreach.go b/internal/console/configreach.go| index a7f1b62ec..75e7545a0 100644 |
| --- a/internal/console/configreach.go |
| +++ b/internal/console/configreach.go |
| @@ -48,14 +48,35 @@ func (s *Server) reachFacts(ctx context.Context, acct, app string) appconfig.Rea |
| } |
| // classifyConfigWrite is ClassifyWrite for one write to acct/app's envName |
| -// bundle ("" = the default), over this box's registry and reachFacts. ok is |
| -// false when this console has not looked: no registry configured, or one |
| -// that will not open or list. A caller renders that as "could not tell", |
| -// never as an empty answer. |
| +// bundle ("" = the default), over this box's registry and reachFacts: the |
| +// settings page's Save and Retry, which say what reaches each copy fleet- |
| +// wide. ok is false when this console has not looked: no registry |
| +// configured, or one that will not open or list. A caller renders that as |
| +// "could not tell", never as an empty answer. |
| // |
| // SCOPE: the registry is this console's OWN box's; routes on other boxes |
| // are not in it, which is what Unseen and the CLI's scope line are for. |
| func (s *Server) classifyConfigWrite(ctx context.Context, acct, app, envName string, keys []string) (appconfig.WriteReach, bool) { |
| + return s.classifyConfigWriteOver(ctx, acct, app, envName, keys, func() appconfig.ReachFacts { |
| + return s.reachFacts(ctx, acct, app) |
| + }) |
| +} |
| + |
| +// classifyConfigWriteLocal is classifyConfigWrite over local facts only |
| +// (appconfig.ReachFacts{}): no records listing and no box reports. It is the |
| +// CLI config door's answer, whose notice already says "this machine's routes |
| +// only", and it keeps that door's write inside its S3 and time budget |
| +// (TestPerfWriteRoutesMeetTheBudget). Its honest local view has no Unseen |
| +// hosts and no host facts, so no copy is called asleep. |
| +func (s *Server) classifyConfigWriteLocal(ctx context.Context, acct, app, envName string, keys []string) (appconfig.WriteReach, bool) { |
| + return s.classifyConfigWriteOver(ctx, acct, app, envName, keys, func() appconfig.ReachFacts { |
| + return appconfig.ReachFacts{} |
| + }) |
| +} |
| + |
| +// classifyConfigWriteOver is the two doors' shared body; facts is called |
| +// only once the registry has answered. |
| +func (s *Server) classifyConfigWriteOver(ctx context.Context, acct, app, envName string, keys []string, facts func() appconfig.ReachFacts) (appconfig.WriteReach, bool) { |
| if s.cfg.Registry == "" { |
| // Opening "" would hand sqlite a throwaway temp DB and answer |
| // "no routes" having created a file to say it: handleAPIRoutes' |
| @@ -72,5 +93,5 @@ func (s *Server) classifyConfigWrite(ctx context.Context, acct, app, envName str |
| log.Printf("console: api config: registry list: %v", err) |
| return appconfig.WriteReach{}, false |
| } |
| - return appconfig.ClassifyWrite(ctx, s.cfg.Releases, routes, s.reachFacts(ctx, acct, app), acct, app, envName, keys), true |
| + return appconfig.ClassifyWrite(ctx, s.cfg.Releases, routes, facts(), acct, app, envName, keys), true |
| } |