carlos / platform Public

region HA G3-B10: record-write census entry; review P3s

Re-pins Server.attachDomainAs and NewServer (no write added, moved or
reclassified). The F1 shape refusal names the region by label; the CLI
docs quote F5 as the console writes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev f4d40974fc1dfa4100242abb4f2f7dd9305d894f parent 38addbd
4 files changed, +34 −3
  • docs/site/cli.md +1 −1
  • internal/console/hacreate.go +1 −1
  • internal/provision/plan9_b8_census_test.go +1 −1
  • internal/provision/region_ha_g3_b10_census_test.go +31 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>b86qc5rfh</task-id> <tool-use-id>toolu_01CPa9hAu5HFcty6onNMyrbA</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/265811d8-fa99-4f28-a191-8a01ce8693ac/tasks/b86qc5rfh.output</output-file> <status>completed</status> <summary>Background command "until s=$(amadan ci status carlos/platform -branch region-ha-g3-b10 2&gt;&amp;1 | head -1); ! echo "$s" | grep -q "running\|queued\|pending"; do sleep 60; done; amadan ci status carlos/platform -branch region-ha-g3-b10 2&gt;&amp;1 | head -20" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a78289f1f1ec6f60c</task-id> <tool-use-id>toolu_017NuCBeZpJcCkPnCcM5ioSo</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/265811d8-fa99-4f28-a191-8a01ce8693ac/tasks/a78289f1f1ec6f60c.output</output-file> <status>completed</status> <summary>Agent "Opus whole-branch review B10" 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>I found no P1 or P2 problems. Three small P3 items are listed below. I couldn't run any tests: the sandbox makes the Go build cache (`~/.cache/go-build`) and `/tmp/g` read-only, so `go test` fails at setup. Everything below comes from reading the code, plus `gofmt -l`, which is clean on all the touched Go files. ## What I checked **(4) Dev is unchanged.** With no `ha_pools` in the config, `haPools` is empty, so `haCreate` gives the same answer as `haRegion` at every create gate (`seedmove.go:40-49`). - The new early 503 in the leftover rail (`haScopeInvalid`) only fires when the capacity config doesn't parse. In that state main already refuses at `requireHACreateCapacity`, because the observer fails on the same parse. The only difference is order: a leftover that would have got a 409 now gets the 503. - `Retry-After` is set on the leftover refusal only when `haCapacityRetryAfter &gt; 0` or the message is the no-room sentence. Dev's leftover refusals carry neither, so dev headers don't change. - Existing tests changed only in expected text: the "check data access for this region" wording, at `hacreate_test.go:208,464` and `hap2_wiring_test.go:312`. - Copy that dev users will see: the no-room, capacity-unknown, pool-capacity, F5 and leftover-503 sentences now use the region label (`offlinePlace`). On dev that means "Dublin (IE)" instead of "ie". This matches ruling R5. Tests still say "ie" because the test servers have no region names configured. No CLI code or user doc parses these strings. **Places that keep the old rule on purpose.** The seeded block (`apiinstances.go:2331`), `refuseHAImport`, `haTransferRegion` and `apiplacements.go:748,1063,1075,1092` still use `haRegion`, as N-HA4 and ruling R3 require. - A plain `--from` into a scoped region now skips the HA capacity gate and isn't stamped. That is the legacy behaviour (1) asks for. **Other create doors.** - App-derived regions only apply when `m.Pool==""`, so in a scoped region they take the legacy path. - Fleet placements are never an HA region. - A rootfs create has `Runtime` set, so it is never stamped, and the `HAData` leftover proof doesn't run for it. - Domain attach writes static records only, so `haCreate("", "")` is safe. - Demo creates are refused earlier. - `appcopies` refuses pooled and HA records. - The hostname-history admission and the plan caps run in the same order as before. - Sidecars: `rec.HA` follows `haCreate`, `recheckSidecarHAManifest` is keyed on `rec.HA`, and `requireHACreateCapacity` is called with the sidecar's pool. **The I-B10 gate can't be bypassed.** Every door that can stamp a record HA goes through `requireHACreateCapacity`: instance create at `:2341` and sidecar create at `:451`. Domain attach can't stamp HA. - The I-B10 check runs whenever an observation exists (`obs != nil`), even a stale or failed one. A failed observation then falls through to the capacity-unknown refusal, so the gate fails closed. - Edges keys are listed with no age filter; only status keys are age-filtered. `ValidRegion("")` is true, so files placed in the home region are checked too. **Startup and concurrency.** - `haPools` and `haScopeInvalid` are written once in `NewServer` and only read afterwards. Reads from a nil map are safe. - `HADataStores` is read-only after startup. `NewS3StoreIn` makes no network calls, so it can't hang startup. - If the config fails to parse, both `buildHADataStores` (returns nil) and the observer fail closed. - With `CONSOLE_HA_REGIONS` empty but `ha_pools` in the config, `haCreate` is always false and the stores that get built are never used. **Cross-compile.** No Linux-only APIs were added. **Census.** None of the touched files appear in any `internal/provision/testdata/plan14-root-reads*.tsv` or in `census-base.tsv`. The only `server.go` hits are `internal/instancectl/server.go`. ## Findings **F1 (P3): one quote in `docs/site/cli.md` doesn't match the code.** - Where: `docs/site/cli.md:1057`. - Problem: the doc quotes `"Use the console's home region without a pool."`. The real message at `createleftovers.go:175` is "…not available yet in %s. use the console's home region without a pool." with a lower-case "use". - Fix: quote the code's text exactly, or paraphrase without quotation marks. **F2 (P3): one refusal in a touched file still names the region by code.** - Where: `hacreate.go:21`. - Problem: the F1 binary-socket refusal still uses `offlineName` ("ie has high availability turned on…"). Its predicate line changed in this branch. Every sibling sentence the dev user meets on the same create path now uses the label. - Context: R5 only requires labels for new or changed sentences, and this sentence's text didn't change, so this is consistency only. - Fix: switch to `offlinePlace`, or note the exemption in the ledger. **F3 (P3): the I-B10 refusal shows a box reference to members.** - Where: `nocapacity.go:59`. - Problem: the I-B10 refusal includes the edges-file box reference in a 503 that any member doing a pool create can see. The comment at `hacapacity.go:302` says storage keys belong "only on operator diagnostics, never member pages". - Context: R8 explicitly rules that the box is named, so this is acceptable as decided. I'm noting it so the conflict with that comment is a conscious choice. - Fix: none required. Optionally, adjust the comment. ## Gaps I noticed that need no change - I-B10 only fires on a valid `data_bucket` or `data_bucket_region` that differs from the config. A stale file placed in the region with that field missing or invalid gets past it. This matches the spec text ("reports a valid…"), and a box omits `data_bucket` only when it has no hibernate bucket, so it can't run HA data anyway. - `haCreate` resolves the home region from `cfg.HomeRegion`, but `requireHACreateCapacity` and the leftover rail use `homeRegionOut`, which reads the claim home when `HostClaim` is on. With claims shelved this doesn't matter. VERDICT: CLEAN</result> <usage><subagent_tokens>127137</subagent_tokens><tool_uses>46</tool_uses><duration_ms>353215</duration_ms></usage> </task-notification>

