carlos / platform Public

Fleet public routes Task 10 fix round 2: a colliding host's row is kept on every instance-pass path

Armed (FleetOwners set), a host an in-scope record and a fleet record
both name is given neither, and the row already there now stays exactly
as it is on every path of the instance pass:

- journalPass takes the colliding hosts and resolves none of their
  journals (no rollback, no redone record CAS, no cleared gate); the
  host stays handled and journaled, and the journal row waits for a pass
  on which the collision is gone;
- the removal phase does not retire a colliding host's row (a trash
  marker or a gone own record included); its record scan now carries the
  fleet records it needs to see the collision.

Dormant, both are today's. Spec §4.3 says so and says nothing times a
waiting journal out (the seeds sweep leaves a host two records hold
alone); §7 records the card (Reconcile now sites, journalPass a changed
unit). 9B8: Reconcile and journalPass re-pinned, same kinds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev a3e9803a1361fe8f1ffdc70b08c35b8cf0286d09 parent ff553a4
5 files changed, +135 −7
  • docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md +19 −3
  • internal/provision/fleet_public_routes_census_test.go +13 −1
  • internal/provision/forward_test.go +77 −0
  • internal/provision/reconcile.go +14 −2
  • internal/provision/seedreconcile.go +12 −1

CI failed — run details

Intent

Human

