fleet-routes-followups: Astra R1 P2 fixes (READY AFTER FIXES, no P1)
Findings: docs/superpowers/reviews/CODEX-FINDINGS-fleet-routes-followups-R1.md (round 1 of 3; every census unit approved). P2-1 (invariant: sentinel identity survives the remote transport): TestPutForwardRefusesWhatIsNotAForwardRow now also sends each malformed argument as a raw PutForward request on the remote transport, past the client's own validation, and asserts ErrNotForward and no write; a valid row sent the same way is written. Removing ErrNotForward from remoteErrors fails all six raw cases (the client-side cases never reached the worker). P2-2 (invariant: expectations hold under scheduling delays): the e2e rate-limit ceiling is now burst + ceil(rate x the loop's elapsed time), since the limiter refills on the wall clock. The old fixed ceiling of 6 failed a valid schedule (2.1 s pause after the fifth: 7 admitted); the new one passes it, and a path rule admitting two over its burst still fails a fast loop. The exact burst stays pinned on the frozen clock in internal/edge (TestForwardRateLimitAtTheHubOnly; a base rule admitting one over its burst fails it). Census unchanged (test files only).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/reviews/CODEX-FINDINGS-fleet-routes-followups-R1.md+35 −0fleet_public_routes_e2e_test.go+12 −3internal/registry/forward_test.go+34 −6
CI passed — run details
Intent
<task-notification> <task-id>br1c0z5s7</task-id> <tool-use-id>toolu_01Jc8VkU4ZxTLHC5dbVeafjd</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/br1c0z5s7.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on the minors branch" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 12.1 g CO₂e (1,602,059 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-routes-followups, 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/reviews/CODEX-FINDINGS-fleet-routes-followups-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-fleet-routes-followups-R1.md| new file mode 100644 |
| index 000000000..8697dd381 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-fleet-routes-followups-R1.md |
| @@ -0,0 +1,35 @@ |
| +Reviewed `d9c4666e361a2b1f0fe331ddfa738af085fe41b0`, branch `fleet-routes-followups`, round 1 of 3, against `65fd8060`. |
| + |
| +**P1: None.** |
| + |
| +**P2 findings** |
| + |
| +1. **The remote refusal test never exercises sentinel transport.** [forward_test.go:307](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/registry/forward_test.go:307) calls `reg.PutForward` for both registries, but every invalid argument returns at [forward.go:332](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/registry/forward.go:332), before `r.remote.call`. Removing `ErrNotForward` from `remoteErrors` would leave these assertions passing while server-originated refusals lose their sentinel identity. |
| + |
| + **Fix:** Send malformed `PutForward` requests through `remote.remote.call`, bypassing client validation, and assert `errors.Is(err, ErrNotForward)` and no writes. Verify removing the sentinel registration fails the test. **Invariant:** sentinel identity survives the remote transport. |
| + |
| +2. **The new rate-test ceiling can reject correct behavior.** [fleet_public_routes_e2e_test.go:620](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/fleet_public_routes_e2e_test.go:620) permits at most six successes, but the limiter uses `time.Now` and the request loop has no duration bound. Five immediate requests followed by a pause until 2.1 seconds legitimately allow two more successes before a 429. The new assertion fails that valid schedule. |
| + |
| + **Fix:** Account for elapsed refill time in the e2e ceiling; retain the exact burst assertion and mutation witness in the frozen-clock edge fixture. **Invariant:** test expectations remain valid under scheduling delays. |
| + |
| +**P3: None.** The remaining skips are reasonable within this slice, including the WebSocket work under #471 and the separate TLS-retirement behavior change. |
| + |
| +**Census verdicts** |
| + |
| +| Unit / envelope | Verdict and evidence | |
| +|---|---| |
| +| `Edge.Reload` | **APPROVE.** [edge.go:781](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/edge/edge.go:781): same owner read and abort-on-error behavior; eligibility and publication remain unchanged. | |
| +| `Registry.PutForward` | **APPROVE.** [forward.go:331](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/registry/forward.go:331): additional argument refusals only; transaction guards remain intact. Legitimate forward-phase inputs satisfy them. | |
| +| `var putForwardSQL` | **APPROVE.** [forward.go:273](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/registry/forward.go:273): compiled metadata only. Independent comparison confirmed all 14 kept-column assignments and forbidden-column metadata are unchanged. | |
| +| `Registry.FleetOwners` | **APPROVE**, new `legacy / accepted-legacy`. [fleets.go:285](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/registry/fleets.go:285): unchanged `ListFleets` query and transport; preserves raw accounts, missing-fleet semantics and errors. | |
| +| `hubFleetOwners` | **APPROVE**, quiet retirement. [hub.go:52](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/host/hub.go:52): direct field reads moved into `FleetOwners`; error wrapping is unchanged. | |
| +| Registry field-list re-pin | **APPROVE.** [overlay:17](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/provision/testdata/plan14-root-reads-fleet-routes-followups.tsv:17): only `OnConflict` added, matching `forwardKeptColumn`; no fields removed. | |
| +| Envelope `internal/edge` | **APPROVE.** [edge.go:786](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/edge/edge.go:786), [ratelimit.go:117](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/edge/ratelimit.go:117): equivalent owner fold and comment changes; no authority expansion. | |
| +| Envelope `internal/host` | **APPROVE.** [hub.go:38](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/host/hub.go:38): equivalent helper call and corrected convergence commentary; no new root inputs. | |
| +| Envelope `internal/registry` | **APPROVE.** Changes above plus [remote.go:17](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-routes-followups/internal/registry/remote.go:17): validation tightens, SQL remains equivalent, sentinel registration is appended without renumbering existing entries. | |
| + |
| +No files changed. `GOCACHE` remained unset. Targeted Go tests could not start because the read-only sandbox denied Go’s work-directory creation. Runtime, mutation and census-test results remain unverified. Formatting and `git diff --check` passed. |
| + |
| +With no P1, apply the P2 fixes without reopening review, subject to the required census and newly changed security-behavior checks. |
| + |
| +READY AFTER FIXES |
| \ No newline at end of file |
diff --git a/fleet_public_routes_e2e_test.go b/fleet_public_routes_e2e_test.go| index ee030bdd9..e9b38735d 100644 |
| --- a/fleet_public_routes_e2e_test.go |
| +++ b/fleet_public_routes_e2e_test.go |
| @@ -64,6 +64,7 @@ import ( |
| "fmt" |
| "io" |
| "log" |
| + "math" |
| "net" |
| "net/http" |
| "net/http/httptest" |
| @@ -605,6 +606,7 @@ func TestFleetAppServesThroughTheHub(t *testing.T) { |
| oks := 0 |
| var refused *http.Response |
| var refusedBody string |
| + started := time.Now() |
| for i := 0; i < 12 && refused == nil; i++ { |
| resp, body := hubURL.mustDo(http.MethodGet, shopHost, "/limited", nil, withCookie) |
| switch { |
| @@ -616,9 +618,16 @@ func TestFleetAppServesThroughTheHub(t *testing.T) { |
| t.Fatalf("GET /limited %d = %d %q, want the app's 200 or the hub's 429", i+1, resp.StatusCode, body) |
| } |
| } |
| - // One token refills a second, so a slow loop may see a sixth; never more. |
| - if refused == nil || oks < 5 || oks > 6 { |
| - t.Fatalf("%d answered before a refusal (%v), want the burst of 5 (6 at most, with one refill) and then a 429", oks, refused != nil) |
| + // The limiter runs on the wall clock and refills one token a second, so |
| + // the ceiling is the burst plus what the loop's own duration refilled, |
| + // rounded up (Astra followups R1 P2-2): a slow scheduler earns the hub |
| + // more admissions, never a failure here. The exact burst is pinned on a |
| + // frozen clock in internal/edge (TestForwardRateLimitAtTheHubOnly). |
| + const burst, rate = 5, 1 |
| + ceiling := burst + int(math.Ceil(rate*time.Since(started).Seconds())) |
| + if refused == nil || oks < burst || oks > ceiling { |
| + t.Fatalf("%d answered before a refusal (%v), want the burst of %d and at most %d (the burst plus refill over %s), then a 429", |
| + oks, refused != nil, burst, ceiling, time.Since(started).Round(time.Millisecond)) |
| } |
| if refused.Header.Get("Retry-After") == "" || refused.Header.Get("Cache-Control") != "no-store" || |
| refusedBody != "Too many requests. Try again in a moment." { |
diff --git a/internal/registry/forward_test.go b/internal/registry/forward_test.go| index 233a34631..9766d6e62 100644 |
| --- a/internal/registry/forward_test.go |
| +++ b/internal/registry/forward_test.go |
| @@ -286,11 +286,30 @@ func TestPutForwardSetsEveryColumnButHost(t *testing.T) { |
| // TestPutForwardRefusesWhatIsNotAForwardRow: a call that is not a forward |
| // row, has no host, or is not placed on a fleet is ErrNotForward and writes |
| // nothing (deferred minor, Task 2; spec §4.4 refuses serving such a row, so |
| -// this is defence in depth). Over the remote transport too. |
| +// this is defence in depth). Locally, through the remote client, and as a |
| +// raw request on the remote transport (Astra followups R1 P2-1): the |
| +// client refuses before it calls, so only the raw request reaches the |
| +// worker's own refusal and shows the sentinel survives the transport |
| +// (remoteErrors). |
| func TestPutForwardRefusesWhatIsNotAForwardRow(t *testing.T) { |
| local := openTestRegistry(t) |
| remote, _ := remoteTestRegistry(t) |
| - for _, reg := range []*Registry{local, remote} { |
| + if remote.remote == nil { |
| + t.Fatal("remoteTestRegistry has no remote client") |
| + } |
| + calls := []struct { |
| + name string |
| + reg *Registry |
| + put func(Route) error |
| + }{ |
| + {"local", local, local.PutForward}, |
| + {"remote client", remote, remote.PutForward}, |
| + {"raw remote request", remote, func(rt Route) error { |
| + _, err := remote.remote.call(nil, remoteRequest{Method: "PutForward", TValue: rt}, nil) |
| + return err |
| + }}, |
| + } |
| + for _, call := range calls { |
| for _, c := range []struct { |
| why string |
| edit func(*Route) |
| @@ -304,18 +323,27 @@ func TestPutForwardRefusesWhatIsNotAForwardRow(t *testing.T) { |
| } { |
| rt := validForward("shop.example.com", "home") |
| c.edit(&rt) |
| - if err := reg.PutForward(rt); !errors.Is(err, ErrNotForward) { |
| - t.Errorf("PutForward(%s) = %v, want ErrNotForward", c.why, err) |
| + if err := call.put(rt); !errors.Is(err, ErrNotForward) { |
| + t.Errorf("%s: PutForward(%s) = %v, want ErrNotForward", call.name, c.why, err) |
| } |
| - all, err := reg.List() |
| + all, err := call.reg.List() |
| if err != nil { |
| t.Fatal(err) |
| } |
| if len(all) != 0 { |
| - t.Fatalf("PutForward(%s) wrote %+v", c.why, all) |
| + t.Fatalf("%s: PutForward(%s) wrote %+v", call.name, c.why, all) |
| } |
| } |
| } |
| + // The raw request is not refused for its shape alone: a valid forward |
| + // row sent the same way is written, so the refusals above are the |
| + // worker's judgment of each argument. |
| + if _, err := remote.remote.call(nil, remoteRequest{Method: "PutForward", TValue: validForward("shop.example.com", "home")}, nil); err != nil { |
| + t.Fatalf("raw remote PutForward of a valid forward row: %v", err) |
| + } |
| + if got, err := remote.Get("shop.example.com"); err != nil || got == nil || !got.InertForward() { |
| + t.Fatalf("raw remote PutForward of a valid row wrote %+v (%v)", got, err) |
| + } |
| } |
| // TestInertForwardChecksEachForbiddenField: one forbidden field set, and |