| new file mode 100644 |
| index 000000000..a36fde8d4 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/cert-import-1429/ASTRA-FINDINGS-R3.md |
| @@ -0,0 +1,96 @@ |
| +- **Astra R2 P1-1 — Partly resolved:** fresh-read CAS attempts protect successor imports; failed withdrawal still breaks the stated invariant. |
| +- **Astra R2 P1-2 — Resolved:** cleanup reads the claim afresh and preserves an import when that read fails. |
| +- **Astra R2 P1-3 — Resolved:** the generic sweep skips imports; expiry cleanup uses conditional deletion. |
| +- **Astra R2 P1-4 — Partly resolved:** the inner-mirror selection bug is fixed; the outer wildcard wrapper can still bypass compatible-certificate selection. |
| +- **Fable R2 P2-1 — Resolved:** unread claims are no longer sufficient authority to delete. |
| +- **Fable R2 P2-2 — Resolved:** the spec identifies the hub’s fleet-forward role, and the host test covers early publication through it. |
| + |
| +Reviewed `8c5bdfd48d1916c5588a7edf2beabfc55e26c4c5`, spec rev 3, and the branch diff against `ce9fb958`. |
| + |
| +1. **P1 — Invariant 2 / handshake composition: a wildcard can bypass the selector.** |
| + |
| + **Problem and evidence:** The import wrapper is installed at [edge.go:5173](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/edge.go:5173), then wrapped by the wildcard selector at line 5183. That outer wrapper returns its certificate without checking `SupportsCertificate` at [wildcard.go:1113](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/wildcard.go:1113). The import gate does not exclude exact names covered by configured or delegated wildcard parents. |
| + |
| + **Failure scenario:** An exact custom name has a usable RSA import and is also covered by a CARLOS ECDSA wildcard. An RSA-only client receives the wildcard and fails TLS despite the compatible import. The randomized selector test never exercises this outer wrapper; the claimed whole-chain regression test also omits it. |
| + |
| + **Fix:** Include wildcard candidates in the compatibility decision for imported names, preserving the existing path for names without imports. Alternatively, explicitly refuse this overlap and prevent wildcard configuration from introducing it later. |
| + |
| + **Fault family:** Certificate selection must preserve the client coverage provided by the import—the recurring R1/R2 family. |
| + |
| +2. **P2 — Invariant 1 / failure handling: withdrawal is best-effort, but the invariant and simulation assume success.** |
| + |
| + **Problem and evidence:** After publishing, `WriteImport` confirms and withdraws using the same context at [certimport_invariant.go:138](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/domains/certimport_invariant.go:138). It neither checks conditional-delete support before writing nor preserves recovery state when withdrawal fails. The simulation’s [DeleteIfMatch:109](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/domains/certimport_sim_test.go:109) injects no storage failure and ignores context cancellation. |
| + |
| + **Failure scenario:** A claim changes after the writer’s authorization read. The write succeeds, confirmation fails or observes the change, and withdrawal fails because the request was cancelled, storage failed, or conditional deletion is unsupported. The function returns with its nonmatching entry still present—the exact condition S2 claims to exclude. Moreover, the joined withdrawal error matches `ErrImportNoClaim`, so [apidomaincert.go:392](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/console/apidomaincert.go:392) returns 404 before logging the cleanup failure. |
| + |
| + **Fix:** Refuse unsupported stores before publication; give cleanup a separate bounded context; expose failed cleanup and define its recovery. Extend the simulation with cancellation and failed mutations, and reconcile the unconditional spec claim with that recovery behavior. |
| + |
| + **Fault family:** Acquisition-bound authority must survive failed or interrupted writes. |
| + |
| +3. **P2 — Early publication / census: the file checks do not establish the declared guarantees.** |
| + |
| + **Problem and evidence:** [importBoundTo:23](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/host/edgesfile_import.go:23) checks usability through one read, then performs another. Its `SameFile` comparison covers only the second `Lstat`/open pair; it never compares that file with the first read. The second parse checks account/app alone and reads up to **1 MiB**, despite the census basis claiming 64 KiB. |
| + |
| + Separately, [UsableImportedCert:133](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/domains/certimport.go:133) uses `Lstat` followed by ordinary `Open`, allowing a symlink or FIFO swap. [reconcileLocalImport:206](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/certimport.go:206) calls `local.Get` even after discovering a nonregular file; production `autocert.DirCache.Get` follows symlinks. |
| + |
| + **Failure scenario:** Replacing the file between the two publication reads can combine usability from one entry with app binding from another, including an expired or wrong-host replacement. A symlink/FIFO can also be followed or opened despite the recorded refusal guarantees. Production runs this agent as `carlos`; I am not asserting a demonstrated root privilege escalation. |
| + |
| + **Fix:** Open one bounded, no-follow regular-file descriptor and validate hostname, dates, account, and app from those same bytes. Avoid reading nonregular local-cache entries before replacing them. Update the census basis to match the implemented checks. |
| + |
| + **Fault family:** Publication authority must come from one validated cache entry. |
| + |
| +4. **P2 — Reconcile scheduling: five persistent failures can starve every later name.** |
| + |
| + **Problem and evidence:** [certimport.go:342](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/certimport.go:342) sorts names on every pass, starts at the beginning, and spends the five-call budget on attempts, including failures. Only successful deletions receive a skip memo. |
| + |
| + **Failure scenario:** The first five suspect names have persistently unreadable claims or failed deletes. Every pass retries those five; a sixth detached or long-expired import is never examined even when its storage operations would succeed. The simulation has one hostname and does not exercise this scheduler. |
| + |
| + **Fix:** Rotate the starting position or retain a cursor across passes, preserving the five-call limit. Test persistent failures ahead of a deletable name. |
| + |
| + **Fault family:** Cleanup failures for one hostname must not prevent cleanup of unrelated names. |
| + |
| +5. **P2 — Removal documentation: the published timing contradicts the spec.** |
| + |
| + **Problem and evidence:** [cli.md:2030](/home/paulca/amadan.net/carlos/platform-cert-import-1429/docs/site/cli.md:2030) promises removal within a minute. The remove section says “usually within seconds” but omits the 30-minute backstop explicitly required by [spec:247](/home/paulca/amadan.net/carlos/platform-cert-import-1429/docs/superpowers/specs/2026-11-25-cert-import-1429-design.md:247). |
| + |
| + **Failure scenario:** An operator removing a compromised key reasonably assumes withdrawal has completed while mirrors still serve it. The five-attempt queue also prevents a one-minute detach guarantee. |
| + |
| + **Fix:** Document cleanup cadence separately from propagation, include the backstop, and explain that storage failures can extend withdrawal. |
| + |
| + **Fault family:** Documented withdrawal guarantees must match observed state. |
| + |
| +No P3 findings. |
| + |
| +The census verdicts concern the submitted dispositions and their stated bases: |
| + |
| +| Unit or envelope | Verdict | Basis | |
| +|---|---|---| |
| +| [`certMirror.backfill`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/certsync.go:1346) | APPROVED | Imports are excluded; existing read authority is unchanged. | |
| +| [`RunWithActivatorReady`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/edge.go:5167) | APPROVED | No new root reader; functional selection defect is finding 1. | |
| +| [`edgesFileWriteClaims`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/host/edgesfile.go:887) | REJECTED | Its new publication basis depends on checks not established by `importBoundTo`. | |
| +| [`readCertFile`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/domains_cert_cli.go:95) | APPROVED | Bounded operator-selected CLI input; no root authority. | |
| +| [`UsableImportedCert`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/domains/certimport.go:128) | REJECTED | The stated no-symlink guarantee is not enforced across open. | |
| +| [`certMirror.pruneLocalImports`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/certimport.go:171) | APPROVED | Removes regular import-cache entries absent from a successful listing. | |
| +| [`certMirror.reconcileLocalImport`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/certimport.go:203) | REJECTED | Its basis says no symlink is followed; `local.Get` does follow one. | |
| +| [`importBoundTo`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/host/edgesfile_import.go:22) | REJECTED | Neither same-entry validation nor the recorded 64-KiB bound holds. | |
| +| Envelope `.` | APPROVED | CLI registration, bounded reads, and API calls introduce no root authority. | |
| +| Envelope `internal/domains` | REJECTED | `UsableImportedCert` basis is unproven. | |
| +| Envelope `internal/edge` | REJECTED | `reconcileLocalImport` contradicts its recorded basis. | |
| +| Envelope `internal/host` | REJECTED | Early-publication validation is incomplete. | |
| + |
| +Record-write census verdicts: |
| + |
| +| Entry | Verdict | |
| +|---|---| |
| +| [`routeDecls`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/console/routedecls.go:909) | APPROVED: existing key-site classification retained; person-only, host-claim-gated routes. | |
| +| [`linkedPolicies`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/console/linkedpolicy.go:92) | APPROVED: existing key-site classification retained; linked credentials refused. | |
| +| [`WriteImport`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/domains/certimport_invariant.go:130) | APPROVED as `nonrecord`: writes only the import object; finding 2 remains. | |
| +| [`reconcileLocalImport`](/home/paulca/amadan.net/carlos/platform-cert-import-1429/internal/edge/certimport.go:217) | APPROVED as `nonrecord`: writes the certificate cache, not provision records; its read-census rejection remains. | |
| + |
| +**Overall census verdict: REJECTED.** |
| + |
| +Domains import tests, the socket-free edge subset—including the randomized selector—and console validation tests passed. Broader edge/console selections were blocked by sandbox socket restrictions. No full suites, census tests, or subagents were run. Tracked files are unchanged; test-generated `go.mod` normalization was restored. |
| + |
| +Round 3 is exhausted. The sole P1 belongs to the recurring client-coverage family. Refusing and preventing wildcard/import overlap would remove that case; cutting imported-certificate support would also remove it. Further work on that family needs Paul’s scope decision, not an automatic fourth round. |
| + |
| +**NOT READY** |
| \ No newline at end of file |