<task-notification> <task-id>abf645273bf670e4a</task-id> <tool-use-id>toolu_01HHu2WHjshGT9vAUWnReU1m</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/abf645273bf670e4a.output</output-file> <status>completed</status> <summary>Agent "Implement Task 10: forward phase" 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.** Fix round 1 is in commit ff553a48, on top of e50ffe0d. Not pushed. **Changes:** - **P1 (unreadable record):** if a listed record's read fails, the hub now treats its host (taken from the record's key) as disputed for that pass. No forward row is minted or rewritten there, and an existing one stays. The regression test `TestForwardPhaseUnreadableRecordDisputesItsHost` covers both cases: an existing row is not rewritten, and a new host gets no row. A control host in the same pass, with no unreadable record beside it, is rewritten as normal. - **P2 ("given neither"):** when `FleetOwners` is set, a host named by both an in-scope record and a fleet record gets no instance row and no forward row on the hub. The collision is logged once per host per pass, by the instance pass only. An instance row already at such a host is kept as it is. The record stays in the pass's record set, so the removal phase still sees it and never retires the row as "record gone"; only the mint loop skips the host. The wake index (`Lifetimes`) is also untouched. With `FleetOwners` nil, the instance pass behaves exactly as today. The collision assertion in `TestForwardPhaseMintsForTheFleetOwnerOnly` now requires neither row, and the new `TestForwardCollisionGivesNeither` has an armed case (including an existing row kept unchanged) and a dormant case. The "as built" narrowing in spec §4.3 is replaced. - **P3:** spec §4.3 now says the claims-on line is logged on hubs only. **Tests:** all three tests failed before the fix and pass after. The whole `internal/provision` package passes except `TestPlan14RootReadCensus`, which failed before this round too (it waits for Task 14's census overlay). `TestPlan9B8RecordWriteCensus` passes after re-pinning `Reconcile` (same class and kinds). All 5 new mutations were caught. One of them implements "neither" by dropping the record from the record set, and the test catches it because the existing row gets retired. Build, vet and gofmt are clean, and the cross-builds ran once and passed. `make census-card` shows the same units and read sites as round 0, and spec §7 notes the fix round. **One thing for the reviewer:** the import journal pass still runs for a colliding host. It finishes an import already in progress on an existing row rather than minting one, so I left it alone. The fix report is appended to `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-public-routes/.superpowers/sdd/2026-10-30-fleet-public-routes/task-10-report.md`.</result> <usage><subagent_tokens>280534</subagent_tokens><tool_uses>14</tool_uses><duration_ms>315406</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bgv6xxihd</task-id> <tool-use-id>toolu_017Yfca4Fzcqhdmf6iWEKpkd</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/bgv6xxihd.output</output-file> <status>completed</status> <summary>Background command "Run the scoped Astra re-review of Task 10" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 28.8 g CO₂e (3,699,561 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 1ffd871e2..f0ffd337e 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
@@ -376,9 +376,14 @@ The cost is the audit of every reader (§4.15).
set, a host that an in-scope record and a fleet record both name gets
no forward row and no instance row on the hub that pass, logged once
per host per pass (by the instance pass). An instance row already at
- such a host is kept as it is: the in-scope record stays in the pass's
- record set, so the removal phase sees its record, and the mint loop
- only skips it (no mint, no converge). With `FleetOwners` nil the
+ such a host is kept as it is, on every path of the instance pass: the
+ in-scope record stays in the pass's record set, the mint loop skips the
+ host (no mint, no converge), the removal phase does not retire its row
+ (not for a trash marker, not for a gone own record), and its import
+ journal is neither finished nor rolled back. The journal row waits for
+ a pass on which the collision is gone. Nothing times it out meanwhile:
+ the console's seeds sweep times out only imports awaiting or checking
+ an upload, and it leaves alone a host two records hold. With `FleetOwners` nil the
instance pass is today's. Beyond the collision, a forward row is also
withheld (no mint, no rewrite, an existing one kept) at a host any
other usable record in the listing names (another fleet, another
@@ -1035,6 +1040,17 @@ Units, by file (N = new, R = removed, otherwise a changed body or sites):
given neither in the mint loop) shows the same card: `Reconcile` body,
sites unchanged (174), the same four N units, no new unit; its 9B8
digest is re-pinned again.
+ Task 10's fix round 2 (a colliding host's import journal waits, and the
+ removal phase keeps a colliding host's row) changes the card:
+ `Reconcile` moves from `body` to `sites` (`+registry:Account`,
+ `+registry:App`, `+registry:Host` x2: the removal phase's collision
+ guard, its log line and its report mark read the row it keeps), and
+ `internal/provision/seedreconcile.go` `journalPass` is a changed unit
+ this list did not name (`sites`, `+registry:Host` x2,
+ `+registry:SeedID`: the waiting journal's host check and log line).
+ Both read only the agent's own registry rows and journal rows and
+ write less, never more. Both 9B8 digests are re-pinned (`journalPass`:
+ key-site, `key:RecordKey`, unchanged).
- `internal/domains/reconcile.go`: `Reconcile` (trash-loop skip).
- `internal/domains/aliases.go`: `ReconcileAliasesReport` (no wildcard
parent for a refused primary; Task 6 fix round 2, card under
diff --git a/internal/provision/fleet_public_routes_census_test.go b/internal/provision/fleet_public_routes_census_test.go
index f817cea19..89cd5ebdb 100644
--- a/internal/provision/fleet_public_routes_census_test.go
+++ b/internal/provision/fleet_public_routes_census_test.go
@@ -50,6 +50,16 @@ package provision
// GET failed (disputed for the forward phase), and, armed, the mint
// loop skips a host an in-scope record and a fleet record both name
// (given neither). Same keys, no bucket write.
+// Fix round 2: armed, the colliding hosts are also handed to
+// journalPass and kept from the removal phase. Same keys, no bucket
+// write.
+//
+// Task 10 fix round 2, one more re-pin, no new unit:
+// - internal/provision/seedreconcile.go journalPass (key-site): a new
+// parameter, the hosts given neither; such a host's journal is neither
+// finished nor rolled back (no record CAS, no gate cleared, no
+// rollback), and the host stays handled and journaled. The record key
+// it compares is unchanged; it writes less, never more.
func fleetPublicRoutesWriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), rootfsFleetFollowupsWriteCensusInventory()...)
repins := []censusEntry{
@@ -60,7 +70,9 @@ func fleetPublicRoutesWriteCensusInventory() []censusEntry {
// Task 3, C01 fix round 1: the write-race mapping; the same manifest key.
{"cli.go", "runRouteHibernate", "key-site", "key:SidecarManifestKey", "51c9d6fada4fccba3ea62e8df01444cc2945442f298dccb3e805557567b6c820"},
// Task 10: the forward phase; the same record keys, no bucket write.
- {"internal/provision/reconcile.go", "Reconcile", "key-site", "key:ParseRecordKey,key:RecordKey,lit:instances", "3476ffd835482a6d9f15b5e2c36fae1f5ea8c6bf088cd3f1fee748cb69b9fa66"},
+ {"internal/provision/reconcile.go", "Reconcile", "key-site", "key:ParseRecordKey,key:RecordKey,lit:instances", "7944b6b6dccd5c1cf621d09ed168608d941a9bcdeeedbcff6ad3e202ac00087f"},
+ // Task 10 fix round 2: a colliding host's journal waits; the same record key.
+ {"internal/provision/seedreconcile.go", "journalPass", "key-site", "key:RecordKey", "1df98e12c38c3913318c4f0d6ac6b6219b484c86cd2f307588e5a2c8dce9acd4"},
}
for _, r := range repins {
found := false
diff --git a/internal/provision/forward_test.go b/internal/provision/forward_test.go
index ed00659ab..2af7b4e7a 100644
--- a/internal/provision/forward_test.go
+++ b/internal/provision/forward_test.go
@@ -795,3 +795,80 @@ func TestForwardAppsReadOnlyTheMarker(t *testing.T) {
}
}
}
+
+// "Given neither" covers the import journal too (Task 10 fix round 2):
+// armed, an in-progress import at a colliding host whose journal would roll
+// back (its record says aborted) is left alone. The swapped row stays byte
+// for byte, the journal row stays for a later pass, and no rollback step
+// runs. Dormant, today's rollback runs: the original row is back and the
+// journal is gone.
+func TestForwardCollisionLeavesAnImportJournal(t *testing.T) {
+ for _, armed := range []bool{true, false} {
+ t.Run(map[bool]string{true: "armed", false: "dormant"}[armed], func(t *testing.T) {
+ x := journaledImport(t, seeds.StateAborted)
+ bah := writeAccountManifest(t, x.s, fwdOwnerID, "Shop owner")
+ mustCreate(t, x.s, fwdRecord(bah, "shop", x.rec.Host, "fleet/home"))
+ if armed {
+ x.cfg.FleetOwners = func() (map[string]string, error) { return map[string]string{"home": bah}, nil }
+ }
+ b := x.box(t)
+ logs := fwdLog(t)
+ if err := Reconcile(ctx, x.s, x.reg, x.cfg); err != nil {
+ t.Fatal(err)
+ }
+ out := logs.take()
+ if armed {
+ x.untouched(t) // the row and the journal row, exactly
+ if len(b.steps) != 0 {
+ t.Fatalf("armed: a rollback step ran: %q", b.steps)
+ }
+ if !strings.Contains(out, "provision: "+x.rec.Host+": import "+x.rec.Seed.ID+" left alone this pass: a fleet record names this host too") {
+ t.Errorf("armed: the waiting journal was not logged:\n%s", out)
+ }
+ return
+ }
+ if got := mustGet(t, x.reg, x.rec.Host); !reflect.DeepEqual(*got, x.j.Original) {
+ t.Fatalf("dormant: row = %+v, want the original %+v", *got, x.j.Original)
+ }
+ if j, _ := x.reg.ImportJournal(x.rec.Host); j != nil {
+ t.Fatalf("dormant: the journal is still there: %+v", j)
+ }
+ })
+ }
+}
+
+// And the removal phase (Task 10 fix round 2, the same invariant): armed,
+// an instance row at a colliding host is not retired even when its app is
+// in the trash (marker read, production clear); dormant, it is.
+func TestForwardCollisionKeepsTheRowOfATrashedApp(t *testing.T) {
+ for _, armed := range []bool{true, false} {
+ t.Run(map[bool]string{true: "armed", false: "dormant"}[armed], func(t *testing.T) {
+ s := dirStore(t)
+ bah, baj := fwdSetup(t, s)
+ here := fwdRecord(baj, "blog", "clash.example.com", "uk")
+ mustCreate(t, s, here)
+ cfg := ReconcileConfig{Region: "uk", DataDir: "/data"}
+ if armed {
+ cfg = hubCfg(map[string]string{"home": bah})
+ }
+ reg := regWith(t)
+ mustPass(t, s, reg, cfg)
+ before := getRow(t, reg, here.Host)
+ if before == nil {
+ t.Fatal("fixture: no instance row")
+ }
+ mustCreate(t, s, fwdRecord(bah, "shop", here.Host, "fleet/home"))
+ if err := release.TrashApp(ctx, s, baj, "blog", "owner@example.com", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ mustPass(t, s, reg, cfg)
+ got := getRow(t, reg, here.Host)
+ if armed && (got == nil || *got != *before) {
+ t.Errorf("armed: the row at a colliding host = %+v, want it kept as it was", got)
+ }
+ if !armed && got != nil {
+ t.Errorf("dormant: the trashed app's row was not retired: %+v", got)
+ }
+ })
+ }
+}
diff --git a/internal/provision/reconcile.go b/internal/provision/reconcile.go
index 2008da09e..e91e7cf90 100644
--- a/internal/provision/reconcile.go
+++ b/internal/provision/reconcile.go
@@ -1640,7 +1640,9 @@ func Reconcile(ctx context.Context, s release.Store, reg *registry.Registry, cfg
// is skipped by the loop below, and every journaled host by the removal
// phase: the journal owns the row until its row is gone. An unreadable
// journal could hide any host, so the removal phase does not run.
- journalHandled, journaled, journalOK := journalPass(ctx, s, reg, cfg, recs, readFailed, protect)
+ // A colliding host's journal waits too (given neither): its row is the
+ // instance pass's to leave exactly as it is, the import's included.
+ journalHandled, journaled, journalOK := journalPass(ctx, s, reg, cfg, recs, readFailed, protect, collide)
if !journalOK {
readFailed = true
pr.whole = true // an unread journal could be holding any host's import gate
@@ -2203,6 +2205,7 @@ func Reconcile(ctx context.Context, s release.Store, reg *registry.Registry, cfg
}
retire := func(sc recordScan, trashFor func(acct, app string) trashState, remove bool) (wouldRemove bool, removed map[string]bool) {
recs, protect, known, stale := sc.recs, sc.protect, sc.known, sc.stale
+ neither := collides(sc)
removed = map[string]bool{}
for _, rt := range routes {
// gone is the judge's evidence that the row's OWN record is
@@ -2290,6 +2293,15 @@ func Reconcile(ctx context.Context, s release.Store, reg *registry.Registry, cfg
pr.fail(rt.Account, rt.App)
continue
}
+ // Armed, a host an in-scope record and a fleet record both name
+ // is given neither (fleet public routes spec §4.3): the row
+ // there stays exactly as it is, a trash marker or a gone own
+ // record included, until the collision is gone.
+ if neither[rt.Host] {
+ log.Printf("provision: not removing %s (%s): a fleet record names this host too", rt.Host, why)
+ pr.fail(rt.Account, rt.App)
+ continue
+ }
// A participant of a running operation keeps its row whatever
// the record's region says (moves spec §9.6, claim spec §8): a
// move's source after the flip, its target during a rollback.
@@ -2349,7 +2361,7 @@ func Reconcile(ctx context.Context, s release.Store, reg *registry.Registry, cfg
keep(recs, nil) // no removal this pass
return pr.fill(cfg.Report, recs)
}
- cur := recordScan{recs: recs, protect: protect, known: sc.known, stale: sc.stale}
+ cur := recordScan{recs: recs, protect: protect, known: sc.known, stale: sc.stale, fleet: sc.fleet}
if !onSnapshot(s) {
retire(cur, trashFor, true)
return pr.fill(cfg.Report, recs)
diff --git a/internal/provision/seedreconcile.go b/internal/provision/seedreconcile.go
index d58c0bbcc..e49e896ba 100644
--- a/internal/provision/seedreconcile.go
+++ b/internal/provision/seedreconcile.go
@@ -342,8 +342,15 @@ func purgeAbortedFromLocal(ctx context.Context, reg *registry.Registry, cfg Reco
// journal's: when another record won the host, or the journal's record is
// out of scope, the host stays handled, so no other record touches the
// row. Every other case leaves the host alone this pass, logged.
+//
+// neither holds the hosts the pass gives neither row (fleet public routes
+// spec §4.3: armed, an in-scope record and a fleet record both name the
+// host). Their journals are not resolved at all, neither finished nor
+// rolled back: the host stays handled and journaled, so its row and its
+// journal row stay exactly as they are until a pass on which the collision
+// is gone. Nil (dormant): none.
func journalPass(ctx context.Context, s release.Store, reg *registry.Registry, cfg ReconcileConfig,
- recs map[string]Record, readFailed bool, protect map[string]bool) (handled, journaled map[string]bool, ok bool) {
+ recs map[string]Record, readFailed bool, protect, neither map[string]bool) (handled, journaled map[string]bool, ok bool) {
handled, journaled = map[string]bool{}, map[string]bool{}
rows, err := reg.ImportJournals()
if err != nil {
@@ -353,6 +360,10 @@ func journalPass(ctx context.Context, s release.Store, reg *registry.Registry, c
for _, j := range rows {
journaled[j.Host] = true
handled[j.Host] = true // cleared below for the two cases the loop converges
+ if neither[j.Host] {
+ log.Printf("provision: %s: import %s left alone this pass: a fleet record names this host too; its journal waits until only one record does", j.Host, j.SeedID)
+ continue
+ }
if cfg.Seeds == nil {
log.Printf("provision: %s: import %s is journaled, but this box cannot act on imports; its row is left alone", j.Host, j.SeedID)
continue