Attributed to this commit: 65.2 g CO₂e (8,238,909 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-g3-b10, 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/site/cli.md b/docs/site/cli.md
index a50fad2ce..9804272bd 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -1054,7 +1054,7 @@ In an active high availability region, a non-hibernating binary socket create is
If earlier data remains for the address, the create is refused with status 409. The message names the data found: lock, files, replica or other. Choose another address, or ask an operator to purge the old data.
-An operator can enable high availability for named pools in a region. Only instances and sidecars for apps placed in those pools use high availability there. Other creates work as usual. High availability creates also work outside the console's home region, using that region's data for the earlier-data check. If the data cannot be checked, the create is refused with status 503 before any write. Try again. If any box uses different data storage from the region, high availability creates are refused with status 503. The message names the box. An operator must reconfigure or retire it. If high availability covers every create in a region, a non-home or pooled high availability create is refused with status 409: "Use the console's home region without a pool."
+An operator can enable high availability for named pools in a region. Only instances and sidecars for apps placed in those pools use high availability there. Other creates work as usual. High availability creates also work outside the console's home region, using that region's data for the earlier-data check. If the data cannot be checked, the create is refused with status 503 before any write. Try again. If any box uses different data storage from the region, high availability creates are refused with status 503. The message names the box. An operator must reconfigure or retire it. If high availability covers every create in a region, a non-home or pooled high availability create is refused with status 409: "use the console's home region without a pool."
New creates in an HA region need a box with room. A 503 response tells you to retry after 60 seconds. Missing evidence pauses creates. It does not report zero capacity. Existing instances can still wake.
diff --git a/internal/console/hacreate.go b/internal/console/hacreate.go
index f0439894c..7d61d1d23 100644
--- a/internal/console/hacreate.go
+++ b/internal/console/hacreate.go
@@ -18,7 +18,7 @@ func (s *Server) haCreateShapeRefusal(rec provision.Record) *doorRefusal {
return demoDataRefusal()
}
if s.haCreate(rec.Region, rec.Pool) && rec.KindOrDefault() == "instance" && len(rec.AddrsOrDefault()) == 0 && rec.Runtime == "" && !rec.HibernateOrDefault() {
- return &doorRefusal{Status: http.StatusBadRequest, Msg: fmt.Sprintf("%s has high availability turned on. binary socket instances must allow hibernation. resident rootfs instances are still allowed.", s.offlineName(rec.Region))}
+ return &doorRefusal{Status: http.StatusBadRequest, Msg: fmt.Sprintf("%s has high availability turned on. binary socket instances must allow hibernation. resident rootfs instances are still allowed.", s.offlinePlace(rec.Region))}
}
return nil
}
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index a490b7d24..3dcba2a1d 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 := regionHASidecarsWriteCensusInventory()
+ inventory := regionHAG3B10WriteCensusInventory()
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/region_ha_g3_b10_census_test.go b/internal/provision/region_ha_g3_b10_census_test.go
new file mode 100644
index 000000000..076cab32c
--- /dev/null
+++ b/internal/provision/region_ha_g3_b10_census_test.go
@@ -0,0 +1,31 @@
+package provision
+
+// Record-write census entry for region-ha-g3-b10 (spec §23: born HA only in
+// a named HA pool), layered on regionHASidecarsWriteCensusInventory (main's
+// newest at ddbc0297). No record write is added, moved or reclassified:
+// - Server.attachDomainAs keeps its one CreateRecord. Its HA capacity
+// check now asks haCreate("", "") instead of haRegion(""), so a home
+// region scoped to named pools treats a first route as legacy. The
+// record it writes is unchanged (static, never stamped).
+// - NewServer keeps its key site. It now parses CONSOLE_HA_CAPACITY_CONFIG
+// once into the server's read-only haPools / haScopeInvalid fields. It
+// writes nothing.
+func regionHAG3B10WriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), regionHASidecarsWriteCensusInventory()...)
+ replacements := []censusEntry{
+ {"internal/console/domainattach.go", "Server.attachDomainAs", "record-writer", "key:CreateRecord", "70d8b7582b91887b6bffbcc969dff5229ca58b97c76d2328f7efcbe46906960c"},
+ {"internal/console/server.go", "NewServer", "key-site", "lit:instances", "584fd507f4fdd6ccf54c78e5b830b58e893597ab4881555b9930a75965d29597"},
+ }
+ for _, r := range replacements {
+ found := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("region-ha-g3-b10 replacement of an unlisted unit " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}