carlos / platform Public

review brief: cert-warm-propagation-443, round 1 of 3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 17349ef79a311d9f01113b0e40590a8d92fcd8e1 parent d16ebe8
1 file changed, +128 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-cert-warm-443.md +128 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-cert-warm-443.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-cert-warm-443.md
new file mode 100644
index 000000000..d2513278d
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-cert-warm-443.md
@@ -0,0 +1,128 @@
+# Review brief: branch cert-warm-propagation-443 (#443), round 1 of 3
+
+Repo carlos/platform, branch `cert-warm-propagation-443`, commit named in
+the reviewer's prompt.
+Under review: the diff `origin/main..cert-warm-propagation-443`, which is
+`internal/edge/certsettle.go` (new), `internal/edge/certsync.go`
+(`issuerHostPolicy`), `internal/edge/certwarm.go` (`pass`, `settling`), the
+tests in `internal/edge/certsettle_test.go`, and the census overlay
+(`internal/provision/testdata/plan14-root-reads-cert-warm-propagation-443.tsv`,
+card `docs/superpowers/notes/census-proposal-cert-warm-propagation-443.md`).
+Authorities: the code on main. The relevant earlier work is merged:
+#386 cert-warm wake (542ad2c), #277 deploymentHost gates, the cert mirror
+(certsync.go) and the home map (homemap.go).
+
+You are an independent reviewer. Read the diff, then the code it touches,
+and check every claim against that code.
+
+## The bug, with the evidence (for context, not for review)
+
+On dev, every new host homed on the issuer box (sophie, ie) failed its
+first order with autocert's "no viable challenge type found", then stayed
+dark for 5 to 12 minutes. Reproduced 2026-10-28 on v0.28.29:
+
+- 07:28:00 sophie (issuer) minted shop-cert-1028-ie.bab.dev.oncarlos.com.
+- 07:28:05-06 dennis (uk, non-issuer) logged `acme/autocert: no token cert`
+ for that name from 13.49.80.41 (AWS eu-north-1) and 54.169.36.6 (AWS
+ ap-southeast-1): Let's Encrypt's remote validators. `*.bab.dev.oncarlos.com`
+ is a geo/latency wildcard, so they resolved to dennis.
+- 07:28:07 dennis still answered `host ... not in registry` for the name;
+ by 07:28:13 it answered `not available here`, i.e. its home map (30 s poll)
+ had learned it.
+- 07:28:09 sophie: `cert warm for ...: no viable challenge type found —
+ retrying in 1h0m0s`.
+
+So the non-issuer's challenge paths (`alpnTokenCert`, `challengeResponse`,
+both bounded by `m.allowed` = `deploymentHost`) refused a name they had
+not polled yet. UK hosts never failed because the issuer learns them from
+its own home map poll, by which time the home box has them.
+
+## Fixed: do not re-argue
+
+- The non-issuer bound (`m.allowed` before any bucket read-through) stays.
+ Relaxing it lets stranger SNI drive bucket reads (#277, PR #180 rule).
+- A fixed window rather than an acknowledgement: no edge publishes what it
+ has learned, and adding that is new per-box bucket traffic (rule: no new
+ per-box polling).
+- The 45 s window lengthens a new host's first certificate in a
+ multi-edge deployment by up to about 45 s. Accepted: `carlos deploy`
+ watches for 2 minutes, and the alternative today is 5 minutes to an hour.
+
+## What to check
+
+1. Completeness. Is every path that places a NEW per-host order on the
+ issuer held? Both the warm (`certWarm.pass` → `getCert`) and an
+ on-demand handshake reach autocert's `GetCertificate`, which runs
+ `HostPolicy` before its cache (x/crypto v0.57.0 autocert.go). Renewal
+ timers do not consult HostPolicy: confirm that cannot produce a first
+ order for a new name. The wildcard manager (DNS-01) is out of scope;
+ confirm it is unaffected.
+2. No regression for names that already have a certificate. A held name is
+ refused by HostPolicy before autocert's cache read. On the issuer,
+ `certMirror.wrapGetCertificate` falls back to the mirror and the local
+ cache: confirm a moved host (new to this box, cert already in the
+ bucket) is still served during the window, and that a box with no
+ mirror (no store) has no home map and so is never held.
+3. The issuer's own live order. `HostPolicy` also gates autocert's
+ `HTTPHandler` (HTTP-01 token serving). Confirm the hold cannot refuse
+ the issuer's own token for an order it placed (an order is only placed
+ once the hold has lifted for that name).
+4. The tracker (`nameAges`). Baseline at construction (`issuerHostPolicyAt`
+ is built in Run after `e.Reload()` and the home map's boot refresh), the
+ failed-boot-refresh case (first read snapshot is a baseline),
+ pointer-change detection (`Edge.Reload` stores a new map pointer,
+ `homeMap.refreshHosts` a new snapshot pointer: is anything ever mutated
+ in place?), pruning of names that leave, a name that returns, and
+ names deploymentHost admits that neither map holds (not held).
+5. `hasPeer`: right test for "more than one edge"? Behaviour with an empty
+ box label.
+6. The warm. In `pass`, a hold must not call `fail` (no 1 h backoff, no
+ failure record), must hand back the order-budget stamp it took, and must
+ bring the next pass back just after the window (`settleWait +
+ warmSettleSlack`). Check `nextAttempt` (set with `c.now()`), `hasNewHost`
+ and the loop's `passDue` handling, and the renewal re-arm path for an
+ already-warmed name that is held (`seen == true`).
+7. Concurrency and cost on the handshake path: `nameAges.mu` is taken on
+ every issuer handshake that reaches autocert, and a rebuild is O(names)
+ under it.
+8. Wire text. `errNameSettling`'s message reaches the wire verbatim through
+ autocert's HTTPHandler; confirm it says nothing diagnostic (see
+ `errNotIssuer`'s comment).
+9. Tests: do `certsettle_test.go`'s tests pin each behaviour above, and
+ would they fail without the change?
+10. Census. Verdict on the re-pinned `internal/edge` envelope per AGENTS.md
+ "Getting a change approved": does the change let root open, run, query
+ or follow anything new from a path or input a tenant, app or box agent
+ can create, write or name, or weaken a check root relies on? (It adds
+ no reads; it adds a refusal.) Say APPROVE or ESCALATE for the envelope.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the section or task, the problem,
+the evidence (file:line, verified), the failure scenario, a concrete
+fix and the invariant or trust boundary it breaks (that is its fault
+family). Then the census verdict for `internal/edge`. End with exactly one
+verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites. You may run
+`go test ./internal/edge/ -run 'Settle|Settling|HoldsA|DoesNotHold' -count=1`.