Fleet public routes Task 7 fix round 1: root adoption leaves forward rows out before resolving installations
With root update inputs on, RootUpdateInputs.routes resolved every registry host's root installation before any adoption predicate ran, so a hub's forward row (no installation) aborted the whole adoption pass for every resident. Forward rows are now left out before Resolve: an inert one silently, a non-inert one with a log line. Leaving a row out is what deleting it already does; every resolved host keeps every check. Regression TestRootAdoptionSkipsAForwardRow runs root's pass through the production resolver with a resident and a forward row (inert and not): the resident adopts v1 and the forward host is never resolved. Spec §7 records the root claim and the sweep of other root registry readers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md+31 −0internal/host/forward_rootupdates_test.go+143 −0internal/release/rootupdates.go+15 −0
CI failed — run details
Intent
<task-notification> <task-id>a87d4e812018c9ccf</task-id> <tool-use-id>toolu_01WAcomsUyhun6r7GBigkr1H</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/a87d4e812018c9ccf.output</output-file> <status>completed</status> <summary>Agent "Implement Task 7: skipping readers" 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. The concerns are notes for the reviewer; nothing is left open. **Commit:** 5f5d5d1d on design-fleet-public-routes (base 44d17f66). Not pushed. The full report is at `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-public-routes/.superpowers/sdd/2026-10-30-fleet-public-routes/task-7-report.md`. **Tests:** all 7 new tests pass (53 subtests). The Step 4 runs pass (host `Egress|Retention|Canar`, the whole domains package), as do build, vet, gofmt and the three cross-builds (run once). `TestPlan9B8RecordWriteCensus` passes. `TestPlan14RootReadCensus` still fails, as it did before this task, until Task 14's overlay. **Failing first:** five tests failed before the code. The other two passed at once and were shown failing by mutation instead (#17 / 3.4): - `TestReadersIgnoreInertForwardRows`: each selector was shown failing by its own one-line mutation (8 mutations). - `TestDomainsMintsNoPlatformNameFromALiveForwardRow`: see concern 2. - The `frobnicate` case fails if the unknown-kind refusal is dropped. - With every forward row skipped regardless of shape, 49 of the 50 per-column egress cases fail. The `backing` case is refused by the existing backing check, which runs first. - A mutation that lets the forward case skip the rows after it fails beside a flat row, a sidecar and an unknown kind. So a forward row can only skip itself. **Census:** `make census-card` shows the four units from spec §7 (`boxWhollyNested` as root, `retentionPass`, `countExpiredCanaries`, domains `Reconcile`), with nothing missing either way. I added a "Task 7's card, reconciled" paragraph to §7 with the root claim. No overlay was proposed; that is Task 14. **Concerns:** 1. **Retention values changed from the brief.** A keep of 1 is impossible because `release.KeepFloor` is 20. The test uses keep 20 with 22 versions, so the two oldest are pruned as intended. 2. **The brief's platform-name mutation doesn't show in the registry.** Making `firstReadyUpstream` accept a forward row does not change the registry state, because Task 3's writer guard refuses the forward-kinded mint. The test therefore also checks the domains log for a mint attempt, which catches it. A second mutation that mints a row of kind `instance` fails on state. 3. **The trash-loop test failed before the code only through a log line.** The row survived thanks to Task 3's `DeleteIfUnchanged` refusal. Two mutations prove the new skip holds by itself (ruling 1.9): with the registry guards removed and the skip kept, the test passes; with both removed, the row is deleted and the test fails. 4. **Not in this task's table:** `retireAbortedSeedRow` (provision) cannot remove a forward row. Two existing guards stop it: the hub's `inScope` and `reg.Delete`'s forward refusal. I left it for Task 10. Accounts are `bah`/`baj` only (never `bab` or `k3x`). Scratch files are removed.</result> <usage><subagent_tokens>212754</subagent_tokens><tool_uses>77</tool_uses><duration_ms>1160104</duration_ms></usage> </task-notification>
<task-notification> <task-id>bo258v2re</task-id> <tool-use-id>toolu_017M2pMARSKRNrDkZrUSgov4</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/bo258v2re.output</output-file> <status>completed</status> <summary>Background command "Package Task 7 and run its Astra task review" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 26.4 g CO₂e (3,372,465 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-fleet-public-routes, 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/docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md b/docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md| index a96e6b5b7..4c8088203 100644 |
| --- a/docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md |
| +++ b/docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md |
| @@ -1112,6 +1112,37 @@ Units, by file (N = new, R = removed, otherwise a changed body or sites): |
| re-pinned: `internal/host`, `internal/domains`. The selectors in |
| "Root's own row readers" below are pinned, unchanged, by |
| `TestReadersIgnoreInertForwardRows`. |
| + |
| + Task 7 fix round 1 (Astra P1; invariant: an inert forward row never |
| + enters local lifecycle processing). `internal/release/rootupdates.go` |
| + `RootUpdateInputs.routes` (root, `carlos adopt`): `sites` |
| + (`+registry:Host`, the log line's host). With root update inputs on, |
| + root reconstructs every registry host's route from its root |
| + installation (`Resolve`) before any adoption predicate runs, and one |
| + host without an installation aborts the pass. A forward row has none |
| + on the hub, so it stopped every resident's adoption. `routes` now |
| + leaves out every row whose `Kind` is `forward` before `Resolve`: an |
| + inert one silently, a non-inert one with a log line |
| + (`adopt: <host> is a forward row that is not inert; root leaves it out |
| + of the pass`). Both call sites (`adopt.go`, the recovery path and the |
| + main pass) go through it. The claim: the agent-written row is still a |
| + selector only. Its `Kind` (and, through `InertForward`, its forbidden |
| + fields) can only remove that one host from the pass, which is what |
| + deleting the row from `reg.List()` already does; it adds no host, no |
| + field of a resolved route, no file, path or command, and every |
| + resolved host keeps every check `Resolve` and the pass make. A |
| + non-inert forward row is left out rather than refused: no adoption |
| + predicate admits the kind, and refusing would let one malformed row |
| + stop every resident's updates, which is the fault this fixes (egress |
| + refuses instead because there refusing withholds an allow, the safe |
| + direction). Swept for other root passes that act on every registry |
| + host before a kind selector: none. Each root `reg.List()` reader |
| + filters first (`capabilityPass` by `CapabilityRoute` and the exec |
| + candidate test, `restartPass` by `restartCandidates`, the root restart |
| + request pass from root installations, not the registry, `proofRoot` by `Adoptable`, config sync by `syncable`, |
| + `claimActivationPreflight` by `Unit`/`Backing`, rollback groups by |
| + upstream, layout by `exempt` and `ActivatorManaged`, the history |
| + selection after `adopts`). Envelope re-pinned: `internal/release`. |
| - `internal/host/plans_pass.go`: `planThrottleFor` (admit). |
| - `internal/edge/edge.go`: `Edge.Reload` (forward case, eligibility, fleets |
| read moved before the routes loop, path rows of forward hosts not |
diff --git a/internal/host/forward_rootupdates_test.go b/internal/host/forward_rootupdates_test.go| new file mode 100644 |
| index 000000000..7fc2b2d4c |
| --- /dev/null |
| +++ b/internal/host/forward_rootupdates_test.go |
| @@ -0,0 +1,143 @@ |
| +package host |
| + |
| +// Fleet public routes, Task 7 fix round 1 (Astra P1; invariant: an inert |
| +// forward row never enters local lifecycle processing). Root's adoption pass |
| +// with root update inputs reconstructs every registry host's route from its |
| +// root installation BEFORE the adoption predicates run. A forward row has no |
| +// installation on the hub, so resolving it answered os.ErrPermission and |
| +// aborted the whole pass for every resident. The pass now drops forward rows |
| +// before that reconstruction: the resident beside one is adopted, and the |
| +// forward host is never resolved. |
| + |
| +import ( |
| + "context" |
| + "crypto/ed25519" |
| + "encoding/json" |
| + "path/filepath" |
| + "slices" |
| + "sync" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/hostclaim" |
| + "github.com/carlosframework/platform/internal/hostguard" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/rollout" |
| + "github.com/carlosframework/platform/internal/rootparticipation" |
| +) |
| + |
| +// frRootPass is root's adoption pass with root update inputs, through the |
| +// production resolver (rootUpdateSource.resolve over a root installation |
| +// store): one resident, blog, with a root installation and a pin to v1, and |
| +// the extra registry rows given. It returns the pass's error, the resident's |
| +// live version afterwards and every host Resolve was asked about. Each |
| +// column in corrupt is written into every forward row by raw SQL after |
| +// PutForward (corruptRow), so the row read back is not inert. |
| +func frRootPass(t *testing.T, corrupt []registry.ForwardColumn, extra ...registry.Route) (error, string, []string) { |
| + t.Helper() |
| + ctx := context.Background() |
| + opt := t.TempDir() |
| + store := release.NewDirStore(t.TempDir()) |
| + seed, public, _ := release.GenerateKey() |
| + priv, _ := release.ParseSigningKey(seed, "test") |
| + pub, _ := release.ParsePublicKey(public, "test") |
| + m := release.Manifest{Schema: 1, App: "blog", Version: "v1", Kind: "binary", Artifacts: map[string]release.Artifact{runtimePlatform(): {}}} |
| + if err := release.Ship(ctx, store, fpOwner, m, map[string][]byte{runtimePlatform(): []byte("v1")}); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := release.Promote(ctx, store, priv, fpOwner, "blog", "canary/x", "v1"); err != nil { |
| + t.Fatal(err) |
| + } |
| + rec := provision.Record{Schema: 1, Host: frNested, Account: fpOwner, App: "blog", Channel: "canary/x", Pin: "v1", CreatedAt: time.Now().UTC()} |
| + body, _ := json.Marshal(rec) |
| + if _, err := store.Put(ctx, provision.RecordKey(rec.Account, rec.App, rec.Host), body, ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + inc, _ := hostclaim.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt) |
| + state := &rollbackMemory{files: map[string][]byte{}} |
| + in := hostguard.RootInstallation{Host: rec.Host, Incarnation: inc, Stamp: 1, Account: rec.Account, App: rec.App, |
| + Record: provision.RecordKey(rec.Account, rec.App, rec.Host), Box: "box", Enrollment: "en", Migration: 1, InventoryRevision: 1} |
| + if err := hostguard.NewRootAuthority(state).RetainMigrationDeny(ctx, in, 1); err != nil { |
| + t.Fatal(err) |
| + } |
| + census := func() (rootparticipation.Census, error) { |
| + return rootparticipation.Census{Schema: 1, Box: "box", Enrollment: "en", Migration: 1, Complete: true}, nil |
| + } |
| + book, err := rollout.InitializeRootFailures(testRootFailureStore(t), "box/en/1", nil) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + p := rootUpdateSource{enforceFailures: true, source: rootRestartRequestSource{state: state, store: store, census: census}, |
| + state: state, book: book, store: store, pub: pub, binding: &proofBindingSource{}, data: t.TempDir()} |
| + reg, err := registry.Open(filepath.Join(t.TempDir(), "registry.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer reg.Close() |
| + upsertRows(t, reg, provision.RouteFor(rec, p.data, "", false, nil)) |
| + for _, rt := range extra { |
| + if rt.IsForward() { |
| + fpPutForward(t, reg, rt) |
| + for _, c := range corrupt { |
| + corruptRow(t, reg.Path(), rt.Host, c) |
| + } |
| + continue |
| + } |
| + upsertRows(t, reg, rt) |
| + } |
| + |
| + var mu sync.Mutex |
| + var resolved []string |
| + provider := func(context.Context, release.Store, ed25519.PublicKey) (*release.RootUpdateInputs, error) { |
| + return &release.RootUpdateInputs{Resolve: func(ctx context.Context, host string) (release.RootUpdateInput, error) { |
| + mu.Lock() |
| + resolved = append(resolved, host) |
| + mu.Unlock() |
| + return p.resolve(ctx, host) |
| + }}, nil |
| + } |
| + passErr := release.Pass(ctx, reg, store, pub, opt, func(string) error { return nil }, updatesPassOption(p.data, true, provider)) |
| + v, _ := release.LiveVersion(opt, rec.Host) |
| + return passErr, v, resolved |
| +} |
| + |
| +// TestRootAdoptionSkipsAForwardRow: root update inputs on, an inert forward |
| +// row with no root installation beside a resident that has one. The pass |
| +// succeeds, the resident is adopted at its pinned v1, and Resolve is never |
| +// asked about the forward host. Control: the resident alone adopts the same. |
| +// A forward row that is not inert (its socket column corrupted) is left out |
| +// the same way: it is not resolved, it does not pass as a resident, and it |
| +// does not stop the resident's update. |
| +func TestRootAdoptionSkipsAForwardRow(t *testing.T) { |
| + err, v, _ := frRootPass(t, nil) |
| + if err != nil || v != "v1" { |
| + t.Fatalf("control, resident alone: pass = %v, live %q, want nil and v1", err, v) |
| + } |
| + |
| + socket := registry.ForwardColumn{Field: "Socket", Column: "socket", Type: "TEXT"} |
| + for _, tc := range []struct { |
| + name string |
| + corrupt []registry.ForwardColumn |
| + }{ |
| + {"inert", nil}, |
| + {"not inert", []registry.ForwardColumn{socket}}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + err, v, resolved := frRootPass(t, tc.corrupt, fpForward(frForward, "home", fpOwner)) |
| + if err != nil { |
| + t.Fatalf("pass with a forward row beside the resident: %v", err) |
| + } |
| + if v != "v1" { |
| + t.Errorf("resident live version %q, want v1", v) |
| + } |
| + if slices.Contains(resolved, frForward) { |
| + t.Errorf("Resolve was asked about the forward host: %v", resolved) |
| + } |
| + if !slices.Contains(resolved, frNested) { |
| + t.Errorf("Resolve never asked about the resident: %v", resolved) |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/release/rootupdates.go b/internal/release/rootupdates.go| index c289138b9..c8fe1e93e 100644 |
| --- a/internal/release/rootupdates.go |
| +++ b/internal/release/rootupdates.go |
| @@ -3,6 +3,7 @@ package release |
| import ( |
| "context" |
| "crypto/ed25519" |
| + "log" |
| "os" |
| "time" |
| @@ -38,6 +39,20 @@ func (r *RootUpdateInputs) routes(ctx context.Context, rows []registry.Route) ([ |
| r.selected = map[string]RootUpdateInput{} |
| out := make([]registry.Route, 0, len(rows)) |
| for _, hint := range rows { |
| + // A forward row (fleet public routes spec §4.15) is the hub's name |
| + // for an app a fleet box runs: nothing of it is installed here, so |
| + // it is never resolved, and its absence from the result keeps it |
| + // out of every later step of the pass. Leaving it out is what |
| + // deleting the row would do, which the agent that writes this list |
| + // can already do. A forward row that is not inert is not refused: |
| + // that would stop every resident's updates over one row no |
| + // adoption predicate admits. It is logged and left out the same. |
| + if hint.IsForward() { |
| + if !hint.InertForward() { |
| + log.Printf("adopt: %s is a forward row that is not inert; root leaves it out of the pass", hint.Host) |
| + } |
| + continue |
| + } |
| in, err := r.Resolve(ctx, hint.Host) |
| if err != nil { |
| return nil, err |