edge: issue custom-domain certs over DNS-01 before DNS moves (#1293)
With CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS set, the issuer reads the domain claims every minute and certifies attached hostnames in those zones, for those accounts, over DNS-01 through the deployment's DNS provider, before their DNS points here. The certificate is an ordinary per-host entry in control/certs/<host>, so every edge serves it the moment DNS switches. Unset = off. - internal/edge/precert.go: the issuer-only pass; renews ahead of autocert; republishes a local cert the bucket lacks; 5 orders/pass, 20/hour, least recently tried first; 1h backoff, 12h on no zone. - wildcard.go: dns01Order shared with wildcards; per-FQDN challenge lock so an apex order and its parent's wildcard cannot overwrite each other's TXT; account key load-or-mint serialized. - Fake CA dns-01 mode; TestPreIssueE2E proves a non-issuer edge serves the cert for a name that points nowhere yet. - hostenv allows both variables. Astra R1 (2 P1, 1 P2 fixed), R2 READY AFTER FIXES (P2 fixed), census approved on #280. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from precert-dns01-1293 into main.
15 files changed,
+1,566
−47
docs/superpowers/notes/census-proposal-precert-dns01-1293.md+19 −0docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R1.md+44 −0docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R2.md+32 −0docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R1.md+113 −0docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R2.md+136 −0internal/edge/certsync_e2e_test.go+16 −1internal/edge/edge.go+7 −0internal/edge/precert.go+464 −0internal/edge/precert_test.go+608 −0internal/edge/wildcard.go+105 −44internal/host/agent.go+6 −0internal/hostenv/hostenv.go+2 −0internal/provision/plan9_b8_census_test.go+6 −2internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-precert-dns01-1293.tsv+7 −0
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-9SRz0X
.amadan/test-gate.sh
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/benbjohnson/litestream v0.5.14
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading github.com/superfly/ltx v0.5.1
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/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading golang.org/x/sys v0.49.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/oschwald/maxminddb-golang v1.13.1
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading github.com/aws/aws-sdk-go-v2/service/ssm v1.74.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.31
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading golang.org/x/sync v0.24.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading github.com/lmittmann/tint v1.1.3
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
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 modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
=== 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 (173 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
=== vet-tags (180 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
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/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
=== gofmt (1 s, from +0 s)
gofmt -l .: clean
=== rest (376 s, from +14 s)
ok github.com/carlosframework/platform/cmd/carlos-media 118.490s
? github.com/carlosframework/platform/cmd/changelog [no test files]
ok github.com/carlosframework/platform/cmd/console 201.564s
ok github.com/carlosframework/platform/cmd/mediaimage 43.537s
ok github.com/carlosframework/platform/cmd/moveprobe 16.740s
ok github.com/carlosframework/platform/cmd/pricebook-export 0.074s
ok github.com/carlosframework/platform/cmd/rootfswitness 0.173s
ok github.com/carlosframework/platform/cmd/runsc-assets 0.160s
ok github.com/carlosframework/platform/cmd/zddprobe 1.028s
ok github.com/carlosframework/platform/internal/agentsock 0.057s
ok github.com/carlosframework/platform/internal/alerting 0.034s
ok github.com/carlosframework/platform/internal/analytics 0.335s
ok github.com/carlosframework/platform/internal/appconfig 45.113s
ok github.com/carlosframework/platform/internal/apperr 0.355s
ok github.com/carlosframework/platform/internal/applog 0.583s
ok github.com/carlosframework/platform/internal/apppolicy 2.146s
ok github.com/carlosframework/platform/internal/assetcache 0.455s
ok github.com/carlosframework/platform/internal/awsinv 0.016s
ok github.com/carlosframework/platform/internal/awsmanaged 0.561s
ok github.com/carlosframework/platform/internal/awsregiongroup 0.615s
ok github.com/carlosframework/platform/internal/awsterminations 0.048s
ok github.com/carlosframework/platform/internal/backupswords 0.030s
ok github.com/carlosframework/platform/internal/billing 0.071s
ok github.com/carlosframework/platform/internal/billing/billingtest 0.067s
ok github.com/carlosframework/platform/internal/billingstripe 2.154s
ok github.com/carlosframework/platform/internal/boxchoice 0.044s
ok github.com/carlosframework/platform/internal/boxid 3.521s
? 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.014s
ok github.com/carlosframework/platform/internal/boxself 0.145s
ok github.com/carlosframework/platform/internal/boxvolumes 0.099s
ok github.com/carlosframework/platform/internal/caps 0.126s
ok github.com/carlosframework/platform/internal/certwarm 0.006s
ok github.com/carlosframework/platform/internal/cgroup 1.442s
ok github.com/carlosframework/platform/internal/changelog 4.940s
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.013s
ok github.com/carlosframework/platform/internal/codehealth 19.866s
ok github.com/carlosframework/platform/internal/compute 0.008s
? 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 10.273s
ok github.com/carlosframework/platform/internal/dbdoor/dbdoortest 0.041s
ok github.com/carlosframework/platform/internal/dbquery 0.052s
ok github.com/carlosframework/platform/internal/dbreads 3.502s
? github.com/carlosframework/platform/internal/dbreads/dbreadstest [no test files]
ok github.com/carlosframework/platform/internal/dbverify 0.053s
ok github.com/carlosframework/platform/internal/demo 0.009s
ok github.com/carlosframework/platform/internal/demobuild 3.895s
ok github.com/carlosframework/platform/internal/democlaim 0.662s
ok github.com/carlosframework/platform/internal/devbox 19.780s
ok github.com/carlosframework/platform/internal/dnsrec 0.012s
ok github.com/carlosframework/platform/internal/docsite 0.138s
ok github.com/carlosframework/platform/internal/domainreg 0.011s
ok github.com/carlosframework/platform/internal/domains 67.951s
ok github.com/carlosframework/platform/internal/doorkey 0.021s
ok github.com/carlosframework/platform/internal/economics 0.034s
ok github.com/carlosframework/platform/internal/edgefence 0.130s
ok github.com/carlosframework/platform/internal/edgeguard 0.262s
? github.com/carlosframework/platform/internal/edgeproof [no test files]
ok github.com/carlosframework/platform/internal/edgesfile 0.079s
ok github.com/carlosframework/platform/internal/egressaddr 0.012s
ok github.com/carlosframework/platform/internal/execsandbox 100.288s
ok github.com/carlosframework/platform/internal/fileacl 0.008s
ok github.com/carlosframework/platform/internal/fleetapi 2.553s
ok github.com/carlosframework/platform/internal/fleetstore 0.006s
ok github.com/carlosframework/platform/internal/fxrate 0.020s
ok github.com/carlosframework/platform/internal/gate 3.482s
ok github.com/carlosframework/platform/internal/genselect 0.064s
ok github.com/carlosframework/platform/internal/geo 0.055s
ok github.com/carlosframework/platform/internal/geoip 0.145s
ok github.com/carlosframework/platform/internal/groupadmission 0.017s
ok github.com/carlosframework/platform/internal/grouprollaws 17.320s
ok github.com/carlosframework/platform/internal/hadeparture 0.018s
ok github.com/carlosframework/platform/internal/hafresh 0.018s
ok github.com/carlosframework/platform/internal/hairpin 0.292s
ok github.com/carlosframework/platform/internal/historyreadback 1.070s
ok github.com/carlosframework/platform/internal/hostactors 25.606s
ok github.com/carlosframework/platform/internal/hostbox 23.874s
ok github.com/carlosframework/platform/internal/hostclaim 3.456s
ok github.com/carlosframework/platform/internal/hostenv 0.034s
ok github.com/carlosframework/platform/internal/hostevidence 0.032s
ok github.com/carlosframework/platform/internal/hostexec 26.847s
ok github.com/carlosframework/platform/internal/hostfence 0.295s
ok github.com/carlosframework/platform/internal/hostfiles 28.011s
ok github.com/carlosframework/platform/internal/hostfloor 0.100s
ok github.com/carlosframework/platform/internal/hostguard 1.794s
ok github.com/carlosframework/platform/internal/hostops 8.641s
? github.com/carlosframework/platform/internal/hostops/fencerelease [no test files]
ok github.com/carlosframework/platform/internal/hostops/internal/fencerelease 0.011s
ok github.com/carlosframework/platform/internal/hostquarantine 0.039s
ok github.com/carlosframework/platform/internal/hostrelocate 2.320s
ok github.com/carlosframework/platform/internal/hostresolve 0.695s
ok github.com/carlosframework/platform/internal/hostwrite 0.013s
ok github.com/carlosframework/platform/internal/infraview 0.011s
ok github.com/carlosframework/platform/internal/ingresshealth 0.028s
ok github.com/carlosframework/platform/internal/ingresshealth/awstg 0.031s
ok github.com/carlosframework/platform/internal/instancectl 56.394s
ok github.com/carlosframework/platform/internal/instanceexec 9.557s
ok github.com/carlosframework/platform/internal/instancefs 0.041s
ok github.com/carlosframework/platform/internal/instancekey 0.010s
ok github.com/carlosframework/platform/internal/instanceupdates 0.020s
ok github.com/carlosframework/platform/internal/interactive 0.662s
ok github.com/carlosframework/platform/internal/launchd 0.012s
ok github.com/carlosframework/platform/internal/layout 26.289s
ok github.com/carlosframework/platform/internal/layout/pubclass 99.634s
ok github.com/carlosframework/platform/internal/lbhealth 0.013s
ok github.com/carlosframework/platform/internal/lease 143.140s
ok github.com/carlosframework/platform/internal/lease/leasetest 1.720s
ok github.com/carlosframework/platform/internal/lease/locktest 0.025s
ok github.com/carlosframework/platform/internal/ledger 0.083s
ok github.com/carlosframework/platform/internal/mail 1.232s
ok github.com/carlosframework/platform/internal/mailer 0.999s
ok github.com/carlosframework/platform/internal/mailsubmit 1.392s
ok github.com/carlosframework/platform/internal/mailwire 0.008s
ok github.com/carlosframework/platform/internal/maintenance 0.225s
ok github.com/carlosframework/platform/internal/maintenanceexec 8.948s
ok github.com/carlosframework/platform/internal/maintenanceguard 0.427s
ok github.com/carlosframework/platform/internal/media 2.623s
ok github.com/carlosframework/platform/internal/media/mediatest 0.014s
ok github.com/carlosframework/platform/internal/mediaaws 62.530s
ok github.com/carlosframework/platform/internal/mediahandler 44.196s
ok github.com/carlosframework/platform/internal/mediajobs 1.268s
ok github.com/carlosframework/platform/internal/medialocal 9.663s
ok github.com/carlosframework/platform/internal/metrics 0.173s
ok github.com/carlosframework/platform/internal/minorunits 0.017s
ok github.com/carlosframework/platform/internal/moves 55.740s
ok github.com/carlosframework/platform/internal/moves/archive 3.751s
ok github.com/carlosframework/platform/internal/moves/offlinerun 0.146s
ok github.com/carlosframework/platform/internal/namedunits 0.020s
ok github.com/carlosframework/platform/internal/objstore 1.204s
ok github.com/carlosframework/platform/internal/ops 17.538s
ok github.com/carlosframework/platform/internal/pageindex 3.681s
ok github.com/carlosframework/platform/internal/parity 0.158s
? github.com/carlosframework/platform/internal/parity/cmd/parity-doc [no test files]
ok github.com/carlosframework/platform/internal/park 0.801s
ok github.com/carlosframework/platform/internal/perf 0.217s
ok github.com/carlosframework/platform/internal/plans 0.145s
ok github.com/carlosframework/platform/internal/privatefile 0.030s
ok github.com/carlosframework/platform/internal/provision 236.976s
ok github.com/carlosframework/platform/internal/proxyproto 0.971s
ok github.com/carlosframework/platform/internal/publicrelease 0.034s
ok github.com/carlosframework/platform/internal/ratelimit 0.173s
ok github.com/carlosframework/platform/internal/regionlabel 0.054s
ok github.com/carlosframework/platform/internal/regionname 0.059s
ok github.com/carlosframework/platform/internal/registrar 0.011s
ok github.com/carlosframework/platform/internal/registrar/openprovider 0.182s
? github.com/carlosframework/platform/internal/registrar/registrartest [no test files]
ok github.com/carlosframework/platform/internal/registry 85.233s
ok github.com/carlosframework/platform/internal/relay 7.634s
ok github.com/carlosframework/platform/internal/release 80.863s
ok github.com/carlosframework/platform/internal/replicagen 0.019s
ok github.com/carlosframework/platform/internal/replicas 0.096s
ok github.com/carlosframework/platform/internal/reqrec 5.754s
ok github.com/carlosframework/platform/internal/rollout 13.925s
ok github.com/carlosframework/platform/internal/rolloutwords 0.036s
ok github.com/carlosframework/platform/internal/rootaws 100.646s
ok github.com/carlosframework/platform/internal/rootfsimage 0.875s
ok github.com/carlosframework/platform/internal/rootparticipation 0.077s
ok github.com/carlosframework/platform/internal/rootstate 0.055s
ok github.com/carlosframework/platform/internal/runs 0.808s
ok github.com/carlosframework/platform/internal/s3compat 0.039s
ok github.com/carlosframework/platform/internal/s3fake 1.014s
ok github.com/carlosframework/platform/internal/safefile 0.022s
ok github.com/carlosframework/platform/internal/schedule 24.062s
ok github.com/carlosframework/platform/internal/seeds 0.114s
ok github.com/carlosframework/platform/internal/sim/litestreamfacts 4.880s
ok github.com/carlosframework/platform/internal/sim/mediajobs 48.557s
ok github.com/carlosframework/platform/internal/sim/regionha 23.017s
ok github.com/carlosframework/platform/internal/status 0.414s
ok github.com/carlosframework/platform/internal/steering 0.347s
ok github.com/carlosframework/platform/internal/stopevidence 0.729s
ok github.com/carlosframework/platform/internal/storecfg 0.591s
ok github.com/carlosframework/platform/internal/svcrole 0.038s
ok github.com/carlosframework/platform/internal/systemd 7.434s
? github.com/carlosframework/platform/internal/systemdshow [no test files]
ok github.com/carlosframework/platform/internal/team 5.680s
ok github.com/carlosframework/platform/internal/teamcontract 0.397s
ok github.com/carlosframework/platform/internal/telemetry 0.056s
ok github.com/carlosframework/platform/internal/termfence 4.220s
ok github.com/carlosframework/platform/internal/timerspec 0.023s
ok github.com/carlosframework/platform/internal/tsidentity 4.205s
ok github.com/carlosframework/platform/internal/tunnelclient 0.483s
ok github.com/carlosframework/platform/internal/unixdial 0.042s
ok github.com/carlosframework/platform/internal/updatewords 0.117s
ok github.com/carlosframework/platform/internal/upstreamguard 0.017s
? github.com/carlosframework/platform/internal/upstreamguard/guardtest [no test files]
ok github.com/carlosframework/platform/internal/usage 0.012s
ok github.com/carlosframework/platform/internal/version 0.004s
ok github.com/carlosframework/platform/internal/vet 3.408s
ok github.com/carlosframework/platform/internal/zonehost 0.013s
ok github.com/carlosframework/platform/internal/zonehost/route53zones 0.060s
? 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.049s
ok github.com/carlosframework/platform/scripts/pathmapcheck 0.061s
ok github.com/carlosframework/platform/scripts/region-ha-g2/fixture 5.173s
ok github.com/carlosframework/platform/scripts/stateless-replicas-drill 1.189s
ok github.com/carlosframework/platform/scripts/witness-pointer 0.029s
=== cutover-witness (155 s, from +14 s)
ok github.com/carlosframework/platform 2.052s
=== internal_grouproll@0 (273 s, from +73 s)
ok github.com/carlosframework/platform/internal/grouproll 272.657s
=== internal_grouproll@1 (279 s, from +73 s)
ok github.com/carlosframework/platform/internal/grouproll 278.706s
=== internal_activator@0 (143 s, from +142 s)
ok github.com/carlosframework/platform/internal/activator 139.998s
=== internal_activator@1 (133 s, from +142 s)
ok github.com/carlosframework/platform/internal/activator 129.917s
=== internal_activator@2 (141 s, from +142 s)
ok github.com/carlosframework/platform/internal/activator 137.356s
=== internal_activator@3 (164 s, from +142 s)
ok github.com/carlosframework/platform/internal/activator 160.733s
=== root@0 (118 s, from +171 s)
ok github.com/carlosframework/platform 109.310s
=== root@1 (113 s, from +171 s)
ok github.com/carlosframework/platform 102.620s
=== root@2 (136 s, from +171 s)
ok github.com/carlosframework/platform 127.270s
=== root@3 (113 s, from +171 s)
ok github.com/carlosframework/platform 102.637s
=== root@4 (96 s, from +171 s)
ok github.com/carlosframework/platform 85.280s
=== internal_edge@0 (193 s, from +174 s)
ok github.com/carlosframework/platform/internal/edge 184.213s
=== internal_edge@1 (184 s, from +174 s)
ok github.com/carlosframework/platform/internal/edge 175.183s
=== internal_edge@2 (162 s, from +174 s)
ok github.com/carlosframework/platform/internal/edge 153.706s
=== internal_edge@3 (150 s, from +174 s)
ok github.com/carlosframework/platform/internal/edge 141.283s
=== internal_host@0 (137 s, from +209 s)
ok github.com/carlosframework/platform/internal/host 131.673s
=== internal_host@1 (145 s, from +209 s)
ok github.com/carlosframework/platform/internal/host 139.538s
=== internal_host@2 (277 s, from +209 s)
ok github.com/carlosframework/platform/internal/host 271.375s
=== internal_host@3 (193 s, from +209 s)
ok github.com/carlosframework/platform/internal/host 187.583s
=== internal_host@4 (212 s, from +209 s)
ok github.com/carlosframework/platform/internal/host 207.166s
=== internal_host@5 (174 s, from +209 s)
ok github.com/carlosframework/platform/internal/host 167.937s
=== internal_console@0 (183 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 176.696s
=== internal_console@1 (194 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 187.091s
=== internal_console@2 (192 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 185.227s
=== internal_console@3 (242 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 234.401s
=== internal_console@4 (181 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 173.203s
=== internal_console@5 (193 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 186.473s
=== internal_console@6 (197 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 190.366s
=== internal_console@7 (190 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 183.444s
=== internal_console@8 (200 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 193.544s
=== internal_console@9 (203 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 196.206s
=== internal_console@10 (212 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 204.314s
=== internal_console@11 (222 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 214.749s
=== internal_console@12 (272 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 265.556s
=== internal_console@13 (191 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 183.482s
=== internal_console@14 (188 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 180.466s
=== internal_console@15 (238 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 231.386s
=== internal_console@16 (222 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 215.115s
=== internal_console@17 (197 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 190.249s
=== internal_console@18 (199 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 191.760s
=== internal_console@19 (199 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 192.063s
=== internal_console@20 (194 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 186.495s
=== internal_console@21 (217 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 209.144s
=== internal_console@22 (214 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 205.467s
=== internal_console@23 (210 s, from +216 s)
ok github.com/carlosframework/platform/internal/console 203.111s
=== lists: internal_console 215 s, internal_edge 173 s, internal_activator 141 s, internal_host 208 s, root 170 s, internal_grouproll 72 s
=== cpu: the gate used 12290 cpu-seconds in 488 s, about 25.2 of 32 cores; the machine as a whole was 84% busy
=== opentofu ===
opentofu: 35 test files in 11 suites, OpenTofu v1.13.9
initialised in 15 s
ok 17 s infra/modules/box-fence-writer/tests/writer.tftest.hcl Success! 1 passed, 0 failed.
ok 29 s infra/modules/deployment-buckets/tests/data_lifecycle.tftest.hcl Success! 3 passed, 0 failed.
ok 19 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 29 s infra/modules/deployment-buckets/tests/fence_writers.tftest.hcl Success! 3 passed, 0 failed.
ok 85 s infra/modules/media-engine/tests/media_engine.tftest.hcl Success! 24 passed, 0 failed.
ok 33 s infra/modules/pdf-host/tests/computed.tftest.hcl Success! 2 passed, 0 failed.
ok 70 s infra/modules/pdf-host/tests/pdf_host.tftest.hcl Success! 24 passed, 0 failed.
ok 44 s infra/modules/region-group-operator-document/tests/document.tftest.hcl Success! 12 passed, 0 failed.
ok 21 s infra/modules/region-host/ingress/tests/fixed-targets/tests/targets.tftest.hcl Success! 2 passed, 0 failed.
ok 64 s infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl Success! 30 passed, 0 failed.
ok 44 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 14 s infra/modules/region-host/tests/analytics_prune.tftest.hcl Success! 2 passed, 0 failed.
ok 16 s infra/modules/region-host/tests/console_mail.tftest.hcl Success! 4 passed, 0 failed.
ok 9 s infra/modules/region-host/tests/fixed_state_unchanged.tftest.hcl Success! 1 passed, 0 failed.
ok 68 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 10 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 36 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 30 s infra/modules/region-host/tests/health_alarms.tftest.hcl Success! 10 passed, 0 failed.
ok 10 s infra/modules/region-host/tests/ingress_drain_read.tftest.hcl Success! 4 passed, 0 failed.
ok 6 s infra/modules/region-host/tests/instance_metadata.tftest.hcl Success! 1 passed, 0 failed.
ok 24 s infra/modules/region-host/tests/mailer.tftest.hcl Success! 6 passed, 0 failed.
ok 13 s infra/modules/region-host/tests/mailer_group.tftest.hcl Success! 2 passed, 0 failed.
ok 17 s infra/modules/region-host/tests/managed_fleets/group_refusal.tftest.hcl Success! 2 passed, 0 failed.
ok 105 s infra/modules/region-host/tests/managed_fleets/managed_fleets.tftest.hcl Success! 46 passed, 0 failed.
ok 72 s infra/modules/region-host/tests/store_conversion.tftest.hcl Success! 27 passed, 0 failed.
ok 17 s infra/modules/region-host/tests/store_scanning.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 10 s infra/modules/region-remote-host/tests/data_lifecycle.tftest.hcl Success! 3 passed, 0 failed.
ok 15 s infra/modules/region-remote-host/tests/no_deployment_bucket.tftest.hcl Success! 5 passed, 0 failed.
ok 26 s infra/modules/scanner-host/tests/scanner_host.tftest.hcl Success! 14 passed, 0 failed.
opentofu: 35 files in 205 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: 65667234 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:34139
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.01s)
--- 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.036s
=== RUN TestT4StorageProbeMinio
2026/11/22 14:01:23 moves: T4: STORE: list: operation error S3: ListObjectsV2, https response error StatusCode: 403, RequestID: 18EA62D866652050, HostID: 44e92caff8d239d0acc32ee48fc7bf957e2a9846692a370b3161e0cf79ad85d9, 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.045s
=== RUN TestS3StoreMinioContract
=== RUN TestS3StoreMinioContract/conditional_get_and_etag_listing
=== RUN TestS3StoreMinioContract/bump_through_every_mutation_path
--- PASS: TestS3StoreMinioContract (0.03s)
--- 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.040s
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.03s)
PASS
ok github.com/carlosframework/platform/internal/release 0.040s
=== RUN TestEndToEndMinio
=== RUN TestEndToEndMinio/plan
=== RUN TestEndToEndMinio/roll
=== RUN TestEndToEndMinio/replace
=== RUN TestEndToEndMinio/remove
--- PASS: TestEndToEndMinio (0.47s)
--- PASS: TestEndToEndMinio/plan (0.01s)
--- PASS: TestEndToEndMinio/roll (0.12s)
--- PASS: TestEndToEndMinio/replace (0.15s)
--- PASS: TestEndToEndMinio/remove (0.15s)
PASS
ok github.com/carlosframework/platform/internal/grouproll 0.474s
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/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/22 14:01:28 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000002
2026/11/22 14:01:28 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000002 maxTXID=0000000000000002 size=370
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000002
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000003
2026/11/22 14:01:28 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000003 maxTXID=0000000000000003 size=454
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000003 txid.db=0000000000000003
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/22 14:01:28 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/22 14:01:28 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/22 14:01:29 console: CARLOS_SECRETS_PUBKEY is unset, so no region outside the home can be chosen automatically
2026/11/22 14:01:29 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%3A39623: could not determine target mailbox
agent.go:136: dbreads: dbr_uxiwoanfxs2ant3rl64f6k4qp4: planned 1 files (720 bytes) and restored to 1 in 11ms
agent.go:136: dbreads: dbr_uxiwoanfxs2ant3rl64f6k4qp4: output 5 bytes in 1 confirmed chunks in 1ms
2026/11/22 14:01:30 console: db read dbr_uxiwoanfxs2ant3rl64f6k4qp4: relayed 1 chunks (102 bytes) in 1.005s, ended done
agent.go:136: dbreads: dbr_guxxufzvga3w36cgpcsu5cdfj4: planned 3 files (1544 bytes) and restored to 3 in 13ms
agent.go:136: dbreads: dbr_guxxufzvga3w36cgpcsu5cdfj4: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/22 14:01:31 console: db read dbr_guxxufzvga3w36cgpcsu5cdfj4: relayed 1 chunks (102 bytes) in 1.005s, ended done
agent.go:136: dbreads: dbr_gehponlxoocftvwdxbpswzbebu: planned 3 files (1544 bytes) and held through 3 in 12ms
agent.go:136: dbreads: dbr_gehponlxoocftvwdxbpswzbebu: output 1544 bytes in 1 confirmed chunks in 1ms
2026/11/22 14:01:32 console: db read dbr_gehponlxoocftvwdxbpswzbebu: relayed 1 chunks (1641 bytes) in 1.005s, ended done
=== RUN TestDBForwardMinio/by_disconnect
=== NAME TestDBForwardMinio
agent.go:136: dbreads: dbr_5xvlrrtzweavbd4z4m6oyg6d34: planned 3 files (1544 bytes) and restored to 3 in 16ms
2026/11/22 14:01:32 console: db read dbr_5xvlrrtzweavbd4z4m6oyg6d34: relayed 0 chunks (0 bytes) in 33ms, ended client gone
agent.go:136: dbreads: dbr_5xvlrrtzweavbd4z4m6oyg6d34: output 5 bytes in 1 confirmed chunks in 104ms
=== RUN TestDBForwardMinio/by_timeout
=== NAME TestDBForwardMinio
agent.go:136: dbreads: dbr_ujprozlskfofue6chgztdjy7zm: planned 3 files (1544 bytes) and restored to 3 in 12ms
2026/11/22 14:01:52 console: db read dbr_ujprozlskfofue6chgztdjy7zm: relayed 0 chunks (0 bytes) in 19.637s, ended no-result
agent.go:136: dbreads: dbr_ujprozlskfofue6chgztdjy7zm: output 5 bytes in 1 confirmed chunks in 19.614s
--- PASS: TestDBForwardMinio (23.30s)
--- PASS: TestDBForwardMinio/by_disconnect (0.24s)
--- PASS: TestDBForwardMinio/by_timeout (19.75s)
PASS
ok github.com/carlosframework/platform/internal/console 23.345s
Bucket created successfully `local/media-transfers`.
Bucket created successfully `local/media-transfer-results`.
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.05s)
PASS
ok github.com/carlosframework/platform/internal/mediaaws 0.059s
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.53s)
PASS
ok github.com/carlosframework/platform/internal/medialocal 0.538s
=== RUN TestHeldHandoverTwoBoxMinio
2026/11/22 14:01:56 edge: mesh key: minted
2026/11/22 14:01:56 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/22 14:01:57 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/22 14:01:57 tenant admission is open. accepting tenant work
2026/11/22 14:01:57 activator: HA placement host=shop-c86de3d6.example.test kind=Place ref=annie reason=roomiest generation=2026-11-22T14:01:57Z lock_generation=0
2026/11/22 14:01:57 lease: t8-c86de3d6/shop-c86de3d6.example.test: HA lease acquired in 4ms (first wake)
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: started carlos-instance@shop\x2dc86de3d6.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/22 14:01:57 activator: shop-c86de3d6.example.test: carlos-instance@shop\x2dc86de3d6.example.test.service launched in 7ms, healthy 0s later
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: woke in 20ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 7ms, replicate 8ms
2026/11/22 14:01:57 lease: t8-c86de3d6/plain-c86de3d6.example.test: acquired in 2ms (client 0s, lock read and write 1ms)
2026/11/22 14:01:57 activator: no replica for plain-c86de3d6.example.test in s3://contract-bucket/t8-c86de3d6/plain-c86de3d6.example.test — booting fresh
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test: started carlos-instance@plain\x2dc86de3d6.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) 5ms, launch file 0s, gate 0s, root start 1ms)
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test: carlos-instance@plain\x2dc86de3d6.example.test.service launched in 6ms, healthy 0s later
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test: woke in 90ms: checks 0s, lease 2ms, restore 18ms, identity 0s, protect 0s, spawn 7ms, replicate 64ms
2026/11/22 14:01:57 lease: t8-c86de3d6/bot0.shop.bac.sidecar.internal: HA lease acquired in 3ms (first wake)
2026/11/22 14:01:57 activator: bot0.shop.bac.sidecar.internal: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/22 14:01:57 activator: bot0.shop.bac.sidecar.internal: woke in 18ms: checks 0s, lease 4ms, restore 0s, identity 0s, protect 0s, spawn 6ms, settle 0s, replicate 7ms
2026/11/22 14:01:57 activator: next-due probe plain-c86de3d6.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/22 14:01:57 activator: next-due probe shop-c86de3d6.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test hibernated
2026/11/22 14:01:57 activator: bot0.shop.bac.sidecar.internal: released with a marker (clean true, txid 1, files 3:5fdc65abc6ce1c66e278b576fc60e51293d80d914414b372b390f249e9fcb770) in 9ms: files 1ms, sync 4ms, record 1ms, marker 3ms
2026/11/22 14:01:57 activator: bot0.shop.bac.sidecar.internal hibernated
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: released with a marker (clean true, txid 1, files 3:7be565c4dbc598f430a96a1029f3c58c865ea5773b3a8b567c2fbd23d76ea393) in 7ms: files 1ms, sync 3ms, record 1ms, marker 2ms
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test hibernated
2026/11/22 14:01:57 lease: t8-c86de3d6/shop-c86de3d6.example.test: HA lease acquired in 3ms (clean marker)
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: restored (other-box)
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: started carlos-instance@shop\x2dc86de3d6.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) 1ms, launch file 0s, gate 0s, root start 1ms)
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: carlos-instance@shop\x2dc86de3d6.example.test.service launched in 2ms, healthy 0s later
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: woke in 36ms: checks 0s, lease 4ms, restore 24ms, identity 0s, protect 0s, spawn 2ms, replicate 7ms
2026/11/22 14:01:57 edge: ha-take shop-c86de3d6.example.test from annie (txn t8-witness, marker generation 1): holder betty, generation 2
2026/11/22 14:01:57 edge: forward shop-c86de3d6.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:1624d410368db87ef786d51acc2defc4 Step:move Result:ok Reasons:[] Fence:t8-witness StartedAt:2026-11-22 14:01:57.273269195 +0000 UTC FinishedAt:2026-11-22 14:01:57.371567994 +0000 UTC Acked:[betty carol] Departed:[] Moved:[{Host:shop-c86de3d6.example.test Holder:betty Gen:2 Confirmed:take}] Released:[{Host:plain-c86de3d6.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:67 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-c86de3d6.example.test <nil> releasing shop-c86de3d6.example.test <nil> stop plain-c86de3d6.example.test marker=true clean=true <nil> stop bot0.shop.bac.sidecar.internal marker=true clean=true <nil> stop shop-c86de3d6.example.test marker=true clean=true <nil> taken shop-c86de3d6.example.test betty <nil> end-moves]
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/bot0.shop.bac.sidecar.internal/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/bot0.shop.bac.sidecar.internal/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/bot0.shop.bac.sidecar.internal/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: DELETE /contract-bucket/t8-c86de3d6/plain-c86de3d6.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-c86de3d6/bot0.shop.bac.sidecar.internal/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-c86de3d6/bot0.shop.bac.sidecar.internal/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/head.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/generations/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0008/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0007/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0006/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0005/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0004/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0008/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0007/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0006/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0005/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0004/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/files/0/manifest.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/files/0/objects/0000000000000001-a85ee6027bff0df7b238020996dc1505a67ea70c13ff47485153e863ccd6d1f1
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/files/0/objects/0000000000000003-f5788ade60f045c94d293cfff4bc1ca9bfcbbca022498aa6db27d44b7280f4f4
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/0000/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/0000/0000000000000002-0000000000000002.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-c86de3d6/shop-c86de3d6.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-c86de3d6/shop-c86de3d6.example.test/0003/
hadrain_twobox_minio_linux_test.go:1243: drain took 152ms; S3 calls 49 (DELETE lock=1 GET files=3 GET head=1 GET lock=3 GET replica=2 LIST replica=33 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/22 14:01:57 lease: t8-c86de3d6/plain-c86de3d6.example.test: acquired in 1ms (client 0s, lock read and write 1ms)
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test: started carlos-instance@plain\x2dc86de3d6.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/22 14:01:57 activator: plain-c86de3d6.example.test: carlos-instance@plain\x2dc86de3d6.example.test.service launched in 1ms, healthy 0s later
2026/11/22 14:01:57 lease: /tmp/carlos-minio-contract-na8Xh6/g/dw1992303993/data/instances/plain-c86de3d6.example.test/plain-c86de3d6.example.test.db: continuity with the last clean close not proven; snapshot 1-0000000000000001 written before serving
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test: woke in 7ms: checks 0s, lease 1ms, restore 0s, identity 0s, protect 0s, spawn 1ms, replicate 4ms
2026/11/22 14:01:57 activator: next-due probe shop-c86de3d6.example.test: decode /api/next-due: invalid character 'b' looking for beginning of value — recording none (it sleeps until a request)
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test: released with a marker (clean true, txid 2, files 3:7be565c4dbc598f430a96a1029f3c58c865ea5773b3a8b567c2fbd23d76ea393) in 4ms: files 1ms, sync 0s, record 1ms, marker 2ms
2026/11/22 14:01:57 activator: shop-c86de3d6.example.test hibernated
2026/11/22 14:01:57 tenant admission is closed for shutdown
2026/11/22 14:01:57 activator: next-due probe plain-c86de3d6.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/22 14:01:57 activator: plain-c86de3d6.example.test hibernated
--- PASS: TestHeldHandoverTwoBoxMinio (0.52s)
=== RUN TestHeldHandoverLostLeaseMinio
2026/11/22 14:01:57 edge: mesh key: minted
2026/11/22 14:01:57 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/22 14:01:57 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/22 14:01:57 tenant admission is open. accepting tenant work
2026/11/22 14:01:57 activator: HA placement host=shop-69476e10.example.test kind=Place ref=annie reason=roomiest generation=2026-11-22T14:01:57Z lock_generation=0
2026/11/22 14:01:57 lease: t8-69476e10/shop-69476e10.example.test: HA lease acquired in 3ms (first wake)
2026/11/22 14:01:57 activator: shop-69476e10.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/22 14:01:57 activator: shop-69476e10.example.test: started carlos-instance@shop\x2d69476e10.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 5ms, control socket 0s, key gate 0s, logs 0s) 5ms, launch file 0s, gate 0s, root start 1ms)
2026/11/22 14:01:57 activator: shop-69476e10.example.test: carlos-instance@shop\x2d69476e10.example.test.service launched in 6ms, healthy 0s later
2026/11/22 14:01:57 activator: shop-69476e10.example.test: woke in 68ms: checks 0s, lease 4ms, restore 0s, identity 0s, protect 0s, spawn 7ms, replicate 57ms
2026/11/22 14:01:57 activator: next-due probe shop-69476e10.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/22 14:01:57 activator: final checkpoint shop-69476e10.example.test: lease: release marker owed for s3://contract-bucket/t8-69476e10/shop-69476e10.example.test/lock.json (If-Match "33f7e6757a4bb8e9d85f644a0ec17a70"): lease: write release marker: operation error S3: PutObject, https response error StatusCode: 503, RequestID: , HostID: , api error ServiceUnavailable: witness: refused
2026/11/22 14:01:57 activator: shop-69476e10.example.test hibernated
2026/11/22 14:01:57 activator: handover of shop-69476e10.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-69476e10.example.test client 4 "
hadrain_twobox_minio_linux_test.go:1486: driver calls: [begin shop-69476e10.example.test <nil> releasing shop-69476e10.example.test <nil> stop shop-69476e10.example.test marker=false clean=false <nil> left shop-69476e10.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/22 14:01:57 tenant admission is closed for shutdown
2026/11/22 14:01:57 http: proxy error: context canceled
--- PASS: TestHeldHandoverLostLeaseMinio (0.32s)
PASS
ok github.com/carlosframework/platform/internal/host 0.877s
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/22 14:01:58 lease: instances/gen-1795356118922272831.shop.example.com: HA lease acquired in 4ms (first wake)
2026/11/22 14:01:58 lease: instances/gen-1795356118922272831.shop.example.com: HA lease acquired in 2ms (holder terminated)
gentake_minio_test.go:308: a second create-only copy onto instances/gen-1795356118922272831.shop.example.com/g-00000000000000000002/0000/0000000000000001-0000000000000001.ltx: <nil> (destination condition honoured: false)
2026/11/22 14:01:58 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/22 14:01:58 http: proxy error: context canceled
2026/11/22 14:01:58 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/22 14:01:59 lease: instances/gen-1795356119042499216.shop.example.com: HA lease acquired in 3ms (first wake)
2026/11/22 14:01:59 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/22 14:01:59 lease: instances/gen-1795356119042499216.shop.example.com: HA lease acquired in 2ms (clean marker)
=== RUN TestGenerationTakeMinio/copy-version
=== RUN TestGenerationTakeMinio/store-time
2026/11/22 14:01:59 lease: instances/gen-1795356119088954430.shop.example.com: HA lease acquired in 4ms (first wake)
2026/11/22 14:01:59 http: proxy error: context canceled
2026/11/22 14:01:59 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/22 14:01:59 lease: instances/gen-1795356119088954430.shop.example.com: HA lease acquired in 2ms (clean marker)
2026/11/22 14:01:59 lease: instances/gen-1795356119088954430.shop.example.com: HA lease acquired in 2ms (unclean marker)
2026/11/22 14:01:59 lease: instances/gen-1795356119088954430.shop.example.com: HA lease acquired in 2ms (unclean marker)
2026/11/22 14:01:59 lease: instances/gen-1795356119088954430.shop.example.com: HA lease acquired in 2ms (unclean marker)
2026/11/22 14:01:59 lease: instances/gen-1795356119088954430.shop.example.com: HA lease acquired in 2ms (unclean marker)
=== RUN TestGenerationTakeMinio/skew
--- PASS: TestGenerationTakeMinio (0.28s)
--- PASS: TestGenerationTakeMinio/take (0.12s)
--- PASS: TestGenerationTakeMinio/switch-412 (0.04s)
--- 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.288s
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
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 1m47.399s
codehealth_test.go:107: line metrics (code lines, then physical):
file-lines 5471 7324 internal/activator activator_test.go
file-lines 4219 7040 internal/console server.go
file-lines 4184 6365 . apimode.go
file-lines 3782 7198 internal/activator activator.go
file-lines 3530 4459 . apimode_test.go
file-lines 3261 3864 internal/registry registry_test.go
file-lines 3211 6362 internal/host agent.go
file-lines 3094 3992 internal/provision reconcile_test.go
func-lines 870 891 internal/host plan14InstalledClaimLaunch
func-lines 811 1275 internal/provision Reconcile
func-lines 769 1242 internal/console (*Server).handleAPIInstanceCreate
func-lines 688 1232 internal/host runAgent
func-lines 570 903 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 809 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 400 868 internal/provision rootReadArchivedChain
func-lines 399 732 internal/release PassFilter
func-lines 390 398 internal/host runFilesSeedPreparationWithLive
func-lines 384 905 internal/edge (*Edge).ServeHTTP
func-lines 383 406 internal/console TestDemoSourceToLiveAndUpdate
func-lines 378 600 internal/console (*Server).handleAPIShip
func-lines 374 377 internal/host plan14RequiredArtifactsRootRunner
func-lines 371 417 internal/host TestRootEgressKernelProof
func-lines 367 635 cmd/console serve
func-lines 364 371 internal/host testRootMigrationBootstrap
func-lines 360 362 internal/edge TestDemoAPIAliasBoundary
func-lines 358 362 internal/registry (*Registry).haJournal
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 (203 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/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
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/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/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/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/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/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/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/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/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 18578 at 45 sites functions over 300 code lines (blank and comment-only lines not counted)
codehealth_test.go:115: file-lines 30752 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/activator activator.go -: 3782 in the code, the record allows 3783 (make code-health-record lowers it)
codehealth_test.go:119: below the record: file-lines internal/host agent.go -: 3211 in the code, the record allows 3214 (make code-health-record lowers it)
--- PASS: TestCodeHealth (107.40s)
PASS
ok github.com/carlosframework/platform/internal/codehealth 108.767s
=== code-health-record ===
go version go1.26.10 linux/arm64
code-health record: HEAD is on main; comparing with its parent 86ac0553e488fe5611d9ebc276f02aa0f7229b10
=== 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 (13 s, from +14 s)
ok github.com/carlosframework/platform/internal/systemd 12.977s
=== internal_rootaws@0 (26 s, from +34 s)
ok github.com/carlosframework/platform/internal/rootaws 25.017s
=== internal_activator@0 (277 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 275.214s
=== internal_activator@1 (268 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 266.216s
=== internal_activator@2 (289 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 287.436s
=== internal_activator@3 (380 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 378.279s
=== internal_activator@4 (280 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 278.288s
=== internal_activator@5 (289 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 287.340s
=== internal_activator@6 (299 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 297.201s
=== internal_activator@7 (431 s, from +110 s)
ok github.com/carlosframework/platform/internal/activator 428.979s
=== internal_edge@0 (84 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 80.905s
=== internal_edge@1 (65 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 61.651s
=== internal_edge@2 (187 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 184.190s
=== internal_edge@3 (149 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 145.560s
=== internal_edge@4 (167 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 164.139s
=== internal_edge@5 (223 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 220.081s
=== internal_edge@6 (213 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 210.228s
=== internal_edge@7 (217 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 214.247s
=== internal_edge@8 (206 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 203.285s
=== internal_edge@9 (320 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 317.048s
=== internal_edge@10 (218 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 214.961s
=== internal_edge@11 (239 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 235.588s
=== internal_edge@12 (244 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 240.844s
=== internal_edge@13 (254 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 250.400s
=== internal_edge@14 (192 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 188.776s
=== internal_edge@15 (259 s, from +130 s)
ok github.com/carlosframework/platform/internal/edge 256.221s
=== internal_host@0 (14 s, from +189 s)
ok github.com/carlosframework/platform/internal/host 11.471s
=== internal_host@1 (8 s, from +189 s)
ok github.com/carlosframework/platform/internal/host 5.342s
=== lists: internal_edge 130 s, internal_activator 109 s, internal_host 188 s, internal_rootaws 34 s, internal_systemd 14 s
=== cpu: the gate used 7523 cpu-seconds in 541 s, about 13.9 of 32 cores; the machine as a whole was 43% busy
=== gitleaks ===
go version go1.26.10 linux/arm64
go: downloading github.com/zricethezav/gitleaks/v8 v8.30.1
go: downloading github.com/rs/zerolog v1.33.0
go: downloading github.com/spf13/cobra v1.9.1
go: downloading github.com/spf13/viper v1.19.0
go: downloading github.com/fatih/semgroup v1.2.0
go: downloading github.com/h2non/filetype v1.1.3
go: downloading github.com/mholt/archives v0.1.2
go: downloading github.com/gitleaks/go-gitdiff v0.9.1
go: downloading github.com/Masterminds/sprig/v3 v3.3.0
go: downloading github.com/charmbracelet/lipgloss v0.5.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/BobuSumisu/aho-corasick v1.0.3
go: downloading github.com/klauspost/compress v1.17.11
go: downloading github.com/minio/minlz v1.0.0
go: downloading github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3
go: downloading github.com/klauspost/pgzip v1.2.6
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/nwaples/rardecode/v2 v2.1.0
go: downloading github.com/STARRY-S/zip v0.2.1
go: downloading github.com/therootcompany/xz v1.0.1
go: downloading github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707
go: downloading golang.org/x/text v0.22.0
go: downloading github.com/ulikunitz/xz v0.5.12
go: downloading github.com/bodgit/sevenzip v1.6.0
go: downloading github.com/sorairolake/lzip-go v0.3.5
go: downloading dario.cat/mergo v1.0.1
go: downloading github.com/Masterminds/semver/v3 v3.3.0
go: downloading github.com/Masterminds/goutils v1.1.1
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/mitchellh/reflectwalk v1.0.2
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 golang.org/x/sys v0.30.0
go: downloading golang.org/x/sync v0.11.0
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/muesli/termenv v0.15.1
go: downloading github.com/rivo/uniseg v0.2.0
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 github.com/mattn/go-colorable v0.1.14
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
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 94 near misses of the names notscanned.go lists
self-test: skipped the 31 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, 126 tracked files judged, 3 broken setups refused
gitleaks: scanned 11251 tracked files; 31 not scanned, by exact path (scripts/gitleaks-gate/notscanned.go)
gitleaks: clean
diff --git a/docs/superpowers/notes/census-proposal-precert-dns01-1293.md b/docs/superpowers/notes/census-proposal-precert-dns01-1293.md| new file mode 100644 |
| index 000000000..5f74fa03f |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-precert-dns01-1293.md |
| @@ -0,0 +1,19 @@ |
| +# Census approval: precert-dns01-1293 |
| + |
| +Ruling `census-ruling-precert-dns01-1293`. 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). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/edge/edge.go` `RunWithActivatorReady` | body | unchanged (5) | the edge process (carlos-edge.service, user carlos), not root: after the cert warm starts, calls e.newPreIssuerFromEnv(certCache, mirror, wm) and, when it returns non-nil, starts its loop and logs one line. newPreIssuerFromEnv (precert.go) reads CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the edge environment (the root-owned host.env); either unset or invalid = nil, nothing else read. Only claims of the named accounts qualify. Armed, the loop runs only while this box holds the issuer gate: it lists domains/ claims in the deployment bucket through a ClaimCache, and for proven claims under the listed zones orders a certificate over DNS-01 through the existing DNS provider seam (dnsProviderFromEnv, same IAM-scoped _acme-challenge TXT writes the wildcard manager already makes), writing the result through the existing publishing cache (local acme dir + control/certs/<host>). No root read; the existing 5 read sites are unchanged. | |
| + |
| +Envelopes re-pinned: `internal/edge`, `internal/host`, `internal/hostenv`. |
| + |
| +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. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/edge/edge.go` `RunWithActivatorReady`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-certwarm-wake;basis=registers the cert warm's nudge on OnReload and on the home map's new served-hosts wake (#386); nudge only sends on a buffered channel; no read added, same 5 sites;rev3=census-ruling-edge-roll-blip;basis=the :80/:443 (and dev) listeners are bound on the calling goroutine with net.Listen via listen()/listenAddr (same empty-address defaults as ListenAndServe) before the serve goroutines, which now call Serve/ServeTLS on them, and one log line names the bound addresses; no read added, same 5 sites;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): the inline home-map arming (newHomeMap, one boot Refresh, Store, run) moves unchanged into the new Edge.ArmHomeMap and is called here as e.ArmHomeMap(); same refresh, same timeout, same order. The reads are moved, none added.;rev3=census-ruling-agent-start-demo-1;basis=Logs the combined explicit wildcard parents through demoWildcardDomains; no new watcher or read loop.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: invoke the local admission Close before HTTP/HTTPS draining and door shutdown in both dev and normal listeners. Preserve merged main's startup behavior and its census basis; the same five read sites, no new reads.;rev3=census-ruling-stateless-replicas-3;basis=Task 1b: defer stopping and joining the edge's replica jobs at shutdown. Existing five direct read sites unchanged; no new reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Wrap dev, HTTP and HTTPS listeners through ConfigureGroupHairpin before serving. Indirectly read protected root boot identity and group-ingress.json; kernel local/peer addresses mark local ingress, never HTTP headers. Agent edge uses verified public source for accounting; direct read sites unchanged and absent marker keeps original listeners. CI fix removes interface enumeration: local peer must match snapshot primary IPv4, an ingress IPv4 installed locally by root, or loopback; kernel destination must still be an ingress EIP on port 80/443. Merge 45cebde4 retains deferred stopReplicaProbes alongside group listener wrapping and shutdown admission closure.;rev3=census-ruling-demo-api-site-route;basis=Change the startup failure context from load routes to initialize because origin validation now runs during construction. Existing five read sites unchanged; no new read or runtime authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Invoke the agent shutdown timestamp hook synchronously at SIGTERM/SIGINT receipt before closing admission in dev and TLS paths. No read added.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5: registers the https and http servers with the connection drain (conns.serve) so a drain can close idle keep-alive connections; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the inline cert warm construction (newCertWarm over warmSet and dnsGate, then OnReload and setServedWake registering warm.nudge) moves unchanged into the new Edge.newIssuerWarm in certwarm.go and is called here with the same apps domain, parents, perHostCert, warmResolver, edgeIPs and store; the loop still starts here. The warm set it wires now reads the published edges files through the home map (OwnServedHosts and ServedHosts, both already polled) instead of the local route table, regional names aside. It is a different source, not a subset: an attached name not yet published as pointing is no longer listed, while a name the route table has already dropped stays listed until this box's next edges file write and the home map's next poll catch up (HostPolicy still refuses an order for a name the registry no longer holds). A name published not pointing is not a warm candidate at all, whether or not its certificate is cached: the warm neither looks it up, orders it nor re-arms its renewal until its home box publishes it pointing again (a cached certificate keeps serving and re-arms on a handshake at the issuer). The warm reads the set only after the issuer gate, and the read is in memory (route table and the home map's last snapshot); it also drops a DNS-miss entry for a name that has left the set before probing it. It keeps a failure record while any box publishes the exact name (the home map DeployedHosts: every box's file, own included, pointing or not, the same in-memory snapshot) or the name is a regional route-table name, and prunes it only once no box publishes it. That retention set has no apps-domain or wildcard filter (those stay on candidacy only), so a name published not pointing, or one a wildcard parent starts covering, keeps the record that explains its backoff; the set is never a source of candidates. No read site added in this unit, same 5 sites.;rev3=census-ruling-w6-ingress-drain;basis=the two public servers are built by e.publicServers (internal/edge/ingressdrain.go): :443 as before (same handler, TLS config and ReadHeaderTimeout 10 s), :80 now wrapped by plainTracked so the ingress drain can count and close its requests (its barrier is never §25's); Serve's error test is listenerFailed(err) = err != nil && !errors.Is(err, http.ErrServerClosed) (was err != ErrServerClosed), so a graceful Shutdown by the drain is not fatal. New Edge.plain connDrain field. Same flags, addresses and listeners; read sites unchanged (5); no read added.;rev3=census-ruling-edge-ppv2;basis=Edge process (uid carlos), not root. Edge gains the proxy atomic.Pointer. Outside dev mode, before either public listener binds and before the ready hook hands the Edge to the agent, calls e.loadProxyIngress(os.Getenv, dataDir): CARLOS_INGRESS_PROXY_SOURCES from the edge's own environment (carlos-edge.service loads the root-owned 0600 host.env) through hostenv.ParseProxySources; blank leaves the edge unarmed with nothing read; a non-empty list arms it and Lstats <dataDir>/edge/trust-barrier (armProxyIngress); a value that does not parse is log.Fatal. After the hairpin configuration, wrapProxyIngress wraps both public listeners outermost (returns them untouched when unarmed); when armed it logs the armed line and starts runProxyJournal (counters to the journal, no reads). The existing 5 read sites are unchanged.;rev3=census-ruling-audit-request-path;basis=the dev-mode http.Server gains IdleTimeout: publicIdleTimeout (120 s) beside its ReadHeaderTimeout; comment updated. Same 5 read sites, no read added. |
| + |
| +Seal: `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132` → `b2f039a12bb284c9a36b391339e25e3f77ec94a3d4e38389ec9ef75261d7873f`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-precert-dns01-1293.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R1.md b/docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R1.md| new file mode 100644 |
| index 000000000..23066f4e5 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R1.md |
| @@ -0,0 +1,44 @@ |
| +Reviewed `b823417eb6e95be0f6febdb87bb081c2bea6445d` against `origin/main`, merge base `d3266e8e`. |
| + |
| +1. **P1 — Non-pending claims do not establish ownership for DNS-01 issuance.** |
| + |
| + [precert.go:223](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/precert.go:223) accepts any non-pending, routed claim inside a listed zone. However, [domainpolicy.go:302](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/console/domainpolicy.go:302) returns “proven” without checking DNS when `CONSOLE_DOMAIN_PROOF` is off—the default. `AttachClaimProven` then stores `Pending=false`. |
| + |
| + **Failure scenario:** configure `CARLOS_DNS01_ZONES=example.com`, leave domain proof off, and leave that zone available to ordinary member attaches. A member attaches an unclaimed `billing.example.com` to their app without controlling its DNS. The issuer publishes the challenge using the operator’s credentials and obtains the certificate. Previously, the member’s attach alone could not satisfy ACME validation against the domain’s existing servers. |
| + |
| + **Fix:** require positive DNS-01 authorization from a trusted path: actual ownership proof or an operator-authorized attach. Legacy/proof-disabled claims must not qualify solely through `Pending=false`. Add a regression covering a member attach with domain proof disabled. |
| + |
| + **Fault family:** tenant claim data must not substitute for authorization to use the operator’s DNS authority. |
| + |
| +2. **P1 — Concurrent apex and wildcard orders overwrite each other’s Route 53 challenge.** |
| + |
| + The wildcard and pre-issuer loops start independently at [edge.go:5106](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/edge.go:5106) and line 5142. Orders for `*.example.com` and `example.com` both publish `_acme-challenge.example.com`. The account mutex ends before challenge handling; [wildcard.go:821](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/wildcard.go:821) has no shared challenge lock. [route53dns.go:106](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/route53dns.go:106) UPSERTs a record set containing exactly one value. |
| + |
| + **Failure scenario:** both certificates are missing or due. One order replaces the other’s TXT before validation, causing that order to fail and back off for an hour. An initial apex pre-issuance can therefore fail precisely when preparing a DNS switch. |
| + |
| + **Fix:** serialize publication through validation and cleanup by challenge FQDN, shared across both managers and provider instances. Add a deterministic concurrent apex/wildcard test using Route 53 replacement semantics. The current fake provider appends values at [precert_test.go:87](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/precert_test.go:87), masking this collision. |
| + |
| + **Fault family:** an active DNS challenge must retain its TXT value until validation completes. |
| + |
| +3. **P2 — Repeated failures can permanently starve later hostnames.** |
| + |
| + Candidates are sorted at [precert.go:236](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/precert.go:236), every pass restarts at the beginning, and budget exhaustion returns immediately at line 275. Failed names become eligible again after the same hour that releases their budget slots. |
| + |
| + **Failure scenario:** the first 20 names repeatedly fail with ordinary errors. They consume every hourly slot, so a later, issuable name never receives an attempt. An in-memory simulation of this scheduling logic over 180 minute passes produced three attempts for each failing name and zero for the final healthy name. |
| + |
| + **Fix:** retain a rotating cursor or prioritize the least recently attempted eligible name. Add a mixed failure/success regression proving eventual progress while preserving both caps. |
| + |
| + **Fault family:** bounded retry scheduling must preserve progress for other eligible claims. |
| + |
| +No P3 findings. The fake CA does check the expected DNS-01 digest. Targeted Go tests could not run: Go attempted to update `go.mod`, which the read-only sandbox refused. `git diff --check` passed; no files were edited. |
| + |
| +The census verdicts below address the root-read criteria; they do not clear the issuance defects above. |
| + |
| +| Census item | Verdict | Lines read and basis | |
| +|---|---|---| |
| +| `internal/edge/edge.go:RunWithActivatorReady` | **APPROVE** | Lines 5020–5150, especially 5138–5144. Starts the optional loop in the edge process; no added root read or weakened root check. | |
| +| `internal/edge` envelope | **APPROVE** | `precert.go` 1–412; `wildcard.go` 691–898; changed test code and serving/provider paths cited above. New certificate work runs as `carlos`; `carlos-edge.service` lines 28–46 confirm the environment source and execution identity. | |
| +| `internal/host` envelope | **APPROVE** | `agent.go` 139–148. Comment-only configuration documentation; no runtime change. | |
| +| `internal/hostenv` envelope | **APPROVE** | `hostenv.go` 56–95, 129–132, 391–434. Adds an operator-supplied variable to the allowlist; existing value validation remains intact. No tenant-controlled root path or command is introduced. | |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R2.md b/docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R2.md| new file mode 100644 |
| index 000000000..e062ff9bf |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/precert-dns01-1293/CODEX-FINDINGS-R2.md |
| @@ -0,0 +1,32 @@ |
| +R1 P1-1 — **Resolved:** issuance now requires both an operator-listed account and zone. |
| +R1 P1-2 — **Resolved:** the shared challenge lock covers TXT publication, validation, and cleanup. |
| +R1 P2 — **Resolved:** least-recently-tried ordering prevents failing names from starving untried names. |
| + |
| +Reviewed `ec7b62d2261e9f854a953d28cfcf2022edd80a7c`, diff `origin/main...HEAD`, merge base `d3266e8e`. |
| + |
| +No P1 findings. |
| + |
| +**P2 — First-route claims are incorrectly excluded from pre-issuance.** |
| + |
| +[precert.go:263](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/precert.go:263) skips every nonregional claim with an empty `Route`. That shape also represents a legitimate first-route attach: [domainattach.go:205](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/console/domainattach.go:205) constructs the claim, and lines 248–324 retain its empty `Route` while creating the static instance record at `Host`. [apidomains.go:520](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/console/apidomains.go:520) explicitly preserves that representation on re-attach. |
| + |
| +**Failure scenario:** an allowed account attaches a hostname inside an allowed zone as its first static route, before moving DNS. Even after provisioning succeeds, every pre-issuer pass skips it. It still depends on HTTP-01 after the switch. |
| + |
| +**Fix:** distinguish a reservation from a first-route claim backed by its matching instance record. Admit the latter while retaining the pending, account, zone, and catch-all exclusions. Add a regression covering this first-route shape alongside an unbacked reservation. |
| + |
| +**Fault family:** candidate selection must recognize every supported representation of a served claim. |
| + |
| +No P3 findings. |
| + |
| +The cache format and serving fallback support pre-issued certificates on both issuer and non-issuer edges. Autocert renewal checks the refreshed cache before ordering. The fake CA’s DNS-01 mode checks the expected TXT digest. |
| + |
| +`git diff --check` and formatting checks passed. Targeted tests could not start: the read-only sandbox prevented Go from creating its work directory. Census execution was therefore not verified. No files were edited. |
| + |
| +| Census item | Verdict | Lines read and basis | |
| +|---|---|---| |
| +| `edge.go:RunWithActivatorReady` | **APPROVE** | [edge.go:5020](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/edge/edge.go:5020), lines 5020–5150. Optional edge-process loop; no added root read or weakened root check. | |
| +| `internal/edge` envelope | **APPROVE** | `precert.go` 1–461; `wildcard.go` 693–926; changed tests and reached serving/provider paths. [carlos-edge.service:28](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/host/units/carlos-edge.service:28), lines 28–46, confirms execution as `carlos` using the protected environment. | |
| +| `internal/host` envelope | **APPROVE** | [agent.go:139](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/host/agent.go:139), lines 139–147. Comment-only configuration additions. | |
| +| `internal/hostenv` envelope | **APPROVE** | [hostenv.go:56](/home/paulca/amadan.net/carlos/platform-precert-dns01-1293/internal/hostenv/hostenv.go:56), lines 56–95, 129–144, 386–434. Operator configuration allowlist additions preserve value validation and introduce no tenant-controlled root path. | |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R1.md b/docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R1.md| new file mode 100644 |
| index 000000000..cc040314a |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R1.md |
| @@ -0,0 +1,113 @@ |
| +# Review brief: branch precert-dns01-1293 (#1293), round 1 of 3 |
| + |
| +Repo carlos/platform, branch `precert-dns01-1293`, commit named in the prompt. |
| +Under review: the diff `origin/main...HEAD` (merge base d3266e8e). |
| +Authorities on main: `internal/edge/certsync.go` (issuer gate, publishing |
| +cache, mirror), `internal/edge/wildcard.go` (DNS-01 wildcards), |
| +`internal/edge/certwarm.go` (HTTP-01 warm), `internal/edge/certsweep.go`, |
| +`internal/domains/claims.go` and `claimcache.go`, AGENTS.md ("Stopping |
| +rules", "The census"). |
| + |
| +You are an independent reviewer. Read the diff, then the code it reaches, |
| +and check every claim in the comments against that code. |
| + |
| +## The problem (amadan discussion #1293) |
| + |
| +A production switch on 2026-11-19 moved a custom hostname's DNS to a |
| +multi-edge CARLOS deployment. The home box (not the issuer) had no |
| +certificate, refused every handshake with "acme: not available here" |
| +for ~4 minutes, and was rolled back. Root cause: an attached alias that |
| +does not point at the deployment yet is never published to |
| +control/edges/, so the issuer never orders it until the home box's DNS |
| +sweep stamps it "pointing" (5-7 min), and HTTP-01 could not succeed |
| +before the switch anyway. |
| + |
| +## The change |
| + |
| +`internal/edge/precert.go`: with `CARLOS_DNS01_ZONES` set, the issuer |
| +(only) lists the claims (domains/) through a ClaimCache every minute, |
| +and for each proven, served claim whose host is in a listed zone, not |
| +covered by a usable wildcard, and without a current published cert, |
| +orders a certificate over DNS-01 through the existing DNS provider seam |
| +and stores it under the host's autocert cache name through the |
| +publishing cache (local disk, then control/certs/<host>). Renews ahead |
| +of autocert's window. Caps: 5 orders/pass, 20/hour; backoff 1h per name, |
| +12h on no-zone. A current local cert missing from the bucket is |
| +republished instead of reordered. `wildcard.go`: the order is factored |
| +into `dns01Order` + free `solveDNS01`, shared with wildcards; the account |
| +key load-or-mint is serialized. `edge.go` wires it after the cert warm. |
| +`hostenv` allows the variable. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Scope is operator-listed zones only (not "any zone the provider |
| + holds"), and the feature is off when the variable is unset. |
| +- Only the issuer orders; non-issuers serve via the existing mirror. |
| +- No console or CLI change in this branch. |
| + |
| +## What to check |
| + |
| +1. Correctness of serving: will a non-issuer edge (and the issuer |
| + itself, whose autocert HostPolicy refuses a name that is not yet a |
| + deployment host) actually serve the pre-issued cert for SNI = host, |
| + before and after the name points? Trace wrapGetCertificate, the |
| + mirror snapshot, syncLocal, autocert's cache format and key name. |
| +2. Interaction with the existing machinery once the name points: |
| + certwarm (could it order HTTP-01 anyway, or duplicate), autocert |
| + renewal timers, certmirror backfill/ownsCertName, certsweep, the |
| + home box's cert_expires_at stamp. Any path that deletes, overwrites |
| + with something worse, or fights the pre-issued entry? |
| +3. The refactor in wildcard.go: behaviour-preserving for wildcards |
| + (identifiers, CSR, challenge FQDN incl. delegation, log text, |
| + errNoZone wrapping, account key semantics)? |
| +4. Trust boundary: can a tenant, member or app cause the issuer to |
| + order (or publish a TXT in the operator's zone for) a name the |
| + operator did not intend? Consider pending claims, claims written via |
| + the fleet store door, IDN/uppercase/trailing-dot hosts, a claim for |
| + the zone apex, hosts that are a suffix-trick of a zone, regional and |
| + instance catch-all claims. Route 53 IAM is scoped to |
| + `_acme-challenge.*` TXT records (infra/modules/region-host/main.tf). |
| +5. Rate limits and cost: the per-pass/hourly caps, backoff, the claims |
| + listing cadence (issuer only), the publish repair path. Can anything |
| + loop orders against Let's Encrypt or write the bucket every pass? |
| +6. Concurrency: shared account key with the wildcard manager, the |
| + mutex, the preIssuer's maps, the held-gate context. |
| +7. Tests: does `TestPreIssueE2E` prove what it claims (the fake CA's |
| + new dns-01 mode really checks the TXT value)? Missing cases? |
| +8. Census: `make census-card` lists unit `internal/edge/edge.go` |
| + `RunWithActivatorReady` (body) and re-pinned envelopes |
| + `internal/edge`, `internal/host`, `internal/hostenv`. The card is |
| + `docs/superpowers/notes/census-proposal-precert-dns01-1293.md`. Give a |
| + verdict for the unit and each envelope per AGENTS.md "Getting a |
| + change approved" step 4: 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, or weakens a |
| + check root relies on. Note carlos-edge runs as user carlos, not root. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the problem, the evidence |
| +(file:line, verified), the failure scenario, a concrete fix and the |
| +invariant or trust boundary it breaks (its fault family). Then the |
| +census verdicts (unit + three envelopes, each APPROVE or REJECT with the |
| +lines read). End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites (targeted `go test -run` on |
| +internal/edge is fine; leave GOCACHE unset). |
diff --git a/docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R2.md b/docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R2.md| new file mode 100644 |
| index 000000000..350585229 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/precert-dns01-1293/CODEX-REVIEW-BRIEF-R2.md |
| @@ -0,0 +1,136 @@ |
| +# Review brief: branch precert-dns01-1293 (#1293), round 2 of 3 |
| + |
| +Repo carlos/platform, branch `precert-dns01-1293`, commit named in the prompt. |
| +Under review: the diff `origin/main...HEAD` (merge base d3266e8e). |
| +Authorities on main: `internal/edge/certsync.go` (issuer gate, publishing |
| +cache, mirror), `internal/edge/wildcard.go` (DNS-01 wildcards), |
| +`internal/edge/certwarm.go` (HTTP-01 warm), `internal/edge/certsweep.go`, |
| +`internal/domains/claims.go` and `claimcache.go`, AGENTS.md ("Stopping |
| +rules", "The census"). |
| + |
| +You are an independent reviewer. Read the diff, then the code it reaches, |
| +and check every claim in the comments against that code. |
| + |
| +## The problem (amadan discussion #1293) |
| + |
| +A production switch on 2026-11-19 moved a custom hostname's DNS to a |
| +multi-edge CARLOS deployment. The home box (not the issuer) had no |
| +certificate, refused every handshake with "acme: not available here" |
| +for ~4 minutes, and was rolled back. Root cause: an attached alias that |
| +does not point at the deployment yet is never published to |
| +control/edges/, so the issuer never orders it until the home box's DNS |
| +sweep stamps it "pointing" (5-7 min), and HTTP-01 could not succeed |
| +before the switch anyway. |
| + |
| +## The change |
| + |
| +`internal/edge/precert.go`: with `CARLOS_DNS01_ZONES` set, the issuer |
| +(only) lists the claims (domains/) through a ClaimCache every minute, |
| +and for each proven, served claim whose host is in a listed zone, not |
| +covered by a usable wildcard, and without a current published cert, |
| +orders a certificate over DNS-01 through the existing DNS provider seam |
| +and stores it under the host's autocert cache name through the |
| +publishing cache (local disk, then control/certs/<host>). Renews ahead |
| +of autocert's window. Caps: 5 orders/pass, 20/hour; backoff 1h per name, |
| +12h on no-zone. A current local cert missing from the bucket is |
| +republished instead of reordered. `wildcard.go`: the order is factored |
| +into `dns01Order` + free `solveDNS01`, shared with wildcards; the account |
| +key load-or-mint is serialized. `edge.go` wires it after the cert warm. |
| +`hostenv` allows the variable. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Scope is operator-listed zones only (not "any zone the provider |
| + holds"), and the feature is off when the variable is unset. |
| +- Only the issuer orders; non-issuers serve via the existing mirror. |
| +- No console or CLI change in this branch. |
| + |
| +## What to check |
| + |
| +1. Correctness of serving: will a non-issuer edge (and the issuer |
| + itself, whose autocert HostPolicy refuses a name that is not yet a |
| + deployment host) actually serve the pre-issued cert for SNI = host, |
| + before and after the name points? Trace wrapGetCertificate, the |
| + mirror snapshot, syncLocal, autocert's cache format and key name. |
| +2. Interaction with the existing machinery once the name points: |
| + certwarm (could it order HTTP-01 anyway, or duplicate), autocert |
| + renewal timers, certmirror backfill/ownsCertName, certsweep, the |
| + home box's cert_expires_at stamp. Any path that deletes, overwrites |
| + with something worse, or fights the pre-issued entry? |
| +3. The refactor in wildcard.go: behaviour-preserving for wildcards |
| + (identifiers, CSR, challenge FQDN incl. delegation, log text, |
| + errNoZone wrapping, account key semantics)? |
| +4. Trust boundary: can a tenant, member or app cause the issuer to |
| + order (or publish a TXT in the operator's zone for) a name the |
| + operator did not intend? Consider pending claims, claims written via |
| + the fleet store door, IDN/uppercase/trailing-dot hosts, a claim for |
| + the zone apex, hosts that are a suffix-trick of a zone, regional and |
| + instance catch-all claims. Route 53 IAM is scoped to |
| + `_acme-challenge.*` TXT records (infra/modules/region-host/main.tf). |
| +5. Rate limits and cost: the per-pass/hourly caps, backoff, the claims |
| + listing cadence (issuer only), the publish repair path. Can anything |
| + loop orders against Let's Encrypt or write the bucket every pass? |
| +6. Concurrency: shared account key with the wildcard manager, the |
| + mutex, the preIssuer's maps, the held-gate context. |
| +7. Tests: does `TestPreIssueE2E` prove what it claims (the fake CA's |
| + new dns-01 mode really checks the TXT value)? Missing cases? |
| +8. Census: `make census-card` lists unit `internal/edge/edge.go` |
| + `RunWithActivatorReady` (body) and re-pinned envelopes |
| + `internal/edge`, `internal/host`, `internal/hostenv`. The card is |
| + `docs/superpowers/notes/census-proposal-precert-dns01-1293.md`. Give a |
| + verdict for the unit and each envelope per AGENTS.md "Getting a |
| + change approved" step 4: 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, or weakens a |
| + check root relies on. Note carlos-edge runs as user carlos, not root. |
| + |
| +## Round 2 |
| + |
| +Earlier rounds: R1 by Astra (`CODEX-FINDINGS-R1.md`, NOT READY: two P1s, |
| +one P2; census items all APPROVE). The fixes: |
| + |
| +- R1 P1-1 (claims are not authorization): refused up front. A second |
| + required setting, `CARLOS_DNS01_ACCOUNTS` (account sqids), names whose |
| + claims may use the zones; claims of any other account never qualify, |
| + and with no account named the feature stays off. |
| +- R1 P1-2 (same challenge name): `solveDNS01` takes a per-FQDN lock |
| + (`lockChallenge`, process-wide, context-aware) from publication through |
| + validation and cleanup, shared by the wildcard manager and the |
| + pre-issuer. `TestSameChallengeNameOrdersDoNotCollide` uses a |
| + replace-semantics provider and fails without the lock (checked). |
| +- R1 P2 (starvation): a pass offers the least recently tried names first |
| + (`tried`); `TestPreIssueFailuresDoNotStarveOthers`. |
| + |
| +First give one line per R1 P1 and P2: resolved, partly, or not. Carry |
| +every unresolved or partly resolved finding forward at its current |
| +severity, then add only new findings. The census card was re-proposed |
| +for the new tip (unit claim updated); re-check the unit and the |
| +`internal/edge`, `internal/host`, `internal/hostenv` envelopes. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the problem, the evidence |
| +(file:line, verified), the failure scenario, a concrete fix and the |
| +invariant or trust boundary it breaks (its fault family). Then the |
| +census verdicts (unit + three envelopes, each APPROVE or REJECT with the |
| +lines read). End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites (targeted `go test -run` on |
| +internal/edge is fine; leave GOCACHE unset). |
diff --git a/internal/edge/certsync_e2e_test.go b/internal/edge/certsync_e2e_test.go| index 3dedbe096..a0aa92fb5 100644 |
| --- a/internal/edge/certsync_e2e_test.go |
| +++ b/internal/edge/certsync_e2e_test.go |
| @@ -110,6 +110,12 @@ type fakeACME struct { |
| // handlers run on the server's goroutines and, for deactivatePendingAuthz, |
| // can outlive the test. |
| faults []string |
| + // dns01TXT, when set, switches the CA to offering ONLY a dns-01 |
| + // challenge (precert_test.go): validation reads the TXT records at |
| + // _acme-challenge.<identifier, "*." stripped> through it and wants the |
| + // RFC 8555 §8.4 digest of the key authorization among them. Set before |
| + // the first order; read without the lock. |
| + dns01TXT func(name string) []string |
| } |
| type fakeACMEOrder struct { |
| @@ -776,12 +782,16 @@ func (ca *fakeACME) serveAuthorization(w http.ResponseWriter, r *http.Request) { |
| http.Error(w, "no such authz", http.StatusNotFound) |
| return |
| } |
| + chalType := "http-01" |
| + if ca.dns01TXT != nil { |
| + chalType = "dns-01" |
| + } |
| ca.mu.Lock() |
| body := map[string]any{ |
| "identifier": map[string]string{"type": "dns", "value": o.domain}, |
| "status": o.authz, |
| "challenges": []map[string]string{{ |
| - "type": "http-01", |
| + "type": chalType, |
| "url": ca.url("/chal/" + id), |
| "token": o.token, |
| "status": o.authz, |
| @@ -806,6 +816,11 @@ func (ca *fakeACME) serveChallengeAccept(w http.ResponseWriter, r *http.Request) |
| base, thumb, domain, token := ca.validateVia, ca.thumb, o.domain, o.token |
| ca.mu.Unlock() |
| + if ca.dns01TXT != nil { |
| + ca.validateDNS01(w, id, o, domain, token, thumb) |
| + return |
| + } |
| + |
| url := base + acmeChallengePrefix + token |
| got, ferr := ca.fetchChallenge(url, domain) |
| want := token + "." + thumb |
diff --git a/internal/edge/edge.go b/internal/edge/edge.go| index b2fd30d8f..d204ab19e 100644 |
| --- a/internal/edge/edge.go |
| +++ b/internal/edge/edge.go |
| @@ -5135,6 +5135,13 @@ func RunWithActivatorReady(args []string, act Activator, cache *Cache, ready fun |
| warm := e.newIssuerWarm(appsDomain, parents, perHostCert, warmResolver, edgeIPs, store) |
| go warm.run() |
| log.Printf("edge: cert warm on (%s pass) — custom domains are ordered and renewed proactively, not on first handshake", warmInterval) |
| + // Certificates before DNS moves (precert.go, #1293): attached names |
| + // in the operator's CARLOS_DNS01_ZONES are issued over DNS-01 from |
| + // the claim, before they point here. nil = not configured. |
| + if p := e.newPreIssuerFromEnv(certCache, mirror, wm); p != nil { |
| + go p.run() |
| + log.Printf("edge: certificates before DNS moves on for %v (DNS-01, %s pass, issuer only)", p.zones, preIssueInterval) |
| + } |
| } |
| tlsCfg.GetCertificate = getCert |
| if mirror != nil { |
diff --git a/internal/edge/precert.go b/internal/edge/precert.go| new file mode 100644 |
| index 000000000..9198c71de |
| --- /dev/null |
| +++ b/internal/edge/precert.go |
| @@ -0,0 +1,464 @@ |
| +package edge |
| + |
| +// Pre-issued certificates (#1293): a certificate for an attached hostname |
| +// BEFORE its DNS moves to the deployment, for hostnames in zones the |
| +// operator names and the deployment's own DNS provider writes. |
| +// |
| +// Why the ordinary path cannot do it. A custom domain's certificate is |
| +// ordered over HTTP-01 by the deployment's issuer, and only once the home |
| +// box's DNS check has stamped the name "pointing" and published it in its |
| +// edges file (certwarm.go's set, edgesfile.go's withholding). A name that |
| +// does not point at us yet is not published at all, so the issuer has never |
| +// heard of it; and HTTP-01 could not succeed before the switch anyway, |
| +// because the CA would ask the old servers. So the switch itself opens a gap: |
| +// the next DNS check (five to seven minutes), then the order. On 2026-11-19 a |
| +// production switch spent four minutes of it failing every handshake on the |
| +// home box ("acme: not available here") and was rolled back. |
| +// |
| +// DNS-01 does not care where the name points. When the deployment's DNS |
| +// provider can write the hostname's zone, the issuer can prove control and |
| +// hold a certificate before a single record moves. That is all this file |
| +// adds: |
| +// |
| +// - The source is the CLAIMS (domains/<host>.json, the deployment-wide |
| +// record every attach writes), not the edges files: a claim exists from |
| +// the moment of the attach, whatever DNS says. Read through a ClaimCache, |
| +// so the steady state is one listing per pass and a body read only for a |
| +// claim that changed. Pending (unproven, #215) claims and catch-all |
| +// claims are skipped. A claim with no Route is NOT skipped: a first |
| +// static route's attach stores exactly that shape (domainattach.go), |
| +// and inside the operator's accounts and zones a certificate ahead of |
| +// the route costs nothing (Astra R2). |
| +// - The scope is named by the operator twice over: CARLOS_DNS01_ZONES (the |
| +// zones) and CARLOS_DNS01_ACCOUNTS (the account sqids whose claims may |
| +// use them). Either unset, nothing here runs. Zones, rather than |
| +// "anything the provider happens to hold", because the provider's |
| +// account may hold zones members can attach names in. Accounts, because |
| +// a claim is not proof of control: with domain proof off (the console's |
| +// default) any member's attach is written proven, and before this file |
| +// that attach alone could never get a certificate for a name whose DNS |
| +// points elsewhere. Using the operator's DNS authority on a name is the |
| +// operator's decision, so it is refused up front for every account the |
| +// operator did not name (Astra R1, #1293). |
| +// - Only the issuer orders, under the same election as every other order |
| +// (certsync.go), and only it reads the claims: a non-issuer's pass ends |
| +// at the gate and costs nothing. |
| +// - The result is an ORDINARY per-host entry under the host's own cache |
| +// name, in autocert's format, written through the publishing cache. So |
| +// it lands in control/certs/<host>, every edge's mirror serves it, the |
| +// home box's DNS sweep stamps its expiry, the cert sweep ages it out like |
| +// any other, and once the name points autocert finds it in its cache and |
| +// orders nothing. Nothing downstream knows how it was issued. |
| +// - Renewal: the same pass renews the certificate over DNS-01 a week (or a |
| +// twelfth of its lifetime, if shorter) before autocert's own HTTP-01 |
| +// renewal would start, so autocert's timer finds a fresh cache and stands |
| +// aside. If DNS-01 renewal breaks, HTTP-01 is still there behind it. |
| +// - Bounds: preIssueOrdersPerPass orders per pass, preIssueOrdersPerHour |
| +// orders an hour across all names (the DNS-01 account is shared with the |
| +// wildcards, and the CA's rate limits are per account and per registered |
| +// domain), a one-hour backoff per name after a failure, twelve hours when |
| +// the provider does not hold the zone. |
| +// |
| +// A name covered by a wildcard this box can serve is left to the wildcard. |
| + |
| +import ( |
| + "context" |
| + "crypto/ecdsa" |
| + "crypto/tls" |
| + "crypto/x509" |
| + "errors" |
| + "fmt" |
| + "log" |
| + "os" |
| + "slices" |
| + "strings" |
| + "sync" |
| + "time" |
| + |
| + "golang.org/x/crypto/acme/autocert" |
| + |
| + "github.com/carlosframework/platform/internal/domains" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +const ( |
| + // preIssueInterval is the pass cadence: the time from an attach to the |
| + // order, at worst. A pass on a quiet deployment is one bucket listing on |
| + // the issuer. |
| + preIssueInterval = time.Minute |
| + // preIssueOrdersPerPass bounds one pass's ACME work, so a newly listed |
| + // zone with many attached names drains over several passes rather than |
| + // in one burst. |
| + preIssueOrdersPerPass = 5 |
| + // preIssueOrdersPerHour bounds the orders this box places in any hour. |
| + preIssueOrdersPerHour = 20 |
| + // preIssueRetry is a name's backoff after a failed order: Let's Encrypt |
| + // allows five failed validations per account, hostname and hour. |
| + preIssueRetry = time.Hour |
| + // preIssueOrderTimeout budgets one order, the TXT wait included. |
| + preIssueOrderTimeout = 10 * time.Minute |
| +) |
| + |
| +// preIssueDue reports whether leaf should be replaced now: ahead of the |
| +// moment autocert's own renewal would start (min(lifetime/3, 30 days) before |
| +// expiry, renewal.go's next()), by a week or a twelfth of the lifetime, |
| +// whichever is less. Ahead, so that autocert's timer, once the name points, |
| +// finds a fresh certificate and orders nothing. |
| +func preIssueDue(leaf *x509.Certificate, now time.Time) bool { |
| + life := leaf.NotAfter.Sub(leaf.NotBefore) |
| + ahead := min(life/3, 30*24*time.Hour) + min(life/12, 7*24*time.Hour) |
| + return !now.Before(leaf.NotAfter.Add(-ahead)) |
| +} |
| + |
| +// parseDNS01Zones reads CARLOS_DNS01_ZONES: comma-separated zone names, |
| +// lowercased, trailing dot dropped, deduplicated. An entry that is not a |
| +// hostname is dropped with a log line. nil when nothing valid is listed, |
| +// which is "off". |
| +func parseDNS01Zones(raw string) []string { |
| + var out []string |
| + for _, z := range strings.Split(raw, ",") { |
| + z = strings.TrimSuffix(strings.ToLower(strings.TrimSpace(z)), ".") |
| + if z == "" { |
| + continue |
| + } |
| + if !provision.ValidHostShape(z) { |
| + log.Printf("edge: CARLOS_DNS01_ZONES entry %q is not a zone name, ignored", z) |
| + continue |
| + } |
| + if !slices.Contains(out, z) { |
| + out = append(out, z) |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// parseDNS01Accounts reads CARLOS_DNS01_ACCOUNTS: comma-separated account |
| +// sqids, as claims record them. An entry that is not a sqid is dropped with a |
| +// log line. nil when none is valid, which is "off". |
| +func parseDNS01Accounts(raw string) []string { |
| + var out []string |
| + for _, a := range strings.Split(raw, ",") { |
| + a = strings.TrimSpace(a) |
| + if a == "" { |
| + continue |
| + } |
| + if !domains.ValidSqid(a) { |
| + log.Printf("edge: CARLOS_DNS01_ACCOUNTS entry %q is not an account sqid, ignored", a) |
| + continue |
| + } |
| + if !slices.Contains(out, a) { |
| + out = append(out, a) |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// preIssuer is the pass. Every input is a field so the decisions are |
| +// testable without an ACME server; newPreIssuerFromEnv wires the real ones. |
| +type preIssuer struct { |
| + zones []string |
| + // accounts are the sqids whose claims qualify; nothing else does. |
| + accounts []string |
| + // cache is the PUBLISHING cache (certsync.go): its Get reads this box's |
| + // own disk, its Put writes the disk and then the bucket. |
| + cache autocert.Cache |
| + // store is the deployment bucket, for republishing a local certificate |
| + // whose bucket copy is missing. |
| + store release.Store |
| + issuer IssuerGate |
| + claims func(context.Context) ([]domains.Claim, error) |
| + // published reads the mirror's copy of control/certs/<name>. |
| + published func(name string) ([]byte, bool) |
| + // covered reports whether a wildcard this box can serve covers host. nil |
| + // = no wildcard manager. |
| + covered func(host string) bool |
| + // order runs one DNS-01 order for host (dns01OrderFunc in production). |
| + order func(ctx context.Context, host string) (*tls.Certificate, *ecdsa.PrivateKey, error) |
| + now func() time.Time |
| + |
| + mu sync.Mutex |
| + nextAttempt map[string]time.Time |
| + // tried is when each name's last order started. A pass offers the |
| + // least recently tried names first, so names that keep failing cannot |
| + // spend the hourly budget ahead of a name never tried. |
| + tried map[string]time.Time |
| + // ordered is when each order of the last hour started, oldest first. |
| + ordered []time.Time |
| + // putAt is when this box last wrote each name to the bucket, so a pass |
| + // that runs before the mirror has seen the write does not write it again. |
| + putAt map[string]time.Time |
| + lastClaimLog time.Time |
| +} |
| + |
| +func newPreIssuer(zones, accounts []string, cache autocert.Cache, store release.Store, issuer IssuerGate, |
| + claims func(context.Context) ([]domains.Claim, error), published func(string) ([]byte, bool), |
| + covered func(string) bool, order func(context.Context, string) (*tls.Certificate, *ecdsa.PrivateKey, error)) *preIssuer { |
| + return &preIssuer{ |
| + zones: zones, accounts: accounts, cache: cache, store: store, issuer: issuer, claims: claims, |
| + published: published, covered: covered, order: order, now: time.Now, |
| + nextAttempt: map[string]time.Time{}, tried: map[string]time.Time{}, putAt: map[string]time.Time{}, |
| + } |
| +} |
| + |
| +// dns01OrderFunc is the production order: a DNS-01 order for exactly host, |
| +// its challenge published directly at _acme-challenge.<host> in the |
| +// provider, under the deployment's DNS-01 account kept in cache. |
| +func dns01OrderFunc(cache autocert.Cache, directory string, dns dnsProvider) func(context.Context, string) (*tls.Certificate, *ecdsa.PrivateKey, error) { |
| + return func(ctx context.Context, host string) (*tls.Certificate, *ecdsa.PrivateKey, error) { |
| + return dns01Order(ctx, cache, directory, dns, host, "_acme-challenge."+host, "pre-issue "+host) |
| + } |
| +} |
| + |
| +// newPreIssuerFromEnv arms the pre-issuer, or returns nil: CARLOS_DNS01_ZONES |
| +// unset (silent, the default), or set with no account named in |
| +// CARLOS_DNS01_ACCOUNTS or no DNS provider to publish through (logged). Called only on a box with a deployment store, so the mirror and |
| +// the issuer gate exist. |
| +func (e *Edge) newPreIssuerFromEnv(cache autocert.Cache, mirror *certMirror, wm *wildcardManager) *preIssuer { |
| + zones := parseDNS01Zones(os.Getenv("CARLOS_DNS01_ZONES")) |
| + if len(zones) == 0 || e.staticStore == nil || mirror == nil { |
| + return nil |
| + } |
| + accounts := parseDNS01Accounts(os.Getenv("CARLOS_DNS01_ACCOUNTS")) |
| + if len(accounts) == 0 { |
| + log.Printf("edge: CARLOS_DNS01_ZONES is set but CARLOS_DNS01_ACCOUNTS names no account — certificates are not issued before DNS moves") |
| + return nil |
| + } |
| + dns, reason := dnsProviderFromEnv() |
| + if dns == nil { |
| + log.Printf("edge: CARLOS_DNS01_ZONES is set but there is no DNS provider (%s) — certificates are not issued before DNS moves", reason) |
| + return nil |
| + } |
| + store := e.staticStore |
| + cc := &domains.ClaimCache{} |
| + claims := func(ctx context.Context) ([]domains.Claim, error) { return cc.List(ctx, store) } |
| + var covered func(string) bool |
| + if wm != nil { |
| + covered = func(h string) bool { return wm.certFor(h) != nil } |
| + } |
| + directory := envOr("CARLOS_ACME_DIRECTORY", letsEncryptDirectory) |
| + return newPreIssuer(zones, accounts, cache, store, e.issuerGate, claims, mirror.Cert, covered, dns01OrderFunc(cache, directory, dns)) |
| +} |
| + |
| +func (p *preIssuer) run() { |
| + for { |
| + p.pass(context.Background()) |
| + time.Sleep(preIssueInterval) |
| + } |
| +} |
| + |
| +// inZone reports whether host is a listed zone or a name under one. |
| +func (p *preIssuer) inZone(host string) bool { |
| + for _, z := range p.zones { |
| + if host == z || strings.HasSuffix(host, "."+z) { |
| + return true |
| + } |
| + } |
| + return false |
| +} |
| + |
| +// candidates is the sorted set of hostnames the pass looks after. |
| +func (p *preIssuer) candidates(claims []domains.Claim) []string { |
| + var out []string |
| + for _, c := range claims { |
| + host := strings.TrimSuffix(strings.ToLower(c.Host), ".") |
| + switch { |
| + case c.Pending, strings.HasPrefix(host, "*."): |
| + continue |
| + case !p.inZone(host), !slices.Contains(p.accounts, c.Account): |
| + continue |
| + case p.covered != nil && p.covered(host): |
| + continue |
| + } |
| + if !slices.Contains(out, host) { |
| + out = append(out, host) |
| + } |
| + } |
| + slices.Sort(out) |
| + return out |
| +} |
| + |
| +// current reports whether body is a certificate for host that is not yet due. |
| +func current(body []byte, host string, now time.Time) bool { |
| + cert, err := parseCertEntry(body) |
| + return err == nil && cert.Leaf.VerifyHostname(host) == nil && !preIssueDue(cert.Leaf, now) |
| +} |
| + |
| +// pass is one sweep: nothing unless this box is the issuer, then every |
| +// candidate without a current published certificate gets one, within the |
| +// bounds. |
| +func (p *preIssuer) pass(ctx context.Context) { |
| + held, ok := p.issuer() |
| + if !ok { |
| + return |
| + } |
| + cctx, cancel := context.WithTimeout(held, time.Minute) |
| + claims, err := p.claims(cctx) |
| + cancel() |
| + if err != nil { |
| + p.logClaimsFailure(err) |
| + return |
| + } |
| + hosts := p.candidates(claims) |
| + p.forget(hosts) |
| + p.mu.Lock() |
| + slices.SortStableFunc(hosts, func(a, b string) int { return p.tried[a].Compare(p.tried[b]) }) |
| + p.mu.Unlock() |
| + orders := 0 |
| + for _, host := range hosts { |
| + now := p.now() |
| + if body, ok := p.published(host); ok && current(body, host, now) { |
| + continue |
| + } |
| + if p.republish(ctx, host, now) { |
| + continue |
| + } |
| + if p.backingOff(host, now) { |
| + continue |
| + } |
| + if orders >= preIssueOrdersPerPass || !p.spend(now) { |
| + return |
| + } |
| + orders++ |
| + p.mu.Lock() |
| + p.tried[host] = now |
| + p.mu.Unlock() |
| + if err := p.issue(held, host); err != nil { |
| + retry := preIssueRetry |
| + if errors.Is(err, errNoZone) { |
| + retry = noZoneRetry |
| + } |
| + log.Printf("edge: pre-issue %s: %v — retrying in %s; HTTP-01 still covers it once it points here", host, err, retry) |
| + p.mu.Lock() |
| + p.nextAttempt[host] = now.Add(retry) |
| + p.mu.Unlock() |
| + continue |
| + } |
| + p.mu.Lock() |
| + delete(p.nextAttempt, host) |
| + p.mu.Unlock() |
| + } |
| +} |
| + |
| +// issue orders host's certificate and writes it through the publishing |
| +// cache: this box's disk, then control/certs/<host>. |
| +func (p *preIssuer) issue(held context.Context, host string) error { |
| + ctx, cancel := context.WithTimeout(held, preIssueOrderTimeout) |
| + defer cancel() |
| + cert, key, err := p.order(ctx, host) |
| + if err != nil { |
| + return err |
| + } |
| + // Never store what would not serve: the right name, the matching key. |
| + if cert.Leaf == nil || cert.Leaf.VerifyHostname(host) != nil { |
| + return fmt.Errorf("issued certificate does not cover %s", host) |
| + } |
| + if !key.PublicKey.Equal(cert.Leaf.PublicKey) { |
| + return fmt.Errorf("issued certificate's key does not match") |
| + } |
| + // autocert's own cache format for an ECDSA entry: the key block, then |
| + // the chain (encodeWildcardPEM writes exactly that). |
| + raw, err := encodeWildcardPEM(cert, key) |
| + if err != nil { |
| + return fmt.Errorf("encode: %v", err) |
| + } |
| + if err := p.cache.Put(ctx, host, raw); err != nil { |
| + return fmt.Errorf("persist: %v", err) |
| + } |
| + p.mu.Lock() |
| + p.putAt[host] = p.now() |
| + p.mu.Unlock() |
| + log.Printf("edge: pre-issue %s: certificate issued over DNS-01 (valid until %s) and published for every edge", host, cert.Leaf.NotAfter.Format(time.RFC3339)) |
| + return nil |
| +} |
| + |
| +// republish handles a name whose published copy is missing or due while this |
| +// box's own disk holds a current certificate: a bucket publish that failed |
| +// after an order succeeded (publishingCache logs and swallows those). It |
| +// writes the local copy to the bucket instead of ordering again, and reports |
| +// whether the local copy was current (in which case there is nothing to |
| +// order, whether or not the write landed). A name this box wrote within the |
| +// mirror's reach of now is left alone: the mirror has not caught up yet. |
| +func (p *preIssuer) republish(ctx context.Context, host string, now time.Time) bool { |
| + gctx, cancel := context.WithTimeout(ctx, 30*time.Second) |
| + defer cancel() |
| + body, err := p.cache.Get(gctx, host) |
| + if err != nil || !current(body, host, now) { |
| + return false |
| + } |
| + p.mu.Lock() |
| + at, recent := p.putAt[host] |
| + p.mu.Unlock() |
| + if recent && now.Sub(at) < 5*time.Minute { |
| + return true |
| + } |
| + if err := putCert(gctx, p.store, host, body); err != nil { |
| + log.Printf("edge: pre-issue %s: republishing this box's certificate failed: %v — retrying next pass", host, err) |
| + return true |
| + } |
| + p.mu.Lock() |
| + p.putAt[host] = now |
| + p.mu.Unlock() |
| + log.Printf("edge: pre-issue %s: republished this box's current certificate to %s", host, certPrefix) |
| + return true |
| +} |
| + |
| +func (p *preIssuer) backingOff(host string, now time.Time) bool { |
| + p.mu.Lock() |
| + defer p.mu.Unlock() |
| + next, ok := p.nextAttempt[host] |
| + return ok && now.Before(next) |
| +} |
| + |
| +// spend takes one order from the hourly budget, or reports that it is spent. |
| +func (p *preIssuer) spend(now time.Time) bool { |
| + p.mu.Lock() |
| + defer p.mu.Unlock() |
| + cut := 0 |
| + for cut < len(p.ordered) && now.Sub(p.ordered[cut]) >= time.Hour { |
| + cut++ |
| + } |
| + p.ordered = p.ordered[cut:] |
| + if len(p.ordered) >= preIssueOrdersPerHour { |
| + return false |
| + } |
| + p.ordered = append(p.ordered, now) |
| + return true |
| +} |
| + |
| +// forget drops bookkeeping for names that are no longer candidates, so the |
| +// maps track the claim set rather than every name ever attached. |
| +func (p *preIssuer) forget(hosts []string) { |
| + p.mu.Lock() |
| + defer p.mu.Unlock() |
| + for h := range p.nextAttempt { |
| + if !slices.Contains(hosts, h) { |
| + delete(p.nextAttempt, h) |
| + } |
| + } |
| + for h := range p.putAt { |
| + if !slices.Contains(hosts, h) { |
| + delete(p.putAt, h) |
| + } |
| + } |
| + for h := range p.tried { |
| + if !slices.Contains(hosts, h) { |
| + delete(p.tried, h) |
| + } |
| + } |
| +} |
| + |
| +// logClaimsFailure says a failed claims read at most hourly: it repeats every |
| +// minute for as long as the bucket is unreachable. |
| +func (p *preIssuer) logClaimsFailure(err error) { |
| + now := p.now() |
| + p.mu.Lock() |
| + quiet := now.Sub(p.lastClaimLog) < time.Hour |
| + if !quiet { |
| + p.lastClaimLog = now |
| + } |
| + p.mu.Unlock() |
| + if !quiet { |
| + log.Printf("edge: pre-issue: reading the domain claims failed: %v — no certificates are issued before DNS moves until it reads again", err) |
| + } |
| +} |
diff --git a/internal/edge/precert_test.go b/internal/edge/precert_test.go| new file mode 100644 |
| index 000000000..3f888451f |
| --- /dev/null |
| +++ b/internal/edge/precert_test.go |
| @@ -0,0 +1,608 @@ |
| +package edge |
| + |
| +import ( |
| + "context" |
| + "crypto/ecdsa" |
| + "crypto/sha256" |
| + "crypto/tls" |
| + "encoding/base64" |
| + "errors" |
| + "fmt" |
| + "net/http" |
| + "slices" |
| + "strings" |
| + "sync" |
| + "testing" |
| + "time" |
| + |
| + "golang.org/x/crypto/acme/autocert" |
| + |
| + "github.com/carlosframework/platform/internal/domains" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// ---- the fake CA's dns-01 mode ----------------------------------------------- |
| + |
| +// validateDNS01 is the fake CA's dns-01 check (fakeACME.dns01TXT): the TXT |
| +// at _acme-challenge.<identifier> must carry base64url(sha256(keyAuth)), the |
| +// key authorization being token + "." + the ordering account's thumbprint. |
| +// Like the http-01 check it is a proof, not a narration: the value can only |
| +// be right if the account that ordered published it where the CA looks. |
| +func (ca *fakeACME) validateDNS01(w http.ResponseWriter, id string, o *fakeACMEOrder, domain, token, thumb string) { |
| + sum := sha256.Sum256([]byte(token + "." + thumb)) |
| + want := base64.RawURLEncoding.EncodeToString(sum[:]) |
| + name := "_acme-challenge." + strings.TrimPrefix(domain, "*.") |
| + valid := slices.Contains(ca.dns01TXT(name), want) |
| + |
| + ca.mu.Lock() |
| + ca.validations = append(ca.validations, fakeACMEValidation{url: "dns:" + name, host: domain, token: token, ok: valid}) |
| + if valid { |
| + o.authz, o.status = "valid", "ready" |
| + } else { |
| + o.authz, o.status = "invalid", "invalid" |
| + ca.faults = append(ca.faults, fmt.Sprintf("dns-01 for %s: no TXT %q at %s", domain, want, name)) |
| + } |
| + ca.mu.Unlock() |
| + |
| + writeJSON(w, http.StatusOK, map[string]string{ |
| + "type": "dns-01", "url": ca.url("/chal/" + id), "token": token, "status": "valid", |
| + }) |
| +} |
| + |
| +// liveDNS is a DNS provider whose records the fake CA can read: present adds |
| +// a TXT, cleanup removes it, and checkZone answers from a fixed zone list. |
| +type liveDNS struct { |
| + mu sync.Mutex |
| + zones []string |
| + txt map[string][]string |
| + presented []string // fqdn, in order |
| + cleaned []string // fqdn, in order |
| +} |
| + |
| +func newLiveDNS(zones ...string) *liveDNS { |
| + return &liveDNS{zones: zones, txt: map[string][]string{}} |
| +} |
| + |
| +func (d *liveDNS) holds(fqdn string) bool { |
| + for _, z := range d.zones { |
| + if fqdn == z || strings.HasSuffix(fqdn, "."+z) { |
| + return true |
| + } |
| + } |
| + return false |
| +} |
| + |
| +func (d *liveDNS) checkZone(_ context.Context, fqdn string) error { |
| + if !d.holds(fqdn) { |
| + return errNoZone |
| + } |
| + return nil |
| +} |
| + |
| +func (d *liveDNS) present(_ context.Context, fqdn, value string) (func(context.Context) error, error) { |
| + if !d.holds(fqdn) { |
| + return nil, errNoZone |
| + } |
| + d.mu.Lock() |
| + d.txt[fqdn] = append(d.txt[fqdn], value) |
| + d.presented = append(d.presented, fqdn) |
| + d.mu.Unlock() |
| + return func(context.Context) error { |
| + d.mu.Lock() |
| + defer d.mu.Unlock() |
| + d.txt[fqdn] = slices.DeleteFunc(d.txt[fqdn], func(v string) bool { return v == value }) |
| + d.cleaned = append(d.cleaned, fqdn) |
| + return nil |
| + }, nil |
| +} |
| + |
| +func (d *liveDNS) lookup(name string) []string { |
| + d.mu.Lock() |
| + defer d.mu.Unlock() |
| + return append([]string(nil), d.txt[name]...) |
| +} |
| + |
| +// noTXTWait skips the real-resolver wait for a test's duration: the records |
| +// live in liveDNS, which no resolver can see. |
| +func noTXTWait(t *testing.T) { |
| + t.Helper() |
| + prev := dns01TXTWait |
| + dns01TXTWait = func(context.Context, string, string, time.Duration) {} |
| + t.Cleanup(func() { dns01TXTWait = prev }) |
| +} |
| + |
| +// ---- fixtures ------------------------------------------------------------------ |
| + |
| +// proven is a served, proven claim: what an attach writes once the hostname |
| +// is verified. |
| +func proven(host string) domains.Claim { |
| + return domains.Claim{Schema: 1, Host: host, Account: "acct", App: "shop", Route: "shop.acct.apps.example.net"} |
| +} |
| + |
| +func staticClaims(cs ...domains.Claim) func(context.Context) ([]domains.Claim, error) { |
| + return func(context.Context) ([]domains.Claim, error) { return cs, nil } |
| +} |
| + |
| +// fakeOrder is an order seam that mints a self-signed leaf for the host (a |
| +// real CA round trip is TestPreIssueE2E's job) and counts what it was asked. |
| +type fakeOrder struct { |
| + mu sync.Mutex |
| + asked []string |
| + fail error |
| + life time.Duration |
| +} |
| + |
| +func (f *fakeOrder) order(t *testing.T) func(context.Context, string) (*tls.Certificate, *ecdsa.PrivateKey, error) { |
| + return func(_ context.Context, host string) (*tls.Certificate, *ecdsa.PrivateKey, error) { |
| + f.mu.Lock() |
| + f.asked = append(f.asked, host) |
| + fail, life := f.fail, f.life |
| + f.mu.Unlock() |
| + if fail != nil { |
| + return nil, nil, fail |
| + } |
| + if life == 0 { |
| + life = 90 * 24 * time.Hour |
| + } |
| + cert, key := selfSignedLeaf(t, host, time.Now().Add(life)) |
| + return cert, key, nil |
| + } |
| +} |
| + |
| +func (f *fakeOrder) count() int { |
| + f.mu.Lock() |
| + defer f.mu.Unlock() |
| + return len(f.asked) |
| +} |
| + |
| +// testPreIssuer is a pre-issuer over a DirStore bucket and a publishing cache |
| +// on a held gate, with the claims and order seams given. |
| +func testPreIssuer(t *testing.T, zones []string, claims func(context.Context) ([]domains.Claim, error), order func(context.Context, string) (*tls.Certificate, *ecdsa.PrivateKey, error)) (*preIssuer, release.Store, autocert.Cache) { |
| + t.Helper() |
| + store := release.NewDirStore(t.TempDir()) |
| + local := autocert.DirCache(t.TempDir()) |
| + held := func() (context.Context, bool) { return context.Background(), true } |
| + cache := &publishingCache{inner: local, s: store, issuer: held} |
| + published := func(name string) ([]byte, bool) { |
| + b, err := certStoreGet(t, store, certKey(name)) |
| + return b, err == nil |
| + } |
| + p := newPreIssuer(zones, []string{"acct"}, cache, store, held, claims, published, nil, order) |
| + return p, store, local |
| +} |
| + |
| +// ---- the end-to-end proof: certificate before DNS ------------------------------ |
| + |
| +// TestPreIssueE2E is #1293's scenario. A hostname is attached under a zone |
| +// the deployment's DNS provider writes, and nothing points at the deployment |
| +// yet. The issuer orders over dns-01 through a real ACME exchange (the fake |
| +// CA checks the TXT value against the ordering account), the certificate |
| +// lands in control/certs/<host>, and ANOTHER edge, one that is not the |
| +// issuer, serves it for the hostname straight from its mirror. That last |
| +// step is the one that failed on 11-19. |
| +func TestPreIssueE2E(t *testing.T) { |
| + e2eQuietLogs(t) |
| + noTXTWait(t) |
| + const host = "billing.example.com" |
| + dns := newLiveDNS("example.com") |
| + ca := newFakeACME(t) |
| + ca.dns01TXT = dns.lookup |
| + |
| + p, store, _ := testPreIssuer(t, []string{"example.com"}, staticClaims(proven(host)), nil) |
| + p.order = dns01OrderFunc(p.cache, ca.directoryURL(), dns) |
| + |
| + p.pass(context.Background()) |
| + ca.checkFaults(t) |
| + |
| + if _, orders := ca.counts(); orders != 1 { |
| + t.Fatalf("CA saw %d orders, want 1", orders) |
| + } |
| + if got := dns.presented; !slices.Equal(got, []string{"_acme-challenge." + host}) { |
| + t.Fatalf("challenge published at %v, want only _acme-challenge.%s", got, host) |
| + } |
| + if got := dns.cleaned; !slices.Equal(got, []string{"_acme-challenge." + host}) { |
| + t.Fatalf("challenge cleanup %v: the TXT must not outlive the order", got) |
| + } |
| + body, err := certStoreGet(t, store, certKey(host)) |
| + if err != nil { |
| + t.Fatalf("control/certs/%s: %v — the certificate must be published for every edge", host, err) |
| + } |
| + cert, err := parseCertEntry(body) |
| + if err != nil || cert.Leaf.VerifyHostname(host) != nil { |
| + t.Fatalf("published entry does not cover %s: %v", host, err) |
| + } |
| + if cert.Leaf.Issuer.CommonName != ca.root.Subject.CommonName { |
| + t.Fatalf("published leaf issued by %q, want the CA's", cert.Leaf.Issuer.CommonName) |
| + } |
| + |
| + // The home box: a gated mirror on another disk, whose autocert refuses |
| + // exactly as IE's did on 11-19. |
| + home := newCertMirror(store, autocert.DirCache(t.TempDir())) |
| + if err := home.Refresh(context.Background()); err != nil { |
| + t.Fatal(err) |
| + } |
| + refuse := func(*tls.ClientHelloInfo) (*tls.Certificate, error) { return nil, errNotIssuer } |
| + got, err := home.wrapGetCertificate(refuse)(&tls.ClientHelloInfo{ServerName: host}) |
| + if err != nil || got == nil || got.Leaf.VerifyHostname(host) != nil { |
| + t.Fatalf("home box handshake for %s: cert %v, err %v — want the pre-issued certificate", host, got != nil, err) |
| + } |
| + |
| + // A second pass finds the published certificate current and orders |
| + // nothing. |
| + p.pass(context.Background()) |
| + if _, orders := ca.counts(); orders != 1 { |
| + t.Fatalf("second pass ordered again: CA saw %d orders", orders) |
| + } |
| +} |
| + |
| +// The wildcard manager's orders run through the same dns01Order after the |
| +// refactor; this pins that a *.<parent> order still completes and covers. |
| +func TestWildcardObtainOverDNS01(t *testing.T) { |
| + e2eQuietLogs(t) |
| + noTXTWait(t) |
| + dns := newLiveDNS("example.com") |
| + ca := newFakeACME(t) |
| + ca.dns01TXT = dns.lookup |
| + w := newWildcardManager([]string{"go.example.com"}, "", func() []string { return nil }, nil, "", autocert.DirCache(t.TempDir()), dns) |
| + w.directory = ca.directoryURL() |
| + w.refresh() |
| + if err := w.obtain(context.Background(), "go.example.com"); err != nil { |
| + t.Fatal(err) |
| + } |
| + ca.checkFaults(t) |
| + if c := w.certFor("x.go.example.com"); c == nil { |
| + t.Fatal("wildcard not serving after obtain") |
| + } |
| + if got := dns.presented; !slices.Equal(got, []string{"_acme-challenge.go.example.com"}) { |
| + t.Fatalf("challenge published at %v", got) |
| + } |
| +} |
| + |
| +// ---- which names -------------------------------------------------------------- |
| + |
| +func TestPreIssueCandidates(t *testing.T) { |
| + pending := proven("pending.example.com") |
| + pending.Pending, pending.PendingUntil = true, time.Now().Add(time.Hour).UTC().Format(time.RFC3339) |
| + // A first static route's claim has no Route (domainattach.go): kept. |
| + firstRoute := proven("firstroute.example.com") |
| + firstRoute.Route = "" |
| + regional := proven("regional.example.com") |
| + regional.Route = "" |
| + regional.Schema = 2 |
| + regional.Placements = []domains.Placement{{Region: "ie", Host: "shop-ie.acct.apps.example.net"}} |
| + catchall := proven("*.example.com") |
| + stranger := proven("stranger.example.com") |
| + stranger.Account = "other" |
| + |
| + claims := []domains.Claim{ |
| + proven("Billing.Example.com"), // case folds |
| + proven("billing.example.com"), // and dedupes |
| + proven("example.com"), // the zone apex is inside the zone |
| + proven("deep.a.b.example.com"), |
| + proven("badexample.com"), // a suffix, not a subdomain |
| + proven("shop.other.test"), |
| + proven("x.covered.example.com"), |
| + pending, |
| + firstRoute, |
| + regional, |
| + catchall, |
| + stranger, // an account the operator did not name |
| + } |
| + p, _, _ := testPreIssuer(t, []string{"example.com"}, nil, nil) |
| + p.covered = func(h string) bool { return strings.HasSuffix(h, ".covered.example.com") } |
| + got := p.candidates(claims) |
| + want := []string{"billing.example.com", "deep.a.b.example.com", "example.com", "firstroute.example.com", "regional.example.com"} |
| + if !slices.Equal(got, want) { |
| + t.Fatalf("candidates = %v, want %v", got, want) |
| + } |
| +} |
| + |
| +func TestDNS01AccountsFromEnv(t *testing.T) { |
| + got := parseDNS01Accounts(" abc ,,not a sqid,abc,xyz") |
| + if want := []string{"abc", "xyz"}; !slices.Equal(got, want) { |
| + t.Fatalf("parseDNS01Accounts = %v, want %v", got, want) |
| + } |
| + if parseDNS01Accounts("") != nil { |
| + t.Fatal("unset must be nil: the feature is off") |
| + } |
| +} |
| + |
| +func TestDNS01ZonesFromEnv(t *testing.T) { |
| + got := parseDNS01Zones(" Example.com. ,,ti.example ,not a zone, example.com,*.wild.test") |
| + want := []string{"example.com", "ti.example"} |
| + if !slices.Equal(got, want) { |
| + t.Fatalf("parseDNS01Zones = %v, want %v", got, want) |
| + } |
| + if parseDNS01Zones("") != nil { |
| + t.Fatal("unset must be nil: the feature is off") |
| + } |
| +} |
| + |
| +// ---- when to order -------------------------------------------------------------- |
| + |
| +func TestPreIssueDue(t *testing.T) { |
| + now := time.Now() |
| + leaf := func(life, left time.Duration) *tls.Certificate { |
| + c, _ := selfSignedLeaf(t, "h.example.com", now.Add(left)) |
| + c.Leaf.NotBefore = now.Add(left - life) |
| + return c |
| + } |
| + day := 24 * time.Hour |
| + // 90-day: autocert renews at 30 days left; we go a week before that. |
| + if preIssueDue(leaf(90*day, 38*day).Leaf, now) { |
| + t.Fatal("90-day cert, 38 days left: not due yet") |
| + } |
| + if !preIssueDue(leaf(90*day, 36*day).Leaf, now) { |
| + t.Fatal("90-day cert, 36 days left: due (ahead of autocert's 30)") |
| + } |
| + // 45-day: autocert's threshold is lifetime/3 = 15 days; ours stays ahead. |
| + if preIssueDue(leaf(45*day, 20*day).Leaf, now) { |
| + t.Fatal("45-day cert, 20 days left: not due yet") |
| + } |
| + if !preIssueDue(leaf(45*day, 17*day).Leaf, now) { |
| + t.Fatal("45-day cert, 17 days left: due") |
| + } |
| +} |
| + |
| +func TestPreIssueOrdersOnlyWhatLacksACurrentCert(t *testing.T) { |
| + e2eQuietLogs(t) |
| + fo := &fakeOrder{} |
| + p, store, _ := testPreIssuer(t, []string{"example.com"}, |
| + staticClaims(proven("fresh.example.com"), proven("stale.example.com"), proven("none.example.com")), fo.order(t)) |
| + ctx := context.Background() |
| + day := 24 * time.Hour |
| + now := time.Now() |
| + for name, raw := range map[string][]byte{ |
| + // 90-day certificates: 80 days left, and 10 left (inside the window). |
| + "fresh.example.com": e2eDatedCertPEM(t, "fresh.example.com", now.Add(-10*day), now.Add(80*day)), |
| + "stale.example.com": e2eDatedCertPEM(t, "stale.example.com", now.Add(-80*day), now.Add(10*day)), |
| + } { |
| + if err := putCert(ctx, store, name, raw); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + p.pass(ctx) |
| + got := append([]string(nil), fo.asked...) |
| + slices.Sort(got) |
| + if want := []string{"none.example.com", "stale.example.com"}; !slices.Equal(got, want) { |
| + t.Fatalf("ordered %v, want %v", got, want) |
| + } |
| + for _, h := range got { |
| + body, err := certStoreGet(t, store, certKey(h)) |
| + if err != nil { |
| + t.Fatalf("%s not published: %v", h, err) |
| + } |
| + if c, err := parseCertEntry(body); err != nil || preIssueDue(c.Leaf, time.Now()) { |
| + t.Fatalf("%s: published entry not current (%v)", h, err) |
| + } |
| + } |
| +} |
| + |
| +// ---- who orders --------------------------------------------------------------- |
| + |
| +// A box that is not the issuer reads no claims and orders nothing: the claim |
| +// listing is the issuer's cost alone. |
| +func TestPreIssueNonIssuerDoesNothing(t *testing.T) { |
| + fo := &fakeOrder{} |
| + read := 0 |
| + claims := func(context.Context) ([]domains.Claim, error) { |
| + read++ |
| + return []domains.Claim{proven("billing.example.com")}, nil |
| + } |
| + p, _, _ := testPreIssuer(t, []string{"example.com"}, claims, fo.order(t)) |
| + p.issuer = func() (context.Context, bool) { return nil, false } |
| + p.pass(context.Background()) |
| + if read != 0 || fo.count() != 0 { |
| + t.Fatalf("non-issuer read claims %d times and ordered %d", read, fo.count()) |
| + } |
| +} |
| + |
| +// ---- failure and bounds --------------------------------------------------------- |
| + |
| +func TestPreIssueBackoff(t *testing.T) { |
| + e2eQuietLogs(t) |
| + fo := &fakeOrder{fail: errors.New("CA said no")} |
| + p, _, _ := testPreIssuer(t, []string{"example.com"}, staticClaims(proven("a.example.com")), fo.order(t)) |
| + now := time.Now() |
| + p.now = func() time.Time { return now } |
| + ctx := context.Background() |
| + p.pass(ctx) |
| + p.pass(ctx) |
| + if fo.count() != 1 { |
| + t.Fatalf("failed name retried inside its backoff: %d orders", fo.count()) |
| + } |
| + now = now.Add(preIssueRetry + time.Second) |
| + p.pass(ctx) |
| + if fo.count() != 2 { |
| + t.Fatalf("failed name not retried after the backoff: %d orders", fo.count()) |
| + } |
| + |
| + // A zone the provider does not hold waits the long retry. |
| + fo.mu.Lock() |
| + fo.fail = fmt.Errorf("cannot publish the DNS-01 challenge: %w", errNoZone) |
| + fo.mu.Unlock() |
| + now = now.Add(preIssueRetry + time.Second) |
| + p.pass(ctx) |
| + now = now.Add(preIssueRetry + time.Second) |
| + p.pass(ctx) |
| + if fo.count() != 3 { |
| + t.Fatalf("no-zone name retried after an hour: %d orders", fo.count()) |
| + } |
| + now = now.Add(noZoneRetry) |
| + p.pass(ctx) |
| + if fo.count() != 4 { |
| + t.Fatalf("no-zone name never retried: %d orders", fo.count()) |
| + } |
| +} |
| + |
| +func TestPreIssueCaps(t *testing.T) { |
| + e2eQuietLogs(t) |
| + fo := &fakeOrder{} |
| + var cs []domains.Claim |
| + for i := range 3 * preIssueOrdersPerHour { |
| + cs = append(cs, proven(fmt.Sprintf("h%02d.example.com", i))) |
| + } |
| + p, _, _ := testPreIssuer(t, []string{"example.com"}, staticClaims(cs...), fo.order(t)) |
| + now := time.Now() |
| + p.now = func() time.Time { return now } |
| + ctx := context.Background() |
| + p.pass(ctx) |
| + if fo.count() != preIssueOrdersPerPass { |
| + t.Fatalf("one pass placed %d orders, want the per-pass cap %d", fo.count(), preIssueOrdersPerPass) |
| + } |
| + for range 2 * preIssueOrdersPerHour { |
| + now = now.Add(preIssueInterval) |
| + p.pass(ctx) |
| + } |
| + if fo.count() > preIssueOrdersPerHour+preIssueOrdersPerPass { |
| + t.Fatalf("%d orders inside about an hour, want at most the hourly cap %d", fo.count(), preIssueOrdersPerHour) |
| + } |
| + now = now.Add(2 * time.Hour) |
| + before := fo.count() |
| + p.pass(ctx) |
| + if fo.count() == before { |
| + t.Fatal("hourly cap never released") |
| + } |
| +} |
| + |
| +// A certificate this box holds locally but the bucket lacks (a publish that |
| +// failed) is republished, not ordered again. |
| +func TestPreIssueRepublishesALocalCert(t *testing.T) { |
| + e2eQuietLogs(t) |
| + fo := &fakeOrder{} |
| + const host = "billing.example.com" |
| + p, store, local := testPreIssuer(t, []string{"example.com"}, staticClaims(proven(host)), fo.order(t)) |
| + ctx := context.Background() |
| + c, _ := selfSignedLeaf(t, host, time.Now().Add(80*24*time.Hour)) |
| + raw, err := encodeWildcardPEM(c, c.PrivateKey.(*ecdsa.PrivateKey)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := local.Put(ctx, host, raw); err != nil { |
| + t.Fatal(err) |
| + } |
| + p.pass(ctx) |
| + if fo.count() != 0 { |
| + t.Fatalf("ordered %d times for a name with a current local cert", fo.count()) |
| + } |
| + if got, err := certStoreGet(t, store, certKey(host)); err != nil || string(got) != string(raw) { |
| + t.Fatalf("local cert not republished to the bucket: %v", err) |
| + } |
| +} |
| + |
| +// The claims read failing is logged and the pass ends: nothing is ordered on |
| +// a partial picture. |
| +func TestPreIssueClaimsReadFailure(t *testing.T) { |
| + e2eQuietLogs(t) |
| + fo := &fakeOrder{} |
| + p, _, _ := testPreIssuer(t, []string{"example.com"}, |
| + func(context.Context) ([]domains.Claim, error) { return nil, errors.New("bucket down") }, fo.order(t)) |
| + p.pass(context.Background()) |
| + if fo.count() != 0 { |
| + t.Fatal("ordered after a failed claims read") |
| + } |
| +} |
| + |
| +// Names that keep failing must not spend the hourly budget ahead of a name |
| +// that was never tried (Astra R1 P2). |
| +func TestPreIssueFailuresDoNotStarveOthers(t *testing.T) { |
| + e2eQuietLogs(t) |
| + var cs []domains.Claim |
| + for i := range preIssueOrdersPerHour + 5 { |
| + cs = append(cs, proven(fmt.Sprintf("a%02d.example.com", i))) |
| + } |
| + cs = append(cs, proven("zz.example.com")) |
| + var mu sync.Mutex |
| + var asked []string |
| + order := func(_ context.Context, host string) (*tls.Certificate, *ecdsa.PrivateKey, error) { |
| + mu.Lock() |
| + asked = append(asked, host) |
| + mu.Unlock() |
| + if host != "zz.example.com" { |
| + return nil, nil, errors.New("CA said no") |
| + } |
| + cert, key := selfSignedLeaf(t, host, time.Now().Add(90*24*time.Hour)) |
| + return cert, key, nil |
| + } |
| + p, _, _ := testPreIssuer(t, []string{"example.com"}, staticClaims(cs...), order) |
| + now := time.Now() |
| + p.now = func() time.Time { return now } |
| + for range 180 { |
| + p.pass(context.Background()) |
| + now = now.Add(preIssueInterval) |
| + } |
| + if !slices.Contains(asked, "zz.example.com") { |
| + t.Fatalf("zz.example.com never tried in three hours of passes (%d orders, all for failing names)", len(asked)) |
| + } |
| +} |
| + |
| +// replaceDNS keeps ONE value per name, as Route 53's UPSERT does, and holds |
| +// the first publication open briefly so that a second order for the same |
| +// name, if nothing serializes them, overwrites it before the CA looks. |
| +type replaceDNS struct { |
| + mu sync.Mutex |
| + txt map[string]string |
| + second chan struct{} |
| + calls int |
| +} |
| + |
| +func (d *replaceDNS) checkZone(context.Context, string) error { return nil } |
| + |
| +func (d *replaceDNS) present(_ context.Context, fqdn, value string) (func(context.Context) error, error) { |
| + d.mu.Lock() |
| + d.calls++ |
| + n := d.calls |
| + d.txt[fqdn] = value |
| + d.mu.Unlock() |
| + if n == 1 { |
| + select { |
| + case <-d.second: |
| + case <-time.After(300 * time.Millisecond): |
| + } |
| + } else { |
| + close(d.second) |
| + } |
| + return func(context.Context) error { |
| + d.mu.Lock() |
| + defer d.mu.Unlock() |
| + if d.txt[fqdn] == value { |
| + delete(d.txt, fqdn) |
| + } |
| + return nil |
| + }, nil |
| +} |
| + |
| +func (d *replaceDNS) lookup(name string) []string { |
| + d.mu.Lock() |
| + defer d.mu.Unlock() |
| + if v, ok := d.txt[name]; ok { |
| + return []string{v} |
| + } |
| + return nil |
| +} |
| + |
| +// An apex pre-issue and the wildcard for the same parent answer at the same |
| +// challenge name; both must complete (Astra R1 P1). |
| +func TestSameChallengeNameOrdersDoNotCollide(t *testing.T) { |
| + e2eQuietLogs(t) |
| + noTXTWait(t) |
| + dns := &replaceDNS{txt: map[string]string{}, second: make(chan struct{})} |
| + ca := newFakeACME(t) |
| + ca.dns01TXT = dns.lookup |
| + cache := autocert.DirCache(t.TempDir()) |
| + w := newWildcardManager([]string{"go.example.com"}, "", func() []string { return nil }, nil, "", cache, dns) |
| + w.directory = ca.directoryURL() |
| + w.refresh() |
| + apex := dns01OrderFunc(cache, ca.directoryURL(), dns) |
| + |
| + var wg sync.WaitGroup |
| + var werr, aerr error |
| + wg.Add(2) |
| + go func() { defer wg.Done(); werr = w.obtain(context.Background(), "go.example.com") }() |
| + go func() { defer wg.Done(); _, _, aerr = apex(context.Background(), "go.example.com") }() |
| + wg.Wait() |
| + if werr != nil || aerr != nil { |
| + t.Fatalf("wildcard: %v; apex: %v — one order overwrote the other's challenge", werr, aerr) |
| + } |
| + ca.checkFaults(t) |
| +} |
diff --git a/internal/edge/wildcard.go b/internal/edge/wildcard.go| index 161bc14fb..7b2bbd9c8 100644 |
| --- a/internal/edge/wildcard.go |
| +++ b/internal/edge/wildcard.go |
| @@ -691,6 +691,35 @@ const noZoneRetry = 12 * time.Hour |
| // obtain runs one full ACME DNS-01 issuance for *.parent and swaps the |
| // result in. |
| func (w *wildcardManager) obtain(ctx context.Context, parent string) error { |
| + cert, certKey, err := dns01Order(ctx, w.cache, w.directory, w.dns, "*."+parent, w.challengeFQDN(parent), "wildcard *."+parent) |
| + if err != nil { |
| + return err |
| + } |
| + // Paranoia: never store what certFor would refuse to serve. |
| + if !coversParent(cert, parent) { |
| + return fmt.Errorf("issued cert does not cover *.%s", parent) |
| + } |
| + raw, err := encodeWildcardPEM(cert, certKey) |
| + if err != nil { |
| + return fmt.Errorf("encode: %v", err) |
| + } |
| + if err := w.cache.Put(ctx, wildcardPEMKey(parent), raw); err != nil { |
| + return fmt.Errorf("persist: %v", err) |
| + } |
| + w.mu.Lock() |
| + w.certs[parent] = cert |
| + w.mu.Unlock() |
| + return nil |
| +} |
| + |
| +// dns01Order runs one ACME order for a single identifier over DNS-01 and |
| +// returns the issued chain with its fresh key. It is the CA conversation and |
| +// nothing else: the caller decides what the result must cover and where it |
| +// is kept. Two callers share it, and with it the deployment's one DNS-01 ACME |
| +// account: the wildcard manager above (identifier "*.<parent>") and the |
| +// pre-issuer (precert.go, an exact hostname). label names the work in log |
| +// lines ("wildcard *.<parent>", "pre-issue <host>"). |
| +func dns01Order(ctx context.Context, cache autocert.Cache, directory string, dns dnsProvider, identifier, challengeFQDN, label string) (*tls.Certificate, *ecdsa.PrivateKey, error) { |
| // Before the CA hears anything: can the provider publish the challenge |
| // at all? A parent whose zone lives elsewhere (per-account platform |
| // parents on a deployment whose apps domain is not in the provider's |
| @@ -699,70 +728,61 @@ func (w *wildcardManager) obtain(ctx context.Context, parent string) error { |
| // rate limits, since the authorization is deactivated and never |
| // validated, but a pointless round trip to the CA and a journal line per |
| // parent per hour. The lookup is the one present would make first. |
| - if zc, ok := w.dns.(zoneChecker); ok { |
| - if err := zc.checkZone(ctx, w.challengeFQDN(parent)); err != nil { |
| - return fmt.Errorf("cannot publish the DNS-01 challenge: %w", err) |
| + if zc, ok := dns.(zoneChecker); ok { |
| + if err := zc.checkZone(ctx, challengeFQDN); err != nil { |
| + return nil, nil, fmt.Errorf("cannot publish the DNS-01 challenge: %w", err) |
| } |
| } |
| - acctKey, err := w.accountKey(ctx) |
| + acctKey, err := dns01AccountKey(ctx, cache) |
| if err != nil { |
| - return fmt.Errorf("account key: %v", err) |
| + return nil, nil, fmt.Errorf("account key: %v", err) |
| } |
| - client := &acme.Client{Key: acctKey, DirectoryURL: w.directory} |
| + client := &acme.Client{Key: acctKey, DirectoryURL: directory} |
| if _, err := client.Register(ctx, &acme.Account{}, acme.AcceptTOS); err != nil && err != acme.ErrAccountAlreadyExists { |
| - return fmt.Errorf("acme register: %v", err) |
| + return nil, nil, fmt.Errorf("acme register: %v", err) |
| } |
| - order, err := client.AuthorizeOrder(ctx, []acme.AuthzID{{Type: "dns", Value: "*." + parent}}) |
| + order, err := client.AuthorizeOrder(ctx, []acme.AuthzID{{Type: "dns", Value: identifier}}) |
| if err != nil { |
| - return fmt.Errorf("authorize order: %v", err) |
| + return nil, nil, fmt.Errorf("authorize order: %v", err) |
| } |
| for _, zurl := range order.AuthzURLs { |
| - if err := w.solveDNS01(ctx, client, parent, zurl); err != nil { |
| - return err |
| + if err := solveDNS01(ctx, client, dns, label, challengeFQDN, zurl); err != nil { |
| + return nil, nil, err |
| } |
| } |
| certKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) |
| if err != nil { |
| - return err |
| + return nil, nil, err |
| } |
| csr, err := x509.CreateCertificateRequest(rand.Reader, &x509.CertificateRequest{ |
| - Subject: pkix.Name{CommonName: "*." + parent}, |
| - DNSNames: []string{"*." + parent}, |
| + Subject: pkix.Name{CommonName: identifier}, |
| + DNSNames: []string{identifier}, |
| }, certKey) |
| if err != nil { |
| - return fmt.Errorf("csr: %v", err) |
| + return nil, nil, fmt.Errorf("csr: %v", err) |
| } |
| ders, _, err := client.CreateOrderCert(ctx, order.FinalizeURL, csr, true) |
| if err != nil { |
| - return fmt.Errorf("finalize: %v", err) |
| + return nil, nil, fmt.Errorf("finalize: %v", err) |
| } |
| leaf, err := x509.ParseCertificate(ders[0]) |
| if err != nil { |
| - return fmt.Errorf("parse issued cert: %v", err) |
| - } |
| - cert := &tls.Certificate{Certificate: ders, PrivateKey: certKey, Leaf: leaf} |
| - // Paranoia: never store what certFor would refuse to serve. |
| - if !coversParent(cert, parent) { |
| - return fmt.Errorf("issued cert does not cover *.%s", parent) |
| - } |
| - raw, err := encodeWildcardPEM(cert, certKey) |
| - if err != nil { |
| - return fmt.Errorf("encode: %v", err) |
| + return nil, nil, fmt.Errorf("parse issued cert: %v", err) |
| } |
| - if err := w.cache.Put(ctx, wildcardPEMKey(parent), raw); err != nil { |
| - return fmt.Errorf("persist: %v", err) |
| - } |
| - w.mu.Lock() |
| - w.certs[parent] = cert |
| - w.mu.Unlock() |
| - return nil |
| + return &tls.Certificate{Certificate: ders, PrivateKey: certKey, Leaf: leaf}, certKey, nil |
| } |
| -// solveDNS01 answers one authorization: publish the challenge TXT record, |
| -// wait for the CA to see it, and always clean the record up afterwards. |
| -func (w *wildcardManager) solveDNS01(ctx context.Context, client *acme.Client, parent, authzURL string) (retErr error) { |
| +// dns01TXTWait is waitForTXT, held in a variable so a test whose challenge |
| +// records live in a fake provider (and so never reach a real resolver) need |
| +// not sit out its minute. |
| +var dns01TXTWait = waitForTXT |
| + |
| +// solveDNS01 answers one authorization: publish the challenge TXT record at |
| +// challengeFQDN, wait for the CA to see it, and always clean the record up |
| +// afterwards. |
| +func solveDNS01(ctx context.Context, client *acme.Client, dns dnsProvider, label, challengeFQDN, authzURL string) (retErr error) { |
| authz, err := client.GetAuthorization(ctx, authzURL) |
| if err != nil { |
| return fmt.Errorf("get authorization: %v", err) |
| @@ -780,7 +800,7 @@ func (w *wildcardManager) solveDNS01(ctx context.Context, client *acme.Client, p |
| dctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) |
| defer cancel() |
| if err := client.RevokeAuthorization(dctx, authz.URI); err != nil { |
| - log.Printf("edge: wildcard *.%s: deactivate abandoned authorization: %v", parent, err) |
| + log.Printf("edge: %s: deactivate abandoned authorization: %v", label, err) |
| } |
| }() |
| var chal *acme.Challenge |
| @@ -798,8 +818,17 @@ func (w *wildcardManager) solveDNS01(ctx context.Context, client *acme.Client, p |
| return err |
| } |
| - challengeFQDN := w.challengeFQDN(parent) |
| - cleanup, err := w.dns.present(ctx, challengeFQDN, txt) |
| + // One order per challenge name at a time, from publication to cleanup: |
| + // an apex pre-issue (precert.go) and the wildcard for the same parent |
| + // both answer at _acme-challenge.<parent>, and a provider that replaces |
| + // the record set (Route 53's UPSERT) would let one order overwrite the |
| + // other's value before the CA looks. |
| + unlock, err := lockChallenge(ctx, challengeFQDN) |
| + if err != nil { |
| + return fmt.Errorf("wait for another order's challenge at %s: %v", challengeFQDN, err) |
| + } |
| + defer unlock() |
| + cleanup, err := dns.present(ctx, challengeFQDN, txt) |
| if err != nil { |
| return fmt.Errorf("publish challenge TXT: %v", err) |
| } |
| @@ -809,14 +838,14 @@ func (w *wildcardManager) solveDNS01(ctx context.Context, client *acme.Client, p |
| cctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) |
| defer cancel() |
| if err := cleanup(cctx); err != nil { |
| - log.Printf("edge: wildcard *.%s: cleanup of challenge TXT failed: %v", parent, err) |
| + log.Printf("edge: %s: cleanup of challenge TXT failed: %v", label, err) |
| } |
| }() |
| // Best-effort: give the record a moment to reach the authoritative NS |
| // before telling the CA to look. Proceed on timeout — the CA does its own |
| // retries, and a hard failure just comes back through the retry loop. |
| - waitForTXT(ctx, challengeFQDN, txt, time.Minute) |
| + dns01TXTWait(ctx, challengeFQDN, txt, time.Minute) |
| if _, err := client.Accept(ctx, chal); err != nil { |
| return fmt.Errorf("accept challenge: %v", err) |
| @@ -827,14 +856,46 @@ func (w *wildcardManager) solveDNS01(ctx context.Context, client *acme.Client, p |
| return nil |
| } |
| +// challengeLocks holds one single-slot channel per challenge FQDN: the lock |
| +// solveDNS01 takes around a challenge's whole life (see there). Keyed by |
| +// name, so it grows with the names this process has ever answered for, |
| +// which is bounded by the deployment's parents and pre-issued hosts. |
| +var challengeLocks sync.Map |
| + |
| +// lockChallenge takes fqdn's challenge lock, or gives up when ctx ends. |
| +func lockChallenge(ctx context.Context, fqdn string) (unlock func(), err error) { |
| + v, _ := challengeLocks.LoadOrStore(fqdn, make(chan struct{}, 1)) |
| + slot := v.(chan struct{}) |
| + select { |
| + case slot <- struct{}{}: |
| + return func() { <-slot }, nil |
| + case <-ctx.Done(): |
| + return nil, ctx.Err() |
| + } |
| +} |
| + |
| // wildcardAccountKeyName is the ACME account key's cache key — Eleven's file |
| -// name, for the same no-migration reason as wildcardPEMKey. |
| +// name, for the same no-migration reason as wildcardPEMKey. Every DNS-01 |
| +// order in the deployment, wildcard or pre-issued host, runs under it. |
| const wildcardAccountKeyName = "wildcard-account.key" |
| // accountKey loads (or mints) the ACME account key. Separate from autocert's |
| // account on purpose: this flow manages its own registration lifecycle. |
| func (w *wildcardManager) accountKey(ctx context.Context) (*ecdsa.PrivateKey, error) { |
| - raw, err := w.cache.Get(ctx, wildcardAccountKeyName) |
| + return dns01AccountKey(ctx, w.cache) |
| +} |
| + |
| +// dns01AccountMu serializes the load-or-mint below. The wildcard manager and |
| +// the pre-issuer order on separate goroutines over one cache, and two first |
| +// orders racing a miss would each mint and register an account, the second |
| +// Put orphaning the first's registration. |
| +var dns01AccountMu sync.Mutex |
| + |
| +// dns01AccountKey loads (or mints) the DNS-01 ACME account key held in cache. |
| +func dns01AccountKey(ctx context.Context, cache autocert.Cache) (*ecdsa.PrivateKey, error) { |
| + dns01AccountMu.Lock() |
| + defer dns01AccountMu.Unlock() |
| + raw, err := cache.Get(ctx, wildcardAccountKeyName) |
| if err == nil { |
| block, _ := pem.Decode(raw) |
| if block == nil { |
| @@ -859,7 +920,7 @@ func (w *wildcardManager) accountKey(ctx context.Context) (*ecdsa.PrivateKey, er |
| // Crash-safety (temp + rename, 0600) is the cache backend's contract — |
| // the dir backend inherits it from autocert.DirCache. |
| raw = pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: der}) |
| - if err := w.cache.Put(ctx, wildcardAccountKeyName, raw); err != nil { |
| + if err := cache.Put(ctx, wildcardAccountKeyName, raw); err != nil { |
| return nil, err |
| } |
| return key, nil |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index 81206e544..e9a823c91 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -139,6 +139,12 @@ |
| // - CARLOS_ACME_DELEGATION_ZONE — our own zone that delegated wildcard |
| // parents' challenge TXTs publish into (spec §4); unset or an invalid |
| // shape = delegation off, per-host and direct DNS-01 continue |
| +// - CARLOS_DNS01_ZONES — comma list of zones the DNS-01 backend writes |
| +// (tito: tito.io) whose attached hostnames the issuer certifies over |
| +// DNS-01 from the claim, before their DNS points here (edge precert.go, |
| +// #1293); unset = off, custom domains wait for HTTP-01 as before |
| +// - CARLOS_DNS01_ACCOUNTS — comma list of account sqids whose claims may |
| +// use CARLOS_DNS01_ZONES; required with it (no account = off) |
| // - PLATFORM_EDGE_IPS — comma-separated edge IPs custom-domain DNS checks |
| // compare against. Default: this box's public IPv4 from IMDS |
| // (best-effort). It is no longer the WHOLE comparison set: each pass |
diff --git a/internal/hostenv/hostenv.go b/internal/hostenv/hostenv.go| index 55da6ecba..ad540ef08 100644 |
| --- a/internal/hostenv/hostenv.go |
| +++ b/internal/hostenv/hostenv.go |
| @@ -91,6 +91,8 @@ var Optional = []string{ |
| "CARLOS_DEMO_API_ORIGIN", |
| "CARLOS_DEPLOYMENT_REGION", |
| "CARLOS_DEPLOYMENT_SINGLE_TENANT", |
| + "CARLOS_DNS01_ACCOUNTS", |
| + "CARLOS_DNS01_ZONES", |
| "CARLOS_DNS_PROVIDER", |
| "CARLOS_EDGE_GZIP", |
| "CARLOS_EDGE_PROTECT", |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index f267413cc..c31e9e42e 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -767,9 +767,13 @@ var plan9B8CensusInventory = []censusEntry{ |
| // Calls the in-memory edge Cache.Put, not a deployment store writer. |
| {"internal/edge/edge.go", "Edge.maybeStore", "nonrecord", "sel:Put", "89231cd6ebfa293c307f502a7bf7236373199489e6846e0c3b8ccf281594b9ab"}, |
| {"internal/edge/mesh.go", "mintMeshKey", "nonrecord", "sel:Put", "bfb55866660051d4c55b2a1be96e7f997c76042119a8f57472fbc41908a2dcc0"}, |
| + // #1293: writes a pre-issued per-host certificate to the cert cache (local acme dir, then control/certs/<host>); no record. |
| + {"internal/edge/precert.go", "preIssuer.issue", "nonrecord", "sel:Put", "281db1f336345758dc4846d0da9392b60ec850e3c67a88a643ca5295cb444bda"}, |
| {"internal/edge/storedoor.go", "storeDoor.serveObject", "record-transport", "sel:Put", "95fef5f91ed7a5f07a3818b1a55baded4209e97d43d48ba21cb69be3d2c7299d"}, |
| - {"internal/edge/wildcard.go", "wildcardManager.obtain", "nonrecord", "sel:Put", "752840841afb596cba318e5c7ece964c5146a7a24edde91f9c9dc0024753dc3b"}, |
| - {"internal/edge/wildcard.go", "wildcardManager.accountKey", "nonrecord", "sel:Put", "77f7da94e302045eff8cbbb1be311bdcbaf75cc4cdd8f794d474e508fbf35a51"}, |
| + // #1293: the CA conversation moved to dns01Order; obtain still writes only the wildcard PEM to the cert cache. |
| + {"internal/edge/wildcard.go", "wildcardManager.obtain", "nonrecord", "sel:Put", "314c68830f5f5ea7393b2c09d390b868bcecf92a63e3eb66067b5335ac74e97e"}, |
| + // #1293: wildcardManager.accountKey's load-or-mint, moved here unchanged and serialized; writes the DNS-01 ACME account key to the cert cache. |
| + {"internal/edge/wildcard.go", "dns01AccountKey", "nonrecord", "sel:Put", "86ce92c43ab7581764bfb5db91239b3ecb40388ac6e6c14b41a40a1242ecc50d"}, |
| {"internal/fleetapi/fleetapi.go", "store.Put", "record-transport", "def:Put", "68f7424cbbaf8fffde48429ae29198cf6e4fcf768c512657b305224febc11186"}, |
| {"internal/genselect/select.go", "requestLocation", "key-site", "lit:instances", "12ef5b8f94be7575ec7ab5f169736320ee6938440387fe5ea99b96f2a528cca0"}, |
| {"internal/host/bootstrap.go", "const tmpfilesConf", "key-site", "lit:instances", "71d83f240cb1c3ab6f9dd2954b1f3e93b90133362ec12193746f60e75aeced7d"}, |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 2f749e957..dc67c94ce 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -276,3 +276,4 @@ plan14-root-reads-path-routes-across-boxes.tsv f959a3626e83650aaad1880eecc3fedde |
| plan14-root-reads-headers-security-allowlist.tsv f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6 |
| plan14-root-reads-stateless-scale-1-memory-env.tsv 47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132 |
| plan14-root-reads-group-revoke-readback-1255.tsv 47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132 |
| +plan14-root-reads-precert-dns01-1293.tsv b2f039a12bb284c9a36b391339e25e3f77ec94a3d4e38389ec9ef75261d7873f |
diff --git a/internal/provision/testdata/plan14-root-reads-precert-dns01-1293.tsv b/internal/provision/testdata/plan14-root-reads-precert-dns01-1293.tsv| new file mode 100644 |
| index 000000000..4eb1c30de |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-precert-dns01-1293.tsv |
| @@ -0,0 +1,7 @@ |
| +# Census overlay precert-dns01-1293, written by census-propose (#369). census-ruling-precert-dns01-1293, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-precert-dns01-1293.md. |
| +# 1 body, 0 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy e2f9aff7fc89e6f5d85c811489416b8961496c0d29550f52852948b90a1fb8a4 internal/edge/edge.go RunWithActivatorReady legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-certwarm-wake;basis=registers the cert warm's nudge on OnReload and on the home map's new served-hosts wake (#386); nudge only sends on a buffered channel; no read added, same 5 sites;rev3=census-ruling-edge-roll-blip;basis=the :80/:443 (and dev) listeners are bound on the calling goroutine with net.Listen via listen()/listenAddr (same empty-address defaults as ListenAndServe) before the serve goroutines, which now call Serve/ServeTLS on them, and one log line names the bound addresses; no read added, same 5 sites;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): the inline home-map arming (newHomeMap, one boot Refresh, Store, run) moves unchanged into the new Edge.ArmHomeMap and is called here as e.ArmHomeMap(); same refresh, same timeout, same order. The reads are moved, none added.;rev3=census-ruling-agent-start-demo-1;basis=Logs the combined explicit wildcard parents through demoWildcardDomains; no new watcher or read loop.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: invoke the local admission Close before HTTP/HTTPS draining and door shutdown in both dev and normal listeners. Preserve merged main's startup behavior and its census basis; the same five read sites, no new reads.;rev3=census-ruling-stateless-replicas-3;basis=Task 1b: defer stopping and joining the edge's replica jobs at shutdown. Existing five direct read sites unchanged; no new reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Wrap dev, HTTP and HTTPS listeners through ConfigureGroupHairpin before serving. Indirectly read protected root boot identity and group-ingress.json; kernel local/peer addresses mark local ingress, never HTTP headers. Agent edge uses verified public source for accounting; direct read sites unchanged and absent marker keeps original listeners. CI fix removes interface enumeration: local peer must match snapshot primary IPv4, an ingress IPv4 installed locally by root, or loopback; kernel destination must still be an ingress EIP on port 80/443. Merge 45cebde4 retains deferred stopReplicaProbes alongside group listener wrapping and shutdown admission closure.;rev3=census-ruling-demo-api-site-route;basis=Change the startup failure context from load routes to initialize because origin validation now runs during construction. Existing five read sites unchanged; no new read or runtime authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Invoke the agent shutdown timestamp hook synchronously at SIGTERM/SIGINT receipt before closing admission in dev and TLS paths. No read added.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5: registers the https and http servers with the connection drain (conns.serve) so a drain can close idle keep-alive connections; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the inline cert warm construction (newCertWarm over warmSet and dnsGate, then OnReload and setServedWake registering warm.nudge) moves unchanged into the new Edge.newIssuerWarm in certwarm.go and is called here with the same apps domain, parents, perHostCert, warmResolver, edgeIPs and store; the loop still starts here. The warm set it wires now reads the published edges files through the home map (OwnServedHosts and ServedHosts, both already polled) instead of the local route table, regional names aside. It is a different source, not a subset: an attached name not yet published as pointing is no longer listed, while a name the route table has already dropped stays listed until this box's next edges file write and the home map's next poll catch up (HostPolicy still refuses an order for a name the registry no longer holds). A name published not pointing is not a warm candidate at all, whether or not its certificate is cached: the warm neither looks it up, orders it nor re-arms its renewal until its home box publishes it pointing again (a cached certificate keeps serving and re-arms on a handshake at the issuer). The warm reads the set only after the issuer gate, and the read is in memory (route table and the home map's last snapshot); it also drops a DNS-miss entry for a name that has left the set before probing it. It keeps a failure record while any box publishes the exact name (the home map DeployedHosts: every box's file, own included, pointing or not, the same in-memory snapshot) or the name is a regional route-table name, and prunes it only once no box publishes it. That retention set has no apps-domain or wildcard filter (those stay on candidacy only), so a name published not pointing, or one a wildcard parent starts covering, keeps the record that explains its backoff; the set is never a source of candidates. No read site added in this unit, same 5 sites.;rev3=census-ruling-w6-ingress-drain;basis=the two public servers are built by e.publicServers (internal/edge/ingressdrain.go): :443 as before (same handler, TLS config and ReadHeaderTimeout 10 s), :80 now wrapped by plainTracked so the ingress drain can count and close its requests (its barrier is never §25's); Serve's error test is listenerFailed(err) = err != nil && !errors.Is(err, http.ErrServerClosed) (was err != ErrServerClosed), so a graceful Shutdown by the drain is not fatal. New Edge.plain connDrain field. Same flags, addresses and listeners; read sites unchanged (5); no read added.;rev3=census-ruling-edge-ppv2;basis=Edge process (uid carlos), not root. Edge gains the proxy atomic.Pointer. Outside dev mode, before either public listener binds and before the ready hook hands the Edge to the agent, calls e.loadProxyIngress(os.Getenv, dataDir): CARLOS_INGRESS_PROXY_SOURCES from the edge's own environment (carlos-edge.service loads the root-owned 0600 host.env) through hostenv.ParseProxySources; blank leaves the edge unarmed with nothing read; a non-empty list arms it and Lstats <dataDir>/edge/trust-barrier (armProxyIngress); a value that does not parse is log.Fatal. After the hairpin configuration, wrapProxyIngress wraps both public listeners outermost (returns them untouched when unarmed); when armed it logs the armed line and starts runProxyJournal (counters to the journal, no reads). The existing 5 read sites are unchanged.;rev3=census-ruling-audit-request-path;basis=the dev-mode http.Server gains IdleTimeout: publicIdleTimeout (120 s) beside its ReadHeaderTimeout; comment updated. Same 5 read sites, no read added.;rev3=census-ruling-precert-dns01-1293;basis=the edge process (carlos-edge.service, user carlos), not root: after the cert warm starts, calls e.newPreIssuerFromEnv(certCache, mirror, wm) and, when it returns non-nil, starts its loop and logs one line. newPreIssuerFromEnv (precert.go) reads CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the edge environment (the root-owned host.env); either unset or invalid = nil, nothing else read. Only claims of the named accounts qualify. Armed, the loop runs only while this box holds the issuer gate: it lists domains/ claims in the deployment bucket through a ClaimCache, and for proven claims under the listed zones orders a certificate over DNS-01 through the existing DNS provider seam (dnsProviderFromEnv, same IAM-scoped _acme-challenge TXT writes the wildcard manager already makes), writing the result through the existing publishing cache (local acme dir + control/certs/<host>). No root read; the existing 5 read sites are unchanged. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 50e87b602c51b69fbe19d43e67210ca878e2ba0acb003eb326ab16e4619ad162 |
| +internal/edge/edge.go RunWithActivatorReady legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-certwarm-wake;basis=registers the cert warm's nudge on OnReload and on the home map's new served-hosts wake (#386); nudge only sends on a buffered channel; no read added, same 5 sites;rev3=census-ruling-edge-roll-blip;basis=the :80/:443 (and dev) listeners are bound on the calling goroutine with net.Listen via listen()/listenAddr (same empty-address defaults as ListenAndServe) before the serve goroutines, which now call Serve/ServeTLS on them, and one log line names the bound addresses; no read added, same 5 sites;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): the inline home-map arming (newHomeMap, one boot Refresh, Store, run) moves unchanged into the new Edge.ArmHomeMap and is called here as e.ArmHomeMap(); same refresh, same timeout, same order. The reads are moved, none added.;rev3=census-ruling-agent-start-demo-1;basis=Logs the combined explicit wildcard parents through demoWildcardDomains; no new watcher or read loop.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: invoke the local admission Close before HTTP/HTTPS draining and door shutdown in both dev and normal listeners. Preserve merged main's startup behavior and its census basis; the same five read sites, no new reads.;rev3=census-ruling-stateless-replicas-3;basis=Task 1b: defer stopping and joining the edge's replica jobs at shutdown. Existing five direct read sites unchanged; no new reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Wrap dev, HTTP and HTTPS listeners through ConfigureGroupHairpin before serving. Indirectly read protected root boot identity and group-ingress.json; kernel local/peer addresses mark local ingress, never HTTP headers. Agent edge uses verified public source for accounting; direct read sites unchanged and absent marker keeps original listeners. CI fix removes interface enumeration: local peer must match snapshot primary IPv4, an ingress IPv4 installed locally by root, or loopback; kernel destination must still be an ingress EIP on port 80/443. Merge 45cebde4 retains deferred stopReplicaProbes alongside group listener wrapping and shutdown admission closure.;rev3=census-ruling-demo-api-site-route;basis=Change the startup failure context from load routes to initialize because origin validation now runs during construction. Existing five read sites unchanged; no new read or runtime authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Invoke the agent shutdown timestamp hook synchronously at SIGTERM/SIGINT receipt before closing admission in dev and TLS paths. No read added.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5: registers the https and http servers with the connection drain (conns.serve) so a drain can close idle keep-alive connections; no read added;rev3=census-ruling-warm-set-published-724;basis=#724: the inline cert warm construction (newCertWarm over warmSet and dnsGate, then OnReload and setServedWake registering warm.nudge) moves unchanged into the new Edge.newIssuerWarm in certwarm.go and is called here with the same apps domain, parents, perHostCert, warmResolver, edgeIPs and store; the loop still starts here. The warm set it wires now reads the published edges files through the home map (OwnServedHosts and ServedHosts, both already polled) instead of the local route table, regional names aside. It is a different source, not a subset: an attached name not yet published as pointing is no longer listed, while a name the route table has already dropped stays listed until this box's next edges file write and the home map's next poll catch up (HostPolicy still refuses an order for a name the registry no longer holds). A name published not pointing is not a warm candidate at all, whether or not its certificate is cached: the warm neither looks it up, orders it nor re-arms its renewal until its home box publishes it pointing again (a cached certificate keeps serving and re-arms on a handshake at the issuer). The warm reads the set only after the issuer gate, and the read is in memory (route table and the home map's last snapshot); it also drops a DNS-miss entry for a name that has left the set before probing it. It keeps a failure record while any box publishes the exact name (the home map DeployedHosts: every box's file, own included, pointing or not, the same in-memory snapshot) or the name is a regional route-table name, and prunes it only once no box publishes it. That retention set has no apps-domain or wildcard filter (those stay on candidacy only), so a name published not pointing, or one a wildcard parent starts covering, keeps the record that explains its backoff; the set is never a source of candidates. No read site added in this unit, same 5 sites.;rev3=census-ruling-w6-ingress-drain;basis=the two public servers are built by e.publicServers (internal/edge/ingressdrain.go): :443 as before (same handler, TLS config and ReadHeaderTimeout 10 s), :80 now wrapped by plainTracked so the ingress drain can count and close its requests (its barrier is never §25's); Serve's error test is listenerFailed(err) = err != nil && !errors.Is(err, http.ErrServerClosed) (was err != ErrServerClosed), so a graceful Shutdown by the drain is not fatal. New Edge.plain connDrain field. Same flags, addresses and listeners; read sites unchanged (5); no read added.;rev3=census-ruling-edge-ppv2;basis=Edge process (uid carlos), not root. Edge gains the proxy atomic.Pointer. Outside dev mode, before either public listener binds and before the ready hook hands the Edge to the agent, calls e.loadProxyIngress(os.Getenv, dataDir): CARLOS_INGRESS_PROXY_SOURCES from the edge's own environment (carlos-edge.service loads the root-owned 0600 host.env) through hostenv.ParseProxySources; blank leaves the edge unarmed with nothing read; a non-empty list arms it and Lstats <dataDir>/edge/trust-barrier (armProxyIngress); a value that does not parse is log.Fatal. After the hairpin configuration, wrapProxyIngress wraps both public listeners outermost (returns them untouched when unarmed); when armed it logs the armed line and starts runProxyJournal (counters to the journal, no reads). The existing 5 read sites are unchanged.;rev3=census-ruling-audit-request-path;basis=the dev-mode http.Server gains IdleTimeout: publicIdleTimeout (120 s) beside its ReadHeaderTimeout; comment updated. Same 5 read sites, no read added.;rev3=census-ruling-precert-dns01-1293;basis=the edge process (carlos-edge.service, user carlos), not root: after the cert warm starts, calls e.newPreIssuerFromEnv(certCache, mirror, wm) and, when it returns non-nil, starts its loop and logs one line. newPreIssuerFromEnv (precert.go) reads CARLOS_DNS01_ZONES and CARLOS_DNS01_ACCOUNTS from the edge environment (the root-owned host.env); either unset or invalid = nil, nothing else read. Only claims of the named accounts qualify. Armed, the loop runs only while this box holds the issuer gate: it lists domains/ claims in the deployment bucket through a ClaimCache, and for proven claims under the listed zones orders a certificate over DNS-01 through the existing DNS provider seam (dnsProviderFromEnv, same IAM-scoped _acme-challenge TXT writes the wildcard manager already makes), writing the result through the existing publishing cache (local acme dir + control/certs/<host>). No root read; the existing 5 read sites are unchanged. data-literal@129,data-literal@148,data-literal@284,data-literal@417,file:Open@1013 50e87b602c51b69fbe19d43e67210ca878e2ba0acb003eb326ab16e4619ad162 |
| +@coverage internal/edge 88c47565ad69fe60fb5f26acee99b338d8534e3fc419dcf2be3465eddfcc809b |
| +@coverage internal/host d3e30f0432b1fb8a0c4affe1e1cd7cccf39d181f47ed44b2832d0465b7f22ddb |
| +@coverage internal/hostenv 42dfd4b787b820301c75ee2a5c158a31b8db4fedd748b32140bd0cfc565fb411 |