carlos / platform Public

zdd-6 task 2: fix round 1

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 88236433882cd1f57e45e4572472b2ccb81aeb20 parent 1f48e2a
2 files changed, +20 −10
  • internal/rolloutwords/words.go +12 −9
  • internal/rolloutwords/words_test.go +8 −1
diff --git a/internal/rolloutwords/words.go b/internal/rolloutwords/words.go
index 4d33e8e3e..665d7d5f0 100644
--- a/internal/rolloutwords/words.go
+++ b/internal/rolloutwords/words.go
@@ -3,8 +3,8 @@
// failed, the short states `carlos instances list` and the console show
// (§9.1, §9.2), and the events a box writes to the platform log stream
// (§9.4). One home, so the CLI, the console and the box never word one fact
-// two ways. Every string here was copy-reviewed; approved_copy_zdd_test.go
-// pins it against docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json.
+// two ways. Every string here is a draft pending copy review; TODO-COPY
+// markers identify the texts that will be pinned by an approved copy test.
//
// A leaf: it imports nothing of this repo's, so the rollout manager and the
// activator can use it without an import cycle.
@@ -88,15 +88,18 @@ const (
StateConfigPending = "config delivered, not active"
)
+// TODO-COPY zdd.unavailable.declined
+const unavailableDeclined = "its box cannot run two builds side by side, so it restarts instances the old way"
+
// unavailablePhrases are the member-facing reasons a box cannot run zero-downtime deploys,
// keyed by the codes in status.RolloutReport.Unavailable.
var unavailablePhrases = map[string]string{
- "no-cgroup-delegation": "its box cannot run two builds side by side, so it restarts instances the old way", // TODO-COPY zdd.unavailable.declined
- "no-generation-control": "its box cannot run two builds side by side, so it restarts instances the old way", // TODO-COPY zdd.unavailable.declined
- "generations-off": "its box cannot run two builds side by side, so it restarts instances the old way", // TODO-COPY zdd.unavailable.declined
- "no-deploy-store": "its box cannot start instances: the deploy store is unavailable", // TODO-COPY zdd.unavailable.store
- "no-release-key": "its box cannot start instances: the release key is unavailable", // TODO-COPY zdd.unavailable.release-key
- "failure-book-unreadable": "its box cannot start instances: its record of failed builds cannot be read", // TODO-COPY zdd.unavailable.failure-book
+ "no-cgroup-delegation": unavailableDeclined, // TODO-COPY zdd.unavailable.declined
+ "no-generation-control": unavailableDeclined, // TODO-COPY zdd.unavailable.declined
+ "generations-off": unavailableDeclined, // TODO-COPY zdd.unavailable.declined
+ "no-deploy-store": "its box cannot start instances: the deploy store is unavailable", // TODO-COPY zdd.unavailable.store
+ "no-release-key": "its box cannot start instances: the release key is unavailable", // TODO-COPY zdd.unavailable.release-key
+ "failure-book-unreadable": "its box cannot start instances: its record of failed builds cannot be read", // TODO-COPY zdd.unavailable.failure-book
}
// TODO-COPY zdd.unavailable.unknown
@@ -104,7 +107,7 @@ const unavailableUnknown = "its box reports a rollout problem (%s)"
// Unavailable is the member-facing phrase for a box's
// RolloutReport.Unavailable code. An unknown code (a newer box) reads
-// through UnavailableUnknown with the code itself.
+// through unavailableUnknown with the code itself.
func Unavailable(code string) string {
if p, ok := unavailablePhrases[code]; ok {
return p
diff --git a/internal/rolloutwords/words_test.go b/internal/rolloutwords/words_test.go
index e183d24e8..dc5f69b71 100644
--- a/internal/rolloutwords/words_test.go
+++ b/internal/rolloutwords/words_test.go
@@ -48,6 +48,7 @@ func TestVerbsAreWhereTheCallersPutThem(t *testing.T) {
"EventCohortHalted": 3, "EventFallbackServed": 2, "EventConfigPending": 2,
"EventStagingRefused": 1, "EventBounceInstance": 1, "EventBounceSidecar": 1,
"StateHeld": 1, "StateRollingOut": 0, "StateAsleep": 1, "StateConfigPending": 0, "reasonUnknown": 1,
+ "unavailableUnknown": 1,
} {
s := words[name]
if strings.Count(s, "%s") != want || strings.Count(s, "%") != want {
@@ -55,7 +56,7 @@ func TestVerbsAreWhereTheCallersPutThem(t *testing.T) {
}
}
for name, s := range words {
- if (strings.HasPrefix(name, "cause ") || strings.HasPrefix(name, "reason ")) && strings.Contains(s, "%") {
+ if (strings.HasPrefix(name, "cause ") || strings.HasPrefix(name, "reason ") || strings.HasPrefix(name, "unavailable ")) && strings.Contains(s, "%") {
t.Errorf("%s = %q: a phrase is filled into other strings and carries no verb", name, s)
}
}
@@ -87,6 +88,9 @@ func TestEveryUnavailableCodeHasAPhrase(t *testing.T) {
if phrase == "" {
t.Errorf("Unavailable(%q) = empty string", code)
}
+ if phrase == fmt.Sprintf(unavailableUnknown, code) {
+ t.Errorf("Unavailable(%q) fell through to unknown format", code)
+ }
if UnavailableRefuses(code) {
t.Errorf("UnavailableRefuses(%q) = true, want false", code)
}
@@ -97,6 +101,9 @@ func TestEveryUnavailableCodeHasAPhrase(t *testing.T) {
if phrase == "" {
t.Errorf("Unavailable(%q) = empty string", code)
}
+ if phrase == fmt.Sprintf(unavailableUnknown, code) {
+ t.Errorf("Unavailable(%q) fell through to unknown format", code)
+ }
if !UnavailableRefuses(code) {
t.Errorf("UnavailableRefuses(%q) = false, want true", code)
}