carlos / platform Public

console: register the label door in the route invariants

The owner's label door (POST .../instances/{host}/label) joins the
closed doors after the fleet doors (closed walk now 103), gets a claim
refusal fixture for its C33 409 with a claimUnsupported reason, and is
classified linkedRefuse, as the other instance doors are: the handler
refuses a linked app through refuseLinkedJSON. The copy-since inventory
pins the label writer's in-memory copy of the record as read (none) and
D1's new kind and addresses probe in handleAPIInstanceCreate (none).
No production behaviour changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev c958a182612ab9971f37981c8beb9894cfbb5d55 parent c08ef7a
5 files changed, +28 −3
  • internal/console/claim_invariant_fixtures_test.go +10 −0
  • internal/console/claim_invariant_test.go +3 −0
  • internal/console/copysince_paths_test.go +8 −1
  • internal/console/linkedpolicy.go +1 −0
  • internal/console/svcroutes_test.go +6 −2

CI failed — run details

Intent

Human

<task-notification> <task-id>a7fd21fcb78014e7c</task-id> <tool-use-id>toolu_01J95nPqvuZV3Nvv8e6Arfea</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/a7fd21fcb78014e7c.output</output-file> <status>completed</status> <summary>Agent "Fix claim route census + CLI golden" 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>Both fixes are committed as `c08ef7a0`. Nothing was pushed. - **Tests:** these all pass. - `TestClaimConsoleRouteCensus`: ok. - `TestCLIGolden|TestInstancesLabel|TestParity`: ok. I ran all three in one command, so there is no separate `TestInstancesLabel|TestParity` line. - **Census:** `internal/console/testdata/claim-routes.txt` has no refuse-versus-serve column, so the fix was one new `route POST …/instances/{host}/label` line. - **Golden diff:** only the two new `instances label` cases (`-h`, `--zz-unknown-flag`) and the added label line in the `instances` usage stderr on 14 existing cases (7 verbs × `-h` and unknown-flag). Nothing else changed. - **Recording:** `-record -base 5b6d5374`, the merge-base with `main`, rewrote 144 unrelated lines, so I discarded that result. `-base b39eecf5^` recorded the new label cases from a binary that lacks the verb, and those cases failed on replay. `-base HEAD` gave the clean diff above. - **Environment:** the Go cache is read-only in the sandbox, so the commands ran unsandboxed with the default `GOCACHE`. The recorder needs `TMPDIR` outside any git checkout and any `.carlos/config` ancestor, so I used a temporary directory under `/var/tmp` and removed it afterwards.</result> <usage><subagent_tokens>60494</subagent_tokens><tool_uses>20</tool_uses><duration_ms>218038</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bsb1lufo7</task-id> <tool-use-id>toolu_01JcMG4opPtaxwWbZQdifFXx</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/bsb1lufo7.output</output-file> <status>completed</status> <summary>Background command "Push the fix and wait for CI" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 24.4 g CO₂e (3,197,383 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-record-labels-m2, 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/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go
index 1693ef6d8..3c052c38e 100644
--- a/internal/console/claim_invariant_fixtures_test.go
+++ b/internal/console/claim_invariant_fixtures_test.go
@@ -1995,6 +1995,16 @@ var claimFixtures = map[string]claimFixture{
return ""
},
}},
+ // The owner's label door (fleet record labels spec §5) refuses on a
+ // host-claim console with C33, after its owner, app and linked-app
+ // gates and before it reads the record or writes anything.
+ "route POST /api/cli/apps/{account}/{app}/instances/{host}/label": {refused: &claimRefusalFixture{
+ apps: claimRefs("bab/titogo"),
+ setup: claimWorldInstance,
+ do: claimRefusedAPI(http.MethodPost, "/api/cli/apps/bab/titogo/instances/acme.go.tito.io/label", `{"box":"box-1"}`),
+ status: http.StatusConflict,
+ msg: claimInstanceLabelUnsupportedMsg,
+ }},
"route POST /api/cli/apps/{account}/{app}/instances/{host}/updates/install": {door: &claimDoor{
apps: claimRefs("bab/titogo"),
setup: claimWorldInstance,
diff --git a/internal/console/claim_invariant_test.go b/internal/console/claim_invariant_test.go
index ce9d70fc1..42dc5c367 100644
--- a/internal/console/claim_invariant_test.go
+++ b/internal/console/claim_invariant_test.go
@@ -134,6 +134,9 @@ var claimUnsupported = map[string]string{
"the publish and unpublish doors refuse after linkRoute's gate and before they read or write any app",
claimFleetDrainUnsupportedMsg: "a drain relabels the box's instance records (managed fleets 1b, rule 5), which no claim operation gates; " +
"the drain door refuses after its caller gates and the box lookup, before it reads the fleet's records or writes anything",
+ claimInstanceLabelUnsupportedMsg: "a first fleet label rewrites the instance record and marks the box (fleet record labels spec §5), " +
+ "and no claim operation gates either write; the label door refuses after its owner, app and linked-app gates " +
+ "and before it reads the record or writes anything",
seedClaimConsoleRefusal().Msg: "seeded instances need nested boxes, and the claim-armed path waits for #250 (seeded-instances spec §3.4); " +
"every import door refuses before it reads the record, and the legacy route assignment before it reads anything",
}
diff --git a/internal/console/copysince_paths_test.go b/internal/console/copysince_paths_test.go
index bd126c9a3..eab2d4321 100644
--- a/internal/console/copysince_paths_test.go
+++ b/internal/console/copysince_paths_test.go
@@ -409,7 +409,10 @@ var copyInventory = map[string]map[string]int{
"(*internal/console.Server).handleAPIInstanceCreate": 2,
},
"literal": {
- "(*internal/console.Server).handleAPIInstanceCreate": 7, // create: the new record (2154); none: probes and reservations (6)
+ // create: the new record (2241); none: probes and reservations (7),
+ // one of them D1's kind and addresses probe for fleetCreateApplies
+ // before C39 (2200).
+ "(*internal/console.Server).handleAPIInstanceCreate": 8,
"(*internal/console.Server).attachDomainAs": 2, // create: a static record (270); none: a reservation probe (143)
"(*internal/console.Server).attachFirstRouteLocked": 1, // create: a static record
"(*internal/console.Server).attachClaimFirstRoute": 1, // create: a static record, CreatedAt from PrepareInstance
@@ -526,6 +529,10 @@ var copyInventory = map[string]map[string]int{
"internal/provision.journalRecord": 1,
"internal/provision.replicaRecordSnapshot": 1,
"internal/provision.scanInstanceRecords": 6,
+ // none: the label writer's copy of the record as read, returned
+ // with ErrFleetBoxNotFirst to name the competing label (C34); it
+ // writes FleetBox, FleetBoxAt and FleetBoxMoved, no copy field.
+ "internal/provision.SetRecordFirstFleetBox": 1,
},
"write": {
diff --git a/internal/console/linkedpolicy.go b/internal/console/linkedpolicy.go
index c6880667f..bb073de40 100644
--- a/internal/console/linkedpolicy.go
+++ b/internal/console/linkedpolicy.go
@@ -215,6 +215,7 @@ var linkedPolicies = map[string]linkedPolicy{
"POST /api/cli/apps/{account}/{app}/instances/{host}/runs/{id}/ack": linkedRefuse,
"GET /api/cli/apps/{account}/{app}/instances/{host}/interactive": linkedRefuse,
"POST /api/cli/apps/{account}/{app}/instances/{host}/retry": linkedRefuse,
+ "POST /api/cli/apps/{account}/{app}/instances/{host}/label": linkedRefuse,
"GET /api/cli/apps/{account}/{app}/db/{host}/ltx/{level}": linkedRefuse,
"GET /api/cli/apps/{account}/{app}/db/{host}/ltx/{level}/{span}": linkedRefuse,
"POST /api/cli/apps/{account}/{app}/db/{host}/reads": linkedRefuse,
diff --git a/internal/console/svcroutes_test.go b/internal/console/svcroutes_test.go
index 92f52295a..ee25cc619 100644
--- a/internal/console/svcroutes_test.go
+++ b/internal/console/svcroutes_test.go
@@ -178,6 +178,10 @@ var closedDoors = []string{
"POST /api/cli/fleets/{account}/{fleet}/boxes/{label}/detach",
"POST /api/cli/fleets/{account}/{fleet}/boxes/{label}/drain",
"POST /api/cli/fleets/{account}/{fleet}/boxes/{label}/tags",
+ // Tying an unlabelled fleet record to the box serving it (fleet record
+ // labels spec §5) decides where the fleet keeps the instance: the
+ // fleet doors' cut, and owner-gated inside.
+ "POST /api/cli/apps/{account}/{app}/instances/{host}/label",
// Setting a fleet's secrets key decides who can read the fleet's future
// secrets. Same cut, and owner-gated inside.
"PUT /api/cli/fleets/{account}/{fleet}/secrets-key",
@@ -1749,8 +1753,8 @@ func TestEveryClosedDoorRefusesAServiceCredential(t *testing.T) {
}
seen++
}
- if seen != len(closedDoors) || seen != 102 {
- t.Errorf("walked %d closed doors, want all %d (and 102 today: three domain purchase doors, two managed admission doors, the fleet show door, two managed configuration doors, three environment ownership doors, instance-token, three door-key doors, the routes door, the regional placements write, instances-manifest, the app update policy, sidecars-manifest, the route-channel move, three instance update settings doors, two db replica doors, the forwarded db read, seven fleets, the fleet secrets key door, the two person link doors (list and unlink), the six home link doors, four services, two email credentials, email pause, the build probe, the swap policy, the copy count, the interactive setting, the interactive session door, two app policy doors, two app region doors, the live tenancy read, the layout read, the activation-cancel door, eleven system doors, three deployment-wide antivirus, the PDF status door, three platform geoip doors, two pointer digest doors, the hostname history status, the channel resign, two release authorize doors, four store-entitlement doors, two account plan doors, two billing problem doors, the billing revenue and payments doors, the billing house door, three account subdomain doors, the subdomain inventory, and the claimed source door)",
+ if seen != len(closedDoors) || seen != 103 {
+ t.Errorf("walked %d closed doors, want all %d (and 103 today: three domain purchase doors, two managed admission doors, the fleet show door, two managed configuration doors, three environment ownership doors, instance-token, three door-key doors, the routes door, the regional placements write, instances-manifest, the app update policy, sidecars-manifest, the route-channel move, three instance update settings doors, two db replica doors, the forwarded db read, seven fleets, the instance label door, the fleet secrets key door, the two person link doors (list and unlink), the six home link doors, four services, two email credentials, email pause, the build probe, the swap policy, the copy count, the interactive setting, the interactive session door, two app policy doors, two app region doors, the live tenancy read, the layout read, the activation-cancel door, eleven system doors, three deployment-wide antivirus, the PDF status door, three platform geoip doors, two pointer digest doors, the hostname history status, the channel resign, two release authorize doors, four store-entitlement doors, two account plan doors, two billing problem doors, the billing revenue and payments doors, the billing house door, three account subdomain doors, the subdomain inventory, and the claimed source door)",
seen, len(closedDoors))
}
}