An absent sealed_to is not stale for the platform: staleForTarget reads it as sealed to the deployment key, so an app moves back to the platform with its older values (Task 7 ruling)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
internal/console/fleetsecrets_moves_test.go+29 −0internal/console/fleetsecretskey.go+16 −5
Intent
<task-notification> <task-id>ae916787ec6397887</task-id> <tool-use-id>toolu_017Mk71GxiRCCSWBtkcvC2u2</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2d812478-ae68-44f2-8075-b2330abd5939/tasks/ae916787ec6397887.output</output-file> <status>completed</status> <summary>Agent "Implement Task 7: moves and env fork" 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: 924d47f1 (on 4abe5168). It printed the known `packed-refs.lock` hook error, but `git log` shows the commit and the tree is clean. Tests: the new Task 7 tests failed first and now pass, and five mutations are each caught. A broad targeted console run (place, create, fork, environment, fleet-secrets and guard tests) passes, as do the copy gate, build, vet, gofmt and the darwin, windows and linux-arm64 builds. A wider `-run` pattern that also matched the Claim tests hit the 10-minute default timeout with no failure printed, and I did not rerun it. Concerns: - **Absent `sealed_to` for a platform target:** it counts as stale, as the brief and spec §5.5 read it, so a legacy app moved back to the platform is refused until its values are set again. - **`CARLOS_RELAY`:** I left it out of the stale list, because the 6b reconcile re-seals it. Until the next reconcile pass it is unreadable on the new boxes (I2 only). - **Plans-off create lock:** `handleAPICreateApp` now takes the account lock itself when plans are off and `--place` is set, so the adoption check is under the lock in both modes. The brief did not ask for this. - **Task 6a test change:** `TestAppCreateAdoptingFleetAppDoesNotDeadlock` seeded a value with no `sealed_to`, which is now refused by design. I re-sealed its seed to the fleet's key; it still witnesses the lock. - **Fork lock span:** the fork holds the account lock through its credential mint, so other doors on that account wait. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/.superpowers/sdd/2026-10-29-fleet-secrets-key/task-7-report.md</result> <usage><subagent_tokens>153881</subagent_tokens><tool_uses>16</tool_uses><duration_ms>795127</duration_ms></usage> </task-notification>
Anything in particular slowing us down?
Attributed to this commit: 15.1 g CO₂e (1,912,238 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-fleet-secrets-key, 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/console/fleetsecrets_moves_test.go b/internal/console/fleetsecrets_moves_test.go| index 463f0906a..fe7fd6c2d 100644 |
| --- a/internal/console/fleetsecrets_moves_test.go |
| +++ b/internal/console/fleetsecrets_moves_test.go |
| @@ -314,3 +314,32 @@ func TestCreatePlaceHoldsTheAccountLock(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// TestPlaceBackToPlatformAcceptsLegacyValues: a value with no sealed_to was |
| +// sealed before the field existed, to the deployment key. Moving the app to |
| +// the platform does not list it; moving it to a fleet does. |
| +func TestPlaceBackToPlatformAcceptsLegacyValues(t *testing.T) { |
| + fx, token, _ := fsmShop(t, "code-fsm-legacy", true) |
| + if status, body := fsmPlace(t, fx, token, "fleet/home"); status != http.StatusOK { |
| + t.Fatalf("place = %d %v", status, body) |
| + } |
| + fskSetSecrets(t, fx, map[string]appconfig.Var{"LEGACY": fskSeal(t, fx, "")}) |
| + stale, err := fx.srv.staleForTarget(context.Background(), &Account{ID: OpsAccountID, Sqid: fx.sqid}, "shop", "") |
| + if err != nil || len(stale) != 0 { |
| + t.Fatalf("stale for the platform = %v, %v, want none", stale, err) |
| + } |
| + stale, err = fx.srv.staleForTarget(context.Background(), &Account{ID: OpsAccountID, Sqid: fx.sqid}, "shop", "fleet/home") |
| + if err != nil || len(stale) != 1 || stale[0] != "LEGACY" { |
| + t.Fatalf("stale for a fleet = %v, %v, want LEGACY", stale, err) |
| + } |
| + if status, body := fsmPlace(t, fx, token, ""); status != http.StatusOK { |
| + t.Fatalf("unplace with a legacy value = %d %v, want 200", status, body) |
| + } |
| + if got := fsmPlacement(t, fx); got != "" { |
| + t.Fatalf("placement = %q, want the platform", got) |
| + } |
| + status, body := fsmPlace(t, fx, token, "fleet/home") |
| + if status != http.StatusConflict || body["error"] != fsmRefusal("LEGACY") { |
| + t.Fatalf("place the legacy value onto a fleet = %d %v, want 409 naming LEGACY", status, body) |
| + } |
| +} |
diff --git a/internal/console/fleetsecretskey.go b/internal/console/fleetsecretskey.go| index dbeab77dc..ff129a201 100644 |
| --- a/internal/console/fleetsecretskey.go |
| +++ b/internal/console/fleetsecretskey.go |
| @@ -231,8 +231,10 @@ func (s *Server) fleetStaleValues(ctx context.Context, acct *Account, fleet, fp |
| // staleForTarget lists, sorted, the sealed vars of app, in any bundle (default, |
| // named environments, instance overlays), that the boxes of target cannot |
| -// open: those whose sealed_to is absent or is not the target's key |
| -// fingerprint (spec §5.5). target is "" (the platform's boxes, the |
| +// open: those whose sealed_to is not the target's key fingerprint, or is |
| +// absent for a fleet (spec §5.5). An absent sealed_to is a value sealed |
| +// before the field existed, so to the deployment key: it is not stale for the |
| +// platform, and it is for a fleet (controller ruling). target is "" (the platform's boxes, the |
| // deployment key) or "fleet/<name>" (that fleet's key; a keyless fleet opens |
| // nothing, so every sealed value is stale for it). The same reading as |
| // fleetStaleValues, appSealedVars, so the two cannot disagree about what a |
| @@ -276,9 +278,18 @@ func (s *Server) staleForTarget(ctx context.Context, acct *Account, app, target |
| if v.name == relayVar { |
| continue |
| } |
| - // An empty fp is a target with no key to match: nothing is sealed |
| - // to it, an absent sealed_to included. |
| - if fp == "" || v.sealedTo != fp { |
| + switch { |
| + case target == "": |
| + // An absent sealed_to is a value sealed before the field |
| + // existed, to the deployment key: the platform's boxes open it |
| + // (the relay reconcile reads it the same way). |
| + if v.sealedTo != "" && v.sealedTo != fp { |
| + set[v.name] = true |
| + } |
| + case fp == "" || v.sealedTo != fp: |
| + // A fleet's boxes hold only the fleet's key. An empty fp is a |
| + // keyless fleet, which nothing is sealed to, an absent |
| + // sealed_to included. |
| set[v.name] = true |
| } |
| } |