| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | // zddCopyIDs is the zero-downtime plan 6 copy inventory, pinned as a literal: |
| 9 | // the 149 strings Paul approved on 2026-10-11. The record must name every one, |
| 10 | // once, and nothing else. A record that loses an entry fails here even though |
| 11 | // every entry left in it is applied. |
| 12 | var zddCopyIDs = []string{ |
| 13 | "zdd.settings.heading", "zdd.settings.intro", "zdd.settings.swap-label", |
| 14 | "zdd.settings.overlap-option", "zdd.settings.hold-option", "zdd.settings.concurrency-label", |
| 15 | "zdd.settings.migrations-note", "zdd.settings.save", "zdd.settings.saved", "zdd.settings.invalid", |
| 16 | "zdd.settings.store-failed", "zdd.settings.rate-limited", "zdd.settings.unread", |
| 17 | "zdd.settings.no-bucket", "zdd.instance.installed", "zdd.instance.serving", "zdd.instance.hold", |
| 18 | "zdd.instance.hold-text", "zdd.instance.hold-down-text", "zdd.instance.promote-retry", |
| 19 | "zdd.instance.retry-button", "zdd.instance.rolling", "zdd.instance.asleep", |
| 20 | "zdd.instance.retry-title", "zdd.instance.retry-line", "zdd.instance.retry-done", |
| 21 | "zdd.instance.retry-failed", "zdd.instance.retry-limited", "zdd.instance.not-held", |
| 22 | "zdd.instance.audit", "zdd.api.swap-nothing", "zdd.api.swap-bad", "zdd.api.concurrency-bad", |
| 23 | "zdd.api.swap-limited", "zdd.api.swap-audit", "zdd.api.ship-swap-bad", |
| 24 | "zdd.api.ship-swap-conflict", "zdd.api.retry-store", "zdd.api.retry-host-audit", |
| 25 | "zdd.api.retry-not-held", "zdd.api.retry-no-bucket", "zdd.api.retry-limited", |
| 26 | "zdd.apps.usage-line", "zdd.apps.usage-set", "zdd.apps-set.usage", "zdd.apps-set.flag-swap", |
| 27 | "zdd.apps-set.flag-concurrency", "zdd.apps-set.flag-app", "zdd.apps-set.nothing", |
| 28 | "zdd.apps-set.bad-swap", "zdd.apps-set.bad-concurrency", "zdd.apps-set.two-apps", |
| 29 | "zdd.apps-set.direct-mode", "zdd.apps-set.done", "zdd.apps-set.overlap-note", |
| 30 | "zdd.apps-set.hold-note", "zdd.apps-set.mismatch", "zdd.apps-set.old-console", |
| 31 | "zdd.apps-set.error", "zdd.apps-set.unreadable", "zdd.ship.flag-swap", "zdd.ship.usage-flag", |
| 32 | "zdd.ship.bad-swap", "zdd.ship.hold-note", "zdd.ship.no-echo", "zdd.deploy.usage-flag", |
| 33 | "zdd.deploy.held-until", "zdd.instances-retry.usage-line", "zdd.instances-retry.usage-para", |
| 34 | "zdd.instances-retry.done", "zdd.instances-retry.old-console", "zdd.list.header", |
| 35 | "zdd.list.retry-hint", "zdd.state.held", "zdd.state.rolling-out", "zdd.state.asleep", |
| 36 | "zdd.state.config-pending", "zdd.cause.release", "zdd.cause.install", "zdd.cause.retry", |
| 37 | "zdd.cause.restart", "zdd.cause.config", "zdd.reason.health", "zdd.reason.settle", |
| 38 | "zdd.reason.exit", "zdd.reason.staging", "zdd.reason.reused", "zdd.reason.unknown", |
| 39 | "zdd.unavailable.declined", "zdd.unavailable.store", "zdd.unavailable.release-key", |
| 40 | "zdd.unavailable.failure-book", "zdd.unavailable.unknown", "zdd.event.swapping", |
| 41 | "zdd.event.swapped", "zdd.event.swap-failed", "zdd.event.hold-down", "zdd.event.cohort-halted", |
| 42 | "zdd.event.fallback-served", "zdd.event.config-pending", "zdd.event.staging-refused", |
| 43 | "zdd.event.bounce-instance", "zdd.event.bounce-sidecar", "zdd.refuse.not-installed", |
| 44 | "zdd.refuse.held-down", "zdd.refuse.not-staged", "zdd.refuse.attempt-running", |
| 45 | "zdd.refuse.not-installable", "zdd.refuse.held-since-plan", "zdd.refuse.no-store", |
| 46 | "zdd.refuse.no-release-key", "zdd.refuse.book-unreadable", "zdd.refuse.no-swaps", |
| 47 | "zdd.refuse.restart", "zdd.wake.not-published", "zdd.sidecar.restart-retrying", "zdd.watch.intro", |
| 48 | "zdd.watch.word-swapped", "zdd.watch.word-installed", "zdd.watch.asleep-tail", |
| 49 | "zdd.watch.word-failed", "zdd.watch.word-held", "zdd.watch.held-tail", "zdd.watch.box", |
| 50 | "zdd.watch.count-swapped", "zdd.watch.count-asleep", "zdd.watch.count-failed", |
| 51 | "zdd.watch.count-held", "zdd.watch.failed-summary", "zdd.watch.hold-down-summary", |
| 52 | "zdd.watch.timeout", "zdd.watch.pending-not-installed", "zdd.watch.pending-other", |
| 53 | "zdd.watch.pending-queued", "zdd.watch.pending-running", "zdd.watch.pending-settling", |
| 54 | "zdd.watch.pending-waiting", "zdd.watch.pending-dark", "zdd.watch.box-busy", |
| 55 | "zdd.watch.pending-unlisted", "zdd.watch.pending-unread", "zdd.watch.list-failed", |
| 56 | "zdd.docs.apps-set", "zdd.docs.deploy-watch", "zdd.docs.deploy-watch-lead", |
| 57 | "zdd.docs.deploy-swap-and-retry", "zdd.docs.migrations", "zdd.docs.instances", |
| 58 | "zdd.docs.sidecars", |
| 59 | } |
| 60 | |
| 61 | // zddCopyFragments are entries shorter than shortCopyBytes that sit inside a |
| 62 | // longer literal. |
| 63 | var zddCopyFragments = map[string]bool{"zdd.ship.usage-flag": true, "zdd.deploy.usage-flag": true} |
| 64 | |
| 65 | // Every string Paul approved in the zero-downtime plan 6 copy review is |
| 66 | // present, byte for byte, in the file the record names. |
| 67 | func TestZeroDowntimeCopyIsApplied(t *testing.T) { |
| 68 | raw, err := os.ReadFile("docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json") |
| 69 | if err != nil { |
| 70 | t.Fatal(err) |
| 71 | } |
| 72 | checkApprovedCopy(t, raw, ".", zddCopyIDs, zddCopyFragments) |
| 73 | } |
| 74 | |
| 75 | // zddReadinessCopyIDs is the flag-readiness copy inventory: the three |
| 76 | // no-signing-key retry strings Paul approved unchanged on 2026-10-12. |
| 77 | var zddReadinessCopyIDs = []string{ |
| 78 | "zdd-readiness.retry-no-key.api", |
| 79 | "zdd-readiness.retry-no-key.browser-title", |
| 80 | "zdd-readiness.retry-no-key.browser-body", |
| 81 | } |
| 82 | |
| 83 | // Every string Paul approved in the flag-readiness copy review is present, |
| 84 | // byte for byte, in the file the record names. |
| 85 | func TestZeroDowntimeReadinessCopyIsApplied(t *testing.T) { |
| 86 | raw, err := os.ReadFile("docs/superpowers/plans/2026-10-11-zero-downtime-flag-readiness-copy.json") |
| 87 | if err != nil { |
| 88 | t.Fatal(err) |
| 89 | } |
| 90 | checkApprovedCopy(t, raw, ".", zddReadinessCopyIDs, nil) |
| 91 | } |
| 92 | |
| 93 | // zddReadiness2CopyIDs is the flag-readiness round 2 copy inventory: the |
| 94 | // seven declined-box and old-box strings Paul approved unchanged on |
| 95 | // 2026-10-13. |
| 96 | var zddReadiness2CopyIDs = []string{ |
| 97 | "zdd-readiness2.hold-declined", |
| 98 | "zdd-readiness2.hold-declined-down", |
| 99 | "zdd-readiness2.retry-line-declined", |
| 100 | "zdd-readiness2.retry-unsupported.api", |
| 101 | "zdd-readiness2.retry-unsupported.browser", |
| 102 | "zdd-readiness2.retry-unsaved.api", |
| 103 | "zdd-readiness2.retry-unsaved.browser", |
| 104 | } |
| 105 | |
| 106 | // Every string Paul approved in the flag-readiness round 2 copy review is |
| 107 | // present, byte for byte, in the file the record names. |
| 108 | func TestZeroDowntimeReadiness2CopyIsApplied(t *testing.T) { |
| 109 | raw, err := os.ReadFile("docs/superpowers/plans/2026-10-12-zero-downtime-flag-readiness-2-copy.json") |
| 110 | if err != nil { |
| 111 | t.Fatal(err) |
| 112 | } |
| 113 | checkApprovedCopy(t, raw, ".", zddReadiness2CopyIDs, nil) |
| 114 | } |
| 115 | |