appconfig: a not-ready route waits to start instead of vanishing
Per the coordinator's ruling, a reached route whose shape (read off a ready copy) is not addr lands in Starting with Why "not-running", after the bundle-unreadable rules and the shadowing test. Its Unresolved entry carries the Why, so Pending() still projects exactly what it did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/appconfig/reach.go+30 −16internal/appconfig/reach_test.go+53 −5
Intent
<task-notification> <task-id>ae73859cee8eb4b00</task-id> <tool-use-id>toolu_019zVpkdR19UZaHzdcNPDQ5j</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/ae73859cee8eb4b00.output</output-file> <status>completed</status> <summary>Agent "Implement Task 3 classifier" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE_WITH_CONCERNS Commit: 20d3367b `appconfig: one classifier for where a config write lands` Tests: the 24 existing AwaitingRestart/BlockedStamps guards pass before and after, with no test file edited. The six new Classify tests pass (41-row table, 2000-case property test, real Sync/SyncExec restart run), all 10 mutants of reach.go were caught, and `go test ./internal/appconfig -count=1` is ok. Concerns: 1. "Not running" can't happen today. Every delivery predicate requires a ready row, so a local route that isn't ready reaches no bucket. Its host is also kept out of Unseen, so the page could claim nothing on this box uses it. The status branch is in the code but can't fire; tests pin the current behaviour. 2. The brief's Self identity contradicts its Starting rule for one case: an asleep sidecar whose box doesn't manage it goes to Starting, though no delivery restarts it. The test checks that case on its own. 3. Unit, socket and sidecar routes now land in Unresolved when the default bundle or overlay won't read. Pending() filters them out, so the CLI notice is unchanged. 4. I didn't run the brief's Astra review: env-notes forbid subagents, so it's yours. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/.superpowers/sdd/2026-11-08-console-secrets/task-3-report.md</result> <usage><subagent_tokens>135152</subagent_tokens><tool_uses>37</tool_uses><duration_ms>846970</duration_ms></usage> </task-notification>
<task-notification> <task-id>b76bt4wm3</task-id> <tool-use-id>toolu_01B7qxnC27ZZn3nFHoBB5odC</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/b76bt4wm3.output</output-file> <status>completed</status> <summary>Background command "echo "Task 6: implemented 86ebd76b; Astra review R1 running (astra-t6-brief.md). Task 6 DOM contract (for Task 7) is in task-6-report.md. Task 6 concern: script default error texts go to Task 9 copy pass; real-Chromium check of DOM wiring belongs to Task 7." >> .superpowers/sdd/2026-11-08-console-secrets/progress.md; until [ -f .superpowers/sdd/2026-11-08-console-secrets/astra-t6.done ]; do sleep 30; done; tail -5 .superpowers/sdd/2026-11-08-console-secrets/astra-t6-findings.md" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 22.5 g CO₂e (2,737,989 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-console-secrets, 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/appconfig/reach.go b/internal/appconfig/reach.go| index aae1a6af8..fa8033157 100644 |
| --- a/internal/appconfig/reach.go |
| +++ b/internal/appconfig/reach.go |
| @@ -192,8 +192,19 @@ func ClassifyWrite(ctx context.Context, s release.Store, routes []registry.Route |
| } |
| for _, rt := range routes { |
| - shape, ok := reachShape(rt) |
| - if !ok || rt.App != app || release.RouteAccount(rt) != acct { |
| + // A route that is not ready is delivered by no pass now, and by its |
| + // shape's pass once it is: its shape is read off a ready copy, so the |
| + // predicates are not restated, and it lands in Starting/"not-running" |
| + // rather than in no list (no absence claims). Never addr: an addr |
| + // process is its supervisor's, and the notice has never named a |
| + // not-ready addr route. |
| + notReady := rt.Status != "" && rt.Status != "ready" |
| + probe := rt |
| + if notReady { |
| + probe.Status = "ready" |
| + } |
| + shape, ok := reachShape(probe) |
| + if !ok || rt.App != app || release.RouteAccount(rt) != acct || (notReady && shape == ReachShapeAddr) { |
| continue |
| } |
| // Which routes a write REACHES. A named bundle is read by the |
| @@ -204,6 +215,11 @@ func ClassifyWrite(ctx context.Context, s release.Store, routes []registry.Route |
| continue |
| } |
| h := ReachHost{Host: rt.Host, Unit: rt.Unit, Shape: shape} |
| + if notReady { |
| + // Carried on an Unresolved entry too, so the projection can |
| + // leave out what the notice never covered. |
| + h.Why = ReachWhyNotRunning |
| + } |
| eb := envRes{} |
| def := loadDefault |
| standalone := false |
| @@ -297,18 +313,15 @@ func ClassifyWrite(ctx context.Context, s release.Store, routes []registry.Route |
| bucket = ReachYours |
| h.How = ReachHowSidecar |
| } |
| - // Starting overrides Self and a sidecar's Yours, never stamped (its |
| - // unit is restarted by the root pass whatever the activator thinks) |
| - // and never addr (above). The registry status test cannot fire for |
| - // today's predicates, which all require a ready row; it is here so |
| - // a predicate that ever admits one classifies it honestly. |
| - if shape != ReachShapeStamped { |
| - switch { |
| - case fact.Asleep: |
| - bucket, h.How, h.Why = ReachStarting, "", ReachWhyAsleep |
| - case rt.Status != "" && rt.Status != "ready": |
| - bucket, h.How, h.Why = ReachStarting, "", ReachWhyNotRunning |
| - } |
| + // Starting overrides Self and a sidecar's Yours; never addr (above). |
| + // A sleep fact never moves a ready stamped route (its unit is |
| + // restarted by the root pass whatever the activator thinks); a |
| + // not-ready one of any shape here is waiting to start. |
| + switch { |
| + case fact.Asleep && shape != ReachShapeStamped: |
| + bucket, h.How, h.Why = ReachStarting, "", ReachWhyAsleep |
| + case notReady: |
| + bucket, h.How, h.Why = ReachStarting, "", ReachWhyNotRunning |
| } |
| switch bucket { |
| case ReachSelf: |
| @@ -371,7 +384,8 @@ func sortReachHosts(l []ReachHost) { |
| // Pending is the AwaitingRestart projection: what the CLI's restart notice |
| // has always said, read off the classification. Hosts are the opted-in addr |
| // routes (the files nothing here restarts); Unresolved is narrowed to the |
| -// addr and stamped shapes, the ones the notice has always covered. |
| +// addr and stamped shapes of ready routes, the ones the notice has always |
| +// covered (a not-ready route's entry carries Why "not-running"). |
| func (w WriteReach) Pending() RestartPending { |
| var p RestartPending |
| for _, h := range w.Yours { |
| @@ -380,7 +394,7 @@ func (w WriteReach) Pending() RestartPending { |
| } |
| } |
| for _, h := range w.Unresolved { |
| - if h.Shape == ReachShapeAddr || h.Shape == ReachShapeStamped { |
| + if (h.Shape == ReachShapeAddr || h.Shape == ReachShapeStamped) && h.Why == "" { |
| p.Unresolved = append(p.Unresolved, h.Host) |
| } |
| } |
diff --git a/internal/appconfig/reach_test.go b/internal/appconfig/reach_test.go| index 7ed10b7f6..68585a681 100644 |
| --- a/internal/appconfig/reach_test.go |
| +++ b/internal/appconfig/reach_test.go |
| @@ -127,10 +127,19 @@ func TestClassifyWriteTable(t *testing.T) { |
| {name: "socket unreported", route: ptr(reachRoute("socket", h, "")), keys: []string{"SHARED"}, want: "self"}, |
| {name: "socket reported awake", route: ptr(reachRoute("socket", h, "")), hosts: awake, keys: []string{"SHARED"}, want: "self"}, |
| {name: "socket asleep", route: ptr(reachRoute("socket", h, "")), hosts: asleep, keys: []string{"SHARED"}, want: "starting", why: ReachWhyAsleep}, |
| - // Every delivery predicate requires a ready row: a not-ready route |
| - // is reached by no pass, so the classifier follows the predicates. |
| - {name: "socket not ready is no pass's", route: ptr(notReady(reachRoute("socket", h, ""))), keys: []string{"SHARED"}, want: ""}, |
| - {name: "stamped not ready is no pass's", route: ptr(notReady(reachRoute("stamped", h, ""))), keys: []string{"SHARED"}, want: ""}, |
| + // Not ready: its shape's pass delivers once it is (coordinator |
| + // ruling); addr stays out, as the notice has always had it. |
| + {name: "unit not ready", route: ptr(notReady(reachRoute("unit", h, ""))), keys: []string{"SHARED"}, want: "starting", why: ReachWhyNotRunning}, |
| + {name: "stamped not ready", route: ptr(notReady(reachRoute("stamped", h, ""))), hosts: asleep, keys: []string{"SHARED"}, want: "starting", why: ReachWhyNotRunning, wantUnit: "u-aa.service"}, |
| + {name: "socket not ready", route: ptr(notReady(reachRoute("socket", h, ""))), keys: []string{"SHARED"}, want: "starting", why: ReachWhyNotRunning}, |
| + {name: "socket not ready and asleep", route: ptr(notReady(reachRoute("socket", h, ""))), hosts: asleep, keys: []string{"SHARED"}, want: "starting", why: ReachWhyAsleep}, |
| + {name: "sidecar not ready, managed", route: ptr(notReady(reachRoute("sidecar", h, ""))), hosts: managed, keys: []string{"SHARED"}, want: "starting", why: ReachWhyNotRunning}, |
| + {name: "sidecar not ready, unreported", route: ptr(notReady(reachRoute("sidecar", h, ""))), keys: []string{"SHARED"}, want: "starting", why: ReachWhyNotRunning}, |
| + {name: "addr not ready is never starting", optIn: true, route: ptr(notReady(reachRoute("addr", h, ""))), keys: []string{"SHARED"}, want: ""}, |
| + {name: "not ready, shadowed", route: ptr(notReady(reachRoute("socket", h, "prod"))), keys: []string{"PROD_KEY"}, want: ""}, |
| + {name: "not ready, missing bound bundle", route: ptr(notReady(reachRoute("stamped", h, "ghost"))), keys: []string{"SHARED"}, want: "unresolved", why: ReachWhyNotRunning, wantUnit: "u-aa.service"}, |
| + {name: "not ready, other environment", route: ptr(notReady(reachRoute("socket", h, "prod"))), envName: "team", keys: []string{"TEAM_ONLY"}, want: ""}, |
| + {name: "not ready, owned env, default write", route: ptr(notReady(reachRoute("unit", h, "team"))), keys: []string{"SHARED"}, want: ""}, |
| {name: "sidecar managed", route: ptr(reachRoute("sidecar", h, "")), hosts: managed, keys: []string{"SHARED"}, want: "self"}, |
| {name: "sidecar unreported", route: ptr(reachRoute("sidecar", h, "")), keys: []string{"SHARED"}, want: "yours", how: ReachHowSidecar}, |
| {name: "sidecar unmanaged asleep", route: ptr(reachRoute("sidecar", h, "")), hosts: asleep, keys: []string{"SHARED"}, want: "starting", why: ReachWhyAsleep}, |
| @@ -318,6 +327,17 @@ func reachCandidate(rt registry.Route) bool { |
| return unitDelivered(rt) || execSyncable(rt) || execSidecarCandidate(rt) || execAddrCandidate(rt) |
| } |
| +// reachReached: a ready candidate, or a not-ready route a ready copy of |
| +// which is a candidate of a shape other than addr. |
| +func reachReached(rt registry.Route) bool { |
| + if rt.Status == "" || rt.Status == "ready" { |
| + return reachCandidate(rt) |
| + } |
| + ready := rt |
| + ready.Status = "ready" |
| + return reachCandidate(ready) && !execAddrCandidate(ready) |
| +} |
| + |
| func TestClassifyWriteProperty(t *testing.T) { |
| ctx := context.Background() |
| worlds := map[bool]release.Store{} |
| @@ -343,7 +363,7 @@ func TestClassifyWriteProperty(t *testing.T) { |
| local[rt.Host] = true |
| at, _ := reachWhere(t, w, rt.Host) // fails on two lists |
| ours := rt.App == "relay" && release.RouteAccount(rt) == "bab" |
| - reached := ours && reachCandidate(rt) && reachInScope(c, rt.Environment) |
| + reached := ours && reachReached(rt) && reachInScope(c, rt.Environment) |
| switch { |
| case !reached && at != "": |
| t.Fatalf("case %d: %+v is not reached by this write, but is in %q", i, rt, at) |
| @@ -404,6 +424,13 @@ func TestClassifySelfMatchesDelivery(t *testing.T) { |
| } |
| at, _ := reachWhere(t, w, rt.Host) |
| fact := c.facts.Hosts[rt.Host] |
| + if rt.Status != "" && rt.Status != "ready" { |
| + // Delivered by no pass now; its shape's pass once ready. |
| + if want := reachReached(rt); want != (at == "starting") { |
| + t.Fatalf("case %d: not-ready %+v in %q, want starting = %v", i, rt, at, want) |
| + } |
| + continue |
| + } |
| if execSidecarCandidate(rt) && !fact.Managed && fact.Asleep { |
| // The one Starting that is not a Self overridden: an |
| // unmanaged sidecar nobody restarts, asleep, which reads the |
| @@ -546,3 +573,24 @@ func TestClassifyPendingProjection(t *testing.T) { |
| t.Fatal("Self, Starting and Unseen must project to nothing") |
| } |
| } |
| + |
| +// TestClassifyNotReadyLeavesThePendingProjectionAlone: a not-ready route |
| +// the notice never named stays out of it, Unresolved included. |
| +func TestClassifyNotReadyLeavesThePendingProjectionAlone(t *testing.T) { |
| + ctx, s := reachWorld(t, true) |
| + var routes []registry.Route |
| + for i, shape := range []string{"unit", "stamped", "socket", "sidecar", "addr"} { |
| + for _, env := range []string{"", "ghost"} { |
| + rt := reachRoute(shape, fmt.Sprintf("n%d%s.example.com", i, env), env) |
| + rt.Status = "starting" |
| + routes = append(routes, rt) |
| + } |
| + } |
| + w := ClassifyWrite(ctx, s, routes, ReachFacts{}, "bab", "relay", "", []string{"SHARED"}) |
| + if len(w.Starting) != 4 || len(w.Unresolved) != 4 { |
| + t.Fatalf("Starting = %v, Unresolved = %v, want four each (no addr)", w.Starting, w.Unresolved) |
| + } |
| + if p := w.Pending(); !p.Empty() { |
| + t.Fatalf("Pending = %+v, want empty", p) |
| + } |
| +} |