carlos / platform Public

census: record-write inventory for #892 S2 console doors

TestPlan9B8RecordWriteCensus rejected four console units that Tasks 2
and 3 changed: placeAppTarget, createRecordMarkedLocked,
createRecordWithLifetimeLocked and reconcileReplicaApp. Each was reviewed
against its diff from the branch base. The fleet-size destination gate,
the name lock and the FleetSizesFloor barrier now run before the write;
the record write is the same and no new field is written.

statelessScale2FleetSizesWriteCensusInventory layers the four re-pins on
fleetRestartWakeWriteCensusInventory with a basis for each. No class or
site kind changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3b18fc7fad15c1b83cc1eaa10386e5f61718ddaf parent 2a610b5
2 files changed, +61 −1
  • internal/provision/plan9_b8_census_test.go +1 −1
  • internal/provision/stateless_scale_2_fleet_sizes_census_test.go +60 −0

Intent

Human

<task-notification> <task-id>a8df6ad79ffd246eb</task-id> <tool-use-id>toolu_01X79ZLoucyeweW4fQp6LzMS</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/29a43d67-87d2-4557-8e9d-9b70d303a90b/tasks/a8df6ad79ffd246eb.output</output-file> <status>completed</status> <summary>Agent "Implement S2 Task 5" 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 committed as 2a610b5d, and `git status` is clean. - **Copy guard:** `approved_stateless_scale_copy_test.go` now checks PS-2-C01 to C15 in the files the deck names. A new `TestStatelessScaleC08AppliesToInstancesSet` checks the "instances set:" variant of C08. - **Deck file column:** PS-2-C04 and PS-2-C14 now name `internal/console/fleetsize.go`, where their strings live. I checked the other rows and they were already right. - **Approval provenance:** IP1-21, 22, 32, 33, 51, 52 and GAP-1 in the instance-policy deck gained `replaced_on`, `replaced_by` and `previous_text`. So did `settings.cli.set-usage` in the instance-settings-5 deck. The old `approved_by` and `approved_on` fields are untouched. The usage line is recorded as a controller usage synopsis. `clireg-golden.jsonl` is unchanged. - **Tests:** these pass: - the root package's Approved, InstancePolicy, Scale and Golden tests - `./internal/updatewords` - `./internal/docsite` - **Census:** `make census-card` reports a clean census, so no re-proposal was needed. - **Concern:** `TestPlan9B8RecordWriteCensus` fails on four console sites. They are `placeAppTarget` in `fleets.go`, `createRecordMarkedLocked` in `hostsused.go`, `createRecordWithLifetimeLocked` in `lifetimes_create.go` and `reconcileReplicaApp` in `replicaplacement.go`. Earlier tasks changed them, and I touched no console file, so their reviewed digests need updating. - **Git noise:** each commit printed a `packed-refs.lock` error, but the commit landed both times. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/stateless-scale-1/.superpowers/sdd/2026-11-22-892-s2-fleet-sizes/task-5-report.md</result> <usage><subagent_tokens>108759</subagent_tokens><tool_uses>8</tool_uses><duration_ms>513220</duration_ms></usage> </task-notification>

