Merge origin/main into gvisor-slice1-control-purge
Take main's census chain and re-propose this branch's overlay last. No behaviour change.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
27 files changed,
+1,944
−172
.amadan/code-health.tsv+1 −1account_choose.go+1 −0apimode.go+0 −46approved_domains_buy_copy_test.go+42 −12cli_spinner.go+128 −0cli_spinner_test.go+135 −0console_moved.go+56 −0docs/superpowers/notes/census-proposal-cli-contact-prompts.md+11 −0docs/superpowers/notes/census-proposal-gvisor-slice1-control-purge.md+1 −1docs/superpowers/specs/LUNA-COPY-BRIEF-CONTACT-PROMPTS.md+87 −0docs/superpowers/specs/LUNA-COPY-RESULT-CONTACT-PROMPTS.md+37 −0domains_account_cli.go+31 −21domains_buy_cli.go+54 −42domains_buy_cli_test.go+2 −2domains_buy_copy.go+58 −12domains_calling_codes.go+84 −0domains_contact_prompt.go+377 −0domains_contact_prompt_test.go+665 −0domains_transfer_cli.go+85 −22internal/console/accountdomainbuy_test.go+1 −0internal/console/accountdomaintransfer_test.go+1 −0internal/console/apidomainbuy.go+5 −2internal/console/apidomainbuy_test.go+21 −0internal/console/contact_autocomplete_test.go+46 −0internal/provision/testdata/plan14-root-reads-chain.tsv+2 −1internal/provision/testdata/plan14-root-reads-cli-contact-prompts.tsv+3 −0internal/provision/testdata/plan14-root-reads-gvisor-slice1-control-purge.tsv+10 −10
CI passed — 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-yLhsph
.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 golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.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/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading golang.org/x/sys v0.49.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading golang.org/x/mod v0.41.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading golang.org/x/text v0.43.0
go: downloading modernc.org/sqlite v1.55.0
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 modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.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
=== launchctx (4 s, from +0 s)
ok amadan.net/carlos/platform.git/launchctx 0.015s
? amadan.net/carlos/platform.git/launchctx/controlname [no test files]
? amadan.net/carlos/platform.git/launchctx/wireid [no test files]
=== vet (164 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
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 modernc.org/libc v1.74.1
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
=== vet-tags (175 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
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 modernc.org/libc v1.74.1
go: downloading modernc.org/mathutil v1.7.1
=== gofmt (1 s, from +0 s)
gofmt -l .: clean
=== rest (386 s, from +15 s)
ok github.com/carlosframework/platform/cmd/carlos-media 125.498s
? github.com/carlosframework/platform/cmd/changelog [no test files]
ok github.com/carlosframework/platform/cmd/console 210.242s
ok github.com/carlosframework/platform/cmd/mediaimage 39.140s
ok github.com/carlosframework/platform/cmd/moveprobe 15.444s
ok github.com/carlosframework/platform/cmd/pricebook-export 0.051s
ok github.com/carlosframework/platform/cmd/rootfswitness 0.172s
ok github.com/carlosframework/platform/cmd/runsc-assets 0.153s
ok github.com/carlosframework/platform/cmd/zddprobe 1.005s
ok github.com/carlosframework/platform/internal/agentsock 0.063s
ok github.com/carlosframework/platform/internal/alerting 0.047s
ok github.com/carlosframework/platform/internal/analytics 0.335s
ok github.com/carlosframework/platform/internal/appconfig 41.786s
ok github.com/carlosframework/platform/internal/apperr 0.468s
ok github.com/carlosframework/platform/internal/applog 0.599s
ok github.com/carlosframework/platform/internal/apppolicy 2.638s
ok github.com/carlosframework/platform/internal/assetcache 0.646s
ok github.com/carlosframework/platform/internal/awsinv 0.024s
ok github.com/carlosframework/platform/internal/awsmanaged 11.660s
ok github.com/carlosframework/platform/internal/awsregiongroup 0.184s
ok github.com/carlosframework/platform/internal/awsterminations 0.026s
ok github.com/carlosframework/platform/internal/backupswords 0.010s
ok github.com/carlosframework/platform/internal/billing 0.073s
ok github.com/carlosframework/platform/internal/billing/billingtest 0.073s
ok github.com/carlosframework/platform/internal/billingstripe 1.966s
ok github.com/carlosframework/platform/internal/boxchoice 0.043s
ok github.com/carlosframework/platform/internal/boxid 1.969s
? github.com/carlosframework/platform/internal/boxid/boxidtest [no test files]
? github.com/carlosframework/platform/internal/boxid/internal/signtest [no test files]
ok github.com/carlosframework/platform/internal/boxroles 0.020s
ok github.com/carlosframework/platform/internal/boxself 0.283s
ok github.com/carlosframework/platform/internal/boxvolumes 0.051s
ok github.com/carlosframework/platform/internal/caps 3.545s
ok github.com/carlosframework/platform/internal/certwarm 0.019s
ok github.com/carlosframework/platform/internal/cgroup 1.374s
ok github.com/carlosframework/platform/internal/changelog 3.515s
ok github.com/carlosframework/platform/internal/clamd 0.076s
? github.com/carlosframework/platform/internal/cliflag [no test files]
ok github.com/carlosframework/platform/internal/clireg 0.023s
ok github.com/carlosframework/platform/internal/codehealth 14.957s
ok github.com/carlosframework/platform/internal/compute 0.033s
ok github.com/carlosframework/platform/internal/consolefleet 0.022s
? github.com/carlosframework/platform/internal/controlname [no test files]
? github.com/carlosframework/platform/internal/controlsock [no test files]
ok github.com/carlosframework/platform/internal/dbdoor 11.023s
ok github.com/carlosframework/platform/internal/dbdoor/dbdoortest 0.093s
ok github.com/carlosframework/platform/internal/dbquery 0.027s
ok github.com/carlosframework/platform/internal/dbreads 3.287s
? github.com/carlosframework/platform/internal/dbreads/dbreadstest [no test files]
ok github.com/carlosframework/platform/internal/dbverify 0.034s
ok github.com/carlosframework/platform/internal/demo 0.018s
ok github.com/carlosframework/platform/internal/demobuild 4.752s
ok github.com/carlosframework/platform/internal/democlaim 0.494s
ok github.com/carlosframework/platform/internal/devbox 13.301s
ok github.com/carlosframework/platform/internal/dnsrec 0.010s
ok github.com/carlosframework/platform/internal/docsite 0.118s
ok github.com/carlosframework/platform/internal/domainreg 0.012s
ok github.com/carlosframework/platform/internal/domains 69.619s
ok github.com/carlosframework/platform/internal/doorkey 0.031s
ok github.com/carlosframework/platform/internal/economics 0.011s
ok github.com/carlosframework/platform/internal/edgefence 0.124s
ok github.com/carlosframework/platform/internal/edgeguard 0.241s
? github.com/carlosframework/platform/internal/edgeproof [no test files]
ok github.com/carlosframework/platform/internal/edgesfile 0.120s
ok github.com/carlosframework/platform/internal/egressaddr 0.013s
ok github.com/carlosframework/platform/internal/execsandbox 103.934s
ok github.com/carlosframework/platform/internal/fileacl 0.006s
ok github.com/carlosframework/platform/internal/fleetapi 2.208s
ok github.com/carlosframework/platform/internal/fleetstore 0.008s
ok github.com/carlosframework/platform/internal/fxrate 0.025s
ok github.com/carlosframework/platform/internal/gate 3.964s
ok github.com/carlosframework/platform/internal/genselect 0.170s
ok github.com/carlosframework/platform/internal/geo 0.057s
ok github.com/carlosframework/platform/internal/geoip 0.154s
ok github.com/carlosframework/platform/internal/groupadmission 0.030s
ok github.com/carlosframework/platform/internal/grouprollaws 17.038s
ok github.com/carlosframework/platform/internal/hadeparture 0.035s
ok github.com/carlosframework/platform/internal/hafresh 0.021s
ok github.com/carlosframework/platform/internal/hairpin 0.215s
ok github.com/carlosframework/platform/internal/historyreadback 1.029s
ok github.com/carlosframework/platform/internal/hostactors 19.813s
ok github.com/carlosframework/platform/internal/hostbox 19.830s
ok github.com/carlosframework/platform/internal/hostclaim 2.133s
ok github.com/carlosframework/platform/internal/hostenv 0.039s
ok github.com/carlosframework/platform/internal/hostevidence 0.019s
ok github.com/carlosframework/platform/internal/hostexec 22.674s
ok github.com/carlosframework/platform/internal/hostfence 0.182s
ok github.com/carlosframework/platform/internal/hostfiles 24.086s
ok github.com/carlosframework/platform/internal/hostfloor 0.042s
ok github.com/carlosframework/platform/internal/hostguard 1.497s
ok github.com/carlosframework/platform/internal/hostops 6.440s
? github.com/carlosframework/platform/internal/hostops/fencerelease [no test files]
ok github.com/carlosframework/platform/internal/hostops/internal/fencerelease 0.015s
ok github.com/carlosframework/platform/internal/hostquarantine 0.011s
ok github.com/carlosframework/platform/internal/hostrelocate 1.900s
ok github.com/carlosframework/platform/internal/hostresolve 0.538s
ok github.com/carlosframework/platform/internal/hostwrite 0.031s
ok github.com/carlosframework/platform/internal/infraview 0.015s
ok github.com/carlosframework/platform/internal/ingresshealth 0.017s
ok github.com/carlosframework/platform/internal/ingresshealth/awstg 0.011s
ok github.com/carlosframework/platform/internal/instancectl 65.702s
ok github.com/carlosframework/platform/internal/instanceexec 8.821s
ok github.com/carlosframework/platform/internal/instancefs 13.824s
ok github.com/carlosframework/platform/internal/instancekey 0.010s
ok github.com/carlosframework/platform/internal/instanceupdates 0.037s
ok github.com/carlosframework/platform/internal/interactive 0.613s
ok github.com/carlosframework/platform/internal/launchd 0.004s
ok github.com/carlosframework/platform/internal/layout 20.322s
ok github.com/carlosframework/platform/internal/layout/pubclass 101.111s
ok github.com/carlosframework/platform/internal/lbhealth 0.009s
ok github.com/carlosframework/platform/internal/lease 144.295s
ok github.com/carlosframework/platform/internal/lease/leasetest 1.159s
ok github.com/carlosframework/platform/internal/lease/locktest 0.022s
ok github.com/carlosframework/platform/internal/ledger 0.043s
ok github.com/carlosframework/platform/internal/mail 1.078s
ok github.com/carlosframework/platform/internal/mailer 0.747s
ok github.com/carlosframework/platform/internal/mailsubmit 0.993s
ok github.com/carlosframework/platform/internal/mailwire 0.008s
ok github.com/carlosframework/platform/internal/maintenance 0.173s
ok github.com/carlosframework/platform/internal/maintenanceexec 8.403s
ok github.com/carlosframework/platform/internal/maintenanceguard 0.380s
ok github.com/carlosframework/platform/internal/managedboot 3.449s
? github.com/carlosframework/platform/internal/managedboot/boottest [no test files]
? github.com/carlosframework/platform/internal/managedboot/roottest [no test files]
ok github.com/carlosframework/platform/internal/media 1.773s
ok github.com/carlosframework/platform/internal/media/mediatest 0.015s
ok github.com/carlosframework/platform/internal/mediaaws 59.224s
ok github.com/carlosframework/platform/internal/mediahandler 40.813s
ok github.com/carlosframework/platform/internal/mediajobs 1.060s
ok github.com/carlosframework/platform/internal/medialocal 9.882s
ok github.com/carlosframework/platform/internal/metrics 0.168s
ok github.com/carlosframework/platform/internal/minorunits 0.016s
ok github.com/carlosframework/platform/internal/moves 53.261s
ok github.com/carlosframework/platform/internal/moves/archive 2.406s
ok github.com/carlosframework/platform/internal/moves/offlinerun 0.092s
ok github.com/carlosframework/platform/internal/namedunits 0.080s
ok github.com/carlosframework/platform/internal/objstore 1.921s
ok github.com/carlosframework/platform/internal/ops 12.501s
ok github.com/carlosframework/platform/internal/pageindex 3.836s
ok github.com/carlosframework/platform/internal/parity 0.123s
? github.com/carlosframework/platform/internal/parity/cmd/parity-doc [no test files]
ok github.com/carlosframework/platform/internal/park 0.635s
ok github.com/carlosframework/platform/internal/perf 0.172s
ok github.com/carlosframework/platform/internal/plans 0.104s
ok github.com/carlosframework/platform/internal/privatefile 0.013s
ok github.com/carlosframework/platform/internal/provision 239.278s
ok github.com/carlosframework/platform/internal/proxyproto 0.960s
ok github.com/carlosframework/platform/internal/publicrelease 0.061s
ok github.com/carlosframework/platform/internal/ratelimit 0.258s
ok github.com/carlosframework/platform/internal/regionlabel 0.067s
ok github.com/carlosframework/platform/internal/regionname 0.036s
ok github.com/carlosframework/platform/internal/registrar 0.019s
ok github.com/carlosframework/platform/internal/registrar/openprovider 0.672s
? github.com/carlosframework/platform/internal/registrar/registrartest [no test files]
ok github.com/carlosframework/platform/internal/registry 84.198s
ok github.com/carlosframework/platform/internal/relay 7.640s
ok github.com/carlosframework/platform/internal/release 98.196s
ok github.com/carlosframework/platform/internal/replicagen 0.025s
ok github.com/carlosframework/platform/internal/replicas 0.087s
ok github.com/carlosframework/platform/internal/reqrec 8.505s
ok github.com/carlosframework/platform/internal/rollout 11.194s
ok github.com/carlosframework/platform/internal/rolloutwords 0.091s
ok github.com/carlosframework/platform/internal/rootaws 97.362s
ok github.com/carlosframework/platform/internal/rootfsimage 1.192s
ok github.com/carlosframework/platform/internal/rootparticipation 0.097s
ok github.com/carlosframework/platform/internal/rootstate 0.051s
ok github.com/carlosframework/platform/internal/runs 0.788s
ok github.com/carlosframework/platform/internal/s3compat 0.030s
ok github.com/carlosframework/platform/internal/s3fake 1.097s
ok github.com/carlosframework/platform/internal/safefile 0.037s
ok github.com/carlosframework/platform/internal/schedule 21.938s
ok github.com/carlosframework/platform/internal/seeds 0.037s
ok github.com/carlosframework/platform/internal/sim/litestreamfacts 4.898s
ok github.com/carlosframework/platform/internal/sim/mediajobs 50.416s
ok github.com/carlosframework/platform/internal/sim/regionha 22.637s
ok github.com/carlosframework/platform/internal/status 0.464s
ok github.com/carlosframework/platform/internal/steering 0.213s
ok github.com/carlosframework/platform/internal/stopevidence 0.454s
ok github.com/carlosframework/platform/internal/storecfg 0.540s
ok github.com/carlosframework/platform/internal/svcrole 0.029s
ok github.com/carlosframework/platform/internal/systemd 5.512s
? github.com/carlosframework/platform/internal/systemdshow [no test files]
ok github.com/carlosframework/platform/internal/team 3.409s
ok github.com/carlosframework/platform/internal/teamcontract 0.317s
ok github.com/carlosframework/platform/internal/telemetry 0.028s
ok github.com/carlosframework/platform/internal/termfence 2.643s
ok github.com/carlosframework/platform/internal/timerspec 0.027s
ok github.com/carlosframework/platform/internal/tsidentity 4.165s
ok github.com/carlosframework/platform/internal/tunnelclient 0.368s
ok github.com/carlosframework/platform/internal/unixdial 0.010s
ok github.com/carlosframework/platform/internal/updatewords 0.029s
ok github.com/carlosframework/platform/internal/upstreamguard 0.011s
? github.com/carlosframework/platform/internal/upstreamguard/guardtest [no test files]
ok github.com/carlosframework/platform/internal/usage 0.024s
ok github.com/carlosframework/platform/internal/version 0.012s
ok github.com/carlosframework/platform/internal/vet 3.088s
ok github.com/carlosframework/platform/internal/zonehost 0.017s
ok github.com/carlosframework/platform/internal/zonehost/route53zones 0.083s
? github.com/carlosframework/platform/internal/zonehost/zonehosttest [no test files]
? github.com/carlosframework/platform/scripts/gitleaks-gate [no test files]
ok github.com/carlosframework/platform/scripts/govulncheck-gate 0.021s
ok github.com/carlosframework/platform/scripts/pathmapcheck 0.070s
ok github.com/carlosframework/platform/scripts/region-ha-g2/fixture 5.229s
ok github.com/carlosframework/platform/scripts/stateless-replicas-drill 1.205s
ok github.com/carlosframework/platform/scripts/witness-pointer 0.013s
=== cutover-witness (152 s, from +15 s)
ok github.com/carlosframework/platform 2.681s
=== internal_grouproll@0 (269 s, from +73 s)
ok github.com/carlosframework/platform/internal/grouproll 267.844s
=== internal_grouproll@1 (278 s, from +73 s)
ok github.com/carlosframework/platform/internal/grouproll 276.988s
=== internal_activator@0 (154 s, from +145 s)
ok github.com/carlosframework/platform/internal/activator 149.858s
=== internal_activator@1 (138 s, from +145 s)
ok github.com/carlosframework/platform/internal/activator 132.740s
=== internal_activator@2 (136 s, from +145 s)
ok github.com/carlosframework/platform/internal/activator 131.129s
=== internal_activator@3 (163 s, from +145 s)
ok github.com/carlosframework/platform/internal/activator 157.693s
=== internal_edge@0 (258 s, from +169 s)
ok github.com/carlosframework/platform/internal/edge 252.211s
=== internal_edge@1 (136 s, from +169 s)
ok github.com/carlosframework/platform/internal/edge 128.358s
=== internal_edge@2 (154 s, from +169 s)
ok github.com/carlosframework/platform/internal/edge 146.206s
=== internal_edge@3 (159 s, from +169 s)
ok github.com/carlosframework/platform/internal/edge 150.752s
=== root@0 (118 s, from +170 s)
ok github.com/carlosframework/platform 110.210s
=== root@1 (112 s, from +170 s)
ok github.com/carlosframework/platform 103.985s
=== root@2 (126 s, from +170 s)
ok github.com/carlosframework/platform 116.047s
=== root@3 (120 s, from +170 s)
ok github.com/carlosframework/platform 111.614s
=== root@4 (104 s, from +170 s)
ok github.com/carlosframework/platform 96.774s
=== internal_host@0 (183 s, from +215 s)
ok github.com/carlosframework/platform/internal/host 176.899s
=== internal_host@1 (145 s, from +215 s)
ok github.com/carlosframework/platform/internal/host 139.101s
=== internal_host@2 (203 s, from +215 s)
ok github.com/carlosframework/platform/internal/host 196.896s
=== internal_host@3 (234 s, from +215 s)
ok github.com/carlosframework/platform/internal/host 228.431s
=== internal_host@4 (263 s, from +215 s)
ok github.com/carlosframework/platform/internal/host 256.882s
=== internal_host@5 (165 s, from +215 s)
ok github.com/carlosframework/platform/internal/host 159.048s
=== internal_console@0 (161 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 153.905s
=== internal_console@1 (174 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 167.381s
=== internal_console@2 (208 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 201.677s
=== internal_console@3 (248 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 239.949s
=== internal_console@4 (202 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 193.720s
=== internal_console@5 (228 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 220.403s
=== internal_console@6 (210 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 202.185s
=== internal_console@7 (215 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 207.772s
=== internal_console@8 (231 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 224.076s
=== internal_console@9 (216 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 209.707s
=== internal_console@10 (219 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 212.109s
=== internal_console@11 (245 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 238.488s
=== internal_console@12 (288 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 280.055s
=== internal_console@13 (250 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 243.313s
=== internal_console@14 (241 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 234.100s
=== internal_console@15 (228 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 220.129s
=== internal_console@16 (261 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 253.118s
=== internal_console@17 (208 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 201.373s
=== internal_console@18 (210 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 201.725s
=== internal_console@19 (208 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 200.071s
=== internal_console@20 (217 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 210.038s
=== internal_console@21 (237 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 229.313s
=== internal_console@22 (221 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 212.532s
=== internal_console@23 (228 s, from +219 s)
ok github.com/carlosframework/platform/internal/console 219.856s
=== lists: internal_console 218 s, internal_edge 167 s, internal_activator 144 s, internal_host 214 s, root 167 s, internal_grouproll 72 s
=== cpu: the gate used 12805 cpu-seconds in 507 s, about 25.3 of 32 cores; the machine as a whole was 84% busy
=== opentofu ===
opentofu: 39 test files in 11 suites, OpenTofu v1.13.9
initialised in 15 s
ok 18 s infra/modules/box-fence-writer/tests/writer.tftest.hcl Success! 1 passed, 0 failed.
ok 21 s infra/modules/deployment-buckets/tests/console_floors.tftest.hcl Success! 1 passed, 0 failed.
ok 31 s infra/modules/deployment-buckets/tests/data_lifecycle.tftest.hcl Success! 3 passed, 0 failed.
ok 21 s infra/modules/deployment-buckets/tests/db_reads.tftest.hcl Success! 1 passed, 0 failed.
ok 22 s infra/modules/deployment-buckets/tests/evidence.tftest.hcl Success! 1 passed, 0 failed.
ok 27 s infra/modules/deployment-buckets/tests/fence_writers.tftest.hcl Success! 3 passed, 0 failed.
ok 25 s infra/modules/deployment-buckets/tests/media_results.tftest.hcl Success! 2 passed, 0 failed.
ok 89 s infra/modules/media-engine/tests/media_engine.tftest.hcl Success! 24 passed, 0 failed.
ok 27 s infra/modules/pdf-host/tests/computed.tftest.hcl Success! 2 passed, 0 failed.
ok 56 s infra/modules/pdf-host/tests/pdf_host.tftest.hcl Success! 24 passed, 0 failed.
ok 40 s infra/modules/region-group-operator-document/tests/document.tftest.hcl Success! 12 passed, 0 failed.
ok 19 s infra/modules/region-host/ingress/tests/fixed-targets/tests/targets.tftest.hcl Success! 2 passed, 0 failed.
ok 67 s infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl Success! 30 passed, 0 failed.
ok 46 s infra/modules/region-host/tests/alert_publish.tftest.hcl Success! 18 passed, 0 failed.
ok 41 s infra/modules/region-host/tests/alerts_topic.tftest.hcl Success! 16 passed, 0 failed.
ok 12 s infra/modules/region-host/tests/analytics_prune.tftest.hcl Success! 2 passed, 0 failed.
ok 13 s infra/modules/region-host/tests/console_mail.tftest.hcl Success! 4 passed, 0 failed.
ok 6 s infra/modules/region-host/tests/fixed_state_unchanged.tftest.hcl Success! 1 passed, 0 failed.
ok 69 s infra/modules/region-host/tests/group.tftest.hcl Success! 32 passed, 0 failed.
ok 10 s infra/modules/region-host/tests/group_alarms.tftest.hcl Success! 4 passed, 0 failed.
ok 11 s infra/modules/region-host/tests/group_iam.tftest.hcl Success! 4 passed, 0 failed.
ok 6 s infra/modules/region-host/tests/group_isolation.tftest.hcl Success! 1 passed, 0 failed.
ok 34 s infra/modules/region-host/tests/group_operator.tftest.hcl Success! 13 passed, 0 failed.
ok 9 s infra/modules/region-host/tests/group_user_data.tftest.hcl Success! 3 passed, 0 failed.
ok 28 s infra/modules/region-host/tests/health_alarms.tftest.hcl Success! 10 passed, 0 failed.
ok 16 s infra/modules/region-host/tests/ingress_drain_read.tftest.hcl Success! 4 passed, 0 failed.
ok 8 s infra/modules/region-host/tests/instance_metadata.tftest.hcl Success! 1 passed, 0 failed.
ok 22 s infra/modules/region-host/tests/mailer.tftest.hcl Success! 6 passed, 0 failed.
ok 11 s infra/modules/region-host/tests/mailer_group.tftest.hcl Success! 2 passed, 0 failed.
ok 12 s infra/modules/region-host/tests/managed_fleets/group_refusal.tftest.hcl Success! 2 passed, 0 failed.
ok 101 s infra/modules/region-host/tests/managed_fleets/managed_fleets.tftest.hcl Success! 46 passed, 0 failed.
ok 66 s infra/modules/region-host/tests/store_conversion.tftest.hcl Success! 27 passed, 0 failed.
ok 13 s infra/modules/region-host/tests/store_scanning.tftest.hcl Success! 4 passed, 0 failed.
ok 27 s infra/modules/region-host/tests/store_versioning.tftest.hcl Success! 11 passed, 0 failed.
ok 14 s infra/modules/region-host/tests/store_write_credentials.tftest.hcl Success! 4 passed, 0 failed.
ok 16 s infra/modules/region-host/tests/user_data_ignored.tftest.hcl Success! 3 passed, 0 failed.
ok 12 s infra/modules/region-remote-host/tests/data_lifecycle.tftest.hcl Success! 3 passed, 0 failed.
ok 17 s infra/modules/region-remote-host/tests/no_deployment_bucket.tftest.hcl Success! 5 passed, 0 failed.
ok 25 s infra/modules/scanner-host/tests/scanner_host.tftest.hcl Success! 14 passed, 0 failed.
opentofu: 39 files in 208 s
opentofu: PASS
=== cross ===
--- shard 0 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling darwin/arm64
--- shard 1 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling darwin/amd64
--- shard 2 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling linux/arm64
linux/arm64 carlos binary: 66519202 bytes (ceiling 70000000)
--- shard 3 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling windows/amd64
--- shard 4 of 5 ---
go version go1.26.10 linux/arm64
cross-compiling windows/arm64
=== minio-contract ===
go version go1.26.10 linux/arm64
minio contract: arm64, minio RELEASE.2025-09-07T16-13-09Z, mc RELEASE.2025-08-13T08-35-41Z
minio: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/minio/minio.linux-arm64.RELEASE.2025-09-07T16-13-09Z
minio: downloaded, digest verified
mc: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/minio/mc.linux-arm64.RELEASE.2025-08-13T08-35-41Z
mc: downloaded, digest verified
minio healthy on 127.0.0.1:35589
Added `local` successfully.
Bucket created successfully `local/contract-bucket`.
Bucket created successfully `local/denied-bucket`.
Created policy `contract-only` successfully.
Added user `scopeduser` successfully.
Attached Policies: [contract-only]
To User: scopeduser
buckets and scoped user ready
=== RUN TestDeliveredContractMinio
=== RUN TestDeliveredContractMinio/put
=== RUN TestDeliveredContractMinio/get_round-trips_the_body
=== RUN TestDeliveredContractMinio/list_shows_the_key
=== RUN TestDeliveredContractMinio/head_and_list_agree_on_the_version
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_its_own_object
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/not_by_PutObjectTagging
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/and_not_by_x-amz-tagging_on_upload
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CreateMultipartUpload
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CopyObject_with_a_REPLACE_tagging_directive
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/but_multipart_itself_is_allowed
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_copy_itself_is_allowed
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/a_POST-policy_forged_tag_with_a_matching_version_is_still_not_a_verdict
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_an_ordinary_tagged-with-something-else_upload_is_allowed
=== RUN TestDeliveredContractMinio/delete_removes_it
=== RUN TestDeliveredContractMinio/cross-bucket_denial
--- PASS: TestDeliveredContractMinio (0.03s)
--- PASS: TestDeliveredContractMinio/put (0.00s)
--- PASS: TestDeliveredContractMinio/get_round-trips_the_body (0.00s)
--- PASS: TestDeliveredContractMinio/list_shows_the_key (0.00s)
--- PASS: TestDeliveredContractMinio/head_and_list_agree_on_the_version (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/not_by_PutObjectTagging (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/and_not_by_x-amz-tagging_on_upload (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route (0.02s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CreateMultipartUpload (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CopyObject_with_a_REPLACE_tagging_directive (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/but_multipart_itself_is_allowed (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_copy_itself_is_allowed (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/a_POST-policy_forged_tag_with_a_matching_version_is_still_not_a_verdict (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_an_ordinary_tagged-with-something-else_upload_is_allowed (0.00s)
--- PASS: TestDeliveredContractMinio/delete_removes_it (0.00s)
--- PASS: TestDeliveredContractMinio/cross-bucket_denial (0.00s)
PASS
ok github.com/carlosframework/platform/internal/objstore 0.039s
=== RUN TestT4StorageProbeMinio
2026/11/27 21:16:35 moves: T4: STORE: list: operation error S3: ListObjectsV2, https response error StatusCode: 403, RequestID: 18EC037F19C51B2B, HostID: ccc6eaeabf11110c8547c5492381907091890fe318affd48c71bed23ce742bae, api error SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
--- PASS: TestT4StorageProbeMinio (0.01s)
PASS
ok github.com/carlosframework/platform/internal/host 0.048s
=== RUN TestS3StoreMinioContract
=== RUN TestS3StoreMinioContract/conditional_get_and_etag_listing
=== RUN TestS3StoreMinioContract/bump_through_every_mutation_path
--- PASS: TestS3StoreMinioContract (0.04s)
--- PASS: TestS3StoreMinioContract/conditional_get_and_etag_listing (0.01s)
--- PASS: TestS3StoreMinioContract/bump_through_every_mutation_path (0.02s)
PASS
ok github.com/carlosframework/platform/internal/release 0.043s
Bucket created successfully `local/analytics-versions`.
local/analytics-versions versioning is enabled
Created policy `analytics-versions` successfully.
Added user `analyticsversions` successfully.
Attached Policies: [analytics-versions]
To User: analyticsversions
=== RUN TestS3StoreMinioVersions
--- PASS: TestS3StoreMinioVersions (0.04s)
PASS
ok github.com/carlosframework/platform/internal/release 0.043s
Bucket created successfully `local/store-versioned`.
local/store-versioned versioning is enabled
Created policy `store-versioned` successfully.
Added user `storeversioned` successfully.
Attached Policies: [store-versioned]
To User: storeversioned
=== RUN TestVersionedContractMinio
--- PASS: TestVersionedContractMinio (0.01s)
PASS
ok github.com/carlosframework/platform/internal/objstore 0.020s
Bucket created successfully `local/wc-bucket`.
Created policy `writer` successfully.
Added user `wcwriter` successfully.
Attached Policies: [writer]
To User: wcwriter
=== RUN TestWriteCredentialContractMinio
=== RUN TestWriteCredentialContractMinio/put_under_the_prefix
=== RUN TestWriteCredentialContractMinio/multipart_under_the_prefix
=== RUN TestWriteCredentialContractMinio/refused:_put_to_another_bucket
=== RUN TestWriteCredentialContractMinio/refused:_copy_from_the_store
=== RUN TestWriteCredentialContractMinio/refused:_read_elsewhere
=== RUN TestWriteCredentialContractMinio/refused:_head
=== RUN TestWriteCredentialContractMinio/refused:_list
=== RUN TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag
=== RUN TestWriteCredentialContractMinio/refused:_put_beside_the_prefix
=== RUN TestWriteCredentialContractMinio/refused:_bucket_settings
=== RUN TestWriteCredentialContractMinio/refused:_read_under_the_prefix
=== RUN TestWriteCredentialContractMinio/refused:_list_uploads
=== RUN TestWriteCredentialContractMinio/refused:_delete
=== RUN TestWriteCredentialContractMinio/refused:_tag
=== RUN TestWriteCredentialContractMinio/refused:_put_tagged
=== RUN TestWriteCredentialContractMinio/refused:_put_outside_the_prefix
--- PASS: TestWriteCredentialContractMinio (0.04s)
--- PASS: TestWriteCredentialContractMinio/put_under_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/multipart_under_the_prefix (0.01s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_to_another_bucket (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_copy_from_the_store (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_read_elsewhere (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_head (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_list (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_beside_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_bucket_settings (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_read_under_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_list_uploads (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_delete (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_tag (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_tagged (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_outside_the_prefix (0.00s)
PASS
ok github.com/carlosframework/platform/internal/objstore 0.051s
=== RUN TestEndToEndMinio
=== RUN TestEndToEndMinio/plan
=== RUN TestEndToEndMinio/roll
=== RUN TestEndToEndMinio/replace
=== RUN TestEndToEndMinio/remove
--- PASS: TestEndToEndMinio (0.49s)
--- PASS: TestEndToEndMinio/plan (0.01s)
--- PASS: TestEndToEndMinio/roll (0.13s)
--- PASS: TestEndToEndMinio/replace (0.16s)
--- PASS: TestEndToEndMinio/remove (0.16s)
PASS
ok github.com/carlosframework/platform/internal/grouproll 0.499s
Bucket created successfully `local/dbf-deploy`.
Bucket created successfully `local/dbf-data-ie`.
Bucket created successfully `local/dbf-data-uk`.
local/dbf-deploy versioning is enabled
Created policy `dbf-console` successfully.
Created policy `dbf-ukbox` successfully.
Added user `dbfconsole` successfully.
Added user `dbfukbox` successfully.
Attached Policies: [dbf-console]
To User: dbfconsole
Attached Policies: [dbf-ukbox]
To User: dbfukbox
=== RUN TestDBForwardMinio
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/27 21:16:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/27 21:16:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000002
2026/11/27 21:16:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000002 maxTXID=0000000000000002 size=370
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000002
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000003
2026/11/27 21:16:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000003 maxTXID=0000000000000003 size=454
2026/11/27 21:16:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000003 txid.db=0000000000000003
2026/11/27 21:16:44 console: CARLOS_SECRETS_PUBKEY is unset, so no region outside the home can be chosen automatically
2026/11/27 21:16:44 console: could not notify member@example.com of a CLI token issue: keymail: lookup member@example.com: keymail: GET /api/federation/lookup?addr=member%40example.com&from=console%40127.0.0.1%3A46363: could not determine target mailbox
agent.go:136: dbreads: dbr_75lfgpfmpgy33776atn6fm6mna: planned 3 files (1544 bytes) and restored to 3 in 15ms
agent.go:136: dbreads: dbr_75lfgpfmpgy33776atn6fm6mna: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/27 21:16:45 console: db read dbr_75lfgpfmpgy33776atn6fm6mna: relayed 1 chunks (102 bytes) in 1.005s, ended done
agent.go:136: dbreads: dbr_5e4ar6tyv2xkrabavfgnczinni: planned 1 files (720 bytes) and restored to 1 in 12ms
agent.go:136: dbreads: dbr_5e4ar6tyv2xkrabavfgnczinni: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/27 21:16:46 console: db read dbr_5e4ar6tyv2xkrabavfgnczinni: relayed 1 chunks (102 bytes) in 1.005s, ended done
agent.go:136: dbreads: dbr_mlq4ylsvqtlslavful3kg7ax5u: planned 3 files (1544 bytes) and held through 3 in 12ms
agent.go:136: dbreads: dbr_mlq4ylsvqtlslavful3kg7ax5u: output 1544 bytes in 1 confirmed chunks in 1ms
2026/11/27 21:16:47 console: db read dbr_mlq4ylsvqtlslavful3kg7ax5u: relayed 1 chunks (1641 bytes) in 1.005s, ended done
=== RUN TestDBForwardMinio/by_disconnect
=== NAME TestDBForwardMinio
agent.go:136: dbreads: dbr_b67fu6d6jw2p3rdrznwvffwlwe: planned 3 files (1544 bytes) and restored to 3 in 13ms
2026/11/27 21:16:47 console: db read dbr_b67fu6d6jw2p3rdrznwvffwlwe: relayed 0 chunks (0 bytes) in 15ms, ended client gone
agent.go:136: dbreads: dbr_b67fu6d6jw2p3rdrznwvffwlwe: output 5 bytes in 1 confirmed chunks in 104ms
=== RUN TestDBForwardMinio/by_timeout
=== NAME TestDBForwardMinio
agent.go:136: dbreads: dbr_7p52v7timt2rujgligxj54m2bq: planned 3 files (1544 bytes) and restored to 3 in 13ms
2026/11/27 21:17:08 console: db read dbr_7p52v7timt2rujgligxj54m2bq: relayed 0 chunks (0 bytes) in 19.85s, ended no-result
agent.go:136: dbreads: dbr_7p52v7timt2rujgligxj54m2bq: output 5 bytes in 1 confirmed chunks in 19.822s
--- PASS: TestDBForwardMinio (23.51s)
--- PASS: TestDBForwardMinio/by_disconnect (0.23s)
--- PASS: TestDBForwardMinio/by_timeout (19.96s)
PASS
ok github.com/carlosframework/platform/internal/console 23.561s
Bucket created successfully `local/media-transfers`.
Bucket created successfully `local/media-transfer-results`.
local/media-transfer-results versioning is enabled
Created policy `media-transfers` successfully.
Added user `mediatransfers` successfully.
Attached Policies: [media-transfers]
To User: mediatransfers
=== RUN TestMediaTransfersMinio
upload.go:117: codec: the store already holds video.mp4
upload.go:117: codec: the store already holds video.m3u8
upload.go:117: codec: the store already holds poster.jpg
--- PASS: TestMediaTransfersMinio (0.07s)
PASS
ok github.com/carlosframework/platform/internal/mediaaws 0.079s
Bucket created successfully `local/media-local-store`.
Bucket created successfully `local/media-local-results`.
Created policy `media-local` successfully.
Added user `medialocal` successfully.
Attached Policies: [media-local]
To User: medialocal
=== RUN TestLocalEndToEndMinio
--- PASS: TestLocalEndToEndMinio (0.57s)
PASS
ok github.com/carlosframework/platform/internal/medialocal 0.579s
=== RUN TestHeldHandoverTwoBoxMinio
2026/11/27 21:17:13 edge: mesh key: minted
2026/11/27 21:17:13 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/27 21:17:13 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/27 21:17:13 tenant admission is open. accepting tenant work
2026/11/27 21:17:13 activator: HA placement host=shop-fa5b81bf.example.test kind=Place ref=annie reason=roomiest generation=2026-11-27T21:17:13Z lock_generation=0
2026/11/27 21:17:13 lease: t8-fa5b81bf/shop-fa5b81bf.example.test: HA lease acquired in 4ms (first wake)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: started carlos-instance@shop\x2dfa5b81bf.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 6ms, control socket 0s, key gate 0s, logs 0s) 7ms, launch file 0s, gate 0s, root start 1ms)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: carlos-instance@shop\x2dfa5b81bf.example.test.service launched in 8ms, healthy 0s later
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: woke in 23ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 8ms, replicate 9ms
2026/11/27 21:17:13 lease: t8-fa5b81bf/plain-fa5b81bf.example.test: acquired in 1ms (client 0s, lock read and write 1ms)
2026/11/27 21:17:13 activator: no replica for plain-fa5b81bf.example.test in s3://contract-bucket/t8-fa5b81bf/plain-fa5b81bf.example.test — booting fresh
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test: started carlos-instance@plain\x2dfa5b81bf.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 1ms, instance key 0s, env 4ms, control socket 0s, key gate 0s, logs 0s) 6ms, launch file 0s, gate 0s, root start 1ms)
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test: carlos-instance@plain\x2dfa5b81bf.example.test.service launched in 7ms, healthy 0s later
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test: woke in 97ms: checks 0s, lease 2ms, restore 18ms, identity 0s, protect 0s, spawn 7ms, replicate 70ms
2026/11/27 21:17:13 lease: t8-fa5b81bf/bot0.shop.bac.sidecar.internal: HA lease acquired in 4ms (first wake)
2026/11/27 21:17:13 activator: bot0.shop.bac.sidecar.internal: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/27 21:17:13 activator: bot0.shop.bac.sidecar.internal: woke in 18ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 7ms, settle 0s, replicate 5ms
2026/11/27 21:17:13 activator: next-due probe plain-fa5b81bf.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test hibernated
2026/11/27 21:17:13 activator: bot0.shop.bac.sidecar.internal: released with a marker (clean true, txid 1, files 3:c074087140622492ac5f25c86e1c41d0d7551f4f63b1ee43cc2d9eb291aba17e) in 8ms: files 1ms, sync 4ms, record 1ms, marker 2ms
2026/11/27 21:17:13 activator: bot0.shop.bac.sidecar.internal hibernated
2026/11/27 21:17:13 activator: next-due probe shop-fa5b81bf.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: released with a marker (clean true, txid 1, files 3:c651fbb135953d79865c50059f512e08572ca22315a2d2a396e4d84a12f482d1) in 8ms: files 1ms, sync 4ms, record 1ms, marker 2ms
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test hibernated
2026/11/27 21:17:13 lease: t8-fa5b81bf/shop-fa5b81bf.example.test: HA lease acquired in 3ms (clean marker)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: restored (other-box)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: started carlos-instance@shop\x2dfa5b81bf.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 1ms, control socket 0s, key gate 0s, logs 0s) 1ms, launch file 0s, gate 0s, root start 1ms)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: carlos-instance@shop\x2dfa5b81bf.example.test.service launched in 2ms, healthy 0s later
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: woke in 88ms: checks 0s, lease 4ms, restore 28ms, identity 0s, protect 0s, spawn 2ms, replicate 54ms
2026/11/27 21:17:13 edge: ha-take shop-fa5b81bf.example.test from annie (txn t8-witness, marker generation 1): holder betty, generation 2
2026/11/27 21:17:13 edge: forward shop-fa5b81bf.example.test: annie handed the request over to betty; sending it there (occurrence #1)
hadrain_twobox_minio_linux_test.go:1238: drain report: {V:1 Transaction:t8-witness Incarnation:0f284fb3bdb8b22103d2d3f00643ba96 Step:move Result:ok Reasons:[] Fence:t8-witness StartedAt:2026-11-27 21:17:13.617321048 +0000 UTC FinishedAt:2026-11-27 21:17:13.81549265 +0000 UTC Acked:[betty carol] Departed:[] Moved:[{Host:shop-fa5b81bf.example.test Holder:betty Gen:2 Confirmed:take}] Released:[{Host:plain-fa5b81bf.example.test Kind:other Marker:true Clean:true Reason:} {Host:bot0.shop.bac.sidecar.internal Kind:worker Marker:true Clean:true Reason:}] Unclean:[] Left:[] Holds:{LongestMS:142 Todays:0 RefusedAtOnce:1} Closed:0 Quiet:{DrainQuiet:{Waking:0 Stopping:0 Recovering:0 Owed:0} Held:[]}}
hadrain_twobox_minio_linux_test.go:1239: driver calls: [begin shop-fa5b81bf.example.test <nil> stop plain-fa5b81bf.example.test marker=true clean=true <nil> stop bot0.shop.bac.sidecar.internal marker=true clean=true <nil> releasing shop-fa5b81bf.example.test <nil> stop shop-fa5b81bf.example.test marker=true clean=true <nil> taken shop-fa5b81bf.example.test betty <nil> end-moves]
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/bot0.shop.bac.sidecar.internal/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/bot0.shop.bac.sidecar.internal/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/bot0.shop.bac.sidecar.internal/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: DELETE /contract-bucket/t8-fa5b81bf/plain-fa5b81bf.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-fa5b81bf/bot0.shop.bac.sidecar.internal/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-fa5b81bf/bot0.shop.bac.sidecar.internal/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/head.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/generations/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0008/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0007/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0006/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0005/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0004/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0008/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0007/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0006/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0005/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0004/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/files/0/manifest.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/files/0/objects/0000000000000001-604fc60523b19f39c4d64b41f9625d0c8afb653b5cd9de3563e030d5ff1ff528
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/files/0/objects/0000000000000003-e7e1790f4b48f70db8c5002f279611c1fa4ae519eacb61f3cd623cbcd085e2ff
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/0000/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-fa5b81bf/shop-fa5b81bf.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/0000/0000000000000002-0000000000000002.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-fa5b81bf/shop-fa5b81bf.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1243: drain took 241ms; S3 calls 45 (DELETE lock=1 GET files=3 GET head=1 GET lock=2 GET replica=2 LIST replica=30 PUT lock=3 PUT replica=3); deployment store calls 20 (GET edges=14 LIST edges=4 PUT edges=2)
hadrain_twobox_minio_linux_test.go:1367: the fenced A's start gate answers 503 "This service is unavailable. Try again later.\n" (Retry-After "10")
2026/11/27 21:17:13 lease: t8-fa5b81bf/plain-fa5b81bf.example.test: acquired in 2ms (client 0s, lock read and write 2ms)
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test: started carlos-instance@plain\x2dfa5b81bf.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 0s, control socket 0s, key gate 0s, logs 0s) 0s, launch file 0s, gate 0s, root start 1ms)
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test: carlos-instance@plain\x2dfa5b81bf.example.test.service launched in 1ms, healthy 0s later
2026/11/27 21:17:13 lease: /tmp/carlos-minio-contract-3LYV4z/g/dw1583040628/data/instances/plain-fa5b81bf.example.test/plain-fa5b81bf.example.test.db: continuity with the last clean close not proven; snapshot 1-0000000000000001 written before serving
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test: woke in 11ms: checks 0s, lease 2ms, restore 0s, identity 0s, protect 1ms, spawn 2ms, replicate 7ms
2026/11/27 21:17:13 activator: next-due probe shop-fa5b81bf.example.test: decode /api/next-due: invalid character 'b' looking for beginning of value — recording none (it sleeps until a request)
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test: released with a marker (clean true, txid 2, files 3:c651fbb135953d79865c50059f512e08572ca22315a2d2a396e4d84a12f482d1) in 4ms: files 1ms, sync 0s, record 1ms, marker 2ms
2026/11/27 21:17:13 activator: shop-fa5b81bf.example.test hibernated
2026/11/27 21:17:13 tenant admission is closed for shutdown
2026/11/27 21:17:13 activator: next-due probe plain-fa5b81bf.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/27 21:17:13 activator: plain-fa5b81bf.example.test hibernated
--- PASS: TestHeldHandoverTwoBoxMinio (0.62s)
=== RUN TestHeldHandoverLostLeaseMinio
2026/11/27 21:17:13 edge: mesh key: minted
2026/11/27 21:17:13 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/27 21:17:13 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/27 21:17:14 tenant admission is open. accepting tenant work
2026/11/27 21:17:14 activator: HA placement host=shop-548e7ec6.example.test kind=Place ref=annie reason=roomiest generation=2026-11-27T21:17:14Z lock_generation=0
2026/11/27 21:17:14 lease: t8-548e7ec6/shop-548e7ec6.example.test: HA lease acquired in 3ms (first wake)
2026/11/27 21:17:14 activator: shop-548e7ec6.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/27 21:17:14 activator: shop-548e7ec6.example.test: started carlos-instance@shop\x2d548e7ec6.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 6ms, control socket 0s, key gate 0s, logs 0s) 6ms, launch file 0s, gate 0s, root start 1ms)
2026/11/27 21:17:14 activator: shop-548e7ec6.example.test: carlos-instance@shop\x2d548e7ec6.example.test.service launched in 7ms, healthy 0s later
2026/11/27 21:17:14 activator: shop-548e7ec6.example.test: woke in 65ms: checks 0s, lease 4ms, restore 0s, identity 0s, protect 0s, spawn 7ms, replicate 53ms
2026/11/27 21:17:14 activator: next-due probe shop-548e7ec6.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/27 21:17:14 activator: final checkpoint shop-548e7ec6.example.test: lease: release marker owed for s3://contract-bucket/t8-548e7ec6/shop-548e7ec6.example.test/lock.json (If-Match "23e77f8b36a4622e056da62875930faa"): lease: write release marker: operation error S3: PutObject, https response error StatusCode: 503, RequestID: , HostID: , api error ServiceUnavailable: witness: refused
2026/11/27 21:17:14 activator: shop-548e7ec6.example.test hibernated
2026/11/27 21:17:14 activator: handover of shop-548e7ec6.example.test left: released without a marker; its held requests get today's answer
hadrain_twobox_minio_linux_test.go:1469: the held request's hold ended "shop-548e7ec6.example.test client 4 "
hadrain_twobox_minio_linux_test.go:1486: driver calls: [begin shop-548e7ec6.example.test <nil> releasing shop-548e7ec6.example.test <nil> stop shop-548e7ec6.example.test marker=false clean=false <nil> left shop-548e7ec6.example.test released without a marker]
hadrain_twobox_minio_linux_test.go:1487: a request after the loss: 503 "This instance cannot wake right now. Please try again shortly.\n" (Retry-After "10", holder "none", 0s, err <nil>)
2026/11/27 21:17:14 tenant admission is closed for shutdown
2026/11/27 21:17:14 http: proxy error: context canceled
--- PASS: TestHeldHandoverLostLeaseMinio (0.32s)
PASS
ok github.com/carlosframework/platform/internal/host 0.994s
Bucket created successfully `local/gen-take`.
local/gen-take versioning is enabled
Created policy `gen-take` successfully.
Added user `gentake` successfully.
Attached Policies: [gen-take]
To User: gentake
=== RUN TestGenerationTakeMinio
=== RUN TestGenerationTakeMinio/take
2026/11/27 21:17:15 lease: instances/gen-1795814235445760983.shop.example.com: HA lease acquired in 6ms (first wake)
2026/11/27 21:17:15 lease: instances/gen-1795814235445760983.shop.example.com: HA lease acquired in 3ms (holder terminated)
gentake_minio_test.go:308: a second create-only copy onto instances/gen-1795814235445760983.shop.example.com/g-00000000000000000002/0000/0000000000000001-0000000000000001.ltx: <nil> (destination condition honoured: false)
2026/11/27 21:17:15 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/27 21:17:15 ERROR enforce L0 time retention system=store db=w.example.com.db error="fetch l1 files: lease: a write has waited too long to reach storage (write fence)"
2026/11/27 21:17:15 http: proxy error: context canceled
2026/11/27 21:17:15 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: a write has waited too long to reach storage (write fence)"
=== RUN TestGenerationTakeMinio/switch-412
2026/11/27 21:17:15 lease: instances/gen-1795814235576770952.shop.example.com: HA lease acquired in 4ms (first wake)
2026/11/27 21:17:15 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/27 21:17:15 lease: instances/gen-1795814235576770952.shop.example.com: HA lease acquired in 3ms (clean marker)
=== RUN TestGenerationTakeMinio/copy-version
=== RUN TestGenerationTakeMinio/store-time
2026/11/27 21:17:15 lease: instances/gen-1795814235674707385.shop.example.com: HA lease acquired in 3ms (first wake)
2026/11/27 21:17:15 http: proxy error: context canceled
2026/11/27 21:17:15 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: fetch ltx files: lease: a write has waited too long to reach storage (write fence)"
2026/11/27 21:17:15 lease: instances/gen-1795814235674707385.shop.example.com: HA lease acquired in 3ms (clean marker)
2026/11/27 21:17:15 lease: instances/gen-1795814235674707385.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/27 21:17:15 lease: instances/gen-1795814235674707385.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/27 21:17:15 lease: instances/gen-1795814235674707385.shop.example.com: HA lease acquired in 2ms (unclean marker)
2026/11/27 21:17:15 lease: instances/gen-1795814235674707385.shop.example.com: HA lease acquired in 2ms (unclean marker)
=== RUN TestGenerationTakeMinio/skew
--- PASS: TestGenerationTakeMinio (0.34s)
--- PASS: TestGenerationTakeMinio/take (0.13s)
--- PASS: TestGenerationTakeMinio/switch-412 (0.09s)
--- PASS: TestGenerationTakeMinio/copy-version (0.01s)
--- PASS: TestGenerationTakeMinio/store-time (0.10s)
--- PASS: TestGenerationTakeMinio/skew (0.01s)
PASS
ok github.com/carlosframework/platform/internal/lease 0.356s
minio contract: PASS
=== staticcheck ===
go version go1.26.10 linux/arm64
go: downloading honnef.co/go/tools v0.8.2
go: downloading golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678
go: downloading github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
go: downloading golang.org/x/sync v0.23.0
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
staticcheck: clean
=== govulncheck ===
go version go1.26.10 linux/arm64
go: downloading golang.org/x/vuln v1.8.0
go: downloading golang.org/x/telemetry v0.0.0-20260908163034-4bcc4b2ee518
go: downloading golang.org/x/tools v0.50.0
govulncheck: scanned github.com/carlosframework/platform, amadan.net/carlos/platform.git/launchctx, carlos-vulnscan
GO-2026-6859 called stdlib@v1.26.10, fixed in v1.26.11
HTTP/1 server crash due to MaxBytesReader header race in net/http
excepted until 2027-01-31 (.amadan/govulncheck-exceptions.tsv:9): net/http MaxBytesReader header race, fixed in go1.26.11. CI and releases stay on go1.26.10 because 1.26.11 deadlocks the edge's Expect: 100-continue path (#897, .amadan/go-toolchain.sh); #904 checked every production MaxBytesReader site and found it unreachable.
GO-2026-5932 required golang.org/x/crypto@v0.58.0, fixed in v0.58.1-0.20261009181718-2f1f834330b2
The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues
not fatal: no call path to the vulnerable code
govulncheck: clean (2 finding(s), none called outside .amadan/govulncheck-exceptions.tsv)
=== code-health ===
go version go1.26.10 linux/arm64
codehealth_test.go:42: scanned in 1m51.982s
codehealth_test.go:107: line metrics (code lines, then physical):
file-lines 5471 7324 internal/activator activator_test.go
file-lines 4200 7033 internal/console server.go
file-lines 4150 6312 . apimode.go
file-lines 3785 7224 internal/activator activator.go
file-lines 3530 4459 . apimode_test.go
file-lines 3261 3864 internal/registry registry_test.go
file-lines 3209 6403 internal/host agent.go
file-lines 3094 3992 internal/provision reconcile_test.go
func-lines 870 891 internal/host plan14InstalledClaimLaunch
func-lines 810 1277 internal/provision Reconcile
func-lines 769 1242 internal/console (*Server).handleAPIInstanceCreate
func-lines 688 1243 internal/host runAgent
func-lines 571 908 internal/activator (*Service).doWakeOnce
func-lines 538 546 internal/host runServingParkPeerNamespace
func-lines 519 712 . runRoute
func-lines 509 569 internal/host TestPagingIsRateLimited
func-lines 494 815 internal/release adoptHost
func-lines 441 500 internal/host TestRootInstanceStopExecStop
func-lines 421 436 internal/host (*ClaimWakeAssembly).Build
func-lines 421 437 internal/team TestFixture
func-lines 412 414 internal/console TestDemoProtectionsSourceToLimitAndTakedown
func-lines 408 485 . TestFleetAppServesThroughTheHub
func-lines 402 406 internal/registry (*Registry).haJournal
func-lines 400 868 internal/provision rootReadArchivedChain
func-lines 399 732 internal/release PassFilter
func-lines 390 398 internal/host runFilesSeedPreparationWithLive
func-lines 383 406 internal/console TestDemoSourceToLiveAndUpdate
func-lines 378 898 internal/edge (*Edge).ServeHTTP
func-lines 374 377 internal/host plan14RequiredArtifactsRootRunner
func-lines 371 417 internal/host TestRootEgressKernelProof
func-lines 367 584 internal/console (*Server).handleAPIShip
func-lines 366 636 cmd/console serve
func-lines 364 371 internal/host testRootMigrationBootstrap
func-lines 360 362 internal/edge TestDemoAPIAliasBoundary
func-lines 357 358 internal/registry (*Registry).dispatchRemote
func-lines 355 372 internal/host TestRootSandboxUpdateFromOldBox
func-lines 343 354 internal/analytics Prune
func-lines 340 353 internal/host newColdRootHarness
func-lines 335 557 internal/console (*Store).migrate
func-lines 334 334 internal/host TestPlan12RecoveryRestoreSourceDatabase
func-lines 330 371 internal/edge TestRegionalNameNeverLeavesItsRegion
func-lines 329 471 . runDeploy
func-lines 329 329 internal/host TestPlan12RecoveryRestoreSourceDatabase.func1
func-lines 327 369 internal/edge TestTunnelWebSocketEndToEnd
func-lines 325 455 internal/objstore TestDeliveredContractMinio
func-lines 320 654 internal/appconfig SyncExecWithCallbacks
func-lines 315 318 internal/host plan14TimerIntention
func-lines 311 314 internal/host plan14TimerIntention.func1
func-lines 310 315 internal/hostbox ColdHandover.Run
func-lines 308 309 internal/host rootFilesSeedIsolatedWitness
func-lines 305 323 internal/host hairpinKernelWitness
func-lines 304 308 internal/console TestHAP2ProductionDoors
func-lines 302 329 internal/host TestRootG2PoolIngress
release-importers: . cmd/console internal/activator internal/analytics internal/appconfig internal/apperr internal/applog internal/apppolicy internal/boxid internal/boxvolumes internal/console internal/dbreads internal/dbreads/dbreadstest internal/dbverify internal/demobuild internal/domains internal/doorkey internal/edge internal/edgeproof internal/edgesfile internal/fleetapi internal/grouproll internal/grouprollaws internal/historyreadback internal/host internal/hostactors internal/hostbox internal/hostclaim internal/hostevidence internal/hostexec internal/hostfence internal/hostfiles internal/hostfloor internal/hostguard internal/hostops internal/hostrelocate internal/hostresolve internal/instancectl internal/instanceupdates internal/interactive internal/layout internal/lease internal/ledger internal/mail internal/mailer internal/mailsubmit internal/metrics internal/moves internal/objstore internal/ops internal/park internal/plans internal/provision internal/relay internal/rollout internal/rootfsimage internal/runs internal/s3fake internal/schedule internal/seeds internal/status internal/telemetry internal/usage internal/vet scripts/pathmapcheck scripts/witness-pointer
not scanned (216 files):
cmd/carlos-media/drill_other.go: built only for other systems or tags
cmd/carlos-media/harden_other.go: built only for other systems or tags
cmd/console/fleetsocket_other.go: built only for other systems or tags
cmd/console/servelock_windows.go: built only for other systems or tags
cmd/moveprobe/detach_windows.go: built only for other systems or tags
cmd/rootfswitness/mmap_other.go: built only for other systems or tags
devbox_acl_other.go: built only for other systems or tags
devbox_envfile_darwin_test.go: built only for other systems or tags
devbox_envfile_other.go: built only for other systems or tags
domains_transfer_signals_other.go: built only for other systems or tags
interactive_term_darwin.go: built only for other systems or tags
interactive_term_other.go: built only for other systems or tags
internal/activator/claimprocess_root_other.go: built only for other systems or tags
internal/activator/escrow_stamp_other.go: built only for other systems or tags
internal/activator/fleetreserve_other.go: built only for other systems or tags
internal/activator/harecord_other.go: built only for other systems or tags
internal/activator/ownenv_other.go: built only for other systems or tags
internal/activator/pty_other.go: built only for other systems or tags
internal/activator/race_on_test.go: built only for other systems or tags
internal/activator/rolelaunch_other.go: built only for other systems or tags
internal/assetcache/statfs_other.go: built only for other systems or tags
internal/boxself/io_other.go: built only for other systems or tags
internal/cgroup/cleanup_other.go: built only for other systems or tags
internal/cgroup/cleanup_other_test.go: built only for other systems or tags
internal/cgroup/hostprocs_other.go: built only for other systems or tags
internal/cgroup/recreate_other.go: built only for other systems or tags
internal/cgroup/role_other.go: built only for other systems or tags
internal/cgroup/shim_other.go: built only for other systems or tags
internal/cgroup/strict_other.go: built only for other systems or tags
internal/cgroup/verify_other.go: built only for other systems or tags
internal/console/claim_sql_identity_other.go: built only for other systems or tags
internal/console/geoipverify_other.go: built only for other systems or tags
internal/console/hostreports_process_other.go: built only for other systems or tags
internal/console/replicaview_other.go: built only for other systems or tags
internal/console/restore_sim_nice_other_test.go: built only for other systems or tags
internal/console/scalecost_other_test.go: built only for other systems or tags
internal/console/seedscratch_windows.go: built only for other systems or tags
internal/dbreads/worker_other.go: built only for other systems or tags
internal/demobuild/security_other.go: built only for other systems or tags
internal/democlaim/source_other.go: built only for other systems or tags
internal/devbox/peer_darwin.go: built only for other systems or tags
internal/devbox/peer_darwin_test.go: built only for other systems or tags
internal/devbox/peer_other.go: built only for other systems or tags
internal/devbox/socketcheck_other.go: built only for other systems or tags
internal/domains/certimport_read_portable.go: built only for other systems or tags
internal/edge/devboxpeer_other.go: built only for other systems or tags
internal/edge/hairpin_other.go: built only for other systems or tags
internal/edge/heldbudget_other.go: built only for other systems or tags
internal/edge/purge_listen_unix.go: built only for other systems or tags
internal/edge/purge_listen_windows.go: built only for other systems or tags
internal/edge/race_on_test.go: built only for other systems or tags
internal/edge/replicaconsole_owner_other.go: built only for other systems or tags
internal/edge/replicaconsole_peer_other.go: built only for other systems or tags
internal/edge/replicaconsole_socket_other_test.go: built only for other systems or tags
internal/edge/static_artifact_other.go: built only for other systems or tags
internal/edge/static_recordlock_other.go: built only for other systems or tags
internal/edge/static_sweep_other.go: built only for other systems or tags
internal/execsandbox/cleanup_other.go: built only for other systems or tags
internal/execsandbox/file_other.go: built only for other systems or tags
internal/execsandbox/oci_other.go: built only for other systems or tags
internal/fileacl/fileacl_darwin.go: built only for other systems or tags
internal/fileacl/fileacl_darwin_amd64.s: built only for other systems or tags
internal/fileacl/fileacl_darwin_arm64.s: built only for other systems or tags
internal/fileacl/fileacl_darwin_test.go: built only for other systems or tags
internal/grouproll/state_other.go: built only for other systems or tags
internal/grouprollaws/pty_darwin.go: built only for other systems or tags
internal/grouprollaws/pty_other.go: built only for other systems or tags
internal/hairpin/native_other.go: built only for other systems or tags
internal/host/applylock_other_test.go: built only for other systems or tags
internal/host/bootstrapfs_other.go: built only for other systems or tags
internal/host/boxroles_config_other.go: built only for other systems or tags
internal/host/claimfilesseed_delegation_other.go: built only for other systems or tags
internal/host/claimfilesseed_transport_other.go: built only for other systems or tags
internal/host/claimjournal_containment_other.go: built only for other systems or tags
internal/host/claimjournal_migration_other.go: built only for other systems or tags
internal/host/claimlaunch_kernel_other.go: built only for other systems or tags
internal/host/claimlaunch_rev2_other_test.go: built only for other systems or tags
internal/host/claimproduction_other.go: built only for other systems or tags
internal/host/claimready_other.go: built only for other systems or tags
internal/host/claimroleassembly_other.go: built only for other systems or tags
internal/host/claimservingartifact_other.go: built only for other systems or tags
internal/host/claimservinghandover_reboot_other.go: built only for other systems or tags
internal/host/claimservinghandover_reboot_other_test.go: built only for other systems or tags
internal/host/claimservingpark_other.go: built only for other systems or tags
internal/host/claimstate_other.go: built only for other systems or tags
internal/host/claimstop_kernel_other.go: built only for other systems or tags
internal/host/claimtoken_inventory_other.go: built only for other systems or tags
internal/host/claimunit_dropin_other.go: built only for other systems or tags
internal/host/claimunit_files_other.go: built only for other systems or tags
internal/host/claimunit_migrate_other.go: built only for other systems or tags
internal/host/claimunit_ready_other.go: built only for other systems or tags
internal/host/claimunit_socket_migration_other.go: built only for other systems or tags
internal/host/consolefleet_owner_other.go: built only for other systems or tags
internal/host/dbreads_other.go: built only for other systems or tags
internal/host/egress_rail_other.go: built only for other systems or tags
internal/host/fileowner_other.go: built only for other systems or tags
internal/host/flock_windows.go: built only for other systems or tags
internal/host/group_config_other.go: built only for other systems or tags
internal/host/group_maintenance_other.go: built only for other systems or tags
internal/host/group_maintenance_verbs_other.go: built only for other systems or tags
internal/host/group_receipt_other.go: built only for other systems or tags
internal/host/hadrain_call_other.go: built only for other systems or tags
internal/host/hadrain_socket_other.go: built only for other systems or tags
internal/host/hadrainfence_other.go: built only for other systems or tags
internal/host/headroom_other.go: built only for other systems or tags
internal/host/installchannel_other.go: built only for other systems or tags
internal/host/managedboot_other.go: built only for other systems or tags
internal/host/metrics_nested_other.go: built only for other systems or tags
internal/host/movesfloor_other.go: built only for other systems or tags
internal/host/movesfloorgate_other.go: built only for other systems or tags
internal/host/movesheldrelease_other.go: built only for other systems or tags
internal/host/movesmeasure_other.go: built only for other systems or tags
internal/host/offcloudcredentials_other.go: built only for other systems or tags
internal/host/registrychild_exec_other.go: built only for other systems or tags
internal/host/registrychild_other.go: built only for other systems or tags
internal/host/registryowner_chown_other.go: built only for other systems or tags
internal/host/registryowner_descriptor_unix.go: built only for other systems or tags
internal/host/replicahealth_other.go: built only for other systems or tags
internal/host/rootgeneration_census_other.go: built only for other systems or tags
internal/host/rootgeneration_kernel_other.go: built only for other systems or tags
internal/host/rootgeneration_payload_other.go: built only for other systems or tags
internal/host/rootgeneration_retired_other.go: built only for other systems or tags
internal/host/rootmigration_production_other.go: built only for other systems or tags
internal/host/runscset_other.go: built only for other systems or tags
internal/host/sandboxenv_other.go: built only for other systems or tags
internal/host/statfs_windows.go: built only for other systems or tags
internal/host/systemapply_other.go: built only for other systems or tags
internal/hostbox/census_vendor_other.go: built only for other systems or tags
internal/hostbox/inventory_identity_other.go: built only for other systems or tags
internal/hostbox/journalmigration_other.go: built only for other systems or tags
internal/hostbox/journalnamespace_other.go: built only for other systems or tags
internal/hostbox/journaltrust_other.go: built only for other systems or tags
internal/hostbox/migration_census_other.go: built only for other systems or tags
internal/hostbox/typedpark_other.go: built only for other systems or tags
internal/hostenv/group_other.go: built only for other systems or tags
internal/hostenv/write_other.go: built only for other systems or tags
internal/hostenv/write_other_test.go: built only for other systems or tags
internal/hostexec/clock_other.go: built only for other systems or tags
internal/hostexec/clock_other_test.go: built only for other systems or tags
internal/hostexec/local_other.go: built only for other systems or tags
internal/hostexec/pending_other.go: built only for other systems or tags
internal/hostexec/probe_other.go: built only for other systems or tags
internal/hostexec/rootprocess_other.go: built only for other systems or tags
internal/hostfiles/dir_other.go: built only for other systems or tags
internal/hostfiles/refuse_other.go: built only for other systems or tags
internal/hostfiles/watch_other.go: built only for other systems or tags
internal/hostfloor/controllers_other.go: built only for other systems or tags
internal/hostfloor/image_other.go: built only for other systems or tags
internal/hostguard/flock_other.go: built only for other systems or tags
internal/hostguard/flock_other_test.go: built only for other systems or tags
internal/hostguard/record_other.go: built only for other systems or tags
internal/instancectl/claimexec_other.go: built only for other systems or tags
internal/instancectl/claimexec_socket_other.go: built only for other systems or tags
internal/instancectl/claimlaunch_snapshot_other.go: built only for other systems or tags
internal/instancectl/claimnetwork_other.go: built only for other systems or tags
internal/instancectl/demo_snapshot_other.go: built only for other systems or tags
internal/instancectl/egress_cgroup_other.go: built only for other systems or tags
internal/instancectl/egress_dropin_other.go: built only for other systems or tags
internal/instancectl/fleetsize_other.go: built only for other systems or tags
internal/instancectl/gvisorprobe_other.go: built only for other systems or tags
internal/instancectl/peer_other.go: built only for other systems or tags
internal/instancectl/peer_tuple_other.go: built only for other systems or tags
internal/instancectl/rootfs_identity_other.go: built only for other systems or tags
internal/instanceexec/claimexec_other.go: built only for other systems or tags
internal/instanceexec/exec_rootfs_other.go: built only for other systems or tags
internal/instanceexec/netlink_route_other.go: built only for other systems or tags
internal/instanceexec/probe_gvisor_other.go: built only for other systems or tags
internal/instanceexec/probe_hardening_other.go: built only for other systems or tags
internal/instanceexec/probe_other.go: built only for other systems or tags
internal/instanceexec/probe_rootfs_other.go: built only for other systems or tags
internal/instanceexec/sandbox_other.go: built only for other systems or tags
internal/instanceexec/scope_other.go: built only for other systems or tags
internal/instanceexec/stop_other.go: built only for other systems or tags
internal/instanceexec/tty_other.go: built only for other systems or tags
internal/instancefs/instancefs_other.go: built only for other systems or tags
internal/launchd/activate_darwin.go: built only for other systems or tags
internal/launchd/activate_darwin_amd64.s: built only for other systems or tags
internal/launchd/activate_darwin_arm64.s: built only for other systems or tags
internal/launchd/activate_darwin_test.go: built only for other systems or tags
internal/layout/journal_other.go: built only for other systems or tags
internal/layout/links_other.go: built only for other systems or tags
internal/mailer/keys_other.go: built only for other systems or tags
internal/maintenanceexec/run_other.go: built only for other systems or tags
internal/managedboot/admission_other.go: built only for other systems or tags
internal/managedboot/identity_other.go: built only for other systems or tags
internal/mediahandler/collect_other.go: built only for other systems or tags
internal/mediahandler/procs_other.go: built only for other systems or tags
internal/medialocal/runner_other.go: built only for other systems or tags
internal/moves/archive/open_other.go: built only for other systems or tags
internal/moves/archive/sync_other.go: built only for other systems or tags
internal/ops/flock_windows.go: built only for other systems or tags
internal/park/local_other.go: built only for other systems or tags
internal/privatefile/io_other.go: built only for other systems or tags
internal/proxyproto/peek_other.go: built only for other systems or tags
internal/relay/race_on_test.go: built only for other systems or tags
internal/release/consumedfence_other.go: built only for other systems or tags
internal/release/digestcache_other.go: built only for other systems or tags
internal/rootaws/credentials_other.go: built only for other systems or tags
internal/rootaws/open_darwin.go: built only for other systems or tags
internal/rootfsimage/dir_other.go: built only for other systems or tags
internal/rootstate/authoritydir_other.go: built only for other systems or tags
internal/rootstate/authorityfile_other.go: built only for other systems or tags
internal/rootstate/file_other.go: built only for other systems or tags
internal/rootstate/link_other.go: built only for other systems or tags
internal/rootstate/persistent_other.go: built only for other systems or tags
internal/rootstate/state_other.go: built only for other systems or tags
internal/safefile/file_other.go: built only for other systems or tags
internal/safefile/reap_other.go: built only for other systems or tags
internal/stopevidence/fds_other.go: built only for other systems or tags
internal/stopevidence/fds_other_test.go: built only for other systems or tags
internal/stopevidence/holders_other.go: built only for other systems or tags
internal/stopevidence/reconstruct_other.go: built only for other systems or tags
internal/team/storelock_other.go: built only for other systems or tags
internal/team/storelock_windows.go: built only for other systems or tags
move_offline_run_other.go: built only for other systems or tags
system_group_other.go: built only for other systems or tags
codehealth_test.go:115: fatal 1094 at 474 sites log.Fatal*, (*log.Logger).Fatal* and os.Exit in the root package's production files
codehealth_test.go:115: sleep 1005 at 811 sites time.Sleep in test files
codehealth_test.go:115: db-no-context 885 at 703 sites database calls with no context (dbOpWithoutContext) in production files
codehealth_test.go:115: host-context 188 at 142 sites context.Background and context.TODO in internal/host production files
codehealth_test.go:115: func-lines 18604 at 45 sites functions over 300 code lines (blank and comment-only lines not counted)
codehealth_test.go:115: file-lines 30700 at 8 sites files over 3,000 code lines, counted the same way
codehealth_test.go:115: release-importers 66 at 1 sites packages whose production files import internal/release
codehealth_test.go:119: below the record: file-lines internal/console server.go -: 4200 in the code, the record allows 4210 (make code-health-record lowers it)
--- PASS: TestCodeHealth (111.98s)
PASS
ok github.com/carlosframework/platform/internal/codehealth 113.340s
=== code-health-record ===
go version go1.26.10 linux/arm64
code-health record: comparing with the merge base 9f5292370dd7cf019afeb7eaf8587ab361eb24e4 (main is 9f5292370dd7cf019afeb7eaf8587ab361eb24e4)
=== RUN TestRecordAgainstBase
--- PASS: TestRecordAgainstBase (0.01s)
PASS
ok github.com/carlosframework/platform/internal/codehealth 0.008s
code-health record: no line went up without a reason
=== race ===
go version go1.26.10 linux/arm64
GATE_RACE=1 .amadan/test-gate.sh
=== internal_systemd@0 (14 s, from +13 s)
ok github.com/carlosframework/platform/internal/systemd 13.413s
=== internal_rootaws@0 (25 s, from +34 s)
ok github.com/carlosframework/platform/internal/rootaws 25.330s
=== internal_activator@0 (269 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 266.561s
=== internal_activator@1 (266 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 264.002s
=== internal_activator@2 (278 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 275.129s
=== internal_activator@3 (418 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 415.284s
=== internal_activator@4 (279 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 276.174s
=== internal_activator@5 (313 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 310.637s
=== internal_activator@6 (323 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 320.067s
=== internal_activator@7 (411 s, from +111 s)
ok github.com/carlosframework/platform/internal/activator 408.245s
=== internal_edge@0 (84 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 81.677s
=== internal_edge@1 (132 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 129.093s
=== internal_edge@2 (222 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 219.414s
=== internal_edge@3 (131 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 128.292s
=== internal_edge@4 (149 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 145.702s
=== internal_edge@5 (237 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 234.047s
=== internal_edge@6 (213 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 210.326s
=== internal_edge@7 (273 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 270.675s
=== internal_edge@8 (231 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 228.283s
=== internal_edge@9 (270 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 267.103s
=== internal_edge@10 (222 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 218.968s
=== internal_edge@11 (218 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 215.554s
=== internal_edge@12 (243 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 240.599s
=== internal_edge@13 (247 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 244.014s
=== internal_edge@14 (194 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 191.462s
=== internal_edge@15 (229 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 226.287s
=== internal_host@0 (9 s, from +195 s)
ok github.com/carlosframework/platform/internal/host 5.149s
=== internal_host@1 (17 s, from +195 s)
ok github.com/carlosframework/platform/internal/host 13.157s
=== lists: internal_edge 134 s, internal_activator 111 s, internal_host 194 s, internal_rootaws 33 s, internal_systemd 13 s
=== cpu: the gate used 7648 cpu-seconds in 529 s, about 14.5 of 32 cores; the machine as a whole was 45% busy
=== gitleaks ===
go version go1.26.10 linux/arm64
go: downloading github.com/zricethezav/gitleaks/v8 v8.30.1
go: downloading github.com/h2non/filetype v1.1.3
go: downloading github.com/mholt/archives v0.1.2
go: downloading github.com/fatih/semgroup v1.2.0
go: downloading github.com/hashicorp/go-version v1.7.0
go: downloading golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa
go: downloading github.com/rs/zerolog v1.33.0
go: downloading github.com/Masterminds/sprig/v3 v3.3.0
go: downloading github.com/gitleaks/go-gitdiff v0.9.1
go: downloading github.com/charmbracelet/lipgloss v0.5.0
go: downloading github.com/BobuSumisu/aho-corasick v1.0.3
go: downloading github.com/spf13/viper v1.19.0
go: downloading github.com/spf13/cobra v1.9.1
go: downloading golang.org/x/sync v0.11.0
go: downloading github.com/muesli/termenv v0.15.1
go: downloading github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707
go: downloading github.com/klauspost/compress v1.17.11
go: downloading github.com/klauspost/pgzip v1.2.6
go: downloading github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3
go: downloading github.com/STARRY-S/zip v0.2.1
go: downloading github.com/nwaples/rardecode/v2 v2.1.0
go: downloading github.com/minio/minlz v1.0.0
go: downloading github.com/bodgit/sevenzip v1.6.0
go: downloading github.com/sorairolake/lzip-go v0.3.5
go: downloading github.com/therootcompany/xz v1.0.1
go: downloading github.com/ulikunitz/xz v0.5.12
go: downloading golang.org/x/text v0.22.0
go: downloading dario.cat/mergo v1.0.1
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading github.com/Masterminds/semver/v3 v3.3.0
go: downloading github.com/huandu/xstrings v1.5.0
go: downloading github.com/mitchellh/copystructure v1.2.0
go: downloading github.com/shopspring/decimal v1.4.0
go: downloading github.com/spf13/cast v1.7.1
go: downloading golang.org/x/crypto v0.35.0
go: downloading github.com/spf13/pflag v1.0.6
go: downloading github.com/fsnotify/fsnotify v1.8.0
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/spf13/afero v1.12.0
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/mattn/go-colorable v0.1.14
go: downloading github.com/subosito/gotenv v1.6.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/magiconair/properties v1.8.9
go: downloading github.com/pelletier/go-toml/v2 v2.2.3
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/mitchellh/reflectwalk v1.0.2
go: downloading github.com/bodgit/plumbing v1.3.0
go: downloading github.com/bodgit/windows v1.0.1
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading go4.org v0.0.0-20230225012048-214862532bf5
go: downloading github.com/hashicorp/golang-lru/v2 v2.0.7
go: downloading golang.org/x/sys v0.30.0
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
go: downloading github.com/hashicorp/errwrap v1.1.0
self-test: reported source file: a key
self-test: reported source file: a 64-hex key
self-test: reported source file: a census-shaped entry
self-test: reported source file: a key marked gitleaks:allow
self-test: reported source file: a test's fake value outside tests
self-test: reported allowed file: another key beside its allowed value
self-test: reported a tracked file named gitleaks-gate-sentinel.env
self-test: reported 100 near misses of the names notscanned.go lists
self-test: skipped the 33 files notscanned.go lists
self-test: refused a notscanned.go entry git does not track
self-test: refused a config that does not parse
self-test: refused a config that does not exist
self-test: refused a missing gitleaks binary
self-test: 6 planted keys reported, 134 tracked files judged, 3 broken setups refused
gitleaks: scanned 11801 tracked files; 33 not scanned, by exact path (scripts/gitleaks-gate/notscanned.go)
gitleaks: clean
diff --git a/.amadan/code-health.tsv b/.amadan/code-health.tsv| index fece09da2..e03de6a10 100644 |
| --- a/.amadan/code-health.tsv |
| +++ b/.amadan/code-health.tsv |
| @@ -2218,7 +2218,7 @@ func-lines internal/registry (*Registry).haJournal - 402 # raised: ha-departure- |
| func-lines internal/release PassFilter - 399 |
| func-lines internal/release adoptHost - 494 |
| func-lines internal/team TestFixture - 421 |
| -file-lines . apimode.go - 4175 |
| +file-lines . apimode.go - 4150 |
| file-lines . apimode_test.go - 3530 # raised: fdc912b (batch 2, #1123) landed before the ratchet; tests for the system update refusals |
| file-lines internal/activator activator.go - 3785 # raised: the Service.ConfigBeforeWake field and doWakeOnce's one call to it (the body lives in configbeforewake.go); before it, #1290 step 2c |
| file-lines internal/activator activator_test.go - 5471 |
diff --git a/account_choose.go b/account_choose.go| index c3d8e65e5..058738862 100644 |
| --- a/account_choose.go |
| +++ b/account_choose.go |
| @@ -69,6 +69,7 @@ func chooserScanner() *bufio.Scanner { |
| // promptLine prints one prompt and reads one trimmed line; EOF answers "". |
| func promptLine(out io.Writer, prompt string) string { |
| + pauseBusyLine() |
| fmt.Fprint(out, prompt) |
| sc := chooserScanner() |
| if !sc.Scan() { |
diff --git a/apimode.go b/apimode.go| index 1276aab9b..cb3b5230d 100644 |
| --- a/apimode.go |
| +++ b/apimode.go |
| @@ -229,52 +229,6 @@ func consoleMoved(from string, status int, location string) *consoleMovedError { |
| return &consoleMovedError{From: from, To: origin} |
| } |
| -// consoleMovedOffered makes the offer once-per-process: polling verbs |
| -// (`logs -f`, authLogin's approval loop) hit the same 3xx every interval, |
| -// and prompting on each would eat the terminal's stdin; and the offer |
| -// itself runs authLogin, whose polls reach these same response sites — the |
| -// guard is also the re-entrancy stop for a redirect chain. After the one |
| -// offer (taken or declined), every further hit is the typed error. |
| -var consoleMovedOffered bool |
| - |
| -// quietConsoleOffers suppresses the offer entirely — set around calls |
| -// whose contract is to degrade silently (whoami's memberships bonus line), |
| -// where even one prompt would make a working command look broken. |
| -var quietConsoleOffers bool |
| - |
| -// offerConsoleMoved is the terminal's version of consoleMovedError: explain |
| -// the move, offer the standard device flow against the new host, and — when |
| -// a .carlos/config names the old console — offer to repoint it (keeping |
| -// every other key, account included: the pair moves together). The verb |
| -// still ends nonzero: its request died against the old host mid-flight, and |
| -// "logged in — re-run your command" is the honest state. |
| -func offerConsoleMoved(e *consoleMovedError) error { |
| - if !interactiveTerminal() || quietConsoleOffers || consoleMovedOffered { |
| - return e |
| - } |
| - consoleMovedOffered = true |
| - fmt.Fprintf(stdout, "this console has moved: %s -> %s\n", e.From, e.To) |
| - if !promptYes(stdout, fmt.Sprintf("log in to %s now? [y/N] ", e.To)) { |
| - return e |
| - } |
| - if err := authLogin(stdout, []string{"--console", e.To}); err != nil { |
| - return err |
| - } |
| - if cfgConsole, src, err := configDefault(); err == nil && cfgConsole == e.From && src != "" { |
| - // The destination is named in the prompt, not only the file: a y |
| - // here changes where future ships go, and that must never rest on |
| - // remembering what the previous prompt said. |
| - if promptYes(stdout, fmt.Sprintf("update %s to point at %s too? [y/N] ", src, e.To)) { |
| - if err := saveConfigFile(src, e.To, 0o755); err != nil { |
| - warnf(stdout, "not updated (%s): %v", src, err) |
| - } else { |
| - mutedf(stdout, "updated: %s now names %s", src, e.To) |
| - } |
| - } |
| - } |
| - return fmt.Errorf("logged in to %s — re-run your command against it", e.To) |
| -} |
| - |
| // errNoDeploymentTarget is resolveMode's "nothing configured at all" |
| // refusal — a var so offerLogin can recognize it by identity rather than |
| // by matching its wording. |
diff --git a/approved_domains_buy_copy_test.go b/approved_domains_buy_copy_test.go| index 722ce45f2..c8baea675 100644 |
| --- a/approved_domains_buy_copy_test.go |
| +++ b/approved_domains_buy_copy_test.go |
| @@ -77,18 +77,48 @@ func TestApprovedDomainsBuyCopy(t *testing.T) { |
| {"cli.contactJSON", "domains_buy_copy.go", "--contact-file must contain one contact JSON object"}, |
| {"cli.contactSize", "domains_buy_copy.go", "--contact-file is too large (maximum 16 KiB)"}, |
| {"cli.contactPrompt", "domains_buy_copy.go", "enter your contact details"}, |
| - {"cli.firstName", "domains_buy_copy.go", "first name: "}, |
| - {"cli.lastName", "domains_buy_copy.go", "last name: "}, |
| - {"cli.company", "domains_buy_copy.go", "company (optional): "}, |
| - {"cli.email", "domains_buy_copy.go", "email: "}, |
| - {"cli.phoneCountryCode", "domains_buy_copy.go", "phone country code (digits only): "}, |
| - {"cli.phone", "domains_buy_copy.go", "phone number (digits only): "}, |
| - {"cli.street", "domains_buy_copy.go", "street: "}, |
| - {"cli.houseNumber", "domains_buy_copy.go", "house number (optional): "}, |
| - {"cli.city", "domains_buy_copy.go", "city: "}, |
| - {"cli.state", "domains_buy_copy.go", "state or province (optional): "}, |
| - {"cli.postalCode", "domains_buy_copy.go", "postal code: "}, |
| - {"cli.country", "domains_buy_copy.go", "country (two uppercase letters): "}, |
| + // The contact prompt labels: Title Case by Paul's ruling, 2026-11-27 |
| + // (cli-contact-prompts). One Phone field replaced the calling code |
| + // and number pair, so cli.phoneCountryCode is gone; the ": " moved |
| + // to the prompt's format (cli.contactField, a draft). |
| + {"cli.firstName", "domains_buy_copy.go", "First Name"}, |
| + {"cli.lastName", "domains_buy_copy.go", "Last Name"}, |
| + {"cli.company", "domains_buy_copy.go", "Company (optional)"}, |
| + {"cli.email", "domains_buy_copy.go", "Email"}, |
| + {"cli.phone", "domains_buy_copy.go", "Phone"}, |
| + {"cli.street", "domains_buy_copy.go", "Street"}, |
| + {"cli.houseNumber", "domains_buy_copy.go", "House Number (optional)"}, |
| + {"cli.city", "domains_buy_copy.go", "City"}, |
| + {"cli.state", "domains_buy_copy.go", "State or Province (optional)"}, |
| + {"cli.postalCode", "domains_buy_copy.go", "Postal Code"}, |
| + {"cli.country", "domains_buy_copy.go", "Country"}, |
| + // The contact form's other strings and the busy line, approved by |
| + // delegation (Luna), 2026-11-27: |
| + // docs/superpowers/specs/LUNA-COPY-RESULT-CONTACT-PROMPTS.md. |
| + {"cli.contactField", "domains_buy_copy.go", "%s: "}, |
| + {"cli.contactFieldDefault", "domains_buy_copy.go", "%s [%s]: "}, |
| + {"cli.contactRequired", "domains_buy_copy.go", "enter a value for %s"}, |
| + {"cli.contactPhoneRequired", "domains_buy_copy.go", "enter a phone number. domain registries require one. for example +353 87 123 4567"}, |
| + {"cli.contactPhoneChars", "domains_buy_copy.go", "use digits, spaces, dashes, dots and brackets. for an international number, start with + and the calling code. for example +353 87 123 4567"}, |
| + {"cli.contactPhoneCode", "domains_buy_copy.go", "start with + and the calling code. for example +353 87 123 4567"}, |
| + {"cli.contactPhoneNumber", "domains_buy_copy.go", "enter the number after the calling code. for example +353 87 123 4567"}, |
| + // Follow-up, approved by delegation (Luna), 2026-11-27: the same |
| + // spec, under its Follow-up heading. |
| + {"cli.contactPhoneLength", "domains_buy_copy.go", "that number is too short or too long. enter it with its calling code, for example +353 87 123 4567"}, |
| + {"cli.contactEmailInvalid", "domains_buy_copy.go", "enter an email address. for example name@example.com"}, |
| + {"cli.contactCountryInvalid", "domains_buy_copy.go", "use the country's two-letter code. for example IE"}, |
| + {"cli.contactPickHeader", "domains_buy_copy.go", "saved contacts:"}, |
| + {"cli.contactPickLine", "domains_buy_copy.go", " %d %s\n"}, |
| + {"cli.contactPickPrompt", "domains_buy_copy.go", "choose a contact by number, or enter n for a new one [1]: "}, |
| + {"cli.contactPickInvalid", "domains_buy_copy.go", "enter a number from 1 to %d, or n for a new contact"}, |
| + {"cli.contactSaveOffer", "domains_buy_copy.go", "save these details as a contact? [Y/n] "}, |
| + {"cli.contactSavedAs", "domains_buy_copy.go", "saved as contact %s. use it next time with --contact %s\n"}, |
| + {"cli.contactSaveFailed", "domains_buy_copy.go", "could not save the contact: %v. save the details below as contact.json, then pass --contact-file contact.json next time:\n"}, |
| + {"cli.spinCheck", "domains_buy_copy.go", "checking %s…"}, |
| + {"cli.spinStartBuy", "domains_buy_copy.go", "starting the purchase…"}, |
| + {"cli.spinStartTransfer", "domains_buy_copy.go", "starting the transfer…"}, |
| + {"cli.spinSaveContact", "domains_buy_copy.go", "saving the contact…"}, |
| + {"cli.spinWait", "domains_buy_copy.go", "waiting for %s…"}, |
| {"cli.inputEnded", "domains_buy_copy.go", "input ended before the answer was complete"}, |
| {"cli.checkout", "domains_buy_copy.go", "checkout: %s\n"}, |
| {"cli.purchaseState", "domains_buy_copy.go", "purchase: %s\n"}, |
diff --git a/cli_spinner.go b/cli_spinner.go| new file mode 100644 |
| index 000000000..411f678d8 |
| --- /dev/null |
| +++ b/cli_spinner.go |
| @@ -0,0 +1,128 @@ |
| +package main |
| + |
| +// A busy line for the CLI's slow calls (`carlos domains buy` and |
| +// `carlos domains transfer`, Paul 2026-11-27): a turning mark and a label on |
| +// stderr, only when stderr is a terminal, so pipes, CI and recorded output |
| +// never see it. The line is cleared when the call ends, before anything |
| +// else is printed or asked, and on an interrupt. |
| + |
| +import ( |
| + "fmt" |
| + "io" |
| + "os" |
| + "os/signal" |
| + "strings" |
| + "sync" |
| + "time" |
| + "unicode/utf8" |
| + |
| + "github.com/mattn/go-isatty" |
| +) |
| + |
| +const spinnerEvery = 120 * time.Millisecond |
| + |
| +// spinnerFrames are ASCII, which every terminal (Windows' among them) draws. |
| +const spinnerFrames = `-\|/` |
| + |
| +// stderrSpinner is the busy line for stderr, or nil when stderr is not a |
| +// terminal: a nil spinner draws nothing (startSpin). |
| +func stderrSpinner() func(string) func() { |
| + return spinnerFor(os.Stderr, isatty.IsTerminal(os.Stderr.Fd())) |
| +} |
| + |
| +// spinnerFor draws on w when terminal says w is one; nil otherwise. |
| +func spinnerFor(w io.Writer, terminal bool) func(string) func() { |
| + if !terminal { |
| + return nil |
| + } |
| + return func(label string) func() { return startLineSpinner(w, label, spinnerEvery, transferCodeSignals) } |
| +} |
| + |
| +// startSpin starts spin's busy line with label and returns what stops it; |
| +// with no spinner, a stop that does nothing. |
| +func startSpin(spin func(string) func(), label string) func() { |
| + if spin == nil { |
| + return func() {} |
| + } |
| + return spin(label) |
| +} |
| + |
| +// busyLine is the busy line drawing now, if any: at most one at a time. |
| +// A prompt or offer reached while it draws (pauseBusyLine) stops and clears |
| +// it first, so nothing is ever drawn over a question: the console-moved |
| +// offer inside an HTTP helper, say, or any promptLine or domainBuyAnswer. |
| +var busyLine struct { |
| + mu sync.Mutex |
| + stop func() |
| + id *int // which line stop is, so a line stopped since is not cleared twice |
| +} |
| + |
| +// pauseBusyLine stops and clears the busy line drawing now, if any. Its |
| +// owner's own stop is then a no-op; the line does not come back. |
| +func pauseBusyLine() { |
| + busyLine.mu.Lock() |
| + stop := busyLine.stop |
| + busyLine.stop, busyLine.id = nil, nil |
| + busyLine.mu.Unlock() |
| + if stop != nil { |
| + stop() |
| + } |
| +} |
| + |
| +// startLineSpinner draws label at once and turns its mark every interval |
| +// until the returned stop is called, which clears the line and returns only |
| +// once nothing more will be written. One of signals clears the line too, |
| +// then is delivered again with its default action, as readTransferCodeTerminal |
| +// does, so Ctrl-C ends the process as it would have, on a clean line. |
| +func startLineSpinner(w io.Writer, label string, every time.Duration, signals []os.Signal) func() { |
| + pauseBusyLine() |
| + width := 2 + utf8.RuneCountInString(label) |
| + blank := "\r" + strings.Repeat(" ", width) + "\r" |
| + fmt.Fprintf(w, "\r%c %s", spinnerFrames[0], label) |
| + sigs := make(chan os.Signal, 1) |
| + if len(signals) > 0 { |
| + signal.Notify(sigs, signals...) |
| + } |
| + stopc, done := make(chan struct{}), make(chan struct{}) |
| + go func() { |
| + defer close(done) |
| + tick := time.NewTicker(every) |
| + defer tick.Stop() |
| + for i := 1; ; i++ { |
| + select { |
| + case <-tick.C: |
| + fmt.Fprintf(w, "\r%c %s", spinnerFrames[i%len(spinnerFrames)], label) |
| + case sig := <-sigs: |
| + io.WriteString(w, blank) |
| + signal.Stop(sigs) |
| + if self, err := os.FindProcess(os.Getpid()); err == nil && self.Signal(sig) != nil { |
| + _ = self.Kill() |
| + } |
| + return |
| + case <-stopc: |
| + io.WriteString(w, blank) |
| + return |
| + } |
| + } |
| + }() |
| + var once sync.Once |
| + stop := func() { |
| + once.Do(func() { |
| + close(stopc) |
| + <-done |
| + signal.Stop(sigs) |
| + }) |
| + } |
| + id := new(int) |
| + busyLine.mu.Lock() |
| + busyLine.stop, busyLine.id = stop, id |
| + busyLine.mu.Unlock() |
| + return func() { |
| + busyLine.mu.Lock() |
| + if busyLine.id == id { |
| + busyLine.stop, busyLine.id = nil, nil |
| + } |
| + busyLine.mu.Unlock() |
| + stop() |
| + } |
| +} |
diff --git a/cli_spinner_test.go b/cli_spinner_test.go| new file mode 100644 |
| index 000000000..403edcc91 |
| --- /dev/null |
| +++ b/cli_spinner_test.go |
| @@ -0,0 +1,135 @@ |
| +package main |
| + |
| +import ( |
| + "bufio" |
| + "bytes" |
| + "context" |
| + "fmt" |
| + "net/http" |
| + "net/http/httptest" |
| + "regexp" |
| + "strings" |
| + "testing" |
| + "time" |
| +) |
| + |
| +// TestSpinnerOffWhenNotATerminal: stderr that is not a terminal gets no |
| +// spinner, and a nil spinner writes nothing at all. |
| +func TestSpinnerOffWhenNotATerminal(t *testing.T) { |
| + var w bytes.Buffer |
| + spin := spinnerFor(&w, false) |
| + if spin != nil { |
| + t.Fatal("a spinner for a non-terminal") |
| + } |
| + startSpin(spin, "checking shop.com…")() |
| + if w.Len() != 0 { |
| + t.Fatalf("wrote %q", w.String()) |
| + } |
| +} |
| + |
| +// TestSpinnerDrawsAndClears: the label is drawn at once, and stop blanks |
| +// the whole line and returns the cursor before anything else is written. |
| +// Stopping twice is harmless. |
| +func TestSpinnerDrawsAndClears(t *testing.T) { |
| + var w bytes.Buffer |
| + stop := startLineSpinner(&w, "checking shop.com…", time.Hour, nil) |
| + stop() |
| + stop() |
| + want := "\r- checking shop.com…" + "\r" + strings.Repeat(" ", 2+len([]rune("checking shop.com…"))) + "\r" |
| + if w.String() != want { |
| + t.Fatalf("got %q want %q", w.String(), want) |
| + } |
| +} |
| + |
| +// TestDomainsBuySpinnerClearedBeforeOutput runs a buy with stdout and the |
| +// spinner on one terminal: every busy line is cleared before the next |
| +// output or prompt, the check, the start and each poll show one, and |
| +// nothing else carries a carriage return. |
| +func TestDomainsBuySpinnerClearedBeforeOutput(t *testing.T) { |
| + polls := 0 |
| + ts := buyTestServer(t, func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment","checkout_url":"https://checkout.example/p1"}`) |
| + }, func(w http.ResponseWriter, r *http.Request) { |
| + polls++ |
| + if polls < 2 { |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment"}`) |
| + return |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"done","domain_state":"live"}`) |
| + }) |
| + var term bytes.Buffer |
| + o := buyTestOptions(&term) |
| + o.yes, o.terminal, o.in = false, true, strings.NewReader("y\n") |
| + o.spin = func(label string) func() { return startLineSpinner(&term, label, time.Hour, nil) } |
| + if err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("%v\n%q", err, term.String()) |
| + } |
| + text := term.String() |
| + busy := regexp.MustCompile(`\r- ([^\r]*)\r( *)\r`) |
| + labels := []string{} |
| + for _, m := range busy.FindAllStringSubmatch(text, -1) { |
| + if len(m[2]) != 2+len([]rune(m[1])) { |
| + t.Errorf("busy line %q cleared with %d spaces", m[1], len(m[2])) |
| + } |
| + labels = append(labels, m[1]) |
| + } |
| + want := []string{"checking shop.com…", "starting the purchase…", "waiting for shop.com…", "waiting for shop.com…"} |
| + if strings.Join(labels, "|") != strings.Join(want, "|") { |
| + t.Errorf("busy lines %q want %q", labels, want) |
| + } |
| + if rest := busy.ReplaceAllString(text, ""); strings.Contains(rest, "\r") { |
| + t.Errorf("a busy line was not cleared before the next output: %q", text) |
| + } |
| + if !strings.Contains(text, "\r"+strings.Repeat(" ", 2+len([]rune("checking shop.com…")))+"\r"+"shop.com: available") { |
| + t.Errorf("the quote must follow the cleared line: %q", text) |
| + } |
| +} |
| + |
| +// TestSpinnerClearedBeforeConsoleMovedOffer: the console-moved offer runs |
| +// inside an HTTP helper, while the caller's busy line draws. It clears the |
| +// line before it speaks, and the caller's own stop afterwards writes |
| +// nothing more. |
| +func TestSpinnerClearedBeforeConsoleMovedOffer(t *testing.T) { |
| + useTempCredentials(t) |
| + clearDeploymentEnv(t) |
| + out := captureStdout(t) |
| + forceTerminal(t, true) |
| + resetMovedOffer(t) |
| + moved := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Location", "https://console.example.test"+r.URL.Path) |
| + w.WriteHeader(http.StatusPermanentRedirect) |
| + })) |
| + t.Cleanup(moved.Close) |
| + oldIn := chooserIn |
| + chooserIn = strings.NewReader("n\n") // log in? no. |
| + t.Cleanup(func() { chooserIn = oldIn }) |
| + |
| + label := "checking shop.com…" |
| + stop := startLineSpinner(out, label, time.Hour, nil) |
| + _, _, err := newTestSession(moved.URL).getJSON(context.Background(), "/api/cli/accounts/bab/domains/contacts") |
| + stop() |
| + if err == nil || !strings.Contains(err.Error(), "this console has moved") { |
| + t.Fatalf("err=%v", err) |
| + } |
| + blank := "\r" + strings.Repeat(" ", 2+len([]rune(label))) + "\r" |
| + want := "\r- " + label + blank + "this console has moved: " |
| + if !strings.HasPrefix(out.String(), want) { |
| + t.Fatalf("the offer was not on a clean line: %q", out.String()) |
| + } |
| + if strings.Count(out.String(), "\r") != 3 { |
| + t.Fatalf("the busy line drew again after the offer: %q", out.String()) |
| + } |
| +} |
| + |
| +// TestSpinnerPausedByPrompt: any prompt reached while a busy line draws |
| +// clears it first. |
| +func TestSpinnerPausedByPrompt(t *testing.T) { |
| + var w bytes.Buffer |
| + stop := startLineSpinner(&w, "saving the contact…", time.Hour, nil) |
| + answer, err := domainBuyAnswer(bufio.NewScanner(strings.NewReader("y\n")), &w, "save? ") |
| + stop() |
| + blank := "\r" + strings.Repeat(" ", 2+len([]rune("saving the contact…"))) + "\r" |
| + if err != nil || answer != "y" || w.String() != "\r- saving the contact…"+blank+"save? " { |
| + t.Fatalf("answer=%q err=%v out=%q", answer, err, w.String()) |
| + } |
| +} |
diff --git a/console_moved.go b/console_moved.go| new file mode 100644 |
| index 000000000..39e8bc96c |
| --- /dev/null |
| +++ b/console_moved.go |
| @@ -0,0 +1,56 @@ |
| +package main |
| + |
| +// The interactive half of a console that has moved (#160): consoleMoved and |
| +// consoleMovedError, in apimode.go, find and word the move; this offers to |
| +// log in to the new host. Split from apimode.go by concern. |
| + |
| +import "fmt" |
| + |
| +// consoleMovedOffered makes the offer once-per-process: polling verbs |
| +// (`logs -f`, authLogin's approval loop) hit the same 3xx every interval, |
| +// and prompting on each would eat the terminal's stdin; and the offer |
| +// itself runs authLogin, whose polls reach these same response sites — the |
| +// guard is also the re-entrancy stop for a redirect chain. After the one |
| +// offer (taken or declined), every further hit is the typed error. |
| +var consoleMovedOffered bool |
| + |
| +// quietConsoleOffers suppresses the offer entirely — set around calls |
| +// whose contract is to degrade silently (whoami's memberships bonus line), |
| +// where even one prompt would make a working command look broken. |
| +var quietConsoleOffers bool |
| + |
| +// offerConsoleMoved is the terminal's version of consoleMovedError: explain |
| +// the move, offer the standard device flow against the new host, and — when |
| +// a .carlos/config names the old console — offer to repoint it (keeping |
| +// every other key, account included: the pair moves together). The verb |
| +// still ends nonzero: its request died against the old host mid-flight, and |
| +// "logged in — re-run your command" is the honest state. |
| +func offerConsoleMoved(e *consoleMovedError) error { |
| + if !interactiveTerminal() || quietConsoleOffers || consoleMovedOffered { |
| + return e |
| + } |
| + consoleMovedOffered = true |
| + // Reached inside an HTTP helper, perhaps under a busy line: clear it |
| + // before speaking. |
| + pauseBusyLine() |
| + fmt.Fprintf(stdout, "this console has moved: %s -> %s\n", e.From, e.To) |
| + if !promptYes(stdout, fmt.Sprintf("log in to %s now? [y/N] ", e.To)) { |
| + return e |
| + } |
| + if err := authLogin(stdout, []string{"--console", e.To}); err != nil { |
| + return err |
| + } |
| + if cfgConsole, src, err := configDefault(); err == nil && cfgConsole == e.From && src != "" { |
| + // The destination is named in the prompt, not only the file: a y |
| + // here changes where future ships go, and that must never rest on |
| + // remembering what the previous prompt said. |
| + if promptYes(stdout, fmt.Sprintf("update %s to point at %s too? [y/N] ", src, e.To)) { |
| + if err := saveConfigFile(src, e.To, 0o755); err != nil { |
| + warnf(stdout, "not updated (%s): %v", src, err) |
| + } else { |
| + mutedf(stdout, "updated: %s now names %s", src, e.To) |
| + } |
| + } |
| + } |
| + return fmt.Errorf("logged in to %s — re-run your command against it", e.To) |
| +} |
diff --git a/docs/superpowers/notes/census-proposal-cli-contact-prompts.md b/docs/superpowers/notes/census-proposal-cli-contact-prompts.md| new file mode 100644 |
| index 000000000..ec04c9ab5 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-cli-contact-prompts.md |
| @@ -0,0 +1,11 @@ |
| +# Census approval: cli-contact-prompts |
| + |
| +Ruling `census-ruling-cli-contact-prompts`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +Envelopes re-pinned: `.`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Seal: `dbdeb2e3a1a89cb8f33584fdb80a3bf1c5adef14ce222fef9d442ed8e059699c` → `dbdeb2e3a1a89cb8f33584fdb80a3bf1c5adef14ce222fef9d442ed8e059699c`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-cli-contact-prompts.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/notes/census-proposal-gvisor-slice1-control-purge.md b/docs/superpowers/notes/census-proposal-gvisor-slice1-control-purge.md| index 9cad24a60..985002ea6 100644 |
| --- a/docs/superpowers/notes/census-proposal-gvisor-slice1-control-purge.md |
| +++ b/docs/superpowers/notes/census-proposal-gvisor-slice1-control-purge.md |
| @@ -34,6 +34,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the |
| - new `internal/instancefs/dirs_linux.go:treeRemover.remove`: reads +file:Fstatat; written legacy, accepted-legacy, frozen |
| - new `internal/instancefs/dirs_linux.go:treeRemover.sameTop`: reads +file:Fstat; written legacy, accepted-legacy, frozen |
| -Seal: `dbdeb2e3a1a89cb8f33584fdb80a3bf1c5adef14ce222fef9d442ed8e059699c` → `a3f8ba38714f1cdeea10b3e5ed4402d290e88cc1cc1f3f3875f446aa46346e82`. |
| +Seal: `dbdeb2e3a1a89cb8f33584fdb80a3bf1c5adef14ce222fef9d442ed8e059699c` → `d7ef97f8418c62f1b248bb121bde3afa54207d5560f5d996577836e18dce5812`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-slice1-control-purge.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/specs/LUNA-COPY-BRIEF-CONTACT-PROMPTS.md b/docs/superpowers/specs/LUNA-COPY-BRIEF-CONTACT-PROMPTS.md| new file mode 100644 |
| index 000000000..06a89432d |
| --- /dev/null |
| +++ b/docs/superpowers/specs/LUNA-COPY-BRIEF-CONTACT-PROMPTS.md |
| @@ -0,0 +1,87 @@ |
| +You are the copy-review gate for this set. Paul delegated copy review to you on 2026-10-25, so your verdicts ARE the review. Do NOT run the copy-review skill or start any server. Do not edit files. |
| + |
| +# Copy pass: carlos domains contact prompts and busy line (CLI) |
| + |
| +`carlos domains buy` and `carlos domains transfer` ask for the registrant's contact details when the account has no usable saved contact. |
| + |
| +The form now does the following: |
| +- It asks one field at a time. Each field shows a default as `Label [value]: `, and Enter keeps it. |
| +- It checks each answer as it is typed. A bad answer prints a reason line and asks the same field again. |
| +- It takes the phone number as one field, after the country, so a number without + uses the country's calling code. |
| +- When no purchase or transfer started, it offers to save what was typed as a contact. |
| + |
| +The form opens with a choice of saved contacts. A busy line (a spinner, on a terminal only, on stderr, cleared before any other output) shows while the CLI waits on the console. |
| + |
| +Reference for the surrounding approved strings: the `domainsBuyCopy` and `domainsTransferCopy` maps in domains_buy_copy.go, on branch cli-contact-prompts, in the worktree /home/paulca/.cache/tmp/cli-contact-prompts. |
| + |
| +## House rules for cli strings |
| + |
| +- Lower case, no final full stop (prompts keep their trailing space; output lines keep their `\n`). |
| +- Plain short words: lead with the state, then what to do. |
| +- No em or en dashes. |
| +- No exclamation marks. |
| +- Keep every placeholder (`%s`, `%d`, `%v`), the same number of each and in the same order. |
| +- Keep command names and flags exactly as written: `--contact`, `--contact-file`, `contact.json`, `[Y/n]`, `n`. |
| +- Example values are data: `+353 87 123 4567`, `name@example.com`, `IE`. |
| +- The `…` in busy lines is the single ellipsis character; keep it or replace it with nothing, never with three dots. |
| + |
| +## Fixed by Paul (do not review) |
| + |
| +The field labels are Title Case (Paul's ruling, 2026-11-27): |
| +- First Name |
| +- Last Name |
| +- Company (optional) |
| +- Street |
| +- House Number (optional) |
| +- City |
| +- State or Province (optional) |
| +- Postal Code |
| +- Country |
| +- Phone |
| + |
| +A label fills `%s` in `contactField` / `contactFieldDefault`. A label also fills `contactRequired`'s `%s`, giving for example `Postal Code is required`. Say if that reads badly, and propose the fix as a new text for `contactRequired` only. |
| + |
| +## Strings to review (key: draft) |
| + |
| +- contactField: `%s: ` |
| +- contactFieldDefault: `%s [%s]: ` |
| +- contactRequired: `%s is required` |
| +- contactPhoneRequired: `a phone number is required, because domain registries need one. for example +353 87 123 4567` |
| +- contactPhoneChars: `use digits, spaces, dashes and brackets, with + before the calling code. for example +353 87 123 4567` |
| +- contactPhoneCode: `start with + and the calling code. for example +353 87 123 4567` |
| +- contactPhoneSplit: `put a space after the calling code. for example +353 87 123 4567` |
| +- contactPhoneNumber: `enter the number after the calling code. for example +353 87 123 4567` |
| +- contactEmailInvalid: `that does not look like an email address. for example name@example.com` |
| +- contactCountryInvalid: `use the country's two-letter code. for example IE` |
| +- contactPickHeader: `saved contacts:` |
| +- contactPickLine: ` %d %s\n` |
| +- contactPickPrompt: `use which contact? a number, or n for a new one [1]: ` |
| +- contactPickInvalid: `enter a number from 1 to %d, or n for a new contact` |
| +- contactSaveOffer: `save these details as a contact? [Y/n] ` |
| +- contactSavedAs: `saved as contact %s. use it next time with --contact %s\n` |
| +- contactSaveFailed: `could not save the contact: %v. to use these details next time, save this as contact.json and pass --contact-file contact.json:\n` (followed by the JSON) |
| +- spinCheck: `checking %s…` (%s is the domain) |
| +- spinStartBuy: `starting the purchase…` |
| +- spinStartTransfer: `starting the transfer…` |
| +- spinSaveContact: `saving the contact…` |
| +- spinWait: `waiting for %s…` (%s is the domain) |
| + |
| +Note: sentences inside one line are joined with ". " and the line stays lower case after the full stop. That is the existing CLI pattern; keep it unless it misleads. |
| + |
| +Answer with a `key | new text | why` table for every key (new text = the draft when you keep it), then a Flags section. |
| + |
| +## Follow-up |
| + |
| +You are the copy-review gate for this set. Paul delegated copy review to you on 2026-10-25, so your verdict IS the review. Do NOT run the copy-review skill or start any server. Do not edit files. |
| + |
| +This is a follow-up to /home/paulca/.cache/cli-contact-prompts/LUNA-BRIEF.md (same CLI contact form; your verdict on it is in LUNA-RESULT.md). The same house rules for cli strings apply. |
| + |
| +Changes since your pass: |
| +- The phone field now accepts any number without a space after the calling code, so `contactPhoneSplit` was removed. |
| +- One new string. It appears when the whole number, calling code included, has fewer than 7 or more than 15 digits: |
| + - contactPhoneLength: `that number is too short or too long. enter it with its calling code, for example +353 87 123 4567` |
| + |
| +Keep it consistent with your approved siblings. For example, contactPhoneRequired reads `enter a phone number. domain registries require one. for example +353 87 123 4567`. |
| + |
| +Answer with a `key | new text | why` row, then Flags. |
diff --git a/docs/superpowers/specs/LUNA-COPY-RESULT-CONTACT-PROMPTS.md b/docs/superpowers/specs/LUNA-COPY-RESULT-CONTACT-PROMPTS.md| new file mode 100644 |
| index 000000000..dd11935e8 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/LUNA-COPY-RESULT-CONTACT-PROMPTS.md |
| @@ -0,0 +1,37 @@ |
| +| key | new text | why | |
| +|---|---|---| |
| +| contactField | `%s: ` | keep | |
| +| contactFieldDefault | `%s [%s]: ` | keep | |
| +| contactRequired | `enter a value for %s` | `Postal Code is required` reads like a heading with Title Case labels; this is more natural and actionable | |
| +| contactPhoneRequired | `enter a phone number. domain registries require one. for example +353 87 123 4567` | clearer action and simpler grammar | |
| +| contactPhoneChars | `use digits, spaces, dashes, dots and brackets. for an international number, start with + and the calling code. for example +353 87 123 4567` | includes dots, which are accepted, and clarifies the international-number rule | |
| +| contactPhoneCode | `start with + and the calling code. for example +353 87 123 4567` | keep | |
| +| contactPhoneSplit | `put a space after the calling code. for example +353 87 123 4567` | keep | |
| +| contactPhoneNumber | `enter the number after the calling code. for example +353 87 123 4567` | keep | |
| +| contactEmailInvalid | `enter an email address. for example name@example.com` | more direct than “that does not look like” | |
| +| contactCountryInvalid | `use the country's two-letter code. for example IE` | keep | |
| +| contactPickHeader | `saved contacts:` | keep | |
| +| contactPickLine | ` %d %s\n` | keep | |
| +| contactPickPrompt | `choose a contact by number, or enter n for a new one [1]: ` | “use which contact?” is unidiomatic | |
| +| contactPickInvalid | `enter a number from 1 to %d, or n for a new contact` | keep | |
| +| contactSaveOffer | `save these details as a contact? [Y/n] ` | keep | |
| +| contactSavedAs | `saved as contact %s. use it next time with --contact %s\n` | keep | |
| +| contactSaveFailed | `could not save the contact: %v. save the details below as contact.json, then pass --contact-file contact.json next time:\n` | makes clear that the JSON below should be saved | |
| +| spinCheck | `checking %s…` | keep | |
| +| spinStartBuy | `starting the purchase…` | keep | |
| +| spinStartTransfer | `starting the transfer…` | keep | |
| +| spinSaveContact | `saving the contact…` | keep | |
| +| spinWait | `waiting for %s…` | keep | |
| + |
| +### Flags |
| + |
| +- P1: none. |
| +- Apply the six copy changes above; the remaining strings pass. |
| +- Placeholders, command names, flags, trailing spaces, newlines, and ellipsis usage are preserved. |
| +- No files were edited. |
| + |
| +## Follow-up |
| + |
| +contactPhoneLength | that number is too short or too long. enter it with its calling code, for example +353 87 123 4567 | Consistent with the approved phone-validation wording and example. |
| + |
| +Flags: none |
diff --git a/domains_account_cli.go b/domains_account_cli.go| index 56bba2e60..32e3e0dcf 100644 |
| --- a/domains_account_cli.go |
| +++ b/domains_account_cli.go |
| @@ -74,24 +74,30 @@ type noContactsDoorError struct{ error } |
| func (e *noContactsDoorError) Unwrap() error { return e.error } |
| -func (s *apiSession) domainContacts(ctx context.Context, acct apiAcct) ([]apiSavedContact, error) { |
| +// apiSavedContacts is the contacts list door's answer: the saved contacts, |
| +// most recently used first, and the account's own billing currency, "" |
| +// while none is set (and from a console that predates the field). |
| +type apiSavedContacts struct { |
| + Contacts []apiSavedContact `json:"contacts"` |
| + BillingCurrency string `json:"billing_currency"` |
| +} |
| + |
| +func (s *apiSession) domainContacts(ctx context.Context, acct apiAcct) (apiSavedContacts, error) { |
| + var out apiSavedContacts |
| status, body, err := s.getJSON(ctx, domainBuyAPIPath(acct, "/contacts")) |
| if err != nil { |
| - return nil, err |
| + return out, err |
| } |
| if status == http.StatusNotFound { |
| - return nil, &noContactsDoorError{apiErrorFromBody(status, body)} |
| + return out, &noContactsDoorError{apiErrorFromBody(status, body)} |
| } |
| if status != http.StatusOK { |
| - return nil, apiErrorFromBody(status, body) |
| - } |
| - var out struct { |
| - Contacts []apiSavedContact `json:"contacts"` |
| + return out, apiErrorFromBody(status, body) |
| } |
| if err := json.Unmarshal(body, &out); err != nil { |
| - return nil, fmt.Errorf(domainsAccountCopy["unreadableContacts"], err) |
| + return apiSavedContacts{}, fmt.Errorf(domainsAccountCopy["unreadableContacts"], err) |
| } |
| - return out.Contacts, nil |
| + return out, nil |
| } |
| // writeDomainContact adds (id "") or edits a saved contact. |
| @@ -129,30 +135,33 @@ func (s *apiSession) removeDomainContact(ctx context.Context, acct apiAcct, id s |
| } |
| // pickSavedContact is the saved contact a buy registers to: id, or with |
| -// id "" the most recently used (the door lists that one first). nil, nil |
| -// is none saved, or a console without the door, where the purchase door |
| -// picks for itself and asks for a contact when it has none (Plan 1). |
| -func pickSavedContact(ctx context.Context, s *apiSession, acct apiAcct, id string) (*apiSavedContact, error) { |
| - contacts, err := s.domainContacts(ctx, acct) |
| +// id "" the most recently used (the door lists that one first), and the |
| +// whole list (every saved contact and the billing currency) for the contact |
| +// form's defaults. A nil contact is none saved, or a console without the |
| +// door, where the purchase door picks for itself and asks for a contact |
| +// when it has none (Plan 1). |
| +func pickSavedContact(ctx context.Context, s *apiSession, acct apiAcct, id string) (*apiSavedContact, apiSavedContacts, error) { |
| + list, err := s.domainContacts(ctx, acct) |
| var missing *noContactsDoorError |
| if errors.As(err, &missing) && id == "" { |
| - return nil, nil |
| + return nil, apiSavedContacts{}, nil |
| } |
| if err != nil { |
| - return nil, err |
| + return nil, apiSavedContacts{}, err |
| } |
| + contacts := list.Contacts |
| if id == "" { |
| if len(contacts) == 0 { |
| - return nil, nil |
| + return nil, list, nil |
| } |
| - return &contacts[0], nil |
| + return &contacts[0], list, nil |
| } |
| for i := range contacts { |
| if contacts[i].ID == id { |
| - return &contacts[i], nil |
| + return &contacts[i], list, nil |
| } |
| } |
| - return nil, fmt.Errorf(domainsAccountCopy["contactUnknown"], id) |
| + return nil, apiSavedContacts{}, fmt.Errorf(domainsAccountCopy["contactUnknown"], id) |
| } |
| // savedContactLabel names a contact in one line: its name, else its |
| @@ -353,10 +362,11 @@ func runDomainsContacts(verb string, args []string) error { |
| } |
| func domainsContactsList(ctx context.Context, s *apiSession, acct apiAcct, out io.Writer) error { |
| - contacts, err := s.domainContacts(ctx, acct) |
| + list, err := s.domainContacts(ctx, acct) |
| if err != nil { |
| return err |
| } |
| + contacts := list.Contacts |
| if len(contacts) == 0 { |
| mutedf(out, "%s", domainsAccountCopy["noContacts"]) |
| return nil |
diff --git a/domains_buy_cli.go b/domains_buy_cli.go| index 72ce1d367..752f0d4a0 100644 |
| --- a/domains_buy_cli.go |
| +++ b/domains_buy_cli.go |
| @@ -75,7 +75,7 @@ func runDomainBuyVerb(args []string, buy bool) { |
| err = domainsBuy(ctx, sess, acct, strings.TrimSpace(pos[0]), app, domainBuyOptions{ |
| yes: yes, noWait: noWait, notYet: notYet, contactFile: contactFile, contactID: contactID, |
| in: os.Stdin, out: stdout, terminal: isatty.IsTerminal(os.Stdin.Fd()), |
| - now: time.Now, wait: waitDomainBuy, |
| + now: time.Now, wait: waitDomainBuy, spin: stderrSpinner(), |
| }) |
| } else { |
| err = domainsCheck(ctx, sess, acct, strings.TrimSpace(pos[0]), country, stdout) |
| @@ -124,32 +124,41 @@ type domainBuyOptions struct { |
| out io.Writer |
| now func() time.Time |
| wait func(context.Context, time.Duration) error |
| + // spin starts the busy line (stderrSpinner) and returns its stop; nil |
| + // draws none, as when stderr is not a terminal. |
| + spin func(label string) (stop func()) |
| } |
| func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app string, o domainBuyOptions) error { |
| o.name, o.app = name, app |
| var contact *registrar.Contact |
| var saved *apiSavedContact |
| + var contacts apiSavedContacts |
| if o.contactFile != "" { |
| var err error |
| contact, err = readContactFile(o.contactFile, buyContactFileErrors) |
| if err != nil { |
| return err |
| } |
| - } else { |
| - var err error |
| - if saved, err = pickSavedContact(ctx, s, acct, o.contactID); err != nil { |
| - return err |
| - } |
| - } |
| - country := "" |
| - switch { |
| - case contact != nil: |
| - country = contact.Country |
| - case saved != nil: |
| - country = saved.Contact.Country |
| } |
| - q, err := s.postDomainCheck(ctx, acct, name, country) |
| + stop := startSpin(o.spin, fmt.Sprintf(domainsBuyCopy["spinCheck"], name)) |
| + q, err := func() (domainQuoteResp, error) { |
| + if contact == nil { |
| + var err error |
| + if saved, contacts, err = pickSavedContact(ctx, s, acct, o.contactID); err != nil { |
| + return domainQuoteResp{}, err |
| + } |
| + } |
| + country := "" |
| + switch { |
| + case contact != nil: |
| + country = contact.Country |
| + case saved != nil: |
| + country = saved.Contact.Country |
| + } |
| + return s.postDomainCheck(ctx, acct, name, country) |
| + }() |
| + stop() |
| if err != nil { |
| return err |
| } |
| @@ -179,13 +188,26 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| } |
| } |
| var p domainPurchaseResp |
| - contactRetried, priceRetried := false, false |
| + contactRetried, priceRetried, typed := false, false, false |
| + // keep ends a purchase that did not start: details typed into the form |
| + // are offered for saving first, after a definite refusal or a declined |
| + // price (err nil) only. An uncertain outcome offers nothing: the start |
| + // may have happened and saved the contact, and the add door does not |
| + // deduplicate. |
| + keep := func(err error) error { |
| + if typed && contact != nil && (err == nil || startDefinitelyRefused(err)) { |
| + offerSaveContact(ctx, s, acct, input, o.out, contact, o.spin) |
| + } |
| + return err |
| + } |
| for { |
| req := domainPurchaseReq{Name: name, App: app, NotYet: o.notYet, Contact: contact} |
| if contact == nil && saved != nil { |
| req.ContactID = saved.ID |
| } |
| + stop := startSpin(o.spin, domainsBuyCopy["spinStartBuy"]) |
| p, err = s.postDomainPurchase(ctx, acct, req, q) |
| + stop() |
| var contactErr *domainContactError |
| var priceErr *domainPriceChangedError |
| if errors.As(err, &contactErr) && !contactRetried { |
| @@ -194,8 +216,14 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| } |
| contactRetried = true |
| fmt.Fprintln(o.out, err) |
| - contact, err = promptDomainContact(input, o.out) |
| - if err != nil { |
| + if o.contactFile != "" { |
| + // The contact file's path has not read the list: read it now, |
| + // for the account's defaults. Best effort: a refusal leaves |
| + // none, and the form still asks. |
| + contacts, _ = s.domainContacts(ctx, acct) |
| + } |
| + known := contactKnown{saved: contacts.Contacts, prefill: contact, email: sessionEmail(s), billingCurrency: contacts.BillingCurrency} |
| + if contact, typed, err = promptDomainContact(input, o.out, known); err != nil { |
| return err |
| } |
| continue |
| @@ -203,12 +231,12 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| if errors.As(err, &priceErr) { |
| printDomainQuote(o.out, priceErr.Quote) |
| if priceRetried { |
| - return err |
| + return keep(err) |
| } |
| priceRetried = true |
| if o.yes { |
| if q.Currency != priceErr.Quote.Currency || q.Price != priceErr.Quote.Price { |
| - return err |
| + return keep(err) |
| } |
| } else { |
| if !o.terminal { |
| @@ -220,14 +248,14 @@ func domainsBuy(ctx context.Context, s *apiSession, acct apiAcct, name, app stri |
| } |
| if !strings.EqualFold(answer, "y") && !strings.EqualFold(answer, "yes") { |
| fmt.Fprintln(o.out, domainsBuyCopy["cancelled"]) |
| - return nil |
| + return keep(nil) |
| } |
| } |
| q = priceErr.Quote |
| continue |
| } |
| if err != nil { |
| - return err |
| + return keep(err) |
| } |
| break |
| } |
| @@ -277,6 +305,7 @@ func readContactFile(path string, words contactFileErrors) (*registrar.Contact, |
| } |
| func domainBuyAnswer(input *bufio.Scanner, out io.Writer, prompt string) (string, error) { |
| + pauseBusyLine() |
| fmt.Fprint(out, prompt) |
| if !input.Scan() { |
| if err := input.Err(); err != nil { |
| @@ -287,27 +316,6 @@ func domainBuyAnswer(input *bufio.Scanner, out io.Writer, prompt string) (string |
| return strings.TrimSpace(input.Text()), nil |
| } |
| -func promptDomainContact(input *bufio.Scanner, out io.Writer) (*registrar.Contact, error) { |
| - fmt.Fprintln(out, domainsBuyCopy["contactPrompt"]) |
| - c := new(registrar.Contact) |
| - for _, field := range []struct { |
| - key string |
| - dst *string |
| - }{ |
| - {"firstName", &c.FirstName}, {"lastName", &c.LastName}, {"company", &c.Company}, |
| - {"email", &c.Email}, {"phoneCountryCode", &c.PhoneCountryCode}, {"phone", &c.Phone}, |
| - {"street", &c.Street}, {"houseNumber", &c.HouseNumber}, {"city", &c.City}, |
| - {"state", &c.State}, {"postalCode", &c.PostalCode}, {"country", &c.Country}, |
| - } { |
| - answer, err := domainBuyAnswer(input, out, domainsBuyCopy[field.key]) |
| - if err != nil { |
| - return nil, err |
| - } |
| - *field.dst = answer |
| - } |
| - return c, nil |
| -} |
| - |
| func waitDomainBuy(ctx context.Context, d time.Duration) error { |
| timer := time.NewTimer(d) |
| defer timer.Stop() |
| @@ -372,10 +380,13 @@ func waitDomainPurchase(ctx context.Context, s *apiSession, acct apiAcct, p doma |
| if id == "" { |
| return errors.New(domainsBuyCopy["missingID"]) |
| } |
| + stop := startSpin(o.spin, fmt.Sprintf(domainsBuyCopy["spinWait"], o.name)) |
| if err := o.wait(ctx, delay); err != nil { |
| + stop() |
| return err |
| } |
| if !doneAt.IsZero() && o.now().Sub(doneAt) >= domainBuyLiveTimeout { |
| + stop() |
| fmt.Fprintln(o.out, domainsBuyCopy["background"]) |
| return nil |
| } |
| @@ -388,6 +399,7 @@ func waitDomainPurchase(ctx context.Context, s *apiSession, acct apiAcct, p doma |
| p, err = s.getDomainPurchase(pollCtx, acct, id) |
| liveTimeout := errors.Is(pollCtx.Err(), context.DeadlineExceeded) && ctx.Err() == nil |
| cancel() |
| + stop() |
| if liveTimeout { |
| fmt.Fprintln(o.out, domainsBuyCopy["background"]) |
| return nil |
diff --git a/domains_buy_cli_test.go b/domains_buy_cli_test.go| index 32c0a25b6..059c260fb 100644 |
| --- a/domains_buy_cli_test.go |
| +++ b/domains_buy_cli_test.go |
| @@ -218,7 +218,7 @@ func TestDomainsBuyContactInputs(t *testing.T) { |
| o.noWait = true |
| if interactive { |
| o.yes, o.terminal = false, true |
| - o.in = strings.NewReader("yes\nAda\nLovelace\n\nada@example.com\n44\n2071234567\nExample Road\n12\nLondon\n\nN1 1AA\nGB\n") |
| + o.in = strings.NewReader("yes\nAda\nLovelace\n\nada@example.com\nExample Road\n12\nLondon\n\nN1 1AA\nGB\n+44 20 7123 4567\n") |
| } else { |
| o.contactFile = filepath.Join(t.TempDir(), "contact.json") |
| if err := os.WriteFile(o.contactFile, []byte(contactJSON), 0600); err != nil { |
| @@ -603,7 +603,7 @@ func TestDomainsBuyChangedPriceAfterContact(t *testing.T) { |
| o.yes = false |
| o.noWait = true |
| o.terminal = true |
| - o.in = strings.NewReader("y\nJane\nBuyer\n\nbuyer@example.test\n353\n871234567\nMain Street\n\nDublin\n\nD01 A123\nIE\ny\n") |
| + o.in = strings.NewReader("y\nJane\nBuyer\n\nbuyer@example.test\nMain Street\n\nDublin\n\nD01 A123\nIE\n087 123 4567\ny\n") |
| if err := domainsBuy(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil || calls != 3 { |
| t.Fatalf("calls=%d err=%v output=%s", calls, err, &out) |
| } |
diff --git a/domains_buy_copy.go b/domains_buy_copy.go| index e4fcfbb1a..d473e4530 100644 |
| --- a/domains_buy_copy.go |
| +++ b/domains_buy_copy.go |
| @@ -54,18 +54,6 @@ var domainsBuyCopy = map[string]string{ |
| "contactJSON": "--contact-file must contain one contact JSON object", |
| "contactSize": "--contact-file is too large (maximum 16 KiB)", |
| "contactPrompt": "enter your contact details", |
| - "firstName": "first name: ", |
| - "lastName": "last name: ", |
| - "company": "company (optional): ", |
| - "email": "email: ", |
| - "phoneCountryCode": "phone country code (digits only): ", |
| - "phone": "phone number (digits only): ", |
| - "street": "street: ", |
| - "houseNumber": "house number (optional): ", |
| - "city": "city: ", |
| - "state": "state or province (optional): ", |
| - "postalCode": "postal code: ", |
| - "country": "country (two uppercase letters): ", |
| "inputEnded": "input ended before the answer was complete", |
| "checkout": "checkout: %s\n", |
| "purchaseState": "purchase: %s\n", |
| @@ -78,6 +66,64 @@ var domainsBuyCopy = map[string]string{ |
| "failedNoReason": "purchase failed. nothing was charged", |
| "expired": "checkout was not completed. nothing was charged", |
| "unpaid": "the domain is registered but the payment did not go through. we will contact you about paying", |
| + |
| + // The contact prompts' labels, in Title Case by Paul's ruling of |
| + // 2026-11-27 (the cli-contact-prompts brief): an exception to the |
| + // lower-case cli.* rule for these labels only. One Phone field replaces |
| + // the calling code and number pair, and Country is asked before it. |
| + "firstName": "First Name", |
| + "lastName": "Last Name", |
| + "company": "Company (optional)", |
| + "email": "Email", |
| + "street": "Street", |
| + "houseNumber": "House Number (optional)", |
| + "city": "City", |
| + "state": "State or Province (optional)", |
| + "postalCode": "Postal Code", |
| + "country": "Country", |
| + "phone": "Phone", |
| + |
| + // The form's other strings, approved by delegation (Luna), 2026-11-27: |
| + // docs/superpowers/specs/LUNA-COPY-RESULT-CONTACT-PROMPTS.md. |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactField": "%s: ", |
| + "contactFieldDefault": "%s [%s]: ", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactRequired": "enter a value for %s", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPhoneRequired": "enter a phone number. domain registries require one. for example +353 87 123 4567", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPhoneChars": "use digits, spaces, dashes, dots and brackets. for an international number, start with + and the calling code. for example +353 87 123 4567", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPhoneCode": "start with + and the calling code. for example +353 87 123 4567", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPhoneNumber": "enter the number after the calling code. for example +353 87 123 4567", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPhoneLength": "that number is too short or too long. enter it with its calling code, for example +353 87 123 4567", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactEmailInvalid": "enter an email address. for example name@example.com", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactCountryInvalid": "use the country's two-letter code. for example IE", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPickHeader": "saved contacts:", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPickLine": " %d %s\n", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPickPrompt": "choose a contact by number, or enter n for a new one [1]: ", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactPickInvalid": "enter a number from 1 to %d, or n for a new contact", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactSaveOffer": "save these details as a contact? [Y/n] ", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactSavedAs": "saved as contact %s. use it next time with --contact %s\n", |
| + // approved by delegation (Luna), 2026-11-27 |
| + "contactSaveFailed": "could not save the contact: %v. save the details below as contact.json, then pass --contact-file contact.json next time:\n", |
| + // approved by delegation (Luna), 2026-11-27: the busy line's labels. |
| + "spinCheck": "checking %s…", |
| + "spinStartBuy": "starting the purchase…", |
| + "spinStartTransfer": "starting the transfer…", |
| + "spinSaveContact": "saving the contact…", |
| + "spinWait": "waiting for %s…", |
| } |
| // Approved by delegation (Luna), 2026-11-19: |
diff --git a/domains_calling_codes.go b/domains_calling_codes.go| new file mode 100644 |
| index 000000000..821171810 |
| --- /dev/null |
| +++ b/domains_calling_codes.go |
| @@ -0,0 +1,84 @@ |
| +package main |
| + |
| +// callingCodes are the ITU-T E.164 country calling codes (ITU-T E.164 |
| +// Annex to Operational Bulletin, "List of ITU-T Recommendation E.164 |
| +// assigned country codes"), by ISO 3166-1 alpha-2 code, plus Kosovo (XK). |
| +// The North American Numbering Plan's members share 1 (their area code is |
| +// part of the number), Kazakhstan shares Russia's 7, and the Vatican dials |
| +// as Italy, 39. Codes are prefix-free, so a number's code is the one entry |
| +// it starts with (callingCodeOf); TestCallingCodesArePrefixFree holds that. |
| +// No dependency: this is the whole table. |
| +var callingCodes = map[string]string{ |
| + "AD": "376", "AE": "971", "AF": "93", "AG": "1", "AI": "1", "AL": "355", "AM": "374", "AO": "244", |
| + "AR": "54", "AS": "1", "AT": "43", "AU": "61", "AW": "297", "AX": "358", "AZ": "994", |
| + "BA": "387", "BB": "1", "BD": "880", "BE": "32", "BF": "226", "BG": "359", "BH": "973", "BI": "257", |
| + "BJ": "229", "BL": "590", "BM": "1", "BN": "673", "BO": "591", "BQ": "599", "BR": "55", "BS": "1", |
| + "BT": "975", "BW": "267", "BY": "375", "BZ": "501", |
| + "CA": "1", "CC": "61", "CD": "243", "CF": "236", "CG": "242", "CH": "41", "CI": "225", "CK": "682", |
| + "CL": "56", "CM": "237", "CN": "86", "CO": "57", "CR": "506", "CU": "53", "CV": "238", "CW": "599", |
| + "CX": "61", "CY": "357", "CZ": "420", |
| + "DE": "49", "DJ": "253", "DK": "45", "DM": "1", "DO": "1", "DZ": "213", |
| + "EC": "593", "EE": "372", "EG": "20", "EH": "212", "ER": "291", "ES": "34", "ET": "251", |
| + "FI": "358", "FJ": "679", "FK": "500", "FM": "691", "FO": "298", "FR": "33", |
| + "GA": "241", "GB": "44", "GD": "1", "GE": "995", "GF": "594", "GG": "44", "GH": "233", "GI": "350", |
| + "GL": "299", "GM": "220", "GN": "224", "GP": "590", "GQ": "240", "GR": "30", "GS": "500", "GT": "502", |
| + "GU": "1", "GW": "245", "GY": "592", |
| + "HK": "852", "HN": "504", "HR": "385", "HT": "509", "HU": "36", |
| + "ID": "62", "IE": "353", "IL": "972", "IM": "44", "IN": "91", "IO": "246", "IQ": "964", "IR": "98", |
| + "IS": "354", "IT": "39", |
| + "JE": "44", "JM": "1", "JO": "962", "JP": "81", |
| + "KE": "254", "KG": "996", "KH": "855", "KI": "686", "KM": "269", "KN": "1", "KP": "850", "KR": "82", |
| + "KW": "965", "KY": "1", "KZ": "7", |
| + "LA": "856", "LB": "961", "LC": "1", "LI": "423", "LK": "94", "LR": "231", "LS": "266", "LT": "370", |
| + "LU": "352", "LV": "371", "LY": "218", |
| + "MA": "212", "MC": "377", "MD": "373", "ME": "382", "MF": "590", "MG": "261", "MH": "692", "MK": "389", |
| + "ML": "223", "MM": "95", "MN": "976", "MO": "853", "MP": "1", "MQ": "596", "MR": "222", "MS": "1", |
| + "MT": "356", "MU": "230", "MV": "960", "MW": "265", "MX": "52", "MY": "60", "MZ": "258", |
| + "NA": "264", "NC": "687", "NE": "227", "NF": "672", "NG": "234", "NI": "505", "NL": "31", "NO": "47", |
| + "NP": "977", "NR": "674", "NU": "683", "NZ": "64", |
| + "OM": "968", |
| + "PA": "507", "PE": "51", "PF": "689", "PG": "675", "PH": "63", "PK": "92", "PL": "48", "PM": "508", |
| + "PN": "64", "PR": "1", "PS": "970", "PT": "351", "PW": "680", "PY": "595", |
| + "QA": "974", |
| + "RE": "262", "RO": "40", "RS": "381", "RU": "7", "RW": "250", |
| + "SA": "966", "SB": "677", "SC": "248", "SD": "249", "SE": "46", "SG": "65", "SH": "290", "SI": "386", |
| + "SJ": "47", "SK": "421", "SL": "232", "SM": "378", "SN": "221", "SO": "252", "SR": "597", "SS": "211", |
| + "ST": "239", "SV": "503", "SX": "1", "SY": "963", "SZ": "268", |
| + "TC": "1", "TD": "235", "TG": "228", "TH": "66", "TJ": "992", "TK": "690", "TL": "670", "TM": "993", |
| + "TN": "216", "TO": "676", "TR": "90", "TT": "1", "TV": "688", "TW": "886", "TZ": "255", |
| + "UA": "380", "UG": "256", "US": "1", "UY": "598", "UZ": "998", |
| + "VA": "39", "VC": "1", "VE": "58", "VG": "1", "VI": "1", "VN": "84", "VU": "678", |
| + "WF": "681", "WS": "685", |
| + "XK": "383", |
| + "YE": "967", "YT": "262", |
| + "ZA": "27", "ZM": "260", "ZW": "263", |
| +} |
| + |
| +// codeOnlyCallingCodes are assigned geographic codes with no ISO 3166-1 |
| +// country of their own: Ascension (247) dials apart from Saint Helena (290), |
| +// whose country code SH it shares. |
| +var codeOnlyCallingCodes = []string{"247"} |
| + |
| +// knownCallingCodes is every distinct code in callingCodes, and the |
| +// code-only ones. |
| +var knownCallingCodes = func() map[string]bool { |
| + m := map[string]bool{} |
| + for _, code := range callingCodes { |
| + m[code] = true |
| + } |
| + for _, code := range codeOnlyCallingCodes { |
| + m[code] = true |
| + } |
| + return m |
| +}() |
| + |
| +// callingCodeOf is the calling code digits start with, by longest prefix |
| +// (codes are one to three digits), or "" when none is assigned. |
| +func callingCodeOf(digits string) string { |
| + for n := min(3, len(digits)); n >= 1; n-- { |
| + if knownCallingCodes[digits[:n]] { |
| + return digits[:n] |
| + } |
| + } |
| + return "" |
| +} |
diff --git a/domains_contact_prompt.go b/domains_contact_prompt.go| new file mode 100644 |
| index 000000000..caea2edad |
| --- /dev/null |
| +++ b/domains_contact_prompt.go |
| @@ -0,0 +1,377 @@ |
| +package main |
| + |
| +// The contact form `carlos domains buy` and `carlos domains transfer` ask |
| +// when the console wants a contact (cli-contact-prompts, Paul 2026-11-27). |
| +// Each answer is checked as it is typed and asked again with a reason when |
| +// it is wrong, so one bad field never costs the rest. Known values are |
| +// offered as defaults: a saved contact picked first, else the contact file |
| +// the console refused, else the signed-in address and a country inferred |
| +// from the account's billing currency, when one is set. Details typed here and not used by a started |
| +// purchase are offered for saving (offerSaveContact). |
| + |
| +import ( |
| + "bufio" |
| + "context" |
| + "encoding/json" |
| + "errors" |
| + "fmt" |
| + "io" |
| + "strconv" |
| + "strings" |
| + |
| + "github.com/carlosframework/platform/internal/registrar" |
| +) |
| + |
| +// contactKnown is what the form can offer as defaults. |
| +type contactKnown struct { |
| + saved []apiSavedContact // the account's saved contacts, most recent first |
| + prefill *registrar.Contact // a contact already given (a refused --contact-file) |
| + email string // the signed-in address, when it is one |
| + // billingCurrency is the account's own billing currency, for a |
| + // last-resort country: "" when none is set. Never the quote's currency, |
| + // which for such an account is only the price book's default. |
| + billingCurrency string |
| +} |
| + |
| +// keepsTrunkZero are the calling codes whose numbers keep their leading 0 |
| +// after the code: Italy's (+39 06 ...). |
| +var keepsTrunkZero = map[string]bool{"39": true} |
| + |
| +// currencyCountry is the one country an account's billing currency names, |
| +// the last source of a default country. The euro names many, so none. |
| +var currencyCountry = map[string]string{"gbp": "GB", "usd": "US"} |
| + |
| +// serverValidContact passes registrar.Contact.Validate, the rule the |
| +// console applies to every contact. A field is required when blanking it |
| +// here fails that rule (contactFieldRequired): the CLI asks for what the |
| +// server asks for and invents nothing. |
| +var serverValidContact = registrar.Contact{FirstName: "A", LastName: "B", Email: "a@example.com", |
| + PhoneCountryCode: "1", Phone: "5550100", Street: "S", City: "C", PostalCode: "P", Country: "US"} |
| + |
| +func contactFieldRequired(set func(*registrar.Contact, string)) bool { |
| + c := serverValidContact |
| + set(&c, "") |
| + return c.Validate() != nil |
| +} |
| + |
| +// contactField is one question of the form: its label, the default it |
| +// shows for a known contact, and apply, which checks an answer and writes |
| +// it, or says why it is wrong. |
| +type contactField struct { |
| + key string |
| + shown func(registrar.Contact) string |
| + apply func(c *registrar.Contact, answer string) error |
| +} |
| + |
| +func plainContactField(key string, get func(*registrar.Contact) *string) contactField { |
| + return contactField{key: key, |
| + shown: func(c registrar.Contact) string { return *get(&c) }, |
| + apply: func(c *registrar.Contact, answer string) error { |
| + answer = strings.TrimSpace(answer) |
| + if answer == "" && contactFieldRequired(func(c *registrar.Contact, v string) { *get(c) = v }) { |
| + return fmt.Errorf(domainsBuyCopy["contactRequired"], strings.ToLower(domainsBuyCopy[key])) |
| + } |
| + *get(c) = answer |
| + return nil |
| + }} |
| +} |
| + |
| +// contactFields is the form in order: the country comes before the phone, |
| +// so a number typed without its calling code takes the country's. |
| +var contactFields = []contactField{ |
| + plainContactField("firstName", func(c *registrar.Contact) *string { return &c.FirstName }), |
| + plainContactField("lastName", func(c *registrar.Contact) *string { return &c.LastName }), |
| + plainContactField("company", func(c *registrar.Contact) *string { return &c.Company }), |
| + {key: "email", shown: func(c registrar.Contact) string { return c.Email }, apply: applyContactEmail}, |
| + plainContactField("street", func(c *registrar.Contact) *string { return &c.Street }), |
| + plainContactField("houseNumber", func(c *registrar.Contact) *string { return &c.HouseNumber }), |
| + plainContactField("city", func(c *registrar.Contact) *string { return &c.City }), |
| + plainContactField("state", func(c *registrar.Contact) *string { return &c.State }), |
| + plainContactField("postalCode", func(c *registrar.Contact) *string { return &c.PostalCode }), |
| + {key: "country", shown: func(c registrar.Contact) string { return c.Country }, apply: applyContactCountry}, |
| + {key: "phone", shown: shownContactPhone, apply: applyContactPhone}, |
| +} |
| + |
| +func applyContactEmail(c *registrar.Contact, answer string) error { |
| + answer = strings.TrimSpace(answer) |
| + if answer == "" { |
| + return fmt.Errorf(domainsBuyCopy["contactRequired"], strings.ToLower(domainsBuyCopy["email"])) |
| + } |
| + if !looksLikeEmail(answer) { |
| + return errors.New(domainsBuyCopy["contactEmailInvalid"]) |
| + } |
| + c.Email = answer |
| + return nil |
| +} |
| + |
| +// looksLikeEmail is a shape check, not a delivery check, kept loose enough |
| +// to take what the server takes: split at the last @, a local part that is |
| +// not empty (a quoted one, "a b" or "a@b", may hold spaces and @), and a |
| +// dotted domain with no spaces. No control characters anywhere. |
| +func looksLikeEmail(s string) bool { |
| + if len(s) > 254 || strings.ContainsFunc(s, func(r rune) bool { return r < ' ' || r == 0x7f }) { |
| + return false |
| + } |
| + at := strings.LastIndexByte(s, '@') |
| + if at < 0 { |
| + return false |
| + } |
| + local, domain := s[:at], s[at+1:] |
| + quoted := len(local) >= 2 && local[0] == '"' && local[len(local)-1] == '"' |
| + if local == "" || (!quoted && strings.ContainsAny(local, " @")) { |
| + return false |
| + } |
| + dot := strings.LastIndexByte(domain, '.') |
| + return dot > 0 && dot < len(domain)-1 && !strings.Contains(domain, " ") && !strings.Contains(domain, "..") && domain[0] != '.' |
| +} |
| + |
| +func applyContactCountry(c *registrar.Contact, answer string) error { |
| + answer = strings.ToUpper(strings.TrimSpace(answer)) |
| + if answer == "" { |
| + return fmt.Errorf(domainsBuyCopy["contactRequired"], strings.ToLower(domainsBuyCopy["country"])) |
| + } |
| + if len(answer) != 2 || answer[0] < 'A' || answer[0] > 'Z' || answer[1] < 'A' || answer[1] > 'Z' { |
| + return errors.New(domainsBuyCopy["contactCountryInvalid"]) |
| + } |
| + c.Country = answer |
| + return nil |
| +} |
| + |
| +func shownContactPhone(c registrar.Contact) string { |
| + if c.PhoneCountryCode == "" || c.Phone == "" { |
| + return "" |
| + } |
| + return "+" + c.PhoneCountryCode + " " + c.Phone |
| +} |
| + |
| +func applyContactPhone(c *registrar.Contact, answer string) error { |
| + code, number, err := parseContactPhone(answer, c.Country) |
| + if err != nil { |
| + return err |
| + } |
| + c.PhoneCountryCode, c.Phone = code, number |
| + return nil |
| +} |
| + |
| +// parseContactPhone splits one phone answer into the calling code and the |
| +// number the registrar takes, digits only. Spaces, dashes, dots and |
| +// brackets may separate the digits, anywhere. With + (or 00) the calling |
| +// code is the assigned one the digits start with (callingCodeOf), however |
| +// they are spaced; an unassigned one is refused. Without, the code is |
| +// country's. The trunk 0 after the code (087 in Ireland, +353 (0)87) is |
| +// dropped, except where the number keeps it (keepsTrunkZero). The whole |
| +// number, code included, must be 7 to 15 digits: E.164 allows 15, and the |
| +// smallest plans (Saint Helena, Niue) have 7. |
| +func parseContactPhone(answer, country string) (code, number string, err error) { |
| + s := strings.TrimSpace(answer) |
| + if s == "" { |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneRequired"]) |
| + } |
| + international := false |
| + switch { |
| + case strings.HasPrefix(s, "+"): |
| + international, s = true, s[1:] |
| + case strings.HasPrefix(s, "00"): |
| + international, s = true, s[2:] |
| + } |
| + var digits strings.Builder |
| + for _, r := range s { |
| + switch { |
| + case r >= '0' && r <= '9': |
| + digits.WriteRune(r) |
| + case r == ' ' || r == '-' || r == '.' || r == '(' || r == ')': |
| + default: |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneChars"]) |
| + } |
| + } |
| + all := digits.String() |
| + if international { |
| + if all == "" { |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneNumber"]) |
| + } |
| + if code = callingCodeOf(all); code == "" { |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneCode"]) |
| + } |
| + number = all[len(code):] |
| + } else { |
| + if code = callingCodes[strings.ToUpper(country)]; code == "" { |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneCode"]) |
| + } |
| + number = all |
| + } |
| + if !keepsTrunkZero[code] { |
| + number = strings.TrimLeft(number, "0") |
| + } |
| + if number == "" { |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneNumber"]) |
| + } |
| + if n := len(code) + len(number); n < 7 || n > 15 { |
| + return "", "", errors.New(domainsBuyCopy["contactPhoneLength"]) |
| + } |
| + return code, number, nil |
| +} |
| + |
| +// promptDomainContact asks for a contact. typed is false when a saved |
| +// contact was picked and used as it is; true when the details went through |
| +// the form, and so are not saved anywhere until a purchase starts. |
| +// |
| +// The defaults are merged field by field (mergeContactDefaults), first |
| +// known wins. A refused contact file is filled in only from the account |
| +// (the signed-in address, then the country the billing currency names), |
| +// never from a saved contact: that is someone else's details. Without a |
| +// file, the first question picks a saved contact (Enter is the most |
| +// recent), filled in from the account the same way; a new contact has |
| +// only the account's two. |
| +func promptDomainContact(input *bufio.Scanner, out io.Writer, known contactKnown) (c *registrar.Contact, typed bool, err error) { |
| + account := registrar.Contact{Email: known.email, Country: currencyCountry[strings.ToLower(known.billingCurrency)]} |
| + var prefill registrar.Contact |
| + switch { |
| + case known.prefill != nil: |
| + prefill = mergeContactDefaults(*known.prefill, account) |
| + case len(known.saved) > 0: |
| + picked, err := pickContactPrompt(input, out, known.saved) |
| + if err != nil { |
| + return nil, false, err |
| + } |
| + if picked == nil { |
| + prefill = account |
| + break |
| + } |
| + // A saved contact every check passes is used as it is; one that |
| + // fails some walks the form with its values as defaults. |
| + if ok, valid := checkedContact(*picked); ok { |
| + return &valid, false, nil |
| + } |
| + prefill = mergeContactDefaults(*picked, account) |
| + default: |
| + prefill = account |
| + } |
| + fmt.Fprintln(out, domainsBuyCopy["contactPrompt"]) |
| + c = new(registrar.Contact) |
| + for _, f := range contactFields { |
| + def := f.shown(prefill) |
| + for { |
| + prompt := fmt.Sprintf(domainsBuyCopy["contactField"], domainsBuyCopy[f.key]) |
| + if def != "" { |
| + prompt = fmt.Sprintf(domainsBuyCopy["contactFieldDefault"], domainsBuyCopy[f.key], def) |
| + } |
| + answer, err := domainBuyAnswer(input, out, prompt) |
| + if err != nil { |
| + return nil, true, err |
| + } |
| + if answer == "" { |
| + answer = def |
| + } |
| + if err := f.apply(c, answer); err != nil { |
| + fmt.Fprintln(out, err) |
| + continue |
| + } |
| + break |
| + } |
| + } |
| + return c, true, nil |
| +} |
| + |
| +// mergeContactDefaults is each field's first non-blank value across |
| +// sources, in order. The phone's code and number travel as a pair, from |
| +// the first source that has both. |
| +func mergeContactDefaults(sources ...registrar.Contact) registrar.Contact { |
| + var out registrar.Contact |
| + first := func(get func(*registrar.Contact) *string) { |
| + for i := range sources { |
| + if v := strings.TrimSpace(*get(&sources[i])); v != "" { |
| + *get(&out) = v |
| + return |
| + } |
| + } |
| + } |
| + for _, get := range []func(*registrar.Contact) *string{ |
| + func(c *registrar.Contact) *string { return &c.FirstName }, func(c *registrar.Contact) *string { return &c.LastName }, |
| + func(c *registrar.Contact) *string { return &c.Company }, func(c *registrar.Contact) *string { return &c.Email }, |
| + func(c *registrar.Contact) *string { return &c.Street }, func(c *registrar.Contact) *string { return &c.HouseNumber }, |
| + func(c *registrar.Contact) *string { return &c.City }, func(c *registrar.Contact) *string { return &c.State }, |
| + func(c *registrar.Contact) *string { return &c.PostalCode }, func(c *registrar.Contact) *string { return &c.Country }, |
| + } { |
| + first(get) |
| + } |
| + for _, src := range sources { |
| + if src.PhoneCountryCode != "" && src.Phone != "" { |
| + out.PhoneCountryCode, out.Phone = src.PhoneCountryCode, src.Phone |
| + break |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// checkedContact runs every field's check over a known contact, as if each |
| +// default were accepted. |
| +func checkedContact(known registrar.Contact) (bool, registrar.Contact) { |
| + var c registrar.Contact |
| + for _, f := range contactFields { |
| + if f.apply(&c, f.shown(known)) != nil { |
| + return false, registrar.Contact{} |
| + } |
| + } |
| + return true, c |
| +} |
| + |
| +// pickContactPrompt lists the saved contacts and asks which; Enter is the |
| +// first, the most recently used. nil is a new contact. |
| +func pickContactPrompt(input *bufio.Scanner, out io.Writer, saved []apiSavedContact) (*registrar.Contact, error) { |
| + fmt.Fprintln(out, domainsBuyCopy["contactPickHeader"]) |
| + for i, sc := range saved { |
| + fmt.Fprintf(out, domainsBuyCopy["contactPickLine"], i+1, savedContactLabel(sc.Contact)) |
| + } |
| + for { |
| + answer, err := domainBuyAnswer(input, out, domainsBuyCopy["contactPickPrompt"]) |
| + if err != nil { |
| + return nil, err |
| + } |
| + if answer == "" { |
| + answer = "1" |
| + } |
| + if strings.EqualFold(answer, "n") || strings.EqualFold(answer, "new") { |
| + return nil, nil |
| + } |
| + if n, err := strconv.Atoi(answer); err == nil && n >= 1 && n <= len(saved) { |
| + c := saved[n-1].Contact |
| + return &c, nil |
| + } |
| + fmt.Fprintln(out, fmt.Sprintf(domainsBuyCopy["contactPickInvalid"], len(saved))) |
| + } |
| +} |
| + |
| +// sessionEmail is the signed-in address as a default for Email: "" for a |
| +// service credential or anything that is not an address. |
| +func sessionEmail(s *apiSession) string { |
| + if s == nil || !looksLikeEmail(s.address) { |
| + return "" |
| + } |
| + return s.address |
| +} |
| + |
| +// offerSaveContact keeps details typed into the form when no purchase or |
| +// transfer started with them (a start saves its contact itself): it offers |
| +// to save them as a contact, so the next run can name it with --contact. |
| +// When saving fails, the details are printed as a contact file instead, so |
| +// they are never lost without a word. Input that has ended asks nothing. |
| +func offerSaveContact(ctx context.Context, s *apiSession, acct apiAcct, input *bufio.Scanner, out io.Writer, c *registrar.Contact, spin func(string) func()) { |
| + answer, err := domainBuyAnswer(input, out, domainsBuyCopy["contactSaveOffer"]) |
| + if err != nil { |
| + fmt.Fprintln(out) |
| + return |
| + } |
| + if answer != "" && !strings.EqualFold(answer, "y") && !strings.EqualFold(answer, "yes") { |
| + return |
| + } |
| + stop := startSpin(spin, domainsBuyCopy["spinSaveContact"]) |
| + sc, err := s.writeDomainContact(ctx, acct, "", c) |
| + stop() |
| + if err != nil { |
| + fmt.Fprintf(out, domainsBuyCopy["contactSaveFailed"], err) |
| + data, _ := json.MarshalIndent(c, "", " ") |
| + fmt.Fprintln(out, string(data)) |
| + return |
| + } |
| + fmt.Fprintf(out, domainsBuyCopy["contactSavedAs"], sc.ID, sc.ID) |
| +} |
diff --git a/domains_contact_prompt_test.go b/domains_contact_prompt_test.go| new file mode 100644 |
| index 000000000..c8b001eb1 |
| --- /dev/null |
| +++ b/domains_contact_prompt_test.go |
| @@ -0,0 +1,665 @@ |
| +package main |
| + |
| +import ( |
| + "bufio" |
| + "bytes" |
| + "context" |
| + "encoding/json" |
| + "fmt" |
| + "net/http" |
| + "net/http/httptest" |
| + "path/filepath" |
| + "strings" |
| + "sync" |
| + "testing" |
| + |
| + "github.com/carlosframework/platform/internal/registrar" |
| +) |
| + |
| +func TestDomainsContactPhoneParse(t *testing.T) { |
| + for _, tc := range []struct { |
| + in, country, code, number, err string |
| + }{ |
| + {in: "+353 87 123 4567", code: "353", number: "871234567"}, |
| + {in: "087 123 4567", country: "IE", code: "353", number: "871234567"}, |
| + {in: "087-123-4567", country: "ie", code: "353", number: "871234567"}, |
| + {in: "+353 (0)87 123-4567", code: "353", number: "871234567"}, |
| + {in: "+3538712345 67", code: "353", number: "871234567"}, |
| + {in: "+353871234567", code: "353", number: "871234567"}, |
| + {in: "0035387 1234567", code: "353", number: "871234567"}, |
| + {in: "+1 (555) 010-0123", code: "1", number: "5550100123"}, |
| + {in: "+15550100123", code: "1", number: "5550100123"}, |
| + {in: "(555) 010.0123", country: "US", code: "1", number: "5550100123"}, |
| + {in: "020 7123 4567", country: "GB", code: "44", number: "2071234567"}, |
| + {in: "+44 (0)20 7123 4567", country: "IE", code: "44", number: "2071234567"}, |
| + {in: "06 1234 5678", country: "IT", code: "39", number: "0612345678"}, |
| + {in: "+39 06 1234 5678", code: "39", number: "0612345678"}, |
| + {in: "+81 3 1234 5678", code: "81", number: "312345678"}, |
| + {in: "", country: "IE", err: "contactPhoneRequired"}, |
| + {in: " ", country: "IE", err: "contactPhoneRequired"}, |
| + {in: "3 1234 5678", country: "JP", code: "81", number: "312345678"}, |
| + {in: "87 123 4567", err: "contactPhoneCode"}, |
| + // The code is found by its digits, however they are spaced. |
| + {in: "+81312345678", code: "81", number: "312345678"}, |
| + {in: "+120 2555 0123", code: "1", number: "2025550123"}, |
| + {in: "+1 202 555 0123", country: "IE", code: "1", number: "2025550123"}, |
| + {in: "+44 7700 900123", code: "44", number: "7700900123"}, |
| + {in: "+7 495 123 45 67", code: "7", number: "4951234567"}, |
| + {in: "+380 44 123 4567", code: "380", number: "441234567"}, |
| + {in: "044 123 4567", country: "UA", code: "380", number: "441234567"}, |
| + {in: "+999 123", err: "contactPhoneCode"}, |
| + {in: "+999123456789", err: "contactPhoneCode"}, |
| + {in: "+0 87 123 4567", err: "contactPhoneCode"}, |
| + {in: "87 123 4567", country: "AQ", err: "contactPhoneCode"}, |
| + // The whole number, code included, is 7 to 15 digits; the |
| + // smallest plans pass. |
| + {in: "+290 2345", code: "290", number: "2345"}, |
| + {in: "+683 4002", code: "683", number: "4002"}, |
| + {in: "+353 87 1", err: "contactPhoneLength"}, |
| + {in: "+353 87 123 4567 8901", err: "contactPhoneLength"}, |
| + {in: "+353 871 234 567 890", code: "353", number: "871234567890"}, |
| + {in: "0871", country: "IE", err: "contactPhoneLength"}, |
| + {in: "087 ABC 4567", country: "IE", err: "contactPhoneChars"}, |
| + {in: "+353 87 123 4567 ext 2", err: "contactPhoneChars"}, |
| + {in: "+353", err: "contactPhoneNumber"}, |
| + {in: "+353 0", err: "contactPhoneNumber"}, |
| + {in: "+", err: "contactPhoneNumber"}, |
| + } { |
| + t.Run(tc.in+"/"+tc.country, func(t *testing.T) { |
| + code, number, err := parseContactPhone(tc.in, tc.country) |
| + if tc.err != "" { |
| + if err == nil || err.Error() != domainsBuyCopy[tc.err] { |
| + t.Fatalf("err=%v want %q", err, domainsBuyCopy[tc.err]) |
| + } |
| + return |
| + } |
| + if err != nil || code != tc.code || number != tc.number { |
| + t.Fatalf("got %q %q %v, want %q %q", code, number, err, tc.code, tc.number) |
| + } |
| + // What the parse gives, the server takes. |
| + c := serverValidContact |
| + c.PhoneCountryCode, c.Phone = code, number |
| + if err := c.Validate(); err != nil { |
| + t.Fatalf("server refuses the parsed phone: %v", err) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestDomainsContactFieldChecks(t *testing.T) { |
| + field := func(key string) contactField { |
| + for _, f := range contactFields { |
| + if f.key == key { |
| + return f |
| + } |
| + } |
| + t.Fatalf("no field %s", key) |
| + return contactField{} |
| + } |
| + required := func(key string) string { |
| + return fmt.Sprintf(domainsBuyCopy["contactRequired"], strings.ToLower(domainsBuyCopy[key])) |
| + } |
| + for _, tc := range []struct { |
| + key, in, want, err string |
| + }{ |
| + {key: "firstName", in: " Paul ", want: "Paul"}, |
| + {key: "firstName", in: "", err: required("firstName")}, |
| + {key: "lastName", in: "", err: required("lastName")}, |
| + {key: "company", in: "", want: ""}, |
| + {key: "houseNumber", in: "", want: ""}, |
| + {key: "state", in: "", want: ""}, |
| + {key: "street", in: "", err: required("street")}, |
| + {key: "city", in: "", err: required("city")}, |
| + {key: "postalCode", in: "", err: required("postalCode")}, |
| + {key: "postalCode", in: "D01 A123", want: "D01 A123"}, |
| + {key: "email", in: "paul@example.com", want: "paul@example.com"}, |
| + {key: "email", in: "p.c+domains@mail.example.ie", want: "p.c+domains@mail.example.ie"}, |
| + {key: "email", in: "", err: required("email")}, |
| + {key: "email", in: "paul", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: "paul@example", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: "@example.com", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: "paul@@example.com", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + // Quoted local parts, which the server takes, may hold @ and spaces; |
| + // the address splits at its last @. |
| + {key: "email", in: `"a@b"@example.com`, want: `"a@b"@example.com`}, |
| + {key: "email", in: `"a b"@example.com`, want: `"a b"@example.com`}, |
| + {key: "email", in: `"a b"@example .com`, err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: `a b"@example.com`, err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: "paul @example.com", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: "paul@example.com.", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "email", in: "paul@.example.com", err: domainsBuyCopy["contactEmailInvalid"]}, |
| + {key: "country", in: "ie", want: "IE"}, |
| + {key: "country", in: " Gb ", want: "GB"}, |
| + {key: "country", in: "", err: required("country")}, |
| + {key: "country", in: "IRL", err: domainsBuyCopy["contactCountryInvalid"]}, |
| + {key: "country", in: "I3", err: domainsBuyCopy["contactCountryInvalid"]}, |
| + } { |
| + t.Run(tc.key+"/"+tc.in, func(t *testing.T) { |
| + var c registrar.Contact |
| + err := field(tc.key).apply(&c, tc.in) |
| + if tc.err != "" { |
| + if err == nil || err.Error() != tc.err { |
| + t.Fatalf("err=%v want %q", err, tc.err) |
| + } |
| + return |
| + } |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := field(tc.key).shown(c); got != tc.want { |
| + t.Fatalf("got %q want %q", got, tc.want) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// TestDomainsContactFormAsksWhatTheServerRequires: a blank answer is refused |
| +// exactly for the fields registrar.Contact.Validate requires, and a contact |
| +// every check passes is one the server takes. |
| +func TestDomainsContactFormAsksWhatTheServerRequires(t *testing.T) { |
| + if err := serverValidContact.Validate(); err != nil { |
| + t.Fatalf("the sample contact is not valid: %v", err) |
| + } |
| + for _, f := range contactFields { |
| + blank := serverValidContact |
| + var probe registrar.Contact |
| + probe.Country = "IE" |
| + blankErr := f.apply(&probe, "") |
| + switch f.key { |
| + case "phone": |
| + blank.Phone, blank.PhoneCountryCode = "", "" |
| + default: |
| + plainSet := map[string]*string{"firstName": &blank.FirstName, "lastName": &blank.LastName, "company": &blank.Company, |
| + "email": &blank.Email, "street": &blank.Street, "houseNumber": &blank.HouseNumber, "city": &blank.City, |
| + "state": &blank.State, "postalCode": &blank.PostalCode, "country": &blank.Country} |
| + *plainSet[f.key] = "" |
| + } |
| + if serverRequires := blank.Validate() != nil; serverRequires != (blankErr != nil) { |
| + t.Errorf("%s: server requires=%v, form refuses blank=%v", f.key, serverRequires, blankErr != nil) |
| + } |
| + } |
| + ok, c := checkedContact(registrar.Contact{FirstName: "Jane", LastName: "Buyer", Email: "jane@example.com", |
| + PhoneCountryCode: "353", Phone: "0871234567", Street: "Main Street", City: "Dublin", PostalCode: "D01 A123", Country: "ie"}) |
| + if !ok { |
| + t.Fatal("a good contact failed the checks") |
| + } |
| + if err := c.Validate(); err != nil || c.Country != "IE" || c.Phone != "871234567" { |
| + t.Fatalf("checked contact %+v: %v", c, err) |
| + } |
| +} |
| + |
| +// contactFlowServer is a console for the contact flow tests: a check, a |
| +// purchase door, the saved contacts and the contact save, recording each |
| +// purchase and save body. |
| +type contactFlowServer struct { |
| + *httptest.Server |
| + mu sync.Mutex |
| + purchases []map[string]json.RawMessage |
| + saves []registrar.Contact |
| +} |
| + |
| +func newContactFlowServer(t *testing.T, quoteCurrency, contacts string, purchase func(n int, w http.ResponseWriter)) *contactFlowServer { |
| + t.Helper() |
| + cs := &contactFlowServer{} |
| + mux := http.NewServeMux() |
| + mux.HandleFunc("POST "+buyTestPath+"/check", func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprintf(w, `{"domain":"shop.com","available":true,"price":1299,"currency":%q}`, quoteCurrency) |
| + }) |
| + mux.HandleFunc("GET "+buyTestPath+"/contacts", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, contacts) }) |
| + mux.HandleFunc("POST "+buyTestPath+"/contacts", func(w http.ResponseWriter, r *http.Request) { |
| + var c registrar.Contact |
| + if err := json.NewDecoder(r.Body).Decode(&c); err != nil { |
| + t.Error(err) |
| + } |
| + cs.mu.Lock() |
| + cs.saves = append(cs.saves, c) |
| + cs.mu.Unlock() |
| + json.NewEncoder(w).Encode(map[string]any{"id": "dc_new", "contact": c}) |
| + }) |
| + mux.HandleFunc("POST "+buyTestPath+"/purchases", func(w http.ResponseWriter, r *http.Request) { |
| + var in map[string]json.RawMessage |
| + if err := json.NewDecoder(r.Body).Decode(&in); err != nil { |
| + t.Error(err) |
| + } |
| + cs.mu.Lock() |
| + cs.purchases = append(cs.purchases, in) |
| + n := len(cs.purchases) |
| + cs.mu.Unlock() |
| + purchase(n, w) |
| + }) |
| + cs.Server = httptest.NewServer(mux) |
| + t.Cleanup(cs.Close) |
| + return cs |
| +} |
| + |
| +// recorded is the purchase and save bodies so far, read under the lock the |
| +// handlers write them under. |
| +func (cs *contactFlowServer) recorded() ([]map[string]json.RawMessage, []registrar.Contact) { |
| + cs.mu.Lock() |
| + defer cs.mu.Unlock() |
| + return append([]map[string]json.RawMessage(nil), cs.purchases...), append([]registrar.Contact(nil), cs.saves...) |
| +} |
| + |
| +func contactRefused(w http.ResponseWriter) { |
| + w.WriteHeader(422) |
| + fmt.Fprint(w, `{"code":"contact","error":"check the contact details"}`) |
| +} |
| + |
| +// TestDomainsBuyContactFormFlow: with no saved contact, the form offers the |
| +// signed-in address and the country the account's billing currency names |
| +// (GBP, so GB), and Enter keeps |
| +// them; a blank phone says why and asks again; the number takes the |
| +// country's calling code; and when the console still refuses the contact, |
| +// the details are offered for saving and saved through the contacts door. |
| +func TestDomainsBuyContactFormFlow(t *testing.T) { |
| + cs := newContactFlowServer(t, "gbp", `{"contacts":[],"billing_currency":"gbp"}`, func(n int, w http.ResponseWriter) { contactRefused(w) }) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait = false, true, true |
| + o.in = strings.NewReader(strings.Join([]string{ |
| + "y", // buy this domain? |
| + "Jane", "Buyer", "", // names, no company |
| + "", // Email: keep the signed-in address |
| + "Main Street", "4", "Leeds", // street, house number, city |
| + "", "LS1 1AA", // no state, postal code |
| + "", // Country: keep GB, from the billing currency |
| + "", // Phone left blank: asked again |
| + "0113 496 0000", // a national number: GB's code, trunk 0 dropped |
| + "", // save these details? Enter is yes |
| + }, "\n") + "\n") |
| + err := domainsBuy(context.Background(), newTestSession(cs.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o) |
| + if err == nil || !strings.Contains(err.Error(), "check the contact details") { |
| + t.Fatalf("err=%v, want the console's refusal; output:\n%s", err, &out) |
| + } |
| + text := out.String() |
| + for _, want := range []string{ |
| + "First Name: ", "Company (optional): ", |
| + "Email [a@keymail.dev]: ", |
| + "Country [GB]: ", |
| + domainsBuyCopy["contactPhoneRequired"] + "\n", |
| + domainsBuyCopy["contactSaveOffer"], |
| + "saved as contact dc_new. use it next time with --contact dc_new\n", |
| + } { |
| + if !strings.Contains(text, want) { |
| + t.Errorf("output lacks %q:\n%s", want, text) |
| + } |
| + } |
| + if n := strings.Count(text, "Phone: "); n != 2 { |
| + t.Errorf("Phone asked %d times, want 2 (blank, then again):\n%s", n, text) |
| + } |
| + if !strings.Contains(text, "Postal Code: ") || strings.Index(text, "Country [GB]: ") > strings.Index(text, "Phone: ") { |
| + t.Errorf("country must be asked before the phone:\n%s", text) |
| + } |
| + want := registrar.Contact{FirstName: "Jane", LastName: "Buyer", Email: "a@keymail.dev", PhoneCountryCode: "44", Phone: "1134960000", |
| + Street: "Main Street", HouseNumber: "4", City: "Leeds", PostalCode: "LS1 1AA", Country: "GB"} |
| + purchases, saves := cs.recorded() |
| + if len(purchases) != 2 || len(saves) != 1 || saves[0] != want { |
| + t.Fatalf("purchases=%d saves=%+v, want one save of %+v", len(purchases), saves, want) |
| + } |
| + var sent registrar.Contact |
| + if err := json.Unmarshal(purchases[1]["contact"], &sent); err != nil || sent != want { |
| + t.Fatalf("second purchase sent %+v (%v), want %+v", sent, err, want) |
| + } |
| +} |
| + |
| +// TestDomainsBuyContactFormPicksSavedFirst: with saved contacts, the first |
| +// question picks one, Enter taking the most recent. One the console |
| +// refused walks the form with its values as defaults, Enter keeping each; |
| +// only what it lacks (here the phone) needs typing. A purchase that then |
| +// starts offers no save: the start saved the contact. |
| +func TestDomainsBuyContactFormPicksSavedFirst(t *testing.T) { |
| + const contacts = `{"contacts":[ |
| + {"id":"dc_recent","contact":{"first_name":"Ada","last_name":"Lovelace","email":"ada@example.com","street":"Example Road","city":"London","postal_code":"N1 1AA","country":"GB"}}, |
| + {"id":"dc_older","contact":{"first_name":"Jane","last_name":"Buyer","email":"buyer@example.test","phone_country_code":"353","phone":"871234567","street":"Main Street","city":"Dublin","postal_code":"D01 A123","country":"IE"}}]}` |
| + cs := newContactFlowServer(t, "gbp", contacts, func(n int, w http.ResponseWriter) { |
| + if n == 1 { |
| + contactRefused(w) |
| + return |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment","checkout_url":"https://checkout.example/p1"}`) |
| + }) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait = false, true, true |
| + // confirm, Enter picks 1, Enter keeps ten fields, a blank phone, then one. |
| + o.in = strings.NewReader("y\n" + "\n" + strings.Repeat("\n", 10) + "\n" + "+44 20 7123 4567\n") |
| + if err := domainsBuy(context.Background(), newTestSession(cs.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("err=%v output:\n%s", err, &out) |
| + } |
| + text := out.String() |
| + for _, want := range []string{ |
| + domainsBuyCopy["contactPickHeader"] + "\n 1 Ada Lovelace (ada@example.com)\n 2 Jane Buyer (buyer@example.test)\n", |
| + domainsBuyCopy["contactPickPrompt"], |
| + "First Name [Ada]: ", "Last Name [Lovelace]: ", "Email [ada@example.com]: ", "Postal Code [N1 1AA]: ", "Country [GB]: ", |
| + "Phone: ", domainsBuyCopy["contactPhoneRequired"], |
| + } { |
| + if !strings.Contains(text, want) { |
| + t.Errorf("output lacks %q:\n%s", want, text) |
| + } |
| + } |
| + if strings.Index(text, domainsBuyCopy["contactPickPrompt"]) > strings.Index(text, "First Name") { |
| + t.Errorf("picking a saved contact must be the first question:\n%s", text) |
| + } |
| + purchases, saves := cs.recorded() |
| + if strings.Contains(text, domainsBuyCopy["contactSaveOffer"]) || len(saves) != 0 { |
| + t.Errorf("a started purchase offered a save:\n%s", text) |
| + } |
| + var sent registrar.Contact |
| + json.Unmarshal(purchases[1]["contact"], &sent) |
| + want := registrar.Contact{FirstName: "Ada", LastName: "Lovelace", Email: "ada@example.com", PhoneCountryCode: "44", Phone: "2071234567", |
| + Street: "Example Road", City: "London", PostalCode: "N1 1AA", Country: "GB"} |
| + if sent != want { |
| + t.Fatalf("sent %+v want %+v", sent, want) |
| + } |
| +} |
| + |
| +// TestDomainsContactPickUsesAValidSavedContactAsIs: a saved contact every |
| +// check passes is used without walking the form, and is not typed. |
| +func TestDomainsContactPickUsesAValidSavedContactAsIs(t *testing.T) { |
| + saved := []apiSavedContact{ |
| + {ID: "dc_a", Contact: registrar.Contact{FirstName: "Ada"}}, |
| + {ID: "dc_b", Contact: registrar.Contact{FirstName: "Jane", LastName: "Buyer", Email: "buyer@example.test", PhoneCountryCode: "353", |
| + Phone: "871234567", Street: "Main Street", City: "Dublin", PostalCode: "D01 A123", Country: "IE"}}, |
| + } |
| + var out bytes.Buffer |
| + c, typed, err := promptDomainContact(bufio.NewScanner(strings.NewReader("7\n2\n")), &out, contactKnown{saved: saved}) |
| + if err != nil || typed || c == nil || *c != saved[1].Contact { |
| + t.Fatalf("c=%+v typed=%v err=%v\n%s", c, typed, err, &out) |
| + } |
| + if !strings.Contains(out.String(), fmt.Sprintf(domainsBuyCopy["contactPickInvalid"], 2)) || strings.Contains(out.String(), "First Name") { |
| + t.Fatalf("output:\n%s", &out) |
| + } |
| +} |
| + |
| +// TestDomainsTransferOffersToSaveTypedContact: a transfer that fails to |
| +// start after the form keeps the details: they are offered for saving. |
| +func TestDomainsTransferOffersToSaveTypedContact(t *testing.T) { |
| + var mu sync.Mutex |
| + var saves []registrar.Contact |
| + starts := 0 |
| + mux := http.NewServeMux() |
| + mux.HandleFunc("POST "+buyTestPath+"/transfers/check", func(w http.ResponseWriter, r *http.Request) { |
| + fmt.Fprint(w, `{"domain":"shop.com","price":1200,"currency":"eur","nameservers":["ns1.example-dns.test"]}`) |
| + }) |
| + mux.HandleFunc("GET "+buyTestPath+"/contacts", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, `{"contacts":[]}`) }) |
| + mux.HandleFunc("POST "+buyTestPath+"/contacts", func(w http.ResponseWriter, r *http.Request) { |
| + var c registrar.Contact |
| + json.NewDecoder(r.Body).Decode(&c) |
| + mu.Lock() |
| + saves = append(saves, c) |
| + mu.Unlock() |
| + json.NewEncoder(w).Encode(map[string]any{"id": "dc_new", "contact": c}) |
| + }) |
| + mux.HandleFunc("POST "+buyTestPath+"/transfers", func(w http.ResponseWriter, r *http.Request) { |
| + mu.Lock() |
| + starts++ |
| + n := starts |
| + mu.Unlock() |
| + if n == 1 { |
| + contactRefused(w) |
| + return |
| + } |
| + w.WriteHeader(409) |
| + fmt.Fprint(w, `{"error":"the domain is locked at its current registrar"}`) |
| + }) |
| + ts := httptest.NewServer(mux) |
| + t.Cleanup(ts.Close) |
| + var out bytes.Buffer |
| + o := transferTestOptions(t, &out) |
| + o.contactFile, o.yes, o.terminal, o.noWait = "", false, true, true |
| + o.in = strings.NewReader(strings.Join([]string{"y", "Jane", "Buyer", "", "jane@example.ie", "Main Street", "", "Dublin", "", "D01 A123", |
| + "ie", "+353 87 123 4567", "y"}, "\n") + "\n") |
| + err := domainsTransfer(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop.com", o) |
| + if err == nil || !strings.Contains(err.Error(), "locked") { |
| + t.Fatalf("err=%v\n%s", err, &out) |
| + } |
| + if strings.Contains(out.String(), "Country [") { |
| + t.Errorf("the euro names no one country, so none is offered:\n%s", &out) |
| + } |
| + want := registrar.Contact{FirstName: "Jane", LastName: "Buyer", Email: "jane@example.ie", PhoneCountryCode: "353", Phone: "871234567", |
| + Street: "Main Street", City: "Dublin", PostalCode: "D01 A123", Country: "IE"} |
| + mu.Lock() |
| + got := append([]registrar.Contact(nil), saves...) |
| + mu.Unlock() |
| + if len(got) != 1 || got[0] != want || !strings.Contains(out.String(), "saved as contact dc_new") { |
| + t.Fatalf("saves=%+v\n%s", got, &out) |
| + } |
| +} |
| + |
| +// TestDomainsBuyNoBillingCurrencyNoCountryDefault: an account with no |
| +// billing currency of its own is quoted in the price book's default (USD |
| +// here, or any other), and that names no country: the form offers no |
| +// Country default, from a console that says "" and from one that predates |
| +// the field alike. |
| +func TestDomainsBuyNoBillingCurrencyNoCountryDefault(t *testing.T) { |
| + for _, tc := range []struct{ name, quote, contacts string }{ |
| + {"usd default, none set", "usd", `{"contacts":[],"billing_currency":""}`}, |
| + {"gbp quote, none set", "gbp", `{"contacts":[],"billing_currency":""}`}, |
| + {"console without the field", "usd", `{"contacts":[]}`}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + cs := newContactFlowServer(t, tc.quote, tc.contacts, func(n int, w http.ResponseWriter) { |
| + if n == 1 { |
| + contactRefused(w) |
| + return |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment"}`) |
| + }) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait = false, true, true |
| + o.in = strings.NewReader(strings.Join([]string{"y", "Jane", "Buyer", "", "", "Main Street", "", "Austin", "TX", "78701", |
| + "", // Country: no default, so Enter is refused and it is asked again |
| + "us", "512 555 0100", // then a national number takes the country's code |
| + }, "\n") + "\n") |
| + if err := domainsBuy(context.Background(), newTestSession(cs.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("err=%v\n%s", err, &out) |
| + } |
| + text := out.String() |
| + if strings.Contains(text, "Country [") { |
| + t.Fatalf("a Country default with no billing currency set:\n%s", text) |
| + } |
| + if n := strings.Count(text, "Country: "); n != 2 { |
| + t.Fatalf("Country asked %d times, want 2:\n%s", n, text) |
| + } |
| + var sent registrar.Contact |
| + purchases, _ := cs.recorded() |
| + json.Unmarshal(purchases[1]["contact"], &sent) |
| + if sent.Country != "US" || sent.PhoneCountryCode != "1" || sent.Phone != "5125550100" { |
| + t.Fatalf("sent %+v", sent) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// TestCallingCodesArePrefixFree: every code is one to three digits and none |
| +// is the start of another, so the longest-prefix match is the only one; |
| +// each country the price book names by currency, and US, has its code. |
| +func TestCallingCodesArePrefixFree(t *testing.T) { |
| + if len(callingCodes) < 230 { |
| + t.Fatalf("%d countries, want the whole E.164 table", len(callingCodes)) |
| + } |
| + for country, code := range callingCodes { |
| + if len(country) != 2 || len(code) < 1 || len(code) > 3 || strings.Trim(code, "0123456789") != "" || code[0] == '0' { |
| + t.Errorf("%s: code %q", country, code) |
| + } |
| + for other := range knownCallingCodes { |
| + if other != code && strings.HasPrefix(other, code) { |
| + t.Errorf("%s's code %s is a prefix of %s", country, code, other) |
| + } |
| + } |
| + } |
| + for country, code := range map[string]string{"IE": "353", "GB": "44", "US": "1", "AT": "43", "BE": "32", "BG": "359", "HR": "385", |
| + "CY": "357", "CZ": "420", "DK": "45", "EE": "372", "FI": "358", "FR": "33", "DE": "49", "GR": "30", "HU": "36", "IT": "39", |
| + "LV": "371", "LT": "370", "LU": "352", "MT": "356", "NL": "31", "PL": "48", "PT": "351", "RO": "40", "SK": "421", "SI": "386", |
| + "ES": "34", "SE": "46"} { |
| + if callingCodes[country] != code { |
| + t.Errorf("%s: %q, want %q", country, callingCodes[country], code) |
| + } |
| + } |
| + // Every assigned geographic code (ITU-T E.164 list) is known, Ascension's |
| + // 247 included, so no reachable number is refused for its code. |
| + for _, code := range strings.Fields(`1 7 20 27 30 31 32 33 34 36 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 58 |
| + 60 61 62 63 64 65 66 81 82 84 86 90 91 92 93 94 95 98 211 212 213 216 218 220 221 222 223 224 225 226 227 228 229 |
| + 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
| + 260 261 262 263 264 265 266 267 268 269 290 291 297 298 299 350 351 352 353 354 355 356 357 358 359 370 371 372 373 |
| + 374 375 376 377 378 380 381 382 383 385 386 387 389 420 421 423 500 501 502 503 504 505 506 507 508 509 590 591 592 |
| + 593 594 595 596 597 598 599 670 672 673 674 675 676 677 678 679 680 681 682 683 685 686 687 688 689 690 691 692 850 |
| + 852 853 855 856 880 886 960 961 962 963 964 965 966 967 968 970 971 972 973 974 975 976 977 992 993 994 995 996 998`) { |
| + if !knownCallingCodes[code] { |
| + t.Errorf("assigned code %s is not known", code) |
| + } |
| + } |
| + if got := callingCodeOf("2476666"); got != "247" { |
| + t.Errorf("Ascension: %q, want 247", got) |
| + } |
| +} |
| + |
| +// TestDomainsBuyNoSaveOfferWhenTheStartIsUncertain: after the form, a start |
| +// whose outcome is not known (the answer lost, a 5xx, an unreadable 200) |
| +// may have started and saved the contact itself, so nothing is offered: |
| +// the error is printed as it is, and no contact is added. |
| +func TestDomainsBuyNoSaveOfferWhenTheStartIsUncertain(t *testing.T) { |
| + for _, tc := range []struct { |
| + name string |
| + answer func(w http.ResponseWriter) |
| + }{ |
| + {"response lost", func(w http.ResponseWriter) { |
| + conn, _, err := http.NewResponseController(w).Hijack() |
| + if err != nil { |
| + t.Error(err) |
| + return |
| + } |
| + conn.Close() |
| + }}, |
| + {"5xx", func(w http.ResponseWriter) { |
| + w.WriteHeader(502) |
| + fmt.Fprint(w, `{"error":"bad gateway"}`) |
| + }}, |
| + {"unreadable 200", func(w http.ResponseWriter) { fmt.Fprint(w, `{"id":`) }}, |
| + {"4xx without words", func(w http.ResponseWriter) { w.WriteHeader(400); fmt.Fprint(w, `<html>`) }}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + cs := newContactFlowServer(t, "gbp", `{"contacts":[],"billing_currency":"gbp"}`, func(n int, w http.ResponseWriter) { |
| + if n == 1 { |
| + contactRefused(w) |
| + return |
| + } |
| + tc.answer(w) |
| + }) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait = false, true, true |
| + o.in = strings.NewReader(strings.Join([]string{"y", "Jane", "Buyer", "", "jane@example.com", "Main Street", "", "Leeds", "", "LS1 1AA", |
| + "", "0113 496 0000", "y"}, "\n") + "\n") |
| + err := domainsBuy(context.Background(), newTestSession(cs.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o) |
| + if err == nil { |
| + t.Fatalf("no error\n%s", &out) |
| + } |
| + purchases, saves := cs.recorded() |
| + if strings.Contains(out.String(), domainsBuyCopy["contactSaveOffer"]) || len(saves) != 0 || len(purchases) != 2 { |
| + t.Fatalf("uncertain start offered a save (saves=%d purchases=%d):\n%s", len(saves), len(purchases), &out) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// TestDomainsBuyContactFileDefaultsMergeFieldByField: a refused contact |
| +// file without an email or a country gets them from the account: the |
| +// signed-in address and the billing currency's country, read from the |
| +// contacts list on this path too. What the file has wins. |
| +func TestDomainsBuyContactFileDefaultsMergeFieldByField(t *testing.T) { |
| + cs := newContactFlowServer(t, "gbp", `{"contacts":[],"billing_currency":"gbp"}`, func(n int, w http.ResponseWriter) { |
| + if n == 1 { |
| + contactRefused(w) |
| + return |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment"}`) |
| + }) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait = false, true, true |
| + o.contactFile = filepath.Join(t.TempDir(), "contact.json") |
| + writeTransferTestFile(t, o.contactFile, `{"first_name":"Jane","last_name":"Buyer","phone_country_code":"44","phone":"1134960000","street":"Main Street","city":"Leeds","postal_code":"LS1 1AA"}`) |
| + o.in = strings.NewReader("y\n" + strings.Repeat("\n", 11)) |
| + if err := domainsBuy(context.Background(), newTestSession(cs.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("err=%v\n%s", err, &out) |
| + } |
| + text := out.String() |
| + for _, want := range []string{"First Name [Jane]: ", "Email [a@keymail.dev]: ", "Country [GB]: ", "Phone [+44 1134960000]: "} { |
| + if !strings.Contains(text, want) { |
| + t.Errorf("output lacks %q:\n%s", want, text) |
| + } |
| + } |
| + var sent registrar.Contact |
| + purchases, _ := cs.recorded() |
| + json.Unmarshal(purchases[1]["contact"], &sent) |
| + want := registrar.Contact{FirstName: "Jane", LastName: "Buyer", Email: "a@keymail.dev", PhoneCountryCode: "44", Phone: "1134960000", |
| + Street: "Main Street", City: "Leeds", PostalCode: "LS1 1AA", Country: "GB"} |
| + if sent != want { |
| + t.Fatalf("sent %+v want %+v", sent, want) |
| + } |
| +} |
| + |
| +func TestMergeContactDefaultsOrder(t *testing.T) { |
| + file := registrar.Contact{FirstName: "File", Phone: "871234567"} // a phone without its code is no phone |
| + saved := registrar.Contact{FirstName: "Saved", LastName: "Contact", Email: "saved@example.com", PhoneCountryCode: "44", Phone: "2071234567", Country: "GB"} |
| + account := registrar.Contact{Email: "login@example.com", Country: "US"} |
| + got := mergeContactDefaults(file, saved, account) |
| + want := registrar.Contact{FirstName: "File", LastName: "Contact", Email: "saved@example.com", PhoneCountryCode: "44", Phone: "2071234567", Country: "GB"} |
| + if got != want { |
| + t.Fatalf("got %+v want %+v", got, want) |
| + } |
| + if got := mergeContactDefaults(file, account); got.Email != "login@example.com" || got.Country != "US" || got.Phone != "" { |
| + t.Fatalf("got %+v", got) |
| + } |
| +} |
| + |
| +// TestDomainsBuyContactFileNeverTakesSavedDetails: a refused contact file |
| +// is filled in from the account only, never from a saved contact, which |
| +// may be someone else: a field the file lacks and the account does not |
| +// know is asked with no default, though a saved contact has a value. |
| +func TestDomainsBuyContactFileNeverTakesSavedDetails(t *testing.T) { |
| + const contacts = `{"billing_currency":"gbp","contacts":[ |
| + {"id":"dc_other","contact":{"first_name":"Ada","last_name":"Lovelace","company":"Engines Ltd","email":"ada@example.com","phone_country_code":"44","phone":"2071234567","street":"Example Road","house_number":"12","city":"London","state":"Greater London","postal_code":"N1 1AA","country":"GB"}}]}` |
| + cs := newContactFlowServer(t, "gbp", contacts, func(n int, w http.ResponseWriter) { |
| + if n == 1 { |
| + contactRefused(w) |
| + return |
| + } |
| + fmt.Fprint(w, `{"id":"p1","state":"awaiting_payment"}`) |
| + }) |
| + var out bytes.Buffer |
| + o := buyTestOptions(&out) |
| + o.yes, o.terminal, o.noWait = false, true, true |
| + o.contactFile = filepath.Join(t.TempDir(), "contact.json") |
| + writeTransferTestFile(t, o.contactFile, `{"first_name":"Jane","last_name":"Buyer"}`) |
| + // Enter keeps each default; the fields with none are typed. |
| + o.in = strings.NewReader(strings.Join([]string{"y", "", "", "", "", "Main Street", "", "Leeds", "", "LS1 1AA", "", "0113 496 0000"}, "\n") + "\n") |
| + if err := domainsBuy(context.Background(), newTestSession(cs.URL), apiAcct{Seg: "bab"}, "shop.com", "shop", o); err != nil { |
| + t.Fatalf("err=%v\n%s", err, &out) |
| + } |
| + text := out.String() |
| + for _, want := range []string{"First Name [Jane]: ", "Company (optional): ", "Email [a@keymail.dev]: ", "Street: ", "House Number (optional): ", |
| + "City: ", "State or Province (optional): ", "Postal Code: ", "Country [GB]: ", "Phone: "} { |
| + if !strings.Contains(text, want) { |
| + t.Errorf("output lacks %q:\n%s", want, text) |
| + } |
| + } |
| + for _, leaked := range []string{"Ada", "Lovelace", "Engines", "ada@example.com", "Example Road", "London", "N1 1AA", "2071234567"} { |
| + if strings.Contains(text, leaked) { |
| + t.Errorf("a saved contact's %q was offered on the contact-file path:\n%s", leaked, text) |
| + } |
| + } |
| + if strings.Contains(text, domainsBuyCopy["contactPickHeader"]) { |
| + t.Errorf("the contact-file path asked to pick a saved contact:\n%s", text) |
| + } |
| + purchases, _ := cs.recorded() |
| + var sent registrar.Contact |
| + json.Unmarshal(purchases[1]["contact"], &sent) |
| + want := registrar.Contact{FirstName: "Jane", LastName: "Buyer", Email: "a@keymail.dev", PhoneCountryCode: "44", Phone: "1134960000", |
| + Street: "Main Street", City: "Leeds", PostalCode: "LS1 1AA", Country: "GB"} |
| + if sent != want { |
| + t.Fatalf("sent %+v want %+v", sent, want) |
| + } |
| +} |
diff --git a/domains_transfer_cli.go b/domains_transfer_cli.go| index 6e0e22715..cd59e528d 100644 |
| --- a/domains_transfer_cli.go |
| +++ b/domains_transfer_cli.go |
| @@ -82,6 +82,9 @@ type domainTransferOptions struct { |
| out io.Writer |
| now func() time.Time |
| wait func(context.Context, time.Duration) error |
| + // spin starts the busy line (stderrSpinner) and returns its stop; nil |
| + // draws none. It never runs while the transfer code is read. |
| + spin func(label string) (stop func()) |
| } |
| func runDomainsTransfer(args []string) error { |
| @@ -110,7 +113,7 @@ func runDomainsTransfer(args []string) error { |
| authCode: *authCode, contactFile: *contactFile, contactID: id, yes: *yes, noWait: *noWait, |
| in: os.Stdin, out: stdout, terminal: isatty.IsTerminal(os.Stdin.Fd()), |
| readSecret: func() (string, error) { return readTransferCodeTerminal(int(os.Stdin.Fd())) }, |
| - now: time.Now, wait: waitDomainBuy, |
| + now: time.Now, wait: waitDomainBuy, spin: stderrSpinner(), |
| }) |
| } |
| @@ -185,22 +188,31 @@ func domainsTransfer(ctx context.Context, s *apiSession, acct apiAcct, name stri |
| func startDomainTransfer(ctx context.Context, s *apiSession, acct apiAcct, name, code string, input *bufio.Scanner, o domainTransferOptions) error { |
| var contact *registrar.Contact |
| var saved *apiSavedContact |
| + var contacts apiSavedContacts |
| var err error |
| if o.contactFile != "" { |
| if contact, err = readContactFile(o.contactFile, buyContactFileErrors); err != nil { |
| return err |
| } |
| - } else if saved, err = pickSavedContact(ctx, s, acct, o.contactID); err != nil { |
| - return err |
| - } |
| - country := "" |
| - switch { |
| - case contact != nil: |
| - country = contact.Country |
| - case saved != nil: |
| - country = saved.Contact.Country |
| } |
| - tq, err := s.postDomainTransferCheck(ctx, acct, name, country) |
| + stop := startSpin(o.spin, fmt.Sprintf(domainsBuyCopy["spinCheck"], name)) |
| + tq, err := func() (domainTransferQuoteResp, error) { |
| + if contact == nil { |
| + var err error |
| + if saved, contacts, err = pickSavedContact(ctx, s, acct, o.contactID); err != nil { |
| + return domainTransferQuoteResp{}, err |
| + } |
| + } |
| + country := "" |
| + switch { |
| + case contact != nil: |
| + country = contact.Country |
| + case saved != nil: |
| + country = saved.Contact.Country |
| + } |
| + return s.postDomainTransferCheck(ctx, acct, name, country) |
| + }() |
| + stop() |
| if err != nil { |
| return err |
| } |
| @@ -223,13 +235,26 @@ func startDomainTransfer(ctx context.Context, s *apiSession, acct apiAcct, name, |
| } |
| } |
| var p domainPurchaseResp |
| - contactRetried, priceRetried := false, false |
| + contactRetried, priceRetried, typed := false, false, false |
| + // keep ends a transfer that did not start: details typed into the form |
| + // are offered for saving first, after a definite refusal or a declined |
| + // price (err nil) only. An uncertain outcome offers nothing: the start |
| + // may have happened and saved the contact, and the add door does not |
| + // deduplicate. |
| + keep := func(err error) error { |
| + if typed && contact != nil && (err == nil || startDefinitelyRefused(err)) { |
| + offerSaveContact(ctx, s, acct, input, o.out, contact, o.spin) |
| + } |
| + return err |
| + } |
| for { |
| req := domainTransferReq{Name: name, AuthCode: code, Contact: contact} |
| if contact == nil && saved != nil { |
| req.ContactID = saved.ID |
| } |
| + stop := startSpin(o.spin, domainsBuyCopy["spinStartTransfer"]) |
| p, err = s.postDomainTransfer(ctx, acct, req, q) |
| + stop() |
| var contactErr *domainContactError |
| var priceErr *domainPriceChangedError |
| switch { |
| @@ -239,25 +264,35 @@ func startDomainTransfer(ctx context.Context, s *apiSession, acct apiAcct, name, |
| } |
| contactRetried = true |
| fmt.Fprintln(o.out, redactTransferCode(err, code)) |
| - if contact, err = promptDomainContact(input, o.out); err != nil { |
| + if o.contactFile != "" { |
| + // The contact file's path has not read the list: read it now, |
| + // for the account's defaults. Best effort: a refusal leaves |
| + // none, and the form still asks. |
| + contacts, _ = s.domainContacts(ctx, acct) |
| + } |
| + known := contactKnown{saved: contacts.Contacts, prefill: contact, email: sessionEmail(s), billingCurrency: contacts.BillingCurrency} |
| + if contact, typed, err = promptDomainContact(input, o.out, known); err != nil { |
| return err |
| } |
| continue |
| case errors.As(err, &priceErr): |
| printDomainTransferQuote(o.out, priceErr.Quote) |
| if priceRetried || (o.yes && (q.Currency != priceErr.Quote.Currency || q.Price != priceErr.Quote.Price)) || (!o.yes && !o.terminal) { |
| - return err |
| + return keep(err) |
| } |
| priceRetried = true |
| if !o.yes { |
| if ok, err := domainTransferYes(input, o.out, domainsTransferCopy["confirmChanged"]); !ok || err != nil { |
| - return err |
| + if err != nil { |
| + return err |
| + } |
| + return keep(nil) |
| } |
| } |
| q = priceErr.Quote |
| continue |
| case err != nil: |
| - return err |
| + return keep(err) |
| } |
| break |
| } |
| @@ -335,10 +370,14 @@ func waitDomainTransfer(ctx context.Context, s *apiSession, acct apiAcct, p doma |
| noted = true |
| } |
| } |
| - if err := o.wait(ctx, delay); err != nil { |
| - return err |
| - } |
| - next, err := pollDomainTransfer(ctx, s, acct, id, o) |
| + stop := startSpin(o.spin, fmt.Sprintf(domainsBuyCopy["spinWait"], domain)) |
| + next, err := func() (domainPurchaseResp, error) { |
| + if err := o.wait(ctx, delay); err != nil { |
| + return domainPurchaseResp{}, err |
| + } |
| + return pollDomainTransfer(ctx, s, acct, id, o) |
| + }() |
| + stop() |
| if err != nil { |
| return err |
| } |
| @@ -519,11 +558,14 @@ func (s *apiSession) postDomainTransfer(ctx context.Context, acct apiAcct, in do |
| } |
| // domainStartError is a refused purchase or transfer start: a changed |
| -// price to confirm, a contact to put right, or the console's words. |
| +// price to confirm, a contact to put right, or the console's words. A |
| +// readable 4xx (the console's own refusal in its JSON) is a |
| +// *domainStartRefusedError: nothing started. |
| func domainStartError(status int, body []byte) error { |
| err := apiErrorFromBody(status, body) |
| var refusal struct { |
| - Code string `json:"code"` |
| + Code string `json:"code"` |
| + Error string `json:"error"` |
| domainQuoteResp |
| } |
| if status == http.StatusConflict && json.Unmarshal(body, &refusal) == nil && refusal.Code == "price_changed" && refusal.Currency != "" && refusal.Price > 0 { |
| @@ -532,5 +574,26 @@ func domainStartError(status int, body []byte) error { |
| if status == http.StatusUnprocessableEntity && json.Unmarshal(body, &refusal) == nil && refusal.Code == "contact" { |
| return &domainContactError{err} |
| } |
| + if status >= 400 && status < 500 && json.Unmarshal(body, &refusal) == nil && refusal.Error != "" { |
| + return &domainStartRefusedError{err} |
| + } |
| return err |
| } |
| + |
| +// domainStartRefusedError is a start the console refused in words, with a |
| +// 4xx: definitely nothing started. |
| +type domainStartRefusedError struct{ error } |
| + |
| +func (e *domainStartRefusedError) Unwrap() error { return e.error } |
| + |
| +// startDefinitelyRefused reports whether err is a start the console |
| +// definitely refused before anything started: a readable 4xx, a contact |
| +// refusal or a changed price. A transport error, a 5xx, a lost or |
| +// unreadable answer is not: the start may have happened, and saved its |
| +// contact itself. |
| +func startDefinitelyRefused(err error) bool { |
| + var refused *domainStartRefusedError |
| + var contactErr *domainContactError |
| + var priceErr *domainPriceChangedError |
| + return errors.As(err, &refused) || errors.As(err, &contactErr) || errors.As(err, &priceErr) |
| +} |
diff --git a/internal/console/accountdomainbuy_test.go b/internal/console/accountdomainbuy_test.go| index d361663a0..f02ffa0e3 100644 |
| --- a/internal/console/accountdomainbuy_test.go |
| +++ b/internal/console/accountdomainbuy_test.go |
| @@ -131,6 +131,7 @@ func TestAccountBuyThreeStepsToCheckout(t *testing.T) { |
| !strings.Contains(body, `name="price" value="1500"`) || !strings.Contains(body, `name="app" value="blog"`) || !strings.Contains(body, `value="new"`) { |
| t.Fatalf("step 3: %d %s", status, body) |
| } |
| + wantContactAutocomplete(t, body, 1) |
| if saved && !strings.Contains(body, `value="`+savedID+`" checked`) { |
| t.Fatal("step 3 does not preselect the most recently used saved contact") |
| } |
diff --git a/internal/console/accountdomaintransfer_test.go b/internal/console/accountdomaintransfer_test.go| index 47ad597cf..e55d7dd9d 100644 |
| --- a/internal/console/accountdomaintransfer_test.go |
| +++ b/internal/console/accountdomaintransfer_test.go |
| @@ -74,6 +74,7 @@ func TestTransferFormShowsNameserversAndPrice(t *testing.T) { |
| t.Errorf("form lacks %q:\n%s", want, main) |
| } |
| } |
| + wantContactAutocomplete(t, main, 1) |
| if strings.Contains(main, "?auth_code") || strings.Contains(main, `method="get"`) { |
| t.Errorf("the form could send the code in a URL:\n%s", main) |
| } |
diff --git a/internal/console/apidomainbuy.go b/internal/console/apidomainbuy.go| index e6f3f783c..d41a7c909 100644 |
| --- a/internal/console/apidomainbuy.go |
| +++ b/internal/console/apidomainbuy.go |
| @@ -475,7 +475,10 @@ func writeContactRefusal(w http.ResponseWriter) { |
| } |
| // handleAPIDomainContacts is GET .../domains/contacts: most recently used |
| -// first, the order a purchase with no contact picks from. |
| +// first, the order a purchase with no contact picks from. billing_currency |
| +// is the account's own billing currency, "" while none is set (a quote then |
| +// prices in the book's default): the CLI's contact form infers a default |
| +// country from it only when one is set. |
| func (s *Server) handleAPIDomainContacts(w http.ResponseWriter, r *http.Request) { |
| acct, ok := s.domainContactsAPIGate(w, r) |
| if !ok { |
| @@ -491,7 +494,7 @@ func (s *Server) handleAPIDomainContacts(w http.ResponseWriter, r *http.Request) |
| for _, c := range contacts { |
| out = append(out, apiSavedContactOf(c)) |
| } |
| - writeJSON(w, http.StatusOK, map[string]any{"contacts": out}) |
| + writeJSON(w, http.StatusOK, map[string]any{"contacts": out, "billing_currency": s.domainCurrency(acct)}) |
| } |
| func (s *Server) handleAPIDomainContactAdd(w http.ResponseWriter, r *http.Request) { |
diff --git a/internal/console/apidomainbuy_test.go b/internal/console/apidomainbuy_test.go| index 587a227c4..45439ff15 100644 |
| --- a/internal/console/apidomainbuy_test.go |
| +++ b/internal/console/apidomainbuy_test.go |
| @@ -685,10 +685,31 @@ func TestAPIContactsOwnerOnly(t *testing.T) { |
| ID string `json:"id"` |
| Contact registrar.Contact `json:"contact"` |
| } `json:"contacts"` |
| + BillingCurrency *string `json:"billing_currency"` |
| } |
| if status != 200 || json.Unmarshal([]byte(b), &listed) != nil || len(listed.Contacts) != 1 || listed.Contacts[0].ID != added.ID { |
| t.Fatalf("list: %d %s", status, b) |
| } |
| + // billing_currency is the account's own billing currency, and "" while |
| + // none is set, never the book's default. |
| + for _, currency := range []string{"", "gbp"} { |
| + b0, err := f.st.BillingAccount(f.acct.ID) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if b0 == nil { |
| + b0 = &billingAccount{AccountID: f.acct.ID, PaidPacks: map[string]int{}, Annual: -1} |
| + } |
| + b0.Currency = currency |
| + if err := f.st.PutBillingState(*b0); err != nil { |
| + t.Fatal(err) |
| + } |
| + status, b = buyRequest(t, f, "GET", path, tok, "") |
| + listed.BillingCurrency = nil |
| + if status != 200 || json.Unmarshal([]byte(b), &listed) != nil || listed.BillingCurrency == nil || *listed.BillingCurrency != currency { |
| + t.Fatalf("billing_currency with %q set: %d %s", currency, status, b) |
| + } |
| + } |
| edited := purchaseContact() |
| edited.City = "Cork" |
| editBody, _ := json.Marshal(edited) |
diff --git a/internal/console/contact_autocomplete_test.go b/internal/console/contact_autocomplete_test.go| new file mode 100644 |
| index 000000000..bb849d068 |
| --- /dev/null |
| +++ b/internal/console/contact_autocomplete_test.go |
| @@ -0,0 +1,46 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "regexp" |
| + "testing" |
| + "time" |
| +) |
| + |
| +// contactAutocomplete is the autofill token (HTML's autocomplete |
| +// attribute) each contact field carries, so a browser fills a saved |
| +// address into the form: on the saved-contact forms, the buy form's |
| +// Registered to and the transfer form's. |
| +var contactAutocomplete = map[string]string{ |
| + "FirstName": "given-name", "LastName": "family-name", "Company": "organization", "Email": "email", |
| + "PhoneCountryCode": "tel-country-code", "Phone": "tel-national", "Street": "address-line1", |
| + "HouseNumber": "address-line2", "City": "address-level2", "State": "address-level1", |
| + "PostalCode": "postal-code", "Country": "country", |
| +} |
| + |
| +// wantContactAutocomplete fails unless every contact field in body is drawn |
| +// with its token, at least min times each. |
| +func wantContactAutocomplete(t *testing.T, body string, min int) { |
| + t.Helper() |
| + for name, token := range contactAutocomplete { |
| + re := regexp.MustCompile(`<(?:input|select) [^>]*name="` + name + `"[^>]* autocomplete="` + regexp.QuoteMeta(token) + `"`) |
| + if n := len(re.FindAllString(body, -1)); n < min { |
| + t.Errorf("%s drawn with autocomplete=%q %d times, want at least %d", name, token, n, min) |
| + } |
| + } |
| +} |
| + |
| +// TestSavedContactFormsAutocomplete: the Domains page's saved-contact edit |
| +// form and its add form both carry the autofill tokens. |
| +func TestSavedContactFormsAutocomplete(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + if _, err := f.st.AddSavedContact(context.Background(), f.acct.ID, purchaseContact(), time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + c, _ := f.ownerBrowser(t) |
| + status, _, body := get(t, c, f.acctURL("/domains")) |
| + if status != 200 { |
| + t.Fatalf("GET domains: %d %s", status, body) |
| + } |
| + wantContactAutocomplete(t, body, 2) |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 4e0804d5f..e0b5eefc3 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -301,4 +301,5 @@ plan14-root-reads-static-error-page-headers.tsv 4d4fdb77961d811bcfeae751b17089f0 |
| plan14-root-reads-replica-read-lock-1443.tsv 4d4fdb77961d811bcfeae751b17089f0104d2333923a15b4c1ab5cc05d58d89f |
| plan14-root-reads-litestream-pin-1443.tsv 022a082b517b59ada965bbd7673e941be7c8bb4ae7547a5632f6be0570c97551 |
| plan14-root-reads-fleet-first-reconcile-speed-5.tsv dbdeb2e3a1a89cb8f33584fdb80a3bf1c5adef14ce222fef9d442ed8e059699c |
| -plan14-root-reads-gvisor-slice1-control-purge.tsv a3f8ba38714f1cdeea10b3e5ed4402d290e88cc1cc1f3f3875f446aa46346e82 |
| +plan14-root-reads-cli-contact-prompts.tsv dbdeb2e3a1a89cb8f33584fdb80a3bf1c5adef14ce222fef9d442ed8e059699c |
| +plan14-root-reads-gvisor-slice1-control-purge.tsv d7ef97f8418c62f1b248bb121bde3afa54207d5560f5d996577836e18dce5812 |
diff --git a/internal/provision/testdata/plan14-root-reads-cli-contact-prompts.tsv b/internal/provision/testdata/plan14-root-reads-cli-contact-prompts.tsv| new file mode 100644 |
| index 000000000..4b9b08925 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-cli-contact-prompts.tsv |
| @@ -0,0 +1,3 @@ |
| +# Census overlay cli-contact-prompts, written by census-propose (#369). census-ruling-cli-contact-prompts, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-cli-contact-prompts.md. |
| +# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@coverage . b97e9522df130f1327d9f7ea2a5df9740e845356a96abf61326cff544fc99ebc |
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-slice1-control-purge.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-slice1-control-purge.tsv| index 0abfe5e17..04463b278 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-gvisor-slice1-control-purge.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-gvisor-slice1-control-purge.tsv |
| @@ -5,19 +5,19 @@ |
| @legacy 53ad57ce6e525e9cd9ae366bd5a559273cac9c5a3dee01da00b27daf260789a5 internal/demobuild/runner.go Run legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Consumes only its private root-prepared invocation, proves stop, then no-follow reads bounded diagnostics/output beneath that job.;rev3=census-ruling-gvisor-demos;basis=Task 7: retain bounded no-follow diagnostics/output reads after termination proof; filter gVisor runtime timestamp lines before returning compiler diagnostics. No new read. Task 9: Log failing steps through root logger before returning exactly ErrBuild. Existing bounded no-follow reads and termination-before-output retained.;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: after the stop proof and before opening out/app, waits (within the build ctx) for the process-wide one-at-a-time output turn; every failure releases it, success hands it to the caller in BuildOutput. Same no-follow OpenBeneath of out/app; validation moves to readOutput. No new read path or input. F3 fix round 1: the output turn's release is deferred right after it is taken and disarmed only when a validated output hands it to the caller, so a panic in validation (debug/elf over the build's bytes) gives it back too. Same no-follow OpenBeneath of out/app and the same bounded read; no new read path or input. file:ReadAll@584 3d24a0d2e321031f74789cd89ff37010c32ed982b79bf44f3f61465da22e3f17 |
| @legacy 118ab165a823021e49a60c97782345e57fb1770dae257ac1b7a8c101dc09955d internal/demobuild/runner.go ValidateOutput legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Reads bounded bytes, ELF header/program headers and computes their SHA-256; never executes output.;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: body split; ELF/segment/digest checks moved verbatim into validateBinary, which ValidateOutput (client side) and readOutput (root) both call. Same bounded ReadAll; checks unchanged. F3 fix round 2: validateBinary recovers a debug/elf panic on the bytes it parses and answers ErrBuild; same bounded read and checks. file:ReadAll@67 a62ad64a8972e972cf152acca76fe58b0600f9bae50bcd7a988f71672c585cee |
| @legacy 380d4df05c08e27ae315aadb157a13f1669ba3af7d9c0809f06eff14a27c62b3 internal/demobuild/worker.go Worker.Build legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Holds the build/purge read lock through cleanup; existing bounded source read remains.;rev3=census-ruling-demo-slice-adopt;basis=Before admission, call the admit hook (nil = reconcileBudget); a pending budget change (errBudgetPending) is retried every 2 s until the job deadline, any other error fails at once. reconcileBudget reads the fixed build slice's systemctl show budget, its cgroup limit files and cgroup.events under the fixed root cgroup path, and list-jobs (a listing at the capture limit defers); only with buildPurge held exclusively, the slice empty and no build or slice job queued does it run systemctl stop on the fixed slice name. No tenant, app or agent input names a path or unit.;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: when scratch cleanup fails and the output is discarded, releases its output turn first. No read change. F3 fix round 1: the scratch-cleanup defer releases the output turn and poisons the worker if cleanup panics, as it already did when cleanup failed. No read change. file:ReadAll@1087 4687911be61feb14e60cbb801651a3982593de07c2c5430f5676b1174169b179 |
| -@legacy 95eb701b556f8512cdf18075320faab42bfda098a9fe694b02b3449a4aaacc82 internal/demobuild/runner.go readOutput legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3, new: root reads the already-open out/app (from Run's no-follow OpenBeneath) by fstat size into one exact buffer; refuses non-regular or over BinaryMaxBytes, refuses a file still growing past its size, then validateBinary on exactly those bytes. Reads only the fd it is given. file:Read@304,file:Stat@63 9c0196894754b9a9d323ab7622e86ee28c5c4e71c86f5e5610289edfe27103d4 |
| -@legacy 3a12b768f3f978410bfd23a4387d5ebb7721b480485b401dc8f4ddfc47118520 internal/instancefs/dirs_linux.go treeRemover.clear legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new: getdents in batches of 256 on an open dir fd; per entry fstatat AT_SYMLINK_NOFOLLOW then unlinkat (AT_REMOVEDIR for dirs); a non-empty dir is returned to descend into. Never follows an entry. file:Fstatat@448 5c78478ebb13128d4cae7913afa86bd2473385e7ae868eca10e0b4988bea263d |
| -@legacy 149232ea92f91ea58f48f16d8c3406c80f10bf3ed4f431d55446f27074815f86 internal/instancefs/dirs_linux.go treeRemover.open legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new: openat2(parentfd, one name, O_RDONLY|O_DIRECTORY|O_NOFOLLOW, RESOLVE_BENEATH|RESOLVE_NO_SYMLINKS|RESOLVE_NO_MAGICLINKS); never a joined path; retries EINTR/EAGAIN. file:Openat2@318 907a0219945d5fec7dd63ad909a3b8121375e3afec270b38b1d7adbf24ec224f |
| -@legacy 991a8e9975e69e9725bf9277b95a53bf04dcdef4bfcc3b1a0dd3809c4b0e78be internal/instancefs/dirs_linux.go treeRemover.remove legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new (replaces removeAt): iterative no-follow removal of a derived child of a root-named dir. fstatat AT_SYMLINK_NOFOLLOW on top; non-dir unlinked; dirs walked by a name stack, each level opened by treeRemover.open from its parent fd; empty dirs removed with unlinkat AT_REMOVEDIR on the parent fd. Re-opens dir only through openDir (RESOLVE_NO_SYMLINKS), as RemoveAllBeneath did, and checks top dev/ino unchanged. F6 fix round 1: at the 65,536-level bound, instead of refusing, hoists the child into top (treeRemover.hoist: reopens dir via openDir or a dup of the caller's held fd, opens top with the same openat2 BENEATH|NO_SYMLINKS|NO_MAGICLINKS and dev/ino check, then renameat2(cur, child, top, .carlos-removing-N, RENAME_NOREPLACE); follows nothing, both ends inside the tree). A child gone before descent re-lists cur (max 64); a missing stack directory on re-walk is an error that is not ErrNotExist. Merge with main: PurgeProven (#1139) now calls removeAllAt instead of removeAt; there dir is PurgeProven's held descriptor, duplicated (F_DUPFD_CLOEXEC) where RemoveAllBeneath would reopen dir by path. Removal-only, no new read. F6 fix round 2: the walk loop moves into treeRemover.walk unchanged in what it opens and removes; remove passes every error walk returns through changed, so once removal has begun no ENOENT (hoist reopening dir included) reads as already absent. Hoist names are .carlos-removing-<128 random bits from crypto/rand> instead of a counter, still renameat2 RENAME_NOREPLACE into the dev/ino-checked top, retried only on a collision (4 tries); a child gone at the hoist re-lists cur within the same 64-try budget as a descent. Same reads; no new read. file:Fstatat@169 5f76afcb90f4c414e993dec067ebd730ab0ff263328a38171cdee6a4da12061e |
| -@legacy 2575069725632e38b00793d60ee00431588b8d5d4a68f7512280e85ed6395c9f internal/instancefs/dirs_linux.go treeRemover.sameTop legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new: fstat of the re-opened top fd; refuses if dev/ino differ from the top the walk began on. file:Fstat@77 ed275affbeee89c9122580e4df3823be61cd02951040897e9f4e63ee2e624e89 |
| +@legacy 5774c962055e8d3b90caed6ecde22781b8ce2727d52764f35e67fa89694f57e0 internal/demobuild/runner.go readOutput legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: body split; ELF/segment/digest checks moved verbatim into validateBinary, which ValidateOutput (client side) and readOutput (root) both call. Same bounded ReadAll; checks unchanged. F3 fix round 2: validateBinary recovers a debug/elf panic on the bytes it parses and answers ErrBuild; same bounded read and checks. file:Read@304,file:Stat@63 9c0196894754b9a9d323ab7622e86ee28c5c4e71c86f5e5610289edfe27103d4 |
| +@legacy ae32344892afebc834362939e23759481ede4902faa7d4b37174503e6708f411 internal/instancefs/dirs_linux.go treeRemover.clear legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Fstatat@448 5c78478ebb13128d4cae7913afa86bd2473385e7ae868eca10e0b4988bea263d |
| +@legacy 70ed0fcd359476d3ee10e9e39b43b34da0cd9cf5c5d94e3ae247429f28cbb4cd internal/instancefs/dirs_linux.go treeRemover.open legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Openat2@318 907a0219945d5fec7dd63ad909a3b8121375e3afec270b38b1d7adbf24ec224f |
| +@legacy 84a0bda46435b7067775bf1881c3c522a4ed68a7b9080519837d5b2e4ef6e7a5 internal/instancefs/dirs_linux.go treeRemover.remove legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Fstatat@169 5f76afcb90f4c414e993dec067ebd730ab0ff263328a38171cdee6a4da12061e |
| +@legacy 8a03b45fb9f1ce3151326909b5a89e89c55bf3f63796a3ab2c280adfa6122a97 internal/instancefs/dirs_linux.go treeRemover.sameTop legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Fstat@77 ed275affbeee89c9122580e4df3823be61cd02951040897e9f4e63ee2e624e89 |
| internal/demobuild/runner.go Run legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Consumes only its private root-prepared invocation, proves stop, then no-follow reads bounded diagnostics/output beneath that job.;rev3=census-ruling-gvisor-demos;basis=Task 7: retain bounded no-follow diagnostics/output reads after termination proof; filter gVisor runtime timestamp lines before returning compiler diagnostics. No new read. Task 9: Log failing steps through root logger before returning exactly ErrBuild. Existing bounded no-follow reads and termination-before-output retained.;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: after the stop proof and before opening out/app, waits (within the build ctx) for the process-wide one-at-a-time output turn; every failure releases it, success hands it to the caller in BuildOutput. Same no-follow OpenBeneath of out/app; validation moves to readOutput. No new read path or input. F3 fix round 1: the output turn's release is deferred right after it is taken and disarmed only when a validated output hands it to the caller, so a panic in validation (debug/elf over the build's bytes) gives it back too. Same no-follow OpenBeneath of out/app and the same bounded read; no new read path or input. file:ReadAll@584 3d24a0d2e321031f74789cd89ff37010c32ed982b79bf44f3f61465da22e3f17 |
| internal/demobuild/runner.go ValidateOutput legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Reads bounded bytes, ELF header/program headers and computes their SHA-256; never executes output.;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: body split; ELF/segment/digest checks moved verbatim into validateBinary, which ValidateOutput (client side) and readOutput (root) both call. Same bounded ReadAll; checks unchanged. F3 fix round 2: validateBinary recovers a debug/elf panic on the bytes it parses and answers ErrBuild; same bounded read and checks. file:ReadAll@67 a62ad64a8972e972cf152acca76fe58b0600f9bae50bcd7a988f71672c585cee |
| internal/demobuild/worker.go Worker.Build legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Holds the build/purge read lock through cleanup; existing bounded source read remains.;rev3=census-ruling-demo-slice-adopt;basis=Before admission, call the admit hook (nil = reconcileBudget); a pending budget change (errBudgetPending) is retried every 2 s until the job deadline, any other error fails at once. reconcileBudget reads the fixed build slice's systemctl show budget, its cgroup limit files and cgroup.events under the fixed root cgroup path, and list-jobs (a listing at the capture limit defers); only with buildPurge held exclusively, the slice empty and no build or slice job queued does it run systemctl stop on the fixed slice name. No tenant, app or agent input names a path or unit.;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: when scratch cleanup fails and the output is discarded, releases its output turn first. No read change. F3 fix round 1: the scratch-cleanup defer releases the output turn and poisons the worker if cleanup panics, as it already did when cleanup failed. No read change. file:ReadAll@1087 4687911be61feb14e60cbb801651a3982593de07c2c5430f5676b1174169b179 |
| -internal/demobuild/runner.go readOutput legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3, new: root reads the already-open out/app (from Run's no-follow OpenBeneath) by fstat size into one exact buffer; refuses non-regular or over BinaryMaxBytes, refuses a file still growing past its size, then validateBinary on exactly those bytes. Reads only the fd it is given. file:Read@304,file:Stat@63 9c0196894754b9a9d323ab7622e86ee28c5c4e71c86f5e5610289edfe27103d4 |
| -internal/instancefs/dirs_linux.go treeRemover.clear legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new: getdents in batches of 256 on an open dir fd; per entry fstatat AT_SYMLINK_NOFOLLOW then unlinkat (AT_REMOVEDIR for dirs); a non-empty dir is returned to descend into. Never follows an entry. file:Fstatat@448 5c78478ebb13128d4cae7913afa86bd2473385e7ae868eca10e0b4988bea263d |
| -internal/instancefs/dirs_linux.go treeRemover.open legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new: openat2(parentfd, one name, O_RDONLY|O_DIRECTORY|O_NOFOLLOW, RESOLVE_BENEATH|RESOLVE_NO_SYMLINKS|RESOLVE_NO_MAGICLINKS); never a joined path; retries EINTR/EAGAIN. file:Openat2@318 907a0219945d5fec7dd63ad909a3b8121375e3afec270b38b1d7adbf24ec224f |
| -internal/instancefs/dirs_linux.go treeRemover.remove legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new (replaces removeAt): iterative no-follow removal of a derived child of a root-named dir. fstatat AT_SYMLINK_NOFOLLOW on top; non-dir unlinked; dirs walked by a name stack, each level opened by treeRemover.open from its parent fd; empty dirs removed with unlinkat AT_REMOVEDIR on the parent fd. Re-opens dir only through openDir (RESOLVE_NO_SYMLINKS), as RemoveAllBeneath did, and checks top dev/ino unchanged. F6 fix round 1: at the 65,536-level bound, instead of refusing, hoists the child into top (treeRemover.hoist: reopens dir via openDir or a dup of the caller's held fd, opens top with the same openat2 BENEATH|NO_SYMLINKS|NO_MAGICLINKS and dev/ino check, then renameat2(cur, child, top, .carlos-removing-N, RENAME_NOREPLACE); follows nothing, both ends inside the tree). A child gone before descent re-lists cur (max 64); a missing stack directory on re-walk is an error that is not ErrNotExist. Merge with main: PurgeProven (#1139) now calls removeAllAt instead of removeAt; there dir is PurgeProven's held descriptor, duplicated (F_DUPFD_CLOEXEC) where RemoveAllBeneath would reopen dir by path. Removal-only, no new read. F6 fix round 2: the walk loop moves into treeRemover.walk unchanged in what it opens and removes; remove passes every error walk returns through changed, so once removal has begun no ENOENT (hoist reopening dir included) reads as already absent. Hoist names are .carlos-removing-<128 random bits from crypto/rand> instead of a counter, still renameat2 RENAME_NOREPLACE into the dev/ino-checked top, retried only on a collision (4 tries); a child gone at the hoist re-lists cur within the same 64-try budget as a descent. Same reads; no new read. file:Fstatat@169 5f76afcb90f4c414e993dec067ebd730ab0ff263328a38171cdee6a4da12061e |
| -internal/instancefs/dirs_linux.go treeRemover.sameTop legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6, new: fstat of the re-opened top fd; refuses if dev/ino differ from the top the walk began on. file:Fstat@77 ed275affbeee89c9122580e4df3823be61cd02951040897e9f4e63ee2e624e89 |
| +internal/demobuild/runner.go readOutput legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F3: body split; ELF/segment/digest checks moved verbatim into validateBinary, which ValidateOutput (client side) and readOutput (root) both call. Same bounded ReadAll; checks unchanged. F3 fix round 2: validateBinary recovers a debug/elf panic on the bytes it parses and answers ErrBuild; same bounded read and checks. file:Read@304,file:Stat@63 9c0196894754b9a9d323ab7622e86ee28c5c4e71c86f5e5610289edfe27103d4 |
| +internal/instancefs/dirs_linux.go treeRemover.clear legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Fstatat@448 5c78478ebb13128d4cae7913afa86bd2473385e7ae868eca10e0b4988bea263d |
| +internal/instancefs/dirs_linux.go treeRemover.open legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Openat2@318 907a0219945d5fec7dd63ad909a3b8121375e3afec270b38b1d7adbf24ec224f |
| +internal/instancefs/dirs_linux.go treeRemover.remove legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Fstatat@169 5f76afcb90f4c414e993dec067ebd730ab0ff263328a38171cdee6a4da12061e |
| +internal/instancefs/dirs_linux.go treeRemover.sameTop legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-slice1-control-purge;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). file:Fstat@77 ed275affbeee89c9122580e4df3823be61cd02951040897e9f4e63ee2e624e89 |
| @remove internal/instancefs/dirs_linux.go removeAt |
| @removed internal/instancefs/dirs_linux.go removeAt H3 census-ruling-gvisor-slice1-control-purge;absent;basis=F6: deleted, replaced by treeRemover (same no-follow guarantees, no depth-64 refusal, bounded descriptors and memory). |
| @coverage internal/activator f6d5f883f0adbe490d06ea7bd5de9fcb5315731c5544b2e6bee46217faacf976 |