carlos / platform Public

transfers plan: fold in Astra round 3 (3 P1, 3 P2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 7b35952b6d6747a9d45ac8e94deaa68ba81d5274 parent 2d1b31d
1 file changed, +75 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-domain-transfers-plan-R3.md +75 −0

CI cancelled — superseded by a newer push — run details

CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
  tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
  tofu: downloaded, digest verified
  aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
  aws: downloaded, digest verified
  archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
  archive: downloaded, digest verified
  installed in /tmp/carlos-opentofu-N8rmfX
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading github.com/benbjohnson/litestream v0.5.14
go: downloading github.com/superfly/ltx v0.5.1
go: downloading modernc.org/sqlite v1.55.0
go: downloading golang.org/x/net v0.62.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1
go: downloading golang.org/x/sys v0.49.0
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/klauspost/compress v1.20.2
go: downloading golang.org/x/text v0.43.0
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading github.com/lmittmann/tint v1.1.3
go: downloading golang.org/x/sync v0.24.0
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading modernc.org/sqlite v1.55.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec

amadan: job cancelled — a newer push superseded it
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-domain-transfers-plan-R3.md b/docs/superpowers/reviews/CODEX-FINDINGS-domain-transfers-plan-R3.md
new file mode 100644
index 000000000..ddb3c2854
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-domain-transfers-plan-R3.md
@@ -0,0 +1,75 @@
+- R2 P1 #1, payment failure — **Partly:** post-capture `requires_payment_method` is handled, but the new mapping also terminates a retryable Checkout payment; finding 3.
+- R2 P1 #2, refund recovery — **Partly:** filtering by attempt fixes selection after a saved transition, but not a crash while starting the replacement attempt; finding 2.
+- R2 P1 #3, unknown registrar outcome — **Resolved:** uncertainty remains live and preserves deletion exclusion and domain uniqueness.
+- R2 P1 #4, empty failure reason — **Resolved:** registrar outcome is stored independently of its optional reason.
+- R2 P2 #5, authorisation deadline — **Resolved:** the provider’s deadline replaces observation time, with a creation-time fallback.
+
+1. **P1 — Task 6: a definite submit refusal is discarded.**
+
+ **Evidence:** [plan:235](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:235) maps an absent post-submit transfer to `rUnknown`; [plan:238](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:238) explicitly makes subsequent reads, not send replies, authoritative. Yet [plan:92](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:92) defines `ErrRefused` as definite, with nothing pending.
+
+ **Failure:** `RequestTransfer` definitively rejects the auth code without creating a transfer record. Every subsequent status read returns `TransferNone`. The engine never reaches `rFailed`, never promptly cancels the authorisation, and blocks another attempt until an operator intervenes. This contradicts the required refusal scenario at [plan:39](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:39).
+
+ **Fix:** persist a documented definite submit refusal as an authoritative registrar fact and feed it into `decideTransfer`. Specify that later absence or read errors cannot erase that fact. Only an ambiguous or lost reply remains unknown. Test refusal followed by perpetual `TransferNone`, including restart.
+
+ **Invariant / fault family:** definite external outcomes must survive reconciliation and drive settlement.
+
+2. **P1 — Task 6: replacement refund recovery loses the current attempt across a crash.**
+
+ **Evidence:** [plan:230](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:230) increments the attempt after failure, but [plan:237](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:237) sends before recording the result. [Plan:235](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:235) lists refunds only when `RefundID` is empty. The existing billing contract explicitly requires prepared writes to be persisted before sending: [billing.go:238](/home/paulca/.cache/tmp/design-domain-transfers/internal/billing/billing.go:238).
+
+ **Failure:** stored refund R0 has failed. The engine sends replacement R1, which succeeds, then crashes before saving its attempt and ID. After restart, the stored ID still selects R0. If Stripe has pruned R1’s idempotency key, resending cannot recover its response; another full refund is refused because the payment is already refunded. R1 is never discovered, and the purchase never terminates. Stripe permits key pruning after 24 hours: [https://docs.stripe.com/api/idempotent_requests](https://docs.stripe.com/api/idempotent_requests).
+
+ **Fix:** atomically persist the next attempt, clear the previous active refund ID, and save the prepared request **before** sending. Recovery must list and reconcile that persisted attempt before resending. Test R0 remaining visible, a lost R1 response, and restart beyond key retention.
+
+ **Invariant / fault family:** I6 and refund settlement require a durable identity for every attempted external mutation.
+
+3. **P1 — Task 6: an ordinary Checkout decline prematurely ends the transfer.**
+
+ **Evidence:** [plan:235](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:235) unconditionally maps `requires_payment_method` to `pFailed`; [plan:226](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:226) makes `rNotSent + pFailed` terminal. The facts contain neither Checkout status nor payment phase. Existing buying instead waits for authorisation or Checkout expiry: [domainbuy.go:630](/home/paulca/.cache/tmp/design-domain-transfers/internal/console/domainbuy.go:630).
+
+ **Failure:** a customer’s first card attempt is declined while Checkout remains open. The next pass marks the transfer failed and clears its auth code. The customer then successfully retries payment in the same Checkout, but terminal purchases are excluded from advancement at [domainbuy.go:602](/home/paulca/.cache/tmp/design-domain-transfers/internal/console/domainbuy.go:602). Their transfer never starts. Stripe explicitly permits payment retries from `requires_payment_method`: [https://docs.stripe.com/payments/paymentintents/lifecycle](https://docs.stripe.com/payments/paymentintents/lifecycle).
+
+ **Fix:** represent the Checkout/payment phase in the facts. A retryable pre-authorisation state must remain awaiting payment; distinguish it from a confirmed failure after capture was attempted. Define Checkout expiry and setup-failure transitions explicitly. Test a decline, an intervening worker pass and restart, then successful authorisation.
+
+ **Invariant / fault family:** payment outcomes must be interpreted in their lifecycle phase before releasing a live purchase.
+
+4. **P2 — Tasks 3 and 6: the declared interfaces omit data their consumers require.**
+
+ **Evidence:** `transferFacts` at [plan:214](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:214) lacks the persisted alert history declared at [plan:173](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:173). `RefundInfo` at [plan:114](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:114) gains attempt metadata, but no purchase metadata.
+
+ **Failure:** the pure function cannot distinguish an already-delivered alert from one due now, despite the once/weekly rules. The refund consumer cannot perform the required purchase-and-attempt filter using the declared return type.
+
+ **Fix:** pass alert history or explicit due-alert facts into `decideTransfer`; expose and parse purchase identity in `RefundInfo`. Test repeat passes and restart after successful alert delivery.
+
+ **Invariant / fault family:** the declared interfaces must carry every fact required by their consumers.
+
+5. **P2 — Task 6: the simulation contract contradicts the table and does not check progress.**
+
+ **Evidence:** I1 at [plan:232](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:232) forbids terminal states with `rNotSent`, while [plan:226](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:226) explicitly requires one. I1–I8 otherwise constrain safety, not eventual settlement.
+
+ **Failure:** a legitimate pre-submit cancellation violates I1. Conversely, the stuck refund in finding 2 can remain live indefinitely without violating any of the listed invariants.
+
+ **Fix:** permit proven pre-submit termination in I1. Add progress assertions: after providers give stable definitive outcomes and injected failures stop, the engine must settle within bounded passes; unresolved obligations must produce their required alerts. Generate valid provider transitions, with lost and stale observations separately.
+
+ **Invariant / fault family:** simulation assertions must check both safe transitions and eventual progress.
+
+6. **P2 — Task 6: the operator-resolution gate names different authority policies.**
+
+ **Evidence:** [plan:239](/home/paulca/.cache/tmp/design-domain-transfers/docs/superpowers/plans/2026-11-21-domain-registration-transfers-in.md:239) says both “system-operator doors” and “the gate the billing operator pages use.” Billing pages use `operatorOnly` and database `IsOperator`: [opbilling.go:456](/home/paulca/.cache/tmp/design-domain-transfers/internal/console/opbilling.go:456), [server.go:3978](/home/paulca/.cache/tmp/design-domain-transfers/internal/console/server.go:3978). `apiSystemOperator` checks the store-operator list: [apisystem.go:49](/home/paulca/.cache/tmp/design-domain-transfers/internal/console/apisystem.go:49). `apiSystemRoller` admits ops-account owners or configured system operators: [apisystemupdate.go:144](/home/paulca/.cache/tmp/design-domain-transfers/internal/console/apisystemupdate.go:144).
+
+ **Failure:** builders can reasonably choose different principals to grant authority over transfer settlement.
+
+ **Fix:** name the exact authorisation predicate and API authentication mechanism; test each relevant operator category, an ordinary account owner and a service principal.
+
+ **Invariant / fault family:** settlement authority must have one explicit, testable boundary.
+
+No P3 findings.
+
+Openprovider documents `/v1` endpoints and the transfer operation; its documented `REQ`, `ACT` and `FAI` states support the proposed neutral mapping. The API version is not a blocker. [https://developer.openprovider.com/rest-api-documentation.html](https://developer.openprovider.com/rest-api-documentation.html), [https://docs.openprovider.com/](https://docs.openprovider.com/)
+
+The three P1s share an incomplete contract for retaining and interpreting facts around `decideTransfer`. Upfront eligibility refusals cannot eliminate crashes or retryable payment outcomes. Cutting transfers would remove these paths; narrowing the TLD list would not. The approved single-function approach can accommodate the fixes above.
+
+Reviewed commit `2d1b31d01e17bc04feb2ab6092aedc8ce7c80d03`, round 3 of 3. No files changed, subagents spawned, or test suites run.
+
+NOT READY
\ No newline at end of file