Attributed to this commit: 13.3 g CO₂e (1,675,689 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on stateless-scale-2-fleet-sizes, 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/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index f267413cc..e60669d2d 100644
--- a/internal/provision/plan9_b8_census_test.go
+++ b/internal/provision/plan9_b8_census_test.go
@@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) {
if len(got) < 100 {
t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root)
}
- inventory := fleetRestartWakeWriteCensusInventory()
+ inventory := statelessScale2FleetSizesWriteCensusInventory()
problems := append(censusDiff(inventory, got), censusPolicy(inventory)...)
if len(problems) > 0 {
t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n "))
diff --git a/internal/provision/stateless_scale_2_fleet_sizes_census_test.go b/internal/provision/stateless_scale_2_fleet_sizes_census_test.go
new file mode 100644
index 000000000..334335182
--- /dev/null
+++ b/internal/provision/stateless_scale_2_fleet_sizes_census_test.go
@@ -0,0 +1,60 @@
+package provision
+
+// statelessScale2FleetSizesWriteCensusInventory is the record-write census
+// for #892 S2, larger sizes on owned fleets (branch
+// stateless-scale-2-fleet-sizes, plan 2026-11-22-892-s2-fleet-sizes),
+// layered on fleetRestartWakeWriteCensusInventory (main's newest at
+// c9dc5b8e). Reviewed by the branch author against the source of each unit
+// and its diff from the branch base (0f58616d^). No class or site kind
+// changes; four console units are re-pinned, each writing the same record
+// it wrote before and no new field:
+//
+// - Server.placeAppTarget (internal/console/fleets.go): #892 S2 adds the
+// fleet-size destination gate (appTargetRefusal) and the
+// FleetSizesFloor barrier (appTargetFloorBarrier) before the write,
+// under the app's name (policy) lock, taken after the app lock and held
+// through the placement row and the SetRecordRegion walk; the row write
+// moves to setAppPlacementIfNameLocked (the same UPDATE without taking
+// that lock again). On a host-claim console the gate and barrier run
+// before the claim operation. Same record write (SetRecordRegion over
+// RecordsPrefix), no new field written.
+// - Server.createRecordMarkedLocked (internal/console/hostsused.go): #892
+// S2: copiesCreateCheck, which now runs the fleet-size destination gate
+// and the FleetSizesFloor barrier before the write, returns the
+// barrier's unlock, held (deferred) through the write. Same record write
+// (CreateRecord at RecordKey), no new field written.
+// - Server.createRecordWithLifetimeLocked
+// (internal/console/lifetimes_create.go): #892 S2: the same
+// copiesCreateCheck change as createRecordMarkedLocked, its unlock held
+// through the write. Same record write, no new field written.
+// - Server.reconcileReplicaApp (internal/console/replicaplacement.go):
+// #892 S2: before the first record it acts on, it judges the fleet's
+// boxes once per app with the fleet-size destination gate
+// (appDestinationsRefused into fleetView.DestRefused), which placement
+// candidates then exclude. Same record writes (the assignment writes
+// through applyReplicaAction), no new field written; replicaRecordKey
+// is still the in-memory map key only.
+func statelessScale2FleetSizesWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), fleetRestartWakeWriteCensusInventory()...)
+ for _, r := range []censusEntry{
+ {"internal/console/fleets.go", "Server.placeAppTarget", "record-writer", "key:RecordsPrefix,key:SetRecordRegion", "256eda2756596af209fede5e9293759e71895b6908d28e6a1c2b0cc1dfc8e9f4"},
+ {"internal/console/hostsused.go", "Server.createRecordMarkedLocked", "record-writer", "key:CreateRecord,key:RecordKey", "7ad4669821eb63368d50ba901580ad980181d9d814a8d3f64035866564bf60bd"},
+ {"internal/console/lifetimes_create.go", "Server.createRecordWithLifetimeLocked", "key-site", "key:RecordKey", "0666e587d348137c533f0d64aa984efe031bf1cdb3d010bb56c85045310bd07b"},
+ {"internal/console/replicaplacement.go", "Server.reconcileReplicaApp", "key-site", "key:replicaRecordKey", "5da7965c17d296229d21159c34daffe6531bf949fd5703c4da8c5623eba971c2"},
+ } {
+ replaced := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ if e.Class != r.Class || e.Kinds != r.Kinds {
+ panic("stateless-scale-2-fleet-sizes census: classification changed for " + r.File + ":" + r.Unit)
+ }
+ entries[i], replaced = r, true
+ break
+ }
+ }
+ if !replaced {
+ panic("stateless-scale-2-fleet-sizes census: re-pin of an unlisted unit " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}