carlos / platform Public

identity: one shared contract for console, CLI and minting (H4-M11 R2)

Paul's round-2 ruling. internal/identity holds Canonical/IsCanonical,
used by the console, cmd/console and account minting:

- carlos accounts create and domains.MintAccount refuse a non-canonical
  owner before anything is written; NormalizeAddress (Unicode ToLower)
  is gone, so a Kelvin-sign K can no longer become kim@ in a manifest.
- Stored principals are matched exactly: alert, store and demo
  recipients skip a non-canonical stored row instead of lower-casing it
  into a twin; console revoke and app revoke act on the exact named
  row and refuse when nothing matches; member -remove takes the exact
  legacy row first.
- The guard parses Go (go/ast) across console, cmd/console, minting and
  the contract, resolves aliases and multi-line calls, and requires a
  per-function exception with a reason for every fold.
- Census overlay for accounts.go createAccountInBucket and the re-pinned
  envelopes (., internal/domains, internal/identity).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 356a7ce347bd1183436a09983b74aab962814317 parent c22d704
18 files changed, +830 −143
  • accounts.go +15 −6
  • accounts_identity_test.go +73 −0
  • cmd/console/main.go +24 −4
  • cmd/console/member.go +15 −4
  • cmd/console/member_test.go +87 −0
  • docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md +19 −0
  • internal/console/alertwatch.go +7 −2
  • internal/console/demo_alerts.go +9 −2
  • internal/console/identity.go +20 −38
  • internal/console/identity_guard_test.go +425 −68
  • internal/console/storenotify.go +7 −4
  • internal/console/storenotify_test.go +18 −1
  • internal/domains/mint.go +15 −11
  • internal/domains/mint_test.go +6 −3
  • internal/identity/identity.go +52 −0
  • internal/identity/identity_test.go +30 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv +7 −0

CI failed — 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-sepjer
.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 golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading golang.org/x/sync v0.24.0
go: downloading golang.org/x/sys v0.49.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading golang.org/x/mod v0.41.0
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
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/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading golang.org/x/text v0.43.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading 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 github.com/dustin/go-humanize v1.0.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
=== 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 (190 s, from +0 s)
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
=== vet-tags (200 s, from +0 s)
go: downloading github.com/klauspost/compress v1.20.2
go: downloading modernc.org/sqlite v1.55.0
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/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
=== gofmt (1 s, from +0 s)
gofmt -l .: clean
=== rest (390 s, from +15 s)
ok  	github.com/carlosframework/platform/cmd/carlos-media	129.438s
?   	github.com/carlosframework/platform/cmd/changelog	[no test files]
ok  	github.com/carlosframework/platform/cmd/console	217.191s
ok  	github.com/carlosframework/platform/cmd/mediaimage	47.435s
ok  	github.com/carlosframework/platform/cmd/moveprobe	16.754s
ok  	github.com/carlosframework/platform/cmd/pricebook-export	0.050s
ok  	github.com/carlosframework/platform/cmd/rootfswitness	0.135s
ok  	github.com/carlosframework/platform/cmd/runsc-assets	0.104s
ok  	github.com/carlosframework/platform/cmd/zddprobe	1.017s
ok  	github.com/carlosframework/platform/internal/agentsock	0.054s
ok  	github.com/carlosframework/platform/internal/alerting	0.015s
ok  	github.com/carlosframework/platform/internal/analytics	0.277s
ok  	github.com/carlosframework/platform/internal/appconfig	48.955s
ok  	github.com/carlosframework/platform/internal/apperr	0.381s
ok  	github.com/carlosframework/platform/internal/applog	3.978s
ok  	github.com/carlosframework/platform/internal/apppolicy	2.425s
ok  	github.com/carlosframework/platform/internal/assetcache	0.644s
ok  	github.com/carlosframework/platform/internal/awsinv	0.012s
ok  	github.com/carlosframework/platform/internal/awsmanaged	9.813s
ok  	github.com/carlosframework/platform/internal/awsregiongroup	0.072s
ok  	github.com/carlosframework/platform/internal/awsterminations	0.024s
ok  	github.com/carlosframework/platform/internal/backupswords	0.011s
ok  	github.com/carlosframework/platform/internal/billing	0.056s
ok  	github.com/carlosframework/platform/internal/billing/billingtest	0.019s
ok  	github.com/carlosframework/platform/internal/billingstripe	2.122s
ok  	github.com/carlosframework/platform/internal/boxchoice	0.031s
ok  	github.com/carlosframework/platform/internal/boxid	2.522s
?   	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.007s
ok  	github.com/carlosframework/platform/internal/boxself	0.204s
ok  	github.com/carlosframework/platform/internal/boxvolumes	0.027s
ok  	github.com/carlosframework/platform/internal/caps	4.459s
ok  	github.com/carlosframework/platform/internal/certwarm	0.007s
ok  	github.com/carlosframework/platform/internal/cgroup	1.384s
ok  	github.com/carlosframework/platform/internal/changelog	3.820s
ok  	github.com/carlosframework/platform/internal/clamd	0.078s
?   	github.com/carlosframework/platform/internal/cliflag	[no test files]
ok  	github.com/carlosframework/platform/internal/clireg	0.005s
ok  	github.com/carlosframework/platform/internal/codehealth	18.959s
ok  	github.com/carlosframework/platform/internal/compute	0.006s
ok  	github.com/carlosframework/platform/internal/consolefleet	0.011s
?   	github.com/carlosframework/platform/internal/controlname	[no test files]
?   	github.com/carlosframework/platform/internal/controlsock	[no test files]
ok  	github.com/carlosframework/platform/internal/dbdoor	11.393s
ok  	github.com/carlosframework/platform/internal/dbdoor/dbdoortest	0.060s
ok  	github.com/carlosframework/platform/internal/dbquery	0.023s
ok  	github.com/carlosframework/platform/internal/dbreads	2.957s
?   	github.com/carlosframework/platform/internal/dbreads/dbreadstest	[no test files]
ok  	github.com/carlosframework/platform/internal/dbverify	0.024s
ok  	github.com/carlosframework/platform/internal/demo	0.012s
ok  	github.com/carlosframework/platform/internal/demobuild	5.101s
ok  	github.com/carlosframework/platform/internal/democlaim	0.323s
ok  	github.com/carlosframework/platform/internal/devbox	20.229s
ok  	github.com/carlosframework/platform/internal/dnsrec	0.015s
ok  	github.com/carlosframework/platform/internal/docsite	0.134s
ok  	github.com/carlosframework/platform/internal/domainreg	0.020s
ok  	github.com/carlosframework/platform/internal/domains	78.405s
ok  	github.com/carlosframework/platform/internal/doorkey	0.045s
ok  	github.com/carlosframework/platform/internal/economics	0.029s
ok  	github.com/carlosframework/platform/internal/edgefence	0.134s
ok  	github.com/carlosframework/platform/internal/edgeguard	0.471s
?   	github.com/carlosframework/platform/internal/edgeproof	[no test files]
ok  	github.com/carlosframework/platform/internal/edgesfile	0.132s
ok  	github.com/carlosframework/platform/internal/egressaddr	0.008s
ok  	github.com/carlosframework/platform/internal/execsandbox	108.598s
ok  	github.com/carlosframework/platform/internal/fileacl	0.009s
ok  	github.com/carlosframework/platform/internal/fleetapi	1.786s
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	4.281s
ok  	github.com/carlosframework/platform/internal/genselect	0.102s
ok  	github.com/carlosframework/platform/internal/geo	0.101s
ok  	github.com/carlosframework/platform/internal/geoip	0.159s
ok  	github.com/carlosframework/platform/internal/groupadmission	0.027s
ok  	github.com/carlosframework/platform/internal/grouprollaws	17.721s
ok  	github.com/carlosframework/platform/internal/hadeparture	0.026s
ok  	github.com/carlosframework/platform/internal/hafresh	0.020s
ok  	github.com/carlosframework/platform/internal/hairpin	0.225s
ok  	github.com/carlosframework/platform/internal/historyreadback	0.994s
ok  	github.com/carlosframework/platform/internal/hostactors	25.814s
ok  	github.com/carlosframework/platform/internal/hostbox	26.336s
ok  	github.com/carlosframework/platform/internal/hostclaim	2.027s
ok  	github.com/carlosframework/platform/internal/hostenv	0.062s
ok  	github.com/carlosframework/platform/internal/hostevidence	0.021s
ok  	github.com/carlosframework/platform/internal/hostexec	29.244s
ok  	github.com/carlosframework/platform/internal/hostfence	0.163s
ok  	github.com/carlosframework/platform/internal/hostfiles	30.292s
ok  	github.com/carlosframework/platform/internal/hostfloor	0.789s
ok  	github.com/carlosframework/platform/internal/hostguard	1.526s
ok  	github.com/carlosframework/platform/internal/hostops	10.184s
?   	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.009s
ok  	github.com/carlosframework/platform/internal/hostrelocate	2.008s
ok  	github.com/carlosframework/platform/internal/hostresolve	0.547s
ok  	github.com/carlosframework/platform/internal/hostwrite	0.016s
ok  	github.com/carlosframework/platform/internal/identity	0.010s
ok  	github.com/carlosframework/platform/internal/infraview	0.008s
ok  	github.com/carlosframework/platform/internal/ingresshealth	0.005s
ok  	github.com/carlosframework/platform/internal/ingresshealth/awstg	0.014s
ok  	github.com/carlosframework/platform/internal/instancectl	66.683s
ok  	github.com/carlosframework/platform/internal/instanceexec	9.594s
ok  	github.com/carlosframework/platform/internal/instancefs	18.941s
ok  	github.com/carlosframework/platform/internal/instancekey	0.012s
ok  	github.com/carlosframework/platform/internal/instanceupdates	0.030s
ok  	github.com/carlosframework/platform/internal/interactive	0.702s
ok  	github.com/carlosframework/platform/internal/launchd	0.009s
ok  	github.com/carlosframework/platform/internal/layout	23.940s
ok  	github.com/carlosframework/platform/internal/layout/pubclass	106.541s
ok  	github.com/carlosframework/platform/internal/lbhealth	0.018s
ok  	github.com/carlosframework/platform/internal/lease	150.564s
ok  	github.com/carlosframework/platform/internal/lease/leasetest	1.440s
ok  	github.com/carlosframework/platform/internal/lease/locktest	0.020s
ok  	github.com/carlosframework/platform/internal/ledger	0.038s
ok  	github.com/carlosframework/platform/internal/mail	1.452s
ok  	github.com/carlosframework/platform/internal/mailer	1.032s
ok  	github.com/carlosframework/platform/internal/mailsubmit	1.726s
ok  	github.com/carlosframework/platform/internal/mailwire	0.009s
ok  	github.com/carlosframework/platform/internal/maintenance	0.251s
ok  	github.com/carlosframework/platform/internal/maintenanceexec	8.777s
ok  	github.com/carlosframework/platform/internal/maintenanceguard	0.435s
ok  	github.com/carlosframework/platform/internal/managedboot	4.243s
?   	github.com/carlosframework/platform/internal/managedboot/boottest	[no test files]
?   	github.com/carlosframework/platform/internal/managedboot/roottest	[no test files]
ok  	github.com/carlosframework/platform/internal/media	2.288s
ok  	github.com/carlosframework/platform/internal/media/mediatest	0.029s
ok  	github.com/carlosframework/platform/internal/mediaaws	69.030s
ok  	github.com/carlosframework/platform/internal/mediahandler	47.039s
ok  	github.com/carlosframework/platform/internal/mediajobs	1.185s
ok  	github.com/carlosframework/platform/internal/medialocal	10.235s
ok  	github.com/carlosframework/platform/internal/metrics	0.160s
ok  	github.com/carlosframework/platform/internal/minorunits	0.016s
ok  	github.com/carlosframework/platform/internal/moves	56.117s
ok  	github.com/carlosframework/platform/internal/moves/archive	3.142s
ok  	github.com/carlosframework/platform/internal/moves/offlinerun	0.126s
ok  	github.com/carlosframework/platform/internal/namedunits	0.013s
ok  	github.com/carlosframework/platform/internal/objstore	3.628s
ok  	github.com/carlosframework/platform/internal/ops	17.501s
ok  	github.com/carlosframework/platform/internal/pageindex	4.473s
ok  	github.com/carlosframework/platform/internal/parity	0.182s
?   	github.com/carlosframework/platform/internal/parity/cmd/parity-doc	[no test files]
ok  	github.com/carlosframework/platform/internal/park	1.208s
ok  	github.com/carlosframework/platform/internal/perf	0.200s
ok  	github.com/carlosframework/platform/internal/plans	0.228s
ok  	github.com/carlosframework/platform/internal/privatefile	0.020s
ok  	github.com/carlosframework/platform/internal/provision	244.158s
ok  	github.com/carlosframework/platform/internal/proxyproto	0.969s
ok  	github.com/carlosframework/platform/internal/publicrelease	0.070s
ok  	github.com/carlosframework/platform/internal/ratelimit	0.269s
ok  	github.com/carlosframework/platform/internal/regionlabel	0.050s
ok  	github.com/carlosframework/platform/internal/regionname	0.041s
ok  	github.com/carlosframework/platform/internal/registrar	0.007s
ok  	github.com/carlosframework/platform/internal/registrar/openprovider	0.822s
?   	github.com/carlosframework/platform/internal/registrar/registrartest	[no test files]
ok  	github.com/carlosframework/platform/internal/registry	87.517s
ok  	github.com/carlosframework/platform/internal/relay	7.685s
ok  	github.com/carlosframework/platform/internal/release	130.133s
?   	github.com/carlosframework/platform/internal/release/requestwitness	[no test files]
ok  	github.com/carlosframework/platform/internal/replicagen	0.030s
ok  	github.com/carlosframework/platform/internal/replicas	0.101s
ok  	github.com/carlosframework/platform/internal/reqrec	5.953s
ok  	github.com/carlosframework/platform/internal/rollout	12.770s
ok  	github.com/carlosframework/platform/internal/rolloutwords	0.018s
ok  	github.com/carlosframework/platform/internal/rootaws	103.281s
ok  	github.com/carlosframework/platform/internal/rootfsimage	1.294s
ok  	github.com/carlosframework/platform/internal/rootparticipation	0.096s
ok  	github.com/carlosframework/platform/internal/rootstate	0.050s
ok  	github.com/carlosframework/platform/internal/runs	1.377s
ok  	github.com/carlosframework/platform/internal/s3compat	0.047s
ok  	github.com/carlosframework/platform/internal/s3fake	1.145s
ok  	github.com/carlosframework/platform/internal/s3meter	0.539s
ok  	github.com/carlosframework/platform/internal/safefile	0.039s
ok  	github.com/carlosframework/platform/internal/schedule	25.919s
ok  	github.com/carlosframework/platform/internal/seeds	0.097s
ok  	github.com/carlosframework/platform/internal/share	0.015s
ok  	github.com/carlosframework/platform/internal/sim/litestreamfacts	4.649s
ok  	github.com/carlosframework/platform/internal/sim/mediajobs	56.598s
ok  	github.com/carlosframework/platform/internal/sim/regionha	23.894s
ok  	github.com/carlosframework/platform/internal/status	0.556s
ok  	github.com/carlosframework/platform/internal/steering	0.277s
ok  	github.com/carlosframework/platform/internal/stopevidence	0.558s
ok  	github.com/carlosframework/platform/internal/storecfg	0.491s
ok  	github.com/carlosframework/platform/internal/svcrole	0.020s
ok  	github.com/carlosframework/platform/internal/systemd	6.326s
?   	github.com/carlosframework/platform/internal/systemdshow	[no test files]
ok  	github.com/carlosframework/platform/internal/team	4.904s
ok  	github.com/carlosframework/platform/internal/teamcontract	0.183s
ok  	github.com/carlosframework/platform/internal/telemetry	0.019s
ok  	github.com/carlosframework/platform/internal/termfence	4.840s
ok  	github.com/carlosframework/platform/internal/timerspec	0.034s
ok  	github.com/carlosframework/platform/internal/tsidentity	4.200s
ok  	github.com/carlosframework/platform/internal/tunnelclient	0.481s
ok  	github.com/carlosframework/platform/internal/unixdial	0.024s
ok  	github.com/carlosframework/platform/internal/updatewords	0.039s
ok  	github.com/carlosframework/platform/internal/upstreamguard	0.018s
?   	github.com/carlosframework/platform/internal/upstreamguard/guardtest	[no test files]
ok  	github.com/carlosframework/platform/internal/usage	0.033s
ok  	github.com/carlosframework/platform/internal/version	0.027s
ok  	github.com/carlosframework/platform/internal/vet	3.386s
ok  	github.com/carlosframework/platform/internal/zonehost	0.026s
ok  	github.com/carlosframework/platform/internal/zonehost/route53zones	0.069s
?   	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.017s
ok  	github.com/carlosframework/platform/scripts/pathmapcheck	0.096s
ok  	github.com/carlosframework/platform/scripts/region-ha-g2/fixture	5.235s
ok  	github.com/carlosframework/platform/scripts/stateless-replicas-drill	1.250s
ok  	github.com/carlosframework/platform/scripts/witness-pointer	0.020s
=== cutover-witness (171 s, from +15 s)
ok  	github.com/carlosframework/platform	4.049s
=== internal_grouproll@0 (273 s, from +74 s)
ok  	github.com/carlosframework/platform/internal/grouproll	272.344s
=== internal_grouproll@1 (281 s, from +74 s)
ok  	github.com/carlosframework/platform/internal/grouproll	280.062s
=== internal_activator@0 (155 s, from +147 s)
ok  	github.com/carlosframework/platform/internal/activator	150.771s
=== internal_activator@1 (133 s, from +147 s)
ok  	github.com/carlosframework/platform/internal/activator	129.395s
=== internal_activator@2 (142 s, from +147 s)
ok  	github.com/carlosframework/platform/internal/activator	138.338s
=== internal_activator@3 (173 s, from +147 s)
ok  	github.com/carlosframework/platform/internal/activator	169.335s
=== root@0 (115 s, from +181 s)
ok  	github.com/carlosframework/platform	105.515s
=== root@1 (105 s, from +181 s)
ok  	github.com/carlosframework/platform	93.564s
=== root@2 (123 s, from +182 s)
ok  	github.com/carlosframework/platform	111.709s
=== root@3 (116 s, from +182 s)
ok  	github.com/carlosframework/platform	104.924s
=== root@4 (103 s, from +182 s)
ok  	github.com/carlosframework/platform	93.090s
=== internal_edge@0 (246 s, from +188 s)
ok  	github.com/carlosframework/platform/internal/edge	238.729s
=== internal_edge@1 (125 s, from +188 s)
ok  	github.com/carlosframework/platform/internal/edge	117.401s
=== internal_edge@2 (164 s, from +188 s)
ok  	github.com/carlosframework/platform/internal/edge	155.926s
=== internal_edge@3 (146 s, from +188 s)
ok  	github.com/carlosframework/platform/internal/edge	137.253s
=== internal_host@0 (174 s, from +226 s)
ok  	github.com/carlosframework/platform/internal/host	169.597s
=== internal_host@1 (157 s, from +226 s)
ok  	github.com/carlosframework/platform/internal/host	152.448s
=== internal_host@2 (147 s, from +226 s)
ok  	github.com/carlosframework/platform/internal/host	142.795s
=== internal_host@3 (191 s, from +226 s)
ok  	github.com/carlosframework/platform/internal/host	186.189s
=== internal_host@4 (230 s, from +226 s)
ok  	github.com/carlosframework/platform/internal/host	225.324s
=== internal_host@5 (269 s, from +226 s)
ok  	github.com/carlosframework/platform/internal/host	264.981s
=== internal_console@0 (177 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	168.514s
=== internal_console@1 (192 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	184.200s
=== internal_console@2 (246 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	237.368s
=== internal_console@3 (265 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	257.152s
=== internal_console@4 (195 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	186.306s
=== internal_console@5 (227 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	218.703s
=== internal_console@6 (236 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	226.491s
=== internal_console@7 (225 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	216.529s
=== internal_console@8 (238 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	229.289s
=== internal_console@9 (241 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	232.609s
=== internal_console@10 (233 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	224.754s
=== internal_console@11 (254 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	246.159s
=== internal_console@12 (330 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	321.971s
=== internal_console@13 (232 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	222.780s
=== internal_console@14 (220 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	210.453s
=== internal_console@15 (230 s, from +234 s)
ok  	github.com/carlosframework/platform/internal/console	220.977s
=== internal_console@16 (243 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	234.444s
=== internal_console@17 (208 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	201.117s
=== internal_console@18 (220 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	212.672s
=== internal_console@19 (233 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	225.819s
=== internal_console@20 (241 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	234.392s
=== internal_console@21 (263 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	255.068s
=== internal_console@22 (274 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	266.830s
=== internal_console@23 (284 s, from +235 s)
ok  	github.com/carlosframework/platform/internal/console	275.355s
=== lists: internal_console 234 s, internal_edge 187 s, internal_activator 146 s, internal_host 225 s, root 180 s, internal_grouproll 73 s
=== cpu: the gate used 13312 cpu-seconds in 564 s, about 23.6 of 32 cores; the machine as a whole was 79% busy
=== opentofu ===
opentofu: 39 test files in 11 suites, OpenTofu v1.13.9
  initialised in 15 s
  ok      19 s  infra/modules/box-fence-writer/tests/writer.tftest.hcl  Success! 1 passed, 0 failed.
  ok      18 s  infra/modules/deployment-buckets/tests/console_floors.tftest.hcl  Success! 1 passed, 0 failed.
  ok      26 s  infra/modules/deployment-buckets/tests/data_lifecycle.tftest.hcl  Success! 3 passed, 0 failed.
  ok      17 s  infra/modules/deployment-buckets/tests/db_reads.tftest.hcl  Success! 1 passed, 0 failed.
  ok      18 s  infra/modules/deployment-buckets/tests/evidence.tftest.hcl  Success! 1 passed, 0 failed.
  ok      27 s  infra/modules/deployment-buckets/tests/fence_writers.tftest.hcl  Success! 3 passed, 0 failed.
  ok      23 s  infra/modules/deployment-buckets/tests/media_results.tftest.hcl  Success! 2 passed, 0 failed.
  ok      85 s  infra/modules/media-engine/tests/media_engine.tftest.hcl  Success! 24 passed, 0 failed.
  ok      27 s  infra/modules/pdf-host/tests/computed.tftest.hcl  Success! 2 passed, 0 failed.
  ok      58 s  infra/modules/pdf-host/tests/pdf_host.tftest.hcl  Success! 24 passed, 0 failed.
  ok      43 s  infra/modules/region-group-operator-document/tests/document.tftest.hcl  Success! 12 passed, 0 failed.
  ok      20 s  infra/modules/region-host/ingress/tests/fixed-targets/tests/targets.tftest.hcl  Success! 2 passed, 0 failed.
  ok      63 s  infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl  Success! 30 passed, 0 failed.
  ok      47 s  infra/modules/region-host/tests/alert_publish.tftest.hcl  Success! 18 passed, 0 failed.
  ok      45 s  infra/modules/region-host/tests/alerts_topic.tftest.hcl  Success! 16 passed, 0 failed.
  ok      10 s  infra/modules/region-host/tests/analytics_prune.tftest.hcl  Success! 2 passed, 0 failed.
  ok      14 s  infra/modules/region-host/tests/console_mail.tftest.hcl  Success! 4 passed, 0 failed.
  ok       8 s  infra/modules/region-host/tests/fixed_state_unchanged.tftest.hcl  Success! 1 passed, 0 failed.
  ok      74 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      35 s  infra/modules/region-host/tests/group_operator.tftest.hcl  Success! 13 passed, 0 failed.
  ok       8 s  infra/modules/region-host/tests/group_user_data.tftest.hcl  Success! 3 passed, 0 failed.
  ok      28 s  infra/modules/region-host/tests/health_alarms.tftest.hcl  Success! 10 passed, 0 failed.
  ok      10 s  infra/modules/region-host/tests/ingress_drain_read.tftest.hcl  Success! 4 passed, 0 failed.
  ok       5 s  infra/modules/region-host/tests/instance_metadata.tftest.hcl  Success! 1 passed, 0 failed.
  ok      22 s  infra/modules/region-host/tests/mailer.tftest.hcl  Success! 6 passed, 0 failed.
  ok       8 s  infra/modules/region-host/tests/mailer_group.tftest.hcl  Success! 2 passed, 0 failed.
  ok      13 s  infra/modules/region-host/tests/managed_fleets/group_refusal.tftest.hcl  Success! 2 passed, 0 failed.
  ok     113 s  infra/modules/region-host/tests/managed_fleets/managed_fleets.tftest.hcl  Success! 46 passed, 0 failed.
  ok      86 s  infra/modules/region-host/tests/store_conversion.tftest.hcl  Success! 27 passed, 0 failed.
  ok      20 s  infra/modules/region-host/tests/store_scanning.tftest.hcl  Success! 4 passed, 0 failed.
  ok      34 s  infra/modules/region-host/tests/store_versioning.tftest.hcl  Success! 11 passed, 0 failed.
  ok      18 s  infra/modules/region-host/tests/store_write_credentials.tftest.hcl  Success! 4 passed, 0 failed.
  ok      20 s  infra/modules/region-host/tests/user_data_ignored.tftest.hcl  Success! 3 passed, 0 failed.
  ok      12 s  infra/modules/region-remote-host/tests/data_lifecycle.tftest.hcl  Success! 3 passed, 0 failed.
  ok      17 s  infra/modules/region-remote-host/tests/no_deployment_bucket.tftest.hcl  Success! 5 passed, 0 failed.
  ok      33 s  infra/modules/scanner-host/tests/scanner_host.tftest.hcl  Success! 14 passed, 0 failed.
opentofu: 39 files in 214 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: 66781346 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:38084
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.02s)
    --- 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/30 16:37:36 moves: T4: STORE: list: operation error S3: ListObjectsV2, https response error StatusCode: 403, RequestID: 18ECE003471DADBD, HostID: 7cf9781dd9d2ce52f65379a88def34f844169df99a6805a100ac97b1ebb7eb60, 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.047s
=== RUN   TestS3StoreMinioContract
=== RUN   TestS3StoreMinioContract/conditional_get_and_etag_listing
=== RUN   TestS3StoreMinioContract/bump_through_every_mutation_path
--- PASS: TestS3StoreMinioContract (0.04s)
    --- PASS: TestS3StoreMinioContract/conditional_get_and_etag_listing (0.01s)
    --- PASS: TestS3StoreMinioContract/bump_through_every_mutation_path (0.02s)
PASS
ok  	github.com/carlosframework/platform/internal/release	0.043s
Bucket created successfully `local/analytics-versions`.
local/analytics-versions versioning is enabled
Created policy `analytics-versions` successfully.
Added user `analyticsversions` successfully.
Attached Policies: [analytics-versions]
To User: analyticsversions
=== RUN   TestS3StoreMinioVersions
--- PASS: TestS3StoreMinioVersions (0.04s)
PASS
ok  	github.com/carlosframework/platform/internal/release	0.044s
Bucket created successfully `local/store-versioned`.
local/store-versioned versioning is enabled
Created policy `store-versioned` successfully.
Added user `storeversioned` successfully.
Attached Policies: [store-versioned]
To User: storeversioned
=== RUN   TestVersionedContractMinio
--- PASS: TestVersionedContractMinio (0.01s)
PASS
ok  	github.com/carlosframework/platform/internal/objstore	0.022s
Bucket created successfully `local/wc-bucket`.
Created policy `writer` successfully.
Added user `wcwriter` successfully.
Attached Policies: [writer]
To User: wcwriter
=== RUN   TestWriteCredentialContractMinio
=== RUN   TestWriteCredentialContractMinio/put_under_the_prefix
=== RUN   TestWriteCredentialContractMinio/multipart_under_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_put_beside_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_put_to_another_bucket
=== RUN   TestWriteCredentialContractMinio/refused:_read_under_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_list
=== RUN   TestWriteCredentialContractMinio/refused:_list_uploads
=== RUN   TestWriteCredentialContractMinio/refused:_tag
=== RUN   TestWriteCredentialContractMinio/refused:_put_tagged
=== RUN   TestWriteCredentialContractMinio/refused:_put_outside_the_prefix
=== RUN   TestWriteCredentialContractMinio/refused:_copy_from_the_store
=== RUN   TestWriteCredentialContractMinio/refused:_bucket_settings
=== RUN   TestWriteCredentialContractMinio/refused:_read_elsewhere
=== RUN   TestWriteCredentialContractMinio/refused:_head
=== RUN   TestWriteCredentialContractMinio/refused:_delete
=== RUN   TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag
--- PASS: TestWriteCredentialContractMinio (0.04s)
    --- PASS: TestWriteCredentialContractMinio/put_under_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/multipart_under_the_prefix (0.01s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_beside_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_to_another_bucket (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_read_under_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_list (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_list_uploads (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_tag (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_tagged (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_outside_the_prefix (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_copy_from_the_store (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_bucket_settings (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_read_elsewhere (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_head (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_delete (0.00s)
    --- PASS: TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag (0.00s)
PASS
ok  	github.com/carlosframework/platform/internal/objstore	0.052s
=== RUN   TestEndToEndMinio
=== RUN   TestEndToEndMinio/plan
=== RUN   TestEndToEndMinio/roll
=== RUN   TestEndToEndMinio/replace
=== RUN   TestEndToEndMinio/remove
--- PASS: TestEndToEndMinio (0.50s)
    --- PASS: TestEndToEndMinio/plan (0.01s)
    --- PASS: TestEndToEndMinio/roll (0.13s)
    --- PASS: TestEndToEndMinio/replace (0.16s)
    --- PASS: TestEndToEndMinio/remove (0.16s)
PASS
ok  	github.com/carlosframework/platform/internal/grouproll	0.504s
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/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/30 16:37:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000002
2026/11/30 16:37:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000002 maxTXID=0000000000000002 size=370
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000002
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000003
2026/11/30 16:37:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000003 maxTXID=0000000000000003 size=454
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000003 txid.db=0000000000000003
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/30 16:37:44 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/30 16:37:44 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/30 16:37:45 console: CARLOS_SECRETS_PUBKEY is unset, so no region outside the home can be chosen automatically
2026/11/30 16:37:45 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%3A43281: could not determine target mailbox
    agent.go:136: dbreads: dbr_djibbcjxucro32acswbqfl5vkm: planned 3 files (1544 bytes) and restored to 3 in 14ms
    agent.go:136: dbreads: dbr_djibbcjxucro32acswbqfl5vkm: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/30 16:37:46 console: db read dbr_djibbcjxucro32acswbqfl5vkm: relayed 1 chunks (102 bytes) in 1.006s, ended done
    agent.go:136: dbreads: dbr_b3ybba4i577hxyx3uyekwb4u2m: planned 1 files (720 bytes) and restored to 1 in 12ms
    agent.go:136: dbreads: dbr_b3ybba4i577hxyx3uyekwb4u2m: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/30 16:37:47 console: db read dbr_b3ybba4i577hxyx3uyekwb4u2m: relayed 1 chunks (102 bytes) in 1.005s, ended done
    agent.go:136: dbreads: dbr_vhnouor57uznekip4imtu4rsyu: planned 3 files (1544 bytes) and held through 3 in 12ms
    agent.go:136: dbreads: dbr_vhnouor57uznekip4imtu4rsyu: output 1544 bytes in 1 confirmed chunks in 1ms
2026/11/30 16:37:48 console: db read dbr_vhnouor57uznekip4imtu4rsyu: relayed 1 chunks (1641 bytes) in 1.005s, ended done
=== RUN   TestDBForwardMinio/by_disconnect
=== NAME  TestDBForwardMinio
    agent.go:136: dbreads: dbr_kpli3oyxebmglgrqnnyem4fa2q: planned 3 files (1544 bytes) and restored to 3 in 14ms
2026/11/30 16:37:48 console: db read dbr_kpli3oyxebmglgrqnnyem4fa2q: relayed 0 chunks (0 bytes) in 30ms, ended client gone
    agent.go:136: dbreads: dbr_kpli3oyxebmglgrqnnyem4fa2q: output 5 bytes in 1 confirmed chunks in 105ms
=== RUN   TestDBForwardMinio/by_timeout
=== NAME  TestDBForwardMinio
    agent.go:136: dbreads: dbr_qy5mcrtinyklzzzivmlfycqwtm: planned 3 files (1544 bytes) and restored to 3 in 14ms
2026/11/30 16:38:08 console: db read dbr_qy5mcrtinyklzzzivmlfycqwtm: relayed 0 chunks (0 bytes) in 19.502s, ended no-result
    agent.go:136: dbreads: dbr_qy5mcrtinyklzzzivmlfycqwtm: output 5 bytes in 1 confirmed chunks in 19.476s
--- PASS: TestDBForwardMinio (23.20s)
    --- PASS: TestDBForwardMinio/by_disconnect (0.24s)
    --- PASS: TestDBForwardMinio/by_timeout (19.61s)
PASS
ok  	github.com/carlosframework/platform/internal/console	23.252s
Bucket created successfully `local/media-transfers`.
Bucket created successfully `local/media-transfer-results`.
local/media-transfer-results versioning is enabled
Created policy `media-transfers` successfully.
Added user `mediatransfers` successfully.
Attached Policies: [media-transfers]
To User: mediatransfers
=== RUN   TestMediaTransfersMinio
    upload.go:117: codec: the store already holds video.mp4
    upload.go:117: codec: the store already holds video.m3u8
    upload.go:117: codec: the store already holds poster.jpg
--- PASS: TestMediaTransfersMinio (0.08s)
PASS
ok  	github.com/carlosframework/platform/internal/mediaaws	0.086s
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.60s)
PASS
ok  	github.com/carlosframework/platform/internal/medialocal	0.600s
=== RUN   TestHeldHandoverTwoBoxMinio
2026/11/30 16:38:13 edge: mesh key: minted
2026/11/30 16:38:13 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 16:38:13 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 16:38:13 tenant admission is open. accepting tenant work
2026/11/30 16:38:13 activator: HA placement host=shop-1016c468.example.test kind=Place ref=annie reason=roomiest generation=2026-11-30T16:38:13Z lock_generation=0
2026/11/30 16:38:13 lease: t8-1016c468/shop-1016c468.example.test: HA lease acquired in 4ms (first wake)
2026/11/30 16:38:13 activator: shop-1016c468.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/30 16:38:13 activator: shop-1016c468.example.test: started carlos-instance@shop\x2d1016c468.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 7ms, control socket 0s, key gate 0s, logs 0s) 8ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 16:38:13 activator: shop-1016c468.example.test: carlos-instance@shop\x2d1016c468.example.test.service launched in 9ms, healthy 0s later
2026/11/30 16:38:13 activator: shop-1016c468.example.test: woke in 22ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 9ms, replicate 7ms
2026/11/30 16:38:13 lease: t8-1016c468/plain-1016c468.example.test: acquired in 2ms (client 0s, lock read and write 1ms)
2026/11/30 16:38:13 activator: no replica for plain-1016c468.example.test in s3://contract-bucket/t8-1016c468/plain-1016c468.example.test — booting fresh
2026/11/30 16:38:13 activator: plain-1016c468.example.test: started carlos-instance@plain\x2d1016c468.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 1ms, instance key 0s, env 5ms, control socket 0s, key gate 0s, logs 0s) 6ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 16:38:13 activator: plain-1016c468.example.test: carlos-instance@plain\x2d1016c468.example.test.service launched in 8ms, healthy 0s later
2026/11/30 16:38:13 activator: plain-1016c468.example.test: woke in 43ms: checks 0s, lease 2ms, restore 19ms, identity 0s, protect 0s, spawn 8ms, replicate 15ms
2026/11/30 16:38:13 lease: t8-1016c468/bot0.shop.bac.sidecar.internal: HA lease acquired in 4ms (first wake)
2026/11/30 16:38:13 activator: bot0.shop.bac.sidecar.internal: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/30 16:38:13 activator: bot0.shop.bac.sidecar.internal: woke in 70ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 8ms, settle 0s, replicate 56ms
2026/11/30 16:38:13 activator: next-due probe plain-1016c468.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 16:38:13 activator: plain-1016c468.example.test hibernated
2026/11/30 16:38:13 activator: next-due probe shop-1016c468.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 16:38:13 activator: bot0.shop.bac.sidecar.internal: released with a marker (clean true, txid 1, files 3:d4b14a117b2a617a23d61b9ba8e08a7ab336184cf18664cae295d46cb3ac7922) in 6ms: files 1ms, sync 2ms, record 1ms, marker 2ms
2026/11/30 16:38:13 activator: bot0.shop.bac.sidecar.internal hibernated
2026/11/30 16:38:13 activator: shop-1016c468.example.test: released with a marker (clean true, txid 1, files 3:15bf704e2936f15647319abb79e2c21d7d37effae558c4a3e2684b6fed07462d) in 6ms: files 1ms, sync 3ms, record 1ms, marker 2ms
2026/11/30 16:38:13 activator: shop-1016c468.example.test hibernated
2026/11/30 16:38:13 lease: t8-1016c468/shop-1016c468.example.test: HA lease acquired in 3ms (clean marker)
2026/11/30 16:38:13 activator: shop-1016c468.example.test: restored (other-box)
2026/11/30 16:38:13 activator: shop-1016c468.example.test: started carlos-instance@shop\x2d1016c468.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 0s, instance key 0s, env 1ms, control socket 0s, key gate 0s, logs 0s) 1ms, launch file 0s, gate 0s, root start 1ms)
2026/11/30 16:38:13 activator: shop-1016c468.example.test: carlos-instance@shop\x2d1016c468.example.test.service launched in 2ms, healthy 0s later
2026/11/30 16:38:13 activator: shop-1016c468.example.test: woke in 91ms: checks 0s, lease 4ms, restore 28ms, identity 0s, protect 1ms, spawn 2ms, replicate 57ms
2026/11/30 16:38:13 edge: ha-take shop-1016c468.example.test from annie (txn t8-witness, marker generation 1): holder betty, generation 2
2026/11/30 16:38:13 edge: forward shop-1016c468.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:807b15ad39699bdc6cdac8dc19db3ce2 Step:move Result:ok Reasons:[] Fence:t8-witness StartedAt:2026-11-30 16:38:13.859936924 +0000 UTC FinishedAt:2026-11-30 16:38:14.007670899 +0000 UTC Acked:[betty carol] Departed:[] Moved:[{Host:shop-1016c468.example.test Holder:betty Gen:2 Confirmed:take}] Released:[{Host:plain-1016c468.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:126 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-1016c468.example.test <nil> stop plain-1016c468.example.test marker=true clean=true <nil> releasing shop-1016c468.example.test <nil> stop bot0.shop.bac.sidecar.internal marker=true clean=true <nil> stop shop-1016c468.example.test marker=true clean=true <nil> taken shop-1016c468.example.test betty <nil> end-moves]
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: DELETE /contract-bucket/t8-1016c468/plain-1016c468.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-1016c468/bot0.shop.bac.sidecar.internal/0009/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-1016c468/bot0.shop.bac.sidecar.internal/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-1016c468/shop-1016c468.example.test/0009/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-1016c468/shop-1016c468.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-1016c468/shop-1016c468.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/head.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/generations/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0008/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0007/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0006/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0005/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0004/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0008/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0007/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0006/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0005/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0004/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/0009/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/files/0/manifest.json
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/files/0/objects/0000000000000001-8cb1d074f61387cd172f9b3ca73512c9ea0f978cc4c167d6ffc23632a7c269f1
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/files/0/objects/0000000000000003-6b84bd3f2c2312e379b206544f0510e7023fb1bedc054cd6a221bbdaefbfcb5e
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/0000/0000000000000001-0000000000000001.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0000/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0009/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-1016c468/shop-1016c468.example.test/0000/0000000000000002-0000000000000002.ltx
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0001/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0002/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-1016c468/shop-1016c468.example.test/0003/
    hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-1016c468/shop-1016c468.example.test/lock.json
    hadrain_twobox_minio_linux_test.go:1243: drain took 192ms; S3 calls 44 (DELETE lock=1 GET files=3 GET head=1 GET lock=3 GET replica=2 LIST replica=28 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/30 16:38:14 lease: t8-1016c468/plain-1016c468.example.test: acquired in 2ms (client 0s, lock read and write 2ms)
2026/11/30 16:38:14 activator: plain-1016c468.example.test: started carlos-instance@plain\x2d1016c468.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/30 16:38:14 activator: plain-1016c468.example.test: carlos-instance@plain\x2d1016c468.example.test.service launched in 1ms, healthy 0s later
2026/11/30 16:38:14 lease: /tmp/carlos-minio-contract-SSThGw/g/dw4076115170/data/instances/plain-1016c468.example.test/plain-1016c468.example.test.db: continuity with the last clean close not proven; snapshot 1-0000000000000001 written before serving
2026/11/30 16:38:14 activator: plain-1016c468.example.test: woke in 9ms: checks 0s, lease 2ms, restore 0s, identity 0s, protect 1ms, spawn 2ms, replicate 5ms
2026/11/30 16:38:14 activator: next-due probe shop-1016c468.example.test: decode /api/next-due: invalid character 'b' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 16:38:14 activator: shop-1016c468.example.test: released with a marker (clean true, txid 2, files 3:15bf704e2936f15647319abb79e2c21d7d37effae558c4a3e2684b6fed07462d) in 4ms: files 1ms, sync 0s, record 1ms, marker 2ms
2026/11/30 16:38:14 activator: shop-1016c468.example.test hibernated
2026/11/30 16:38:14 tenant admission is closed for shutdown
2026/11/30 16:38:14 activator: next-due probe plain-1016c468.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 16:38:14 activator: plain-1016c468.example.test hibernated
--- PASS: TestHeldHandoverTwoBoxMinio (0.56s)
=== RUN   TestHeldHandoverLostLeaseMinio
2026/11/30 16:38:14 edge: mesh key: minted
2026/11/30 16:38:14 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 16:38:14 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/30 16:38:14 tenant admission is open. accepting tenant work
2026/11/30 16:38:14 activator: HA placement host=shop-b3c34513.example.test kind=Place ref=annie reason=roomiest generation=2026-11-30T16:38:14Z lock_generation=0
2026/11/30 16:38:14 lease: t8-b3c34513/shop-b3c34513.example.test: HA lease acquired in 3ms (first wake)
2026/11/30 16:38:14 activator: shop-b3c34513.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/30 16:38:14 activator: shop-b3c34513.example.test: started carlos-instance@shop\x2db3c34513.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/30 16:38:14 activator: shop-b3c34513.example.test: carlos-instance@shop\x2db3c34513.example.test.service launched in 8ms, healthy 0s later
2026/11/30 16:38:14 activator: shop-b3c34513.example.test: woke in 20ms: checks 0s, lease 4ms, restore 0s, identity 0s, protect 0s, spawn 8ms, replicate 8ms
2026/11/30 16:38:14 activator: next-due probe shop-b3c34513.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/30 16:38:14 activator: final checkpoint shop-b3c34513.example.test: lease: release marker owed for s3://contract-bucket/t8-b3c34513/shop-b3c34513.example.test/lock.json (If-Match "430e4d1813f4e7508c39d559c23d1bcd"): lease: write release marker: operation error S3: PutObject, https response error StatusCode: 503, RequestID: , HostID: , api error ServiceUnavailable: witness: refused
2026/11/30 16:38:14 activator: shop-b3c34513.example.test hibernated
2026/11/30 16:38:14 activator: handover of shop-b3c34513.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-b3c34513.example.test client 4 "
    hadrain_twobox_minio_linux_test.go:1486: driver calls: [begin shop-b3c34513.example.test <nil> releasing shop-b3c34513.example.test <nil> stop shop-b3c34513.example.test marker=false clean=false <nil> left shop-b3c34513.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/30 16:38:14 tenant admission is closed for shutdown
2026/11/30 16:38:14 http: proxy error: context canceled
--- PASS: TestHeldHandoverLostLeaseMinio (0.28s)
PASS
ok  	github.com/carlosframework/platform/internal/host	0.882s
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/30 16:38:15 lease: instances/gen-1796056695621098170.shop.example.com: HA lease acquired in 5ms (first wake)
2026/11/30 16:38:15 lease: instances/gen-1796056695621098170.shop.example.com: HA lease acquired in 3ms (holder terminated)
    gentake_minio_test.go:308: a second create-only copy onto instances/gen-1796056695621098170.shop.example.com/g-00000000000000000002/0000/0000000000000001-0000000000000001.ltx: <nil> (destination condition honoured: false)
2026/11/30 16:38:15 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/30 16:38:15 ERROR enforce L0 time retention system=store db=w.example.com.db error="fetch l1 files: lease: a write has waited too long to reach storage (write fence)"
2026/11/30 16:38:15 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: a write has waited too long to reach storage (write fence)"
2026/11/30 16:38:15 http: proxy error: context canceled
=== RUN   TestGenerationTakeMinio/switch-412
2026/11/30 16:38:15 lease: instances/gen-1796056695753491709.shop.example.com: HA lease acquired in 4ms (first wake)
2026/11/30 16:38:15 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: fetch ltx files: lease: a write has waited too long to reach storage (write fence)"
2026/11/30 16:38:15 lease: instances/gen-1796056695753491709.shop.example.com: HA lease acquired in 3ms (clean marker)
=== RUN   TestGenerationTakeMinio/copy-version
=== RUN   TestGenerationTakeMinio/store-time
2026/11/30 16:38:15 lease: instances/gen-1796056695807970711.shop.example.com: HA lease acquired in 4ms (first wake)
2026/11/30 16:38:15 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/30 16:38:15 lease: instances/gen-1796056695807970711.shop.example.com: HA lease acquired in 3ms (clean marker)
2026/11/30 16:38:15 lease: instances/gen-1796056695807970711.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/30 16:38:15 lease: instances/gen-1796056695807970711.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/30 16:38:15 lease: instances/gen-1796056695807970711.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/30 16:38:15 lease: instances/gen-1796056695807970711.shop.example.com: HA lease acquired in 3ms (unclean marker)
=== RUN   TestGenerationTakeMinio/skew
--- PASS: TestGenerationTakeMinio (0.37s)
    --- PASS: TestGenerationTakeMinio/take (0.13s)
    --- PASS: TestGenerationTakeMinio/switch-412 (0.04s)
    --- PASS: TestGenerationTakeMinio/copy-version (0.01s)
    --- PASS: TestGenerationTakeMinio/store-time (0.17s)
    --- PASS: TestGenerationTakeMinio/skew (0.01s)
PASS
ok  	github.com/carlosframework/platform/internal/lease	0.381s
minio contract: PASS
=== staticcheck ===
go version go1.26.10 linux/arm64
go: downloading honnef.co/go/tools v0.8.2
go: downloading github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
go: downloading golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678
go: downloading golang.org/x/sync v0.23.0
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
staticcheck: clean
=== govulncheck ===
go version go1.26.10 linux/arm64
go: downloading golang.org/x/vuln v1.8.0
go: downloading golang.org/x/telemetry v0.0.0-20260908163034-4bcc4b2ee518
go: downloading golang.org/x/tools v0.50.0
govulncheck: scanned github.com/carlosframework/platform, amadan.net/carlos/platform.git/launchctx, carlos-vulnscan
GO-2026-6859  called  stdlib@v1.26.10, fixed in v1.26.11
    HTTP/1 server crash due to MaxBytesReader header race in net/http
    excepted until 2027-01-31 (.amadan/govulncheck-exceptions.tsv:9): net/http MaxBytesReader header race, fixed in go1.26.11. CI and releases stay on go1.26.10 because 1.26.11 deadlocks the edge's Expect: 100-continue path (#897, .amadan/go-toolchain.sh); #904 checked every production MaxBytesReader site and found it unreachable.
GO-2026-5932  required  golang.org/x/crypto@v0.58.0, fixed in v0.58.1-0.20261009181718-2f1f834330b2
    The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues
    not fatal: no call path to the vulnerable code
govulncheck: clean (2 finding(s), none called outside .amadan/govulncheck-exceptions.tsv)
=== code-health ===
go version go1.26.10 linux/arm64
    codehealth_test.go:42: scanned in 1m53.878s
    codehealth_test.go:107: line metrics (code lines, then physical):
          file-lines  5471  7324  internal/activator activator_test.go
          file-lines  4195  7052  internal/console server.go
          file-lines  4147  6311  . apimode.go
          file-lines  3785  7224  internal/activator activator.go
          file-lines  3530  4459  . apimode_test.go
          file-lines  3261  3864  internal/registry registry_test.go
          file-lines  3204  6398  internal/host agent.go
          file-lines  3094  3992  internal/provision reconcile_test.go
          func-lines   870   891  internal/host plan14InstalledClaimLaunch
          func-lines   810  1277  internal/provision Reconcile
          func-lines   769  1242  internal/console (*Server).handleAPIInstanceCreate
          func-lines   683  1238  internal/host runAgent
          func-lines   571   908  internal/activator (*Service).doWakeOnce
          func-lines   538   546  internal/host runServingParkPeerNamespace
          func-lines   519   712  . runRoute
          func-lines   509   569  internal/host TestPagingIsRateLimited
          func-lines   494   817  internal/release adoptHost
          func-lines   441   500  internal/host TestRootInstanceStopExecStop
          func-lines   421   436  internal/host (*ClaimWakeAssembly).Build
          func-lines   421   437  internal/team TestFixture
          func-lines   412   414  internal/console TestDemoProtectionsSourceToLimitAndTakedown
          func-lines   408   485  . TestFleetAppServesThroughTheHub
          func-lines   402   406  internal/registry (*Registry).haJournal
          func-lines   400   868  internal/provision rootReadArchivedChain
          func-lines   399   733  internal/release PassFilter
          func-lines   390   398  internal/host runFilesSeedPreparationWithLive
          func-lines   383   406  internal/console TestDemoSourceToLiveAndUpdate
          func-lines   374   377  internal/host plan14RequiredArtifactsRootRunner
          func-lines   371   417  internal/host TestRootEgressKernelProof
          func-lines   369   883  internal/edge (*Edge).ServeHTTP
          func-lines   367   584  internal/console (*Server).handleAPIShip
          func-lines   364   371  internal/host testRootMigrationBootstrap
          func-lines   362   631  cmd/console serve
          func-lines   360   362  internal/edge TestDemoAPIAliasBoundary
          func-lines   357   358  internal/registry (*Registry).dispatchRemote
          func-lines   355   372  internal/host TestRootSandboxUpdateFromOldBox
          func-lines   343   354  internal/analytics Prune
          func-lines   340   353  internal/host newColdRootHarness
          func-lines   335   557  internal/console (*Store).migrate
          func-lines   334   334  internal/host TestPlan12RecoveryRestoreSourceDatabase
          func-lines   330   371  internal/edge TestRegionalNameNeverLeavesItsRegion
          func-lines   329   471  . runDeploy
          func-lines   329   329  internal/host TestPlan12RecoveryRestoreSourceDatabase.func1
          func-lines   327   369  internal/edge TestTunnelWebSocketEndToEnd
          func-lines   325   455  internal/objstore TestDeliveredContractMinio
          func-lines   320   654  internal/appconfig SyncExecWithCallbacks
          func-lines   315   318  internal/host plan14TimerIntention
          func-lines   311   314  internal/host plan14TimerIntention.func1
          func-lines   310   315  internal/hostbox ColdHandover.Run
          func-lines   308   309  internal/host rootFilesSeedIsolatedWitness
          func-lines   305   323  internal/host hairpinKernelWitness
          func-lines   304   308  internal/console TestHAP2ProductionDoors
          func-lines   302   329  internal/host TestRootG2PoolIngress
        release-importers: . cmd/console internal/activator internal/analytics internal/appconfig internal/apperr internal/applog internal/apppolicy internal/boxid internal/boxvolumes internal/console internal/dbreads internal/dbreads/dbreadstest internal/dbverify internal/demobuild internal/domains internal/doorkey internal/edge internal/edgeproof internal/edgesfile internal/fleetapi internal/grouproll internal/grouprollaws internal/historyreadback internal/host internal/hostactors internal/hostbox internal/hostclaim internal/hostevidence internal/hostexec internal/hostfence internal/hostfiles internal/hostfloor internal/hostguard internal/hostops internal/hostrelocate internal/hostresolve internal/instancectl internal/instanceupdates internal/interactive internal/layout internal/lease internal/ledger internal/mail internal/mailer internal/mailsubmit internal/metrics internal/moves internal/objstore internal/ops internal/park internal/plans internal/provision internal/relay internal/rollout internal/rootfsimage internal/runs internal/s3fake internal/schedule internal/seeds internal/status internal/telemetry internal/usage internal/vet scripts/pathmapcheck scripts/witness-pointer
        not scanned (216 files):
          cmd/carlos-media/drill_other.go: built only for other systems or tags
          cmd/carlos-media/harden_other.go: built only for other systems or tags
          cmd/console/fleetsocket_other.go: built only for other systems or tags
          cmd/console/servelock_windows.go: built only for other systems or tags
          cmd/moveprobe/detach_windows.go: built only for other systems or tags
          cmd/rootfswitness/mmap_other.go: built only for other systems or tags
          devbox_acl_other.go: built only for other systems or tags
          devbox_envfile_darwin_test.go: built only for other systems or tags
          devbox_envfile_other.go: built only for other systems or tags
          domains_transfer_signals_other.go: built only for other systems or tags
          interactive_term_darwin.go: built only for other systems or tags
          interactive_term_other.go: built only for other systems or tags
          internal/activator/claimprocess_root_other.go: built only for other systems or tags
          internal/activator/escrow_stamp_other.go: built only for other systems or tags
          internal/activator/fleetreserve_other.go: built only for other systems or tags
          internal/activator/harecord_other.go: built only for other systems or tags
          internal/activator/ownenv_other.go: built only for other systems or tags
          internal/activator/pty_other.go: built only for other systems or tags
          internal/activator/race_on_test.go: built only for other systems or tags
          internal/activator/rolelaunch_other.go: built only for other systems or tags
          internal/assetcache/statfs_other.go: built only for other systems or tags
          internal/boxself/io_other.go: built only for other systems or tags
          internal/cgroup/cleanup_other.go: built only for other systems or tags
          internal/cgroup/cleanup_other_test.go: built only for other systems or tags
          internal/cgroup/hostprocs_other.go: built only for other systems or tags
          internal/cgroup/recreate_other.go: built only for other systems or tags
          internal/cgroup/role_other.go: built only for other systems or tags
          internal/cgroup/shim_other.go: built only for other systems or tags
          internal/cgroup/strict_other.go: built only for other systems or tags
          internal/cgroup/verify_other.go: built only for other systems or tags
          internal/console/claim_sql_identity_other.go: built only for other systems or tags
          internal/console/geoipverify_other.go: built only for other systems or tags
          internal/console/hostreports_process_other.go: built only for other systems or tags
          internal/console/replicaview_other.go: built only for other systems or tags
          internal/console/restore_sim_nice_other_test.go: built only for other systems or tags
          internal/console/scalecost_other_test.go: built only for other systems or tags
          internal/console/seedscratch_windows.go: built only for other systems or tags
          internal/dbreads/worker_other.go: built only for other systems or tags
          internal/demobuild/security_other.go: built only for other systems or tags
          internal/democlaim/source_other.go: built only for other systems or tags
          internal/devbox/peer_darwin.go: built only for other systems or tags
          internal/devbox/peer_darwin_test.go: built only for other systems or tags
          internal/devbox/peer_other.go: built only for other systems or tags
          internal/devbox/socketcheck_other.go: built only for other systems or tags
          internal/domains/certimport_read_portable.go: built only for other systems or tags
          internal/edge/devboxpeer_other.go: built only for other systems or tags
          internal/edge/hairpin_other.go: built only for other systems or tags
          internal/edge/heldbudget_other.go: built only for other systems or tags
          internal/edge/purge_listen_unix.go: built only for other systems or tags
          internal/edge/purge_listen_windows.go: built only for other systems or tags
          internal/edge/race_on_test.go: built only for other systems or tags
          internal/edge/replicaconsole_owner_other.go: built only for other systems or tags
          internal/edge/replicaconsole_peer_other.go: built only for other systems or tags
          internal/edge/replicaconsole_socket_other_test.go: built only for other systems or tags
          internal/edge/static_artifact_other.go: built only for other systems or tags
          internal/edge/static_recordlock_other.go: built only for other systems or tags
          internal/edge/static_sweep_other.go: built only for other systems or tags
          internal/execsandbox/cleanup_other.go: built only for other systems or tags
          internal/execsandbox/file_other.go: built only for other systems or tags
          internal/execsandbox/oci_other.go: built only for other systems or tags
          internal/fileacl/fileacl_darwin.go: built only for other systems or tags
          internal/fileacl/fileacl_darwin_amd64.s: built only for other systems or tags
          internal/fileacl/fileacl_darwin_arm64.s: built only for other systems or tags
          internal/fileacl/fileacl_darwin_test.go: built only for other systems or tags
          internal/grouproll/state_other.go: built only for other systems or tags
          internal/grouprollaws/pty_darwin.go: built only for other systems or tags
          internal/grouprollaws/pty_other.go: built only for other systems or tags
          internal/hairpin/native_other.go: built only for other systems or tags
          internal/host/applylock_other_test.go: built only for other systems or tags
          internal/host/bootstrapfs_other.go: built only for other systems or tags
          internal/host/boxroles_config_other.go: built only for other systems or tags
          internal/host/claimfilesseed_delegation_other.go: built only for other systems or tags
          internal/host/claimfilesseed_transport_other.go: built only for other systems or tags
          internal/host/claimjournal_containment_other.go: built only for other systems or tags
          internal/host/claimjournal_migration_other.go: built only for other systems or tags
          internal/host/claimlaunch_kernel_other.go: built only for other systems or tags
          internal/host/claimlaunch_rev2_other_test.go: built only for other systems or tags
          internal/host/claimproduction_other.go: built only for other systems or tags
          internal/host/claimready_other.go: built only for other systems or tags
          internal/host/claimroleassembly_other.go: built only for other systems or tags
          internal/host/claimservingartifact_other.go: built only for other systems or tags
          internal/host/claimservinghandover_reboot_other.go: built only for other systems or tags
          internal/host/claimservinghandover_reboot_other_test.go: built only for other systems or tags
          internal/host/claimservingpark_other.go: built only for other systems or tags
          internal/host/claimstate_other.go: built only for other systems or tags
          internal/host/claimstop_kernel_other.go: built only for other systems or tags
          internal/host/claimtoken_inventory_other.go: built only for other systems or tags
          internal/host/claimunit_dropin_other.go: built only for other systems or tags
          internal/host/claimunit_files_other.go: built only for other systems or tags
          internal/host/claimunit_migrate_other.go: built only for other systems or tags
          internal/host/claimunit_ready_other.go: built only for other systems or tags
          internal/host/claimunit_socket_migration_other.go: built only for other systems or tags
          internal/host/consolefleet_owner_other.go: built only for other systems or tags
          internal/host/dbreads_other.go: built only for other systems or tags
          internal/host/egress_rail_other.go: built only for other systems or tags
          internal/host/fileowner_other.go: built only for other systems or tags
          internal/host/flock_windows.go: built only for other systems or tags
          internal/host/group_config_other.go: built only for other systems or tags
          internal/host/group_maintenance_other.go: built only for other systems or tags
          internal/host/group_maintenance_verbs_other.go: built only for other systems or tags
          internal/host/group_receipt_other.go: built only for other systems or tags
          internal/host/hadrain_call_other.go: built only for other systems or tags
          internal/host/hadrain_socket_other.go: built only for other systems or tags
          internal/host/hadrainfence_other.go: built only for other systems or tags
          internal/host/headroom_other.go: built only for other systems or tags
          internal/host/installchannel_other.go: built only for other systems or tags
          internal/host/managedboot_other.go: built only for other systems or tags
          internal/host/metrics_nested_other.go: built only for other systems or tags
          internal/host/movesfloor_other.go: built only for other systems or tags
          internal/host/movesfloorgate_other.go: built only for other systems or tags
          internal/host/movesheldrelease_other.go: built only for other systems or tags
          internal/host/movesmeasure_other.go: built only for other systems or tags
          internal/host/offcloudcredentials_other.go: built only for other systems or tags
          internal/host/registrychild_exec_other.go: built only for other systems or tags
          internal/host/registrychild_other.go: built only for other systems or tags
          internal/host/registryowner_chown_other.go: built only for other systems or tags
          internal/host/registryowner_descriptor_unix.go: built only for other systems or tags
          internal/host/replicahealth_other.go: built only for other systems or tags
          internal/host/rootgeneration_census_other.go: built only for other systems or tags
          internal/host/rootgeneration_kernel_other.go: built only for other systems or tags
          internal/host/rootgeneration_payload_other.go: built only for other systems or tags
          internal/host/rootgeneration_retired_other.go: built only for other systems or tags
          internal/host/rootmigration_production_other.go: built only for other systems or tags
          internal/host/runscset_other.go: built only for other systems or tags
          internal/host/sandboxenv_other.go: built only for other systems or tags
          internal/host/statfs_windows.go: built only for other systems or tags
          internal/host/systemapply_other.go: built only for other systems or tags
          internal/hostbox/census_vendor_other.go: built only for other systems or tags
          internal/hostbox/inventory_identity_other.go: built only for other systems or tags
          internal/hostbox/journalmigration_other.go: built only for other systems or tags
          internal/hostbox/journalnamespace_other.go: built only for other systems or tags
          internal/hostbox/journaltrust_other.go: built only for other systems or tags
          internal/hostbox/migration_census_other.go: built only for other systems or tags
          internal/hostbox/typedpark_other.go: built only for other systems or tags
          internal/hostenv/group_other.go: built only for other systems or tags
          internal/hostenv/write_other.go: built only for other systems or tags
          internal/hostenv/write_other_test.go: built only for other systems or tags
          internal/hostexec/clock_other.go: built only for other systems or tags
          internal/hostexec/clock_other_test.go: built only for other systems or tags
          internal/hostexec/local_other.go: built only for other systems or tags
          internal/hostexec/pending_other.go: built only for other systems or tags
          internal/hostexec/probe_other.go: built only for other systems or tags
          internal/hostexec/rootprocess_other.go: built only for other systems or tags
          internal/hostfiles/dir_other.go: built only for other systems or tags
          internal/hostfiles/refuse_other.go: built only for other systems or tags
          internal/hostfiles/watch_other.go: built only for other systems or tags
          internal/hostfloor/controllers_other.go: built only for other systems or tags
          internal/hostfloor/image_other.go: built only for other systems or tags
          internal/hostguard/flock_other.go: built only for other systems or tags
          internal/hostguard/flock_other_test.go: built only for other systems or tags
          internal/hostguard/record_other.go: built only for other systems or tags
          internal/instancectl/claimexec_other.go: built only for other systems or tags
          internal/instancectl/claimexec_socket_other.go: built only for other systems or tags
          internal/instancectl/claimlaunch_snapshot_other.go: built only for other systems or tags
          internal/instancectl/claimnetwork_other.go: built only for other systems or tags
          internal/instancectl/demo_snapshot_other.go: built only for other systems or tags
          internal/instancectl/egress_cgroup_other.go: built only for other systems or tags
          internal/instancectl/egress_dropin_other.go: built only for other systems or tags
          internal/instancectl/fleetsize_other.go: built only for other systems or tags
          internal/instancectl/gvisorprobe_other.go: built only for other systems or tags
          internal/instancectl/peer_other.go: built only for other systems or tags
          internal/instancectl/peer_tuple_other.go: built only for other systems or tags
          internal/instancectl/rootfs_identity_other.go: built only for other systems or tags
          internal/instanceexec/claimexec_other.go: built only for other systems or tags
          internal/instanceexec/exec_rootfs_other.go: built only for other systems or tags
          internal/instanceexec/netlink_route_other.go: built only for other systems or tags
          internal/instanceexec/probe_gvisor_other.go: built only for other systems or tags
          internal/instanceexec/probe_hardening_other.go: built only for other systems or tags
          internal/instanceexec/probe_other.go: built only for other systems or tags
          internal/instanceexec/probe_rootfs_other.go: built only for other systems or tags
          internal/instanceexec/sandbox_other.go: built only for other systems or tags
          internal/instanceexec/scope_other.go: built only for other systems or tags
          internal/instanceexec/stop_other.go: built only for other systems or tags
          internal/instanceexec/tty_other.go: built only for other systems or tags
          internal/instancefs/instancefs_other.go: built only for other systems or tags
          internal/launchd/activate_darwin.go: built only for other systems or tags
          internal/launchd/activate_darwin_amd64.s: built only for other systems or tags
          internal/launchd/activate_darwin_arm64.s: built only for other systems or tags
          internal/launchd/activate_darwin_test.go: built only for other systems or tags
          internal/layout/journal_other.go: built only for other systems or tags
          internal/layout/links_other.go: built only for other systems or tags
          internal/mailer/keys_other.go: built only for other systems or tags
          internal/maintenanceexec/run_other.go: built only for other systems or tags
          internal/managedboot/admission_other.go: built only for other systems or tags
          internal/managedboot/identity_other.go: built only for other systems or tags
          internal/mediahandler/collect_other.go: built only for other systems or tags
          internal/mediahandler/procs_other.go: built only for other systems or tags
          internal/medialocal/runner_other.go: built only for other systems or tags
          internal/moves/archive/open_other.go: built only for other systems or tags
          internal/moves/archive/sync_other.go: built only for other systems or tags
          internal/ops/flock_windows.go: built only for other systems or tags
          internal/park/local_other.go: built only for other systems or tags
          internal/privatefile/io_other.go: built only for other systems or tags
          internal/proxyproto/peek_other.go: built only for other systems or tags
          internal/relay/race_on_test.go: built only for other systems or tags
          internal/release/consumedfence_other.go: built only for other systems or tags
          internal/release/digestcache_other.go: built only for other systems or tags
          internal/rootaws/credentials_other.go: built only for other systems or tags
          internal/rootaws/open_darwin.go: built only for other systems or tags
          internal/rootfsimage/dir_other.go: built only for other systems or tags
          internal/rootstate/authoritydir_other.go: built only for other systems or tags
          internal/rootstate/authorityfile_other.go: built only for other systems or tags
          internal/rootstate/file_other.go: built only for other systems or tags
          internal/rootstate/link_other.go: built only for other systems or tags
          internal/rootstate/persistent_other.go: built only for other systems or tags
          internal/rootstate/state_other.go: built only for other systems or tags
          internal/safefile/file_other.go: built only for other systems or tags
          internal/safefile/reap_other.go: built only for other systems or tags
          internal/stopevidence/fds_other.go: built only for other systems or tags
          internal/stopevidence/fds_other_test.go: built only for other systems or tags
          internal/stopevidence/holders_other.go: built only for other systems or tags
          internal/stopevidence/reconstruct_other.go: built only for other systems or tags
          internal/team/storelock_other.go: built only for other systems or tags
          internal/team/storelock_windows.go: built only for other systems or tags
          move_offline_run_other.go: built only for other systems or tags
          system_group_other.go: built only for other systems or tags
        
    codehealth_test.go:115: fatal               1094 at  474 sites  log.Fatal*, (*log.Logger).Fatal* and os.Exit in the root package's production files
    codehealth_test.go:115: sleep               1006 at  812 sites  time.Sleep in test files
    codehealth_test.go:115: db-no-context        873 at  696 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         18586 at   45 sites  functions over 300 code lines (blank and comment-only lines not counted)
    codehealth_test.go:115: file-lines         30687 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:128: the code is above .amadan/code-health.tsv at 2 sites:
          fatal . createAccountInBucket log.Fatalf: 3 in the code, the record allows 2
          file-lines internal/console server.go -: 4195 in the code, the record allows 4191
        Each is a new offence, or more at an old site. Fix it (AGENTS.md, "Writing Go here"). If it moved
        (a rename, another package): make code-health-record MOVE='<old>:<new>'. A deliberate raise is a
        hand edit ending in "# raised: <reason>", which CI's 61-code-health-record step checks.
--- FAIL: TestCodeHealth (113.88s)
FAIL
FAIL	github.com/carlosframework/platform/internal/codehealth	115.265s
FAIL
make: *** [Makefile:209: code-health] Error 1

amadan: step code-health failed: exit status 2

amadan: job failed at step code-health — its output is above, not at the tail of this log
diff --git a/accounts.go b/accounts.go
index 1cd44306d..349b0ebbb 100644
--- a/accounts.go
+++ b/accounts.go
@@ -26,6 +26,7 @@ import (
"github.com/carlosframework/platform/internal/clireg"
"github.com/carlosframework/platform/internal/domains"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
)
@@ -168,12 +169,20 @@ func runAccountsCreate(args []string) {
// what the bucket says, never has to assign anything. The owner rides along in
// that same manifest, which is how the console learns who to admit.
func createAccountInBucket(regPath, name, owner string) {
- // Normalize before anything is written OR printed. MintAccount normalizes
- // what it stores, so printing the raw input would tell the operator their
- // membership is "Paul@Keymail.dev" when the row — and the session that must
- // match it — is lowercase. That mismatch is exactly the confusion the
- // `console member` verb was fixed for.
- owner = domains.NormalizeAddress(owner)
+ // Canonicalise before anything is written OR printed. MintAccount stores
+ // the canonical form, so printing the raw input would tell the operator
+ // their membership is "Paul@Keymail.dev" when the row — and the session
+ // that must match it — is lowercase. That mismatch is exactly the
+ // confusion the `console member` verb was fixed for. An owner that cannot
+ // be canonical (non-ASCII, malformed) is refused here, before the mint,
+ // never lower-cased into somebody else's identity (internal/identity).
+ if strings.TrimSpace(owner) != "" {
+ canonical, ok := identity.Canonical(owner)
+ if !ok {
+ log.Fatalf("accounts create: %q is not a keymail address: expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", owner)
+ }
+ owner = canonical
+ }
store := openStore()
id, sqid, err := domains.MintAccount(context.Background(), store, name, owner, time.Now())
if err != nil {
diff --git a/accounts_identity_test.go b/accounts_identity_test.go
new file mode 100644
index 000000000..57b939109
--- /dev/null
+++ b/accounts_identity_test.go
@@ -0,0 +1,73 @@
+package main
+
+import (
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/console"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// H4-M11 round 2: the whole minting path, through the real CLI. `carlos
+// accounts create --owner` writes the manifest and the console materialises
+// the owner membership from it. A mixed-case owner names the canonical
+// Keymail identity end to end; a Kelvin-sign or long-s owner is refused
+// BEFORE anything is written, so it can never become kim@ or sam@ in the
+// manifest and then in the console.
+func TestAccountsCreateOwnerFollowsTheIdentityContract(t *testing.T) {
+ bin := buildCarlos(t)
+ for _, tc := range []struct {
+ owner, want string // want "" means refused
+ }{
+ {" Kim@Keymail.dev ", "kim@keymail.dev"},
+ {"Kim@keymail.dev", ""},
+ {"ſam@keymail.dev", ""},
+ } {
+ t.Run(tc.owner, func(t *testing.T) {
+ tmp := t.TempDir()
+ storeDir := filepath.Join(tmp, "store")
+ cmd := exec.Command(bin, "accounts", "create", "-name", "kass", "-owner", tc.owner)
+ cmd.Env = carlosTestEnv(t,
+ "CARLOS_DEPLOYMENT_BUCKET=",
+ "AWS_PROFILE=",
+ "CARLOS_DEPLOYMENT_DIR="+storeDir,
+ "CARLOS_CREDENTIALS="+filepath.Join(tmp, "credentials"),
+ "CARLOS_DATA_DIR="+tmp,
+ "HOME="+tmp,
+ )
+ cmd.Dir = tmp
+ out, err := cmd.CombinedOutput()
+ store := release.NewDirStore(storeDir)
+ keys, lerr := store.List(t.Context(), "accounts/")
+ if tc.want == "" {
+ if err == nil {
+ t.Fatalf("create with owner %q succeeded:\n%s", tc.owner, out)
+ }
+ if !strings.Contains(string(out), "not a keymail address") {
+ t.Errorf("refusal does not say why:\n%s", out)
+ }
+ if lerr != nil || len(keys) != 0 {
+ t.Fatalf("a refused create left %v behind (%v)", keys, lerr)
+ }
+ return
+ }
+ if err != nil {
+ t.Fatalf("create: %v\n%s", err, out)
+ }
+ st, err := console.Open(filepath.Join(tmp, "console.db"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer st.Close()
+ if n, err := console.MaterializeAccounts(t.Context(), store, st); err != nil || n != 1 {
+ t.Fatalf("materialized %d (%v), want 1", n, err)
+ }
+ accts, err := st.AccountsFor(tc.want)
+ if err != nil || len(accts) != 1 || accts[0].Role != console.RoleOwner {
+ t.Fatalf("AccountsFor(%s) = %+v (%v), want the new account as owner", tc.want, accts, err)
+ }
+ })
+ }
+}
diff --git a/cmd/console/main.go b/cmd/console/main.go
index 1ac21b7d9..e02f9a1bc 100644
--- a/cmd/console/main.go
+++ b/cmd/console/main.go
@@ -167,6 +167,7 @@ import (
"os/signal"
"path/filepath"
"regexp"
+ "slices"
"sort"
"strconv"
"strings"
@@ -186,6 +187,7 @@ import (
"github.com/carlosframework/platform/internal/fleetstore"
"github.com/carlosframework/platform/internal/geo"
"github.com/carlosframework/platform/internal/geoip"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/lease"
"github.com/carlosframework/platform/internal/mail"
"github.com/carlosframework/platform/internal/moves"
@@ -222,15 +224,19 @@ func main() {
operator := fs.Bool("operator", false, "grant/revoke the fleet-operator role instead of an app")
fs.Parse(os.Args[2:])
args := fs.Args()
- if len(args) >= 1 {
- // The console's identity contract: the role or grant goes to
+ if len(args) >= 1 && verb == "grant" {
+ // The identity contract (internal/identity): a grant goes to
// exactly the identity a sign-in produces, or to nobody.
- address, ok := console.CanonicalIdentity(args[0])
+ address, ok := identity.Canonical(args[0])
if !ok {
- log.Fatalf("%q is not a keymail address — expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", args[0])
+ log.Fatalf("%q is not a keymail address: expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", args[0])
}
args[0] = address
}
+ // A revoke is NOT canonicalised: it acts on the exact stored row the
+ // operator names, so a legacy row (Sam@..., or a non-ASCII one) is
+ // revoked as itself and never confused with its lower-case twin. A
+ // revoke that matches no row refuses rather than reporting success.
st := openConsoleDB()
var err error
switch {
@@ -240,6 +246,13 @@ func main() {
if len(args) != 1 {
log.Fatalf("usage: console %s -operator <address>", verb)
}
+ if verb == "revoke" {
+ if held, herr := st.IsOperator(args[0]); herr != nil {
+ log.Fatal(herr)
+ } else if !held {
+ log.Fatalf("%q is not a fleet operator, so nothing was revoked. Name the address exactly as it is stored.", args[0])
+ }
+ }
err = st.SetOperator(args[0], verb == "grant")
default:
if len(args) != 2 {
@@ -248,6 +261,13 @@ func main() {
if verb == "grant" {
err = st.Grant(args[0], args[1])
} else {
+ apps, aerr := st.AppsFor(args[0])
+ if aerr != nil {
+ log.Fatal(aerr)
+ }
+ if !slices.Contains(apps, args[1]) {
+ log.Fatalf("%q does not hold %s, so nothing was revoked. Name the address exactly as it is stored.", args[0], args[1])
+ }
err = st.Revoke(args[0], args[1])
}
}
diff --git a/cmd/console/member.go b/cmd/console/member.go
index b04b289ee..98761b82a 100644
--- a/cmd/console/member.go
+++ b/cmd/console/member.go
@@ -12,6 +12,7 @@ import (
"github.com/carlosframework/platform/internal/console"
"github.com/carlosframework/platform/internal/demo"
+ "github.com/carlosframework/platform/internal/identity"
)
// memberUsage is spelled out rather than left to flag.PrintDefaults because
@@ -59,7 +60,7 @@ func runMember(args []string) {
log.Fatalf("unknown role %q — there are exactly two: owner or member", *role)
}
- var address, sqid string
+ var address, exact, sqid string
switch {
case *list:
if len(pos) != 1 {
@@ -89,15 +90,20 @@ func runMember(args []string) {
// owner anybody can actually sign in as while the guard reports
// another still exists.
//
- // The form is the console's identity contract (CanonicalIdentity:
+ // The form is the platform's identity contract (identity.Canonical:
// ASCII-only, ASCII-lowercased, never Unicode-folded), so the row is
// exactly the identity a sign-in produces. Same refusal otherwise: a
// membership for an address keymail could never authenticate is a
// grant nobody can claim, and a silent typo here is a member who "was
// added" and cannot get in.
+ //
+ // Removal is the exception, below: it acts on the exact stored row
+ // when there is one, so a legacy Sam@... or non-ASCII row is removed
+ // as itself and never confused with its lower-case twin.
+ exact = strings.TrimSpace(typed)
var canonical bool
- address, canonical = console.CanonicalIdentity(typed)
- if !canonical {
+ address, canonical = identity.Canonical(typed)
+ if !canonical && !*remove {
log.Fatalf("%q is not a keymail address — expected <user>@<host>, e.g. paul@keymail.dev", typed)
}
}
@@ -133,6 +139,11 @@ func runMember(args []string) {
case *add:
memberAdd(st, acct, address, *role)
case *remove:
+ if role, err := st.Role(acct.ID, exact); err != nil {
+ log.Fatal(err)
+ } else if role != "" || address == "" {
+ address = exact
+ }
memberRemove(st, acct, address)
}
}
diff --git a/cmd/console/member_test.go b/cmd/console/member_test.go
index 7f022cd3b..6a30c89a6 100644
--- a/cmd/console/member_test.go
+++ b/cmd/console/member_test.go
@@ -476,3 +476,90 @@ func TestGrantOperatorIsCanonical(t *testing.T) {
}
}
}
+
+// H4-M11 round 2: revoke acts on the EXACT stored row it names, never on a
+// canonicalised twin. Legacy rows (mixed case, non-ASCII) are revoked as
+// themselves, the twin is untouched, and a revoke that matches nothing
+// refuses rather than reporting success.
+func TestRevokeActsOnTheExactStoredRow(t *testing.T) {
+ bin := buildConsole(t)
+ dbPath := filepath.Join(t.TempDir(), "console.db")
+ run := runner(t, bin, "CONSOLE_DB="+dbPath)
+ st, err := console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []string{"Sam@keymail.dev", "sam@keymail.dev", "ſue@keymail.dev"} {
+ if err := st.SetOperator(a, true); err != nil {
+ t.Fatal(err)
+ }
+ if err := st.Grant(a, "titogo"); err != nil {
+ t.Fatal(err)
+ }
+ }
+ st.Close()
+
+ for _, legacy := range []string{"Sam@keymail.dev", "ſue@keymail.dev"} {
+ if out, err := run("revoke", "-operator", legacy); err != nil {
+ t.Fatalf("revoke -operator %s: %v\n%s", legacy, err, out)
+ }
+ if out, err := run("revoke", legacy, "titogo"); err != nil {
+ t.Fatalf("revoke %s titogo: %v\n%s", legacy, err, out)
+ }
+ }
+ // Nothing left to revoke for Sam@: refused, not a silent success.
+ if out, err := run("revoke", "-operator", "Sam@keymail.dev"); err == nil || !strings.Contains(out, "nothing was revoked") {
+ t.Errorf("second revoke -operator Sam@ = %v:\n%s", err, out)
+ }
+ if out, err := run("revoke", "Sam@keymail.dev", "titogo"); err == nil || !strings.Contains(out, "nothing was revoked") {
+ t.Errorf("second app revoke Sam@ = %v:\n%s", err, out)
+ }
+
+ st, err = console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer st.Close()
+ for addr, want := range map[string]bool{"Sam@keymail.dev": false, "ſue@keymail.dev": false, "sam@keymail.dev": true} {
+ if got, _ := st.IsOperator(addr); got != want {
+ t.Errorf("IsOperator(%s) = %v, want %v", addr, got, want)
+ }
+ apps, _ := st.AppsFor(addr)
+ if got := len(apps) == 1; got != want {
+ t.Errorf("AppsFor(%s) = %v, want held=%v", addr, apps, want)
+ }
+ }
+}
+
+// member -remove takes the exact stored row when there is one, so a legacy
+// Sam@ membership is removed as itself and the canonical sam@ is untouched;
+// a typed variant of a canonical row still removes it
+// (TestMemberVerbNormalizesTheAddress).
+func TestMemberRemoveTakesTheExactLegacyRow(t *testing.T) {
+ bin := buildConsole(t)
+ dbPath := filepath.Join(t.TempDir(), "console.db")
+ run := runner(t, bin, "CONSOLE_DB="+dbPath)
+ st, err := console.Open(dbPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := st.CreateAccount(console.OpsAccountID, "bab", "ops", "paul@keymail.dev", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []string{"Sam@keymail.dev", "sam@keymail.dev", "ſue@keymail.dev"} {
+ if err := st.AddMember(console.OpsAccountID, a, console.RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ st.Close()
+ for _, legacy := range []string{"Sam@keymail.dev", "ſue@keymail.dev"} {
+ if out, err := run("member", "-remove", legacy, "bab"); err != nil {
+ t.Fatalf("member -remove %s: %v\n%s", legacy, err, out)
+ }
+ }
+ for addr, want := range map[string]string{"Sam@keymail.dev": "", "ſue@keymail.dev": "", "sam@keymail.dev": console.RoleMember} {
+ if got := roleOf(t, dbPath, console.OpsAccountID, addr); got != want {
+ t.Errorf("role of %s = %q, want %q", addr, got, want)
+ }
+ }
+}
diff --git a/docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md b/docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md
new file mode 100644
index 000000000..4275d73c1
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md
@@ -0,0 +1,19 @@
+# Census approval: sec-h4-m11-stepup-fold
+
+Ruling `census-ruling-sec-h4-m11-stepup-fold`. 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 |
+|---|---|---|---|
+| `accounts.go` `createAccountInBucket` | body | unchanged (1) | The --owner input now goes through identity.Canonical (internal/identity) instead of domains.NormalizeAddress: same trim and ASCII lower-casing, but a non-ASCII, control-character or malformed owner is refused (log.Fatalf) before the mint, so the Unicode lower-casing that turned a Kelvin-sign K into "k" is gone. No read added; the bucket read/write sites are unchanged. |
+
+Envelopes re-pinned: `.`, `internal/domains`, `internal/identity`.
+
+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:
+
+- `accounts.go` `createAccountInBucket`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input
+
+Seal: `bf71949458c3c44c86b778a2a3e0d0b352268f5640c28b6b5d2f25bc2a5318b2` → `7fd594e36c3aa3d9892083bbf9b709f3f9e55239269bc0a167a69e99a0fbe906`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/console/alertwatch.go b/internal/console/alertwatch.go
index 05d0754a5..fa555ce9c 100644
--- a/internal/console/alertwatch.go
+++ b/internal/console/alertwatch.go
@@ -61,12 +61,17 @@ func (s *Server) alertRecipients() (*alertRun, error) {
// grantRecipients resolves canonical addresses to their own Keymail grants.
// Alert delivery and one-shot console notifications share this lookup so both
// keep the same missing-grant and per-recipient-token behaviour.
+//
+// The addresses are principals exactly as stored (operator rows, owners, the
+// By of a record) or already-canonicalised configuration: each is used AS IS.
+// One that is not canonical (a legacy Sam@... row) is skipped, never
+// lower-cased, because its lower-case twin is a different person who does not
+// hold the role that made this address a recipient (identity.go).
func (s *Server) grantRecipients(addrs []string) (*alertRun, error) {
run := &alertRun{}
seen := make(map[string]bool)
for _, addr := range addrs {
- addr, _ = canonicalIdentity(addr)
- if addr == "" || seen[addr] {
+ if !isCanonicalIdentity(addr) || seen[addr] {
continue
}
seen[addr] = true
diff --git a/internal/console/demo_alerts.go b/internal/console/demo_alerts.go
index c24396bbc..7c46088e7 100644
--- a/internal/console/demo_alerts.go
+++ b/internal/console/demo_alerts.go
@@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "slices"
"strconv"
"strings"
"time"
@@ -147,7 +146,15 @@ func (s *Server) demoAlertRecipients() (*alertRun, error) {
if err != nil {
return nil, err
}
- addrs := slices.Clone(s.cfg.SystemOperators)
+ // Configured entries are typed input, canonicalised as identityListed
+ // does; stored owners are used exactly (grantRecipients skips one that is
+ // not canonical).
+ var addrs []string
+ for _, entry := range s.cfg.SystemOperators {
+ if c, ok := canonicalIdentity(entry); ok {
+ addrs = append(addrs, c)
+ }
+ }
for _, member := range members {
if member.Role == RoleOwner {
addrs = append(addrs, member.Name)
diff --git a/internal/console/identity.go b/internal/console/identity.go
index cc01c3198..5d7433626 100644
--- a/internal/console/identity.go
+++ b/internal/console/identity.go
@@ -1,14 +1,14 @@
package console
-import "strings"
+import "github.com/carlosframework/platform/internal/identity"
// The console's one identity contract (H4-M11).
//
-// An identity is an address in its canonical form: trimmed, printable ASCII
-// only, ASCII letters lower-cased, and the platform's <local>@<host> shape.
-// Keymail only ever issues addresses like that (its mailbox names are
-// [a-z0-9_-] after its own canonicalisation), so the contract costs no real
-// Keymail user anything.
+// The contract itself lives in internal/identity, shared with cmd/console
+// and account minting. An identity is an address in canonical form: trimmed,
+// printable ASCII only, ASCII letters lower-cased, <local>@<host>. Keymail's
+// mailbox names are already lowercase ASCII; the host half is its
+// KEYMAIL_HOST setting, which must therefore be lowercase ASCII too.
//
// Both sides of every identity decision go through it:
//
@@ -23,45 +23,27 @@ import "strings"
// - CHECK sites then compare with ==. Both sides are canonical by
// construction, so exact equality is the right test and no fold is ever
// needed.
+// - STORED principals (operator rows, owners, memberships, the By of a
+// record) are matched exactly and never re-canonicalised: a legacy row
+// such as Sam@... is that principal, not its lower-case twin. Readers that
+// turn stored rows into recipients skip a non-canonical one.
//
// Never Unicode folding or Unicode lower-casing. strings.EqualFold makes
// U+017F (ſ) equal "s", and strings.ToLower maps U+212A (Kelvin sign) to an
// ASCII "k": either turns a different identity into this one. Refusing
// non-ASCII outright means no such character ever reaches a comparison.
-// identity_guard_test.go fails if a console source file folds or
-// lower-cases an address-like value anywhere else.
+// identity_guard_test.go parses the console, cmd/console and account
+// minting and fails on any case fold outside the functions it lists as not
+// identity decisions.
-// canonicalIdentity returns raw in the canonical identity form, or false when
-// raw cannot be one (non-ASCII, a control character, or not <local>@<host>).
-func canonicalIdentity(raw string) (string, bool) {
- a := strings.TrimSpace(raw)
- b := []byte(a)
- for i, c := range b {
- switch {
- case c < 0x21 || c > 0x7e:
- return "", false
- case 'A' <= c && c <= 'Z':
- b[i] = c + ('a' - 'A')
- }
- }
- a = string(b)
- if !ValidAddress(a) {
- return "", false
- }
- return a, true
-}
-
-// CanonicalIdentity is canonicalIdentity for the console binary's box-side
-// commands (cmd/console), which grant membership and operator roles.
-func CanonicalIdentity(raw string) (string, bool) { return canonicalIdentity(raw) }
+// canonicalIdentity is the shared contract's Canonical (internal/identity),
+// under the name the console's grant sites use.
+func canonicalIdentity(raw string) (string, bool) { return identity.Canonical(raw) }
-// isCanonicalIdentity reports whether a is ALREADY canonical: the test a proof
-// site applies to an address an identity provider returned, which it must
-// refuse rather than rewrite.
-func isCanonicalIdentity(a string) bool {
- c, ok := canonicalIdentity(a)
- return ok && c == a
-}
+// isCanonicalIdentity is the shared contract's IsCanonical: whether a is
+// ALREADY canonical. Proof sites refuse, and stored-principal readers skip,
+// an address that is not; neither ever rewrites it.
+func isCanonicalIdentity(a string) bool { return identity.IsCanonical(a) }
// identityListed reports whether addr (a principal's canonical address) is on
// an operator-configured allowlist. Each entry is canonicalised the same way
diff --git a/internal/console/identity_guard_test.go b/internal/console/identity_guard_test.go
index 1488ccd3f..736ba442a 100644
--- a/internal/console/identity_guard_test.go
+++ b/internal/console/identity_guard_test.go
@@ -1,106 +1,396 @@
package console
import (
+ "go/ast"
+ "go/parser"
+ "go/token"
"net/http"
"net/url"
- "os"
"path/filepath"
- "regexp"
- "sort"
+ "strconv"
"strings"
"testing"
"time"
)
-// The guard for the identity contract (identity.go, H4-M11). Every place the
-// console grants or checks an identity must go through canonicalIdentity and
-// then compare exactly. This test fails when console source (internal/console
-// and cmd/console, tests excluded) folds or lower-cases something that looks
-// like an identity anywhere else: strings.EqualFold, strings.ToLower/ToUpper,
-// bytes.EqualFold, unicode.SimpleFold, domains.NormalizeAddress, SQL lower()
-// or COLLATE NOCASE on a line that names an address-like value.
+// identityFoldExceptions maps "file: function" to why that function's fold is
+// not an identity decision.
+var identityFoldExceptions = map[string]string{
+ "accounts.go: pickAccount": "an account NAME among accounts the caller already holds; membership is checked on the resolved account, and no principal is compared",
+ "cmd/console/main.go: appRegionsSwitch": "a region, account sqid or environment value from configuration; not a person",
+ "cmd/console/main.go: appsDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "cmd/console/main.go: denyDomains": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "cmd/console/main.go: haPoolAccounts": "a region, account sqid or environment value from configuration; not a person",
+ "cmd/console/main.go: mailDeployment": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "cmd/console/main.go: platformDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "cmd/console/main.go: relayRegions": "a region, account sqid or environment value from configuration; not a person",
+ "cmd/console/main.go: sidecarAccounts": "a region, account sqid or environment value from configuration; not a person",
+ "cmd/console/main.go: tunnelHostFrom": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountdomains.go: (*Server).accountDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountdomains.go: (*Server).domainCardAddresses": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountdomains.go: (*Server).domainCardRecords": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountdomains.go: (*Server).domainCardsUnread": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountdomains.go: domainCardKey": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountdomainspage.go: domainRegistrable": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/accountplans.go: disabledColumn": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/alertdial.go: numericLastLabel": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/alertdial.go: validConnectorURL": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/alertengine_pass.go: alertMidSentence": "display text: changes the case of a word in a sentence",
+ "internal/console/alertnotify.go: (alertTestFailure).Reason": "display text: changes the case of a word in a sentence",
+ "internal/console/alertpages.go: (*Server).alertDoorForm": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/alertstore.go: alertSeededMarker": "a bookkeeping key recording that an operator's alert rules were seeded; grants nothing. P3 follow-up: fold-equivalent legacy addresses share one key and can suppress each other's seeding",
+ "internal/console/analyticsdisplay.go: countryFlag": "an ISO country code",
+ "internal/console/analyticsdisplay.go: countryName": "an ISO country code",
+ "internal/console/apex.go: (*Server).apexHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apex.go: (*Server).apexSquats": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apibilling.go: (*Server).closeUnresolvedOpLocked": "a word in an operator's billing note",
+ "internal/console/apiconfig.go: configIfVersionMember": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/apiconfig.go: readConfigPutBody": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/apidbforward.go: readDBReadBody": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/apidemo.go: (*Server).handleDemoPublish": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/apidemo.go: validateDemoConfig": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomaincert.go: (*Server).certWildcardCovered": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomaincert.go: exactSAN": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomains.go: (*Server).consoleHosts": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomains.go: (*Server).delegationCNAMEDelegated": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomains.go: (*Server).denyEntries": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomains.go: (*Server).handleAPIDomainAttach": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomains.go: (*Server).reservedDomainsWith": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apidomains.go: (*Server).resolveAliasRoute": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apimail.go: (*Server).handleAPIEmailDomainEnsure": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apimail.go: (*Server).handleAPIEmailDomainRemove": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apimail.go: (*Server).handleAPIEmailDomainVerify": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apipdf.go: (*Server).handleAPIPDF": "a URL path or scheme check",
+ "internal/console/apiplacements.go: (*Server).placementsBindings": "a region, account sqid or environment value from configuration; not a person",
+ "internal/console/apipolicy.go: (*Server).applyPolicyChange": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apipolicy.go: policyAuditDetail": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apiservices.go: serviceHandleOf": "an app or canary name (a lower-case slug); not a person",
+ "internal/console/apistoreuploads.go: uploadsOrigin": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/apisubmission.go: (*Server).submissionFromRefusal": "the DOMAIN half of a sender address, matched against verified sending domains (DNS is case-insensitive)",
+ "internal/console/apisubmission.go: (*Server).submissionPreconditions": "the DOMAIN half of a sender address, matched against verified sending domains (DNS is case-insensitive)",
+ "internal/console/apisystemupdate.go: (*Server).bootstrapState": "a hex digest, cursor or code shape check; not an identity",
+ "internal/console/appdomains.go: (*Server).handleAppDomainAttach": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/appdomains.go: (*Server).handleAppDomainDetach": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/appframe.go: (*appFrames).clearAccount": "an account NAME among accounts the caller already holds; membership is checked on the resolved account, and no principal is compared",
+ "internal/console/applist.go: appFilter": "a case-insensitive search filter over rows the viewer can already see; grants nothing",
+ "internal/console/applist.go: filterApps": "a case-insensitive search filter over rows the viewer can already see; grants nothing",
+ "internal/console/appregionset.go: sentenceCase": "display text: changes the case of a word in a sentence",
+ "internal/console/appsettings.go: (*Server).settingsDomains": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/archgraph.go: machineFor": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/authcli.go: bearer": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/authcli.go: decodeJSONBody": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/authstore.go: NormalizeUserCode": "a device-login user code's alphabet normalisation",
+ "internal/console/billingpage.go: (*Server).billingBuy": "an ISO currency code",
+ "internal/console/billingpage.go: (*Server).billingViewFor": "an ISO currency code",
+ "internal/console/billingpage.go: currencyQuery": "an ISO currency code",
+ "internal/console/billingpayments_store.go: matchPayment": "an ISO currency code",
+ "internal/console/billingrevenue.go: (*Store).BillingFacts": "an ISO currency code",
+ "internal/console/claim_backends.go: (backendGuard).domainMembers": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/claim_backends.go: (claimDNSWriter).check": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/consolemail.go: ConsoleMailFrom": "the console's own configured From address for its outgoing mail; names no principal and grants nothing",
+ "internal/console/delivery.go: domainOf": "the DOMAIN half of a sender address, matched against verified sending domains (DNS is case-insensitive)",
+ "internal/console/demo_domains.go: (*Server).demoDomainReserved": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/demo_reports.go: demoReportCursor": "a hex digest, cursor or code shape check; not an identity",
+ "internal/console/demo_serving.go: demoExactHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/dnsds.go: (*Server).lookupDomainNS": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/dnsds.go: dsAnswer": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/domaincatchall.go: (*Server).catchallParentRefused": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/domainpoint.go: normalizePointDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/domainpolicy.go: (*Server).directAppsDomainHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/domainpolicy.go: (*Server).domainHostPolicy": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/econlistquery.go: pageEconAccounts": "a case-insensitive search filter over rows the viewer can already see; grants nothing",
+ "internal/console/emailsignin.go: (*Server).sameOrigin": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/geoipfeed.go: (*geoipFeeder).checkMaxMind": "a hex digest, cursor or code shape check; not an identity",
+ "internal/console/homelink.go: homeLinkPublicURL": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/keymail.go: (*Keymail).ExchangeGrant": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/keymail.go: (*Keymail).Host": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/listquery.go: healthSlug": "display text: changes the case of a word in a sentence",
+ "internal/console/mailpush.go: (*Server).mailPushURL": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/managedapi.go: readManagedJSON": "an HTTP header token or media type (case-insensitive by RFC 9110)",
+ "internal/console/opbilling.go: buildOpBillingPayments": "an ISO currency code",
+ "internal/console/opbilling_money.go: accountMoneyRows": "an ISO currency code",
+ "internal/console/opbilling_money.go: minorText": "an ISO currency code",
+ "internal/console/opbilling_money.go: moneyByMonth": "an ISO currency code",
+ "internal/console/opbilling_money.go: paymentRowEUR": "an ISO currency code",
+ "internal/console/opbilling_money.go: settledEUR": "an ISO currency code",
+ "internal/console/opbilling_overview.go: opBillingNatives": "an ISO currency code",
+ "internal/console/oplegal.go: legalPublishedText": "display text: changes the case of a word in a sentence",
+ "internal/console/oplegal.go: svgFuncsOK": "SVG element and attribute names in an uploaded logo check",
+ "internal/console/oplegal.go: svgLogoOK": "SVG element and attribute names in an uploaded logo check",
+ "internal/console/perfspeed.go: consoleSpeedRoute": "a URL path or scheme check",
+ "internal/console/plancaps.go: (*Server).customDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/planlapse_inventory.go: (*Server).lapseInventory": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/planlapse_inventory.go: (*Server).lapseUnreadClaims": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/planlapse_inventory.go: lapseHosts": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/policysize.go: policySizeChecks": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/relayops.go: (*Server).relayDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/relayops.go: (*Server).relayRegions": "a region, account sqid or environment value from configuration; not a person",
+ "internal/console/relayops.go: (*Server).relayResolveRegions": "a region, account sqid or environment value from configuration; not a person",
+ "internal/console/relayops.go: (*Server).relayRotate": "a region, account sqid or environment value from configuration; not a person",
+ "internal/console/relayops.go: relayMastersEnv": "an environment variable name built from a region code",
+ "internal/console/resolve.go: matchAccounts": "an account NAME among accounts the caller already holds; membership is checked on the resolved account, and no principal is compared",
+ "internal/console/resolve.go: preferredSeg": "an account NAME among accounts the caller already holds; membership is checked on the resolved account, and no principal is compared",
+ "internal/console/scanhook.go: validCallbackPath": "a URL path or scheme check",
+ "internal/console/server.go: (*Server).handleNewCanary": "an app or canary name (a lower-case slug); not a person",
+ "internal/console/server.go: (*Server).handleRetireCanary": "an app or canary name (a lower-case slug); not a person",
+ "internal/console/server.go: normalizeAppName": "an app or canary name (a lower-case slug); not a person",
+ "internal/console/server.go: normalizeDelegationZone": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/server.go: normalizeHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/server.go: normalizeSteeringHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/sesevents.go: canonicalSigningCertURL": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/sesevents.go: validSigningCertURL": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/shares.go: (*Server).handleAPISystemShareStop": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/store_gate.go: claimAppish": "SQL keywords and identifiers in the claim gate's schema check",
+ "internal/console/store_gate.go: claimBlockedLiteral": "SQL keywords and identifiers in the claim gate's schema check",
+ "internal/console/store_gate.go: claimSQLCensus": "SQL keywords and identifiers in the claim gate's schema check",
+ "internal/console/store_gate.go: claimTriggerSQL": "SQL keywords and identifiers in the claim gate's schema check",
+ "internal/console/store_gate.go: inspectClaimSQL": "SQL keywords and identifiers in the claim gate's schema check",
+ "internal/console/subdomains.go: (*Server).appsDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/subdomains.go: (*Server).subdomainInfrastructure": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/svcpage.go: runMintSentence": "display text: changes the case of a word in a sentence",
+ "internal/console/teamdoors.go: (*Server).teamInScope": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/usageattrib.go: (*Server).newUsageAttribution": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/usageattrib.go: (*usageAttribution).namespaceOwner": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/console/view.go: isApexDomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/claims.go: NormalizeAliasHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/claims.go: ParseInstanceCatchallHost": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).Forget": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).Retain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).Strike": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).answer": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).answerAAAA": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).lookup": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).query": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).serverAddrs": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: (*FreshResolver).verifyZone": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: noData": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: referralFrom": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/freshdns.go: zoneHint": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/namespace.go: NormalizeSubdomain": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/reconcile.go: dnsVerdicts": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/reconcile.go: hostCertExpiry": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/reconcile.go: hostVerdicts": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+ "internal/domains/reconcile.go: stampKey": "a DNS name or host (case-insensitive by RFC 4343); not a person's identity",
+}
+
+// The guard for the identity contract (internal/identity, H4-M11).
//
-// A new hit is either an identity site that should call canonicalIdentity
-// (fix it), or not an identity decision at all (add it to identityFoldAllowed
-// with the reason). The allowlist is checked both ways, so an entry whose line
-// is gone fails too and the list cannot quietly go stale.
-
-var (
- identityFoldCall = regexp.MustCompile(`strings\.(EqualFold|ToLower|ToUpper)\(|bytes\.EqualFold\(|unicode\.SimpleFold\(|NormalizeAddress\(|(?i)collate\s+nocase|\blower\(`)
- identityWord = regexp.MustCompile(`\b(addrs?|address(es)?|owners?|op|ops|operators?|members?|email|person|principal|invitee|subject|who|actor|recipient|by|to|from|typed|identity)\b|\.(Address|Owner|By|Subject|Email)\b`)
-)
+// It parses Go source (go/ast, not text) and reports every reference to a
+// case-folding or case-mapping function: strings/bytes EqualFold, ToLower,
+// ToUpper, ToTitle and their Special forms, strings.Title, unicode.ToLower/
+// ToUpper/ToTitle/To/SimpleFold (which also catches strings.Map(unicode.ToLower,
+// ...)), golang.org/x/text/cases, and anything named NormalizeAddress. Import
+// aliases are resolved, a call split over several lines is one call, and a
+// method value (lower := strings.ToLower) is a reference like any other.
+//
+// The scope is every package that grants or checks an identity: the console,
+// cmd/console, account minting (internal/domains and the carlos CLI's
+// accounts.go) and the contract itself. Each hit must sit in a function
+// listed in identityFoldExceptions, with the reason that function's fold is
+// not an identity decision. An unlisted hit is either an identity site that
+// must use identity.Canonical / IsCanonical and == (fix it), or a new
+// non-identity use (list it, with the reason). Stale entries fail too.
+
+// identityGuardScope is what the guard parses, relative to the module root:
+// a directory means its non-test .go files, a file means just that file.
+var identityGuardScope = []string{
+ "internal/console",
+ "cmd/console",
+ "internal/domains",
+ "internal/identity",
+ "accounts.go",
+}
-// identityFoldAllowed maps "file: trimmed line" to why that fold is not an
-// identity decision.
-var identityFoldAllowed = map[string]string{
- "internal/console/delivery.go: return strings.ToLower(addr[i+1:])": "the DOMAIN of an address, for mail routing; DNS names are case-insensitive",
- `internal/console/mailevents.go: where = append(where, "recipient = ? COLLATE NOCASE")`: "a list filter over one app's own mail events, after that app's authorisation; grants nothing",
- "internal/console/apisubmission.go: domain := strings.ToLower(from[strings.LastIndexByte(from, '@')+1:])": "the sender's DOMAIN, matched against the app's verified sending domains",
- `internal/console/alertstore.go: return "seeded:" + strings.ToLower(strings.TrimSpace(addr))`: "a bookkeeping key recording that alert rules were seeded; grants nothing",
+// foldSite is one reference the guard found.
+type foldSite struct {
+ fn string // enclosing function, "(*Server).name", "name", or "<package>"
+ what string // e.g. "strings.ToLower"
+ line int
+}
+
+// foldTargets are the functions the guard reports, by package path.
+var foldTargets = map[string]map[string]bool{
+ "strings": {"EqualFold": true, "ToLower": true, "ToUpper": true, "ToTitle": true,
+ "ToLowerSpecial": true, "ToUpperSpecial": true, "ToTitleSpecial": true, "Title": true},
+ "bytes": {"EqualFold": true, "ToLower": true, "ToUpper": true, "ToTitle": true,
+ "ToLowerSpecial": true, "ToUpperSpecial": true, "ToTitleSpecial": true, "Title": true},
+ "unicode": {"ToLower": true, "ToUpper": true, "ToTitle": true, "To": true, "SimpleFold": true},
+}
+
+// findFoldSites reports every fold reference in one parsed file.
+func findFoldSites(fset *token.FileSet, f *ast.File) []foldSite {
+ local := map[string]string{} // local import name -> path
+ var sites []foldSite
+ for _, imp := range f.Imports {
+ path, _ := strconv.Unquote(imp.Path.Value)
+ name := path[strings.LastIndex(path, "/")+1:]
+ if imp.Name != nil {
+ name = imp.Name.Name
+ }
+ if path == "golang.org/x/text/cases" || (name == "." && foldTargets[path] != nil) {
+ sites = append(sites, foldSite{fn: "<imports>", what: "import " + path, line: fset.Position(imp.Pos()).Line})
+ }
+ local[name] = path
+ }
+ inspect := func(fn string, n ast.Node) {
+ ast.Inspect(n, func(n ast.Node) bool {
+ switch x := n.(type) {
+ case *ast.SelectorExpr:
+ if id, ok := x.X.(*ast.Ident); ok {
+ if path, ok := local[id.Name]; ok && foldTargets[path][x.Sel.Name] {
+ sites = append(sites, foldSite{fn: fn, what: path + "." + x.Sel.Name, line: fset.Position(x.Pos()).Line})
+ }
+ }
+ if x.Sel.Name == "NormalizeAddress" {
+ sites = append(sites, foldSite{fn: fn, what: "NormalizeAddress", line: fset.Position(x.Pos()).Line})
+ }
+ case *ast.Ident:
+ if x.Name == "NormalizeAddress" {
+ sites = append(sites, foldSite{fn: fn, what: "NormalizeAddress", line: fset.Position(x.Pos()).Line})
+ }
+ }
+ return true
+ })
+ }
+ for _, d := range f.Decls {
+ switch d := d.(type) {
+ case *ast.FuncDecl:
+ name := d.Name.Name
+ if d.Recv != nil && len(d.Recv.List) == 1 {
+ recv := d.Recv.List[0].Type
+ star := ""
+ if s, ok := recv.(*ast.StarExpr); ok {
+ recv, star = s.X, "*"
+ }
+ if ix, ok := recv.(*ast.IndexExpr); ok {
+ recv = ix.X
+ }
+ if id, ok := recv.(*ast.Ident); ok {
+ name = "(" + star + id.Name + ")." + name
+ }
+ }
+ inspect(name, d)
+ case *ast.GenDecl:
+ if d.Tok != token.IMPORT {
+ inspect("<package>", d)
+ }
+ }
+ }
+ return sites
}
func TestIdentityFoldGuard(t *testing.T) {
root := filepath.Join("..", "..")
- var hits []string
- for _, dir := range []string{"internal/console", "cmd/console"} {
- files, err := filepath.Glob(filepath.Join(root, dir, "*.go"))
- if err != nil {
- t.Fatal(err)
+ counted := map[string]int{}
+ for _, scope := range identityGuardScope {
+ files := []string{filepath.Join(root, scope)}
+ if !strings.HasSuffix(scope, ".go") {
+ var err error
+ if files, err = filepath.Glob(filepath.Join(root, scope, "*.go")); err != nil {
+ t.Fatal(err)
+ }
}
- for _, f := range files {
- if strings.HasSuffix(f, "_test.go") {
+ for _, file := range files {
+ if strings.HasSuffix(file, "_test.go") {
continue
}
- src, err := os.ReadFile(f)
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, file, nil, parser.SkipObjectResolution)
if err != nil {
t.Fatal(err)
}
- for _, line := range strings.Split(string(src), "\n") {
- line = strings.TrimSpace(line)
- if strings.HasPrefix(line, "//") || !identityFoldCall.MatchString(line) || !identityWord.MatchString(line) {
- continue
+ rel, _ := filepath.Rel(root, file)
+ rel = filepath.ToSlash(rel)
+ for _, site := range findFoldSites(fset, f) {
+ key := rel + ": " + site.fn
+ counted[key]++
+ if _, ok := identityFoldExceptions[key]; !ok {
+ t.Errorf("%s:%d: %s in %s is outside the identity contract: use identity.Canonical/IsCanonical and ==, or list %q in identityFoldExceptions with the reason it is not an identity decision",
+ rel, site.line, site.what, site.fn, key)
}
- hits = append(hits, dir+"/"+filepath.Base(f)+": "+line)
}
}
}
- seen := map[string]bool{}
- var bad []string
- for _, h := range hits {
- seen[h] = true
- if _, ok := identityFoldAllowed[h]; !ok {
- bad = append(bad, h)
- }
- }
- sort.Strings(bad)
- for _, h := range bad {
- t.Errorf("identity fold outside the contract (use canonicalIdentity and ==, or allowlist with a reason):\n\t%s", h)
- }
- for k := range identityFoldAllowed {
- if !seen[k] {
- t.Errorf("stale identityFoldAllowed entry (the line is gone; drop it):\n\t%s", k)
+ for key := range identityFoldExceptions {
+ if counted[key] == 0 {
+ t.Errorf("stale identityFoldExceptions entry %q: that function no longer folds; drop it", key)
}
}
}
-// TestIdentityFoldGuardCatchesTheFamily keeps the guard's patterns honest: the
-// shapes H4-M11 fixed must all be hits.
+// TestIdentityFoldGuardCatchesTheFamily keeps the detector honest on the
+// forms a line grep misses: a call split over lines, an import alias, a
+// method value, strings.Map with a unicode case function, and the rest.
func TestIdentityFoldGuardCatchesTheFamily(t *testing.T) {
- for _, line := range []string{
- `if !strings.EqualFold(grant.Address, addr) {`,
- `if m.Role == RoleOwner && strings.EqualFold(m.Name, addr) {`,
- `if strings.ToLower(strings.TrimSpace(op)) == addr {`,
- `to := strings.ToLower(strings.TrimSpace(r.FormValue("address")))`,
- `address = strings.ToLower(strings.TrimSpace(typed))`,
- `} else if err := st.AddMember(m.ID, strings.ToLower(m.Owner), RoleOwner, created); err != nil {`,
- `owner := domains.NormalizeAddress(m.Owner)`,
- `if strings.EqualFold(from, to) {`,
- `SELECT 1 FROM memberships WHERE address = ? COLLATE NOCASE`,
+ src := `package p
+
+import (
+ "bytes"
+ str "strings"
+ u "unicode"
+
+ "example.com/domains"
+)
+
+func multiLine(grant struct{ Address string }, addr string) bool {
+ return str.EqualFold(
+ grant.Address,
+ addr,
+ )
+}
+
+func methodValue(a string) string {
+ lower := str.ToLower
+ return lower(a)
+}
+
+func mapped(address string) string { return str.Map(u.ToLower, address) }
+
+func bytesFold(a, b []byte) bool { return bytes.EqualFold(a, b) }
+
+func simple(r rune) rune { return u.SimpleFold(r) }
+
+func upper(a string) string { return str.ToUpper(a) }
+
+func normalised(owner string) string { return domains.NormalizeAddress(owner) }
+
+type T struct{}
+
+func (*T) method(a string) string { return str.ToLower(a) }
+
+var pkgLevel = str.ToLower
+`
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, "p.go", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := map[string]bool{}
+ for _, s := range findFoldSites(fset, f) {
+ got[s.fn+" "+s.what] = true
+ }
+ for _, want := range []string{
+ "multiLine strings.EqualFold",
+ "methodValue strings.ToLower",
+ "mapped unicode.ToLower",
+ "bytesFold bytes.EqualFold",
+ "simple unicode.SimpleFold",
+ "upper strings.ToUpper",
+ "normalised NormalizeAddress",
+ "(*T).method strings.ToLower",
+ "<package> strings.ToLower",
} {
- if !identityFoldCall.MatchString(line) || !identityWord.MatchString(line) {
- t.Errorf("guard misses %q", line)
+ if !got[want] {
+ t.Errorf("guard misses %q (found %v)", want, got)
}
}
+ dot, err := parser.ParseFile(fset, "d.go", "package p\n\nimport . \"strings\"\n\nvar x = ToLower(\"A\")\n", 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if sites := findFoldSites(fset, dot); len(sites) == 0 {
+ t.Error("guard misses a dot import of strings")
+ }
}
func TestCanonicalIdentity(t *testing.T) {
@@ -194,3 +484,70 @@ func legacyCLIToken(t *testing.T, fx *consoleFixture, address string) string {
}
return tok
}
+
+// recipientSet is the addresses a run would write to and the ones it could
+// not, together: everything the run treats as a recipient. An error is the
+// "<error>" key, which no assertion here accepts.
+func recipientSet(run *alertRun, err error) map[string]bool {
+ if err != nil {
+ return map[string]bool{"<error>": true}
+ }
+ out := map[string]bool{}
+ for _, g := range run.to {
+ out[g.address] = true
+ }
+ for _, m := range run.missing {
+ out[m] = true
+ }
+ return out
+}
+
+// H4-M11 round 2: stored principals are matched exactly. With a legacy
+// operator row Sam@keymail.dev and an ordinary user sam@keymail.dev (who holds
+// a grant but no operator bit), no recipient resolution may hand the legacy
+// operator's notices to the lower-case twin, and the legacy row itself is
+// skipped rather than rewritten.
+func TestRecipientsNeverReachALowerCaseTwin(t *testing.T) {
+ fx := newConsoleFixture(t)
+ now := time.Now()
+ const legacy, twin = "Sam@keymail.dev", "sam@keymail.dev"
+ if err := fx.st.SetOperator(legacy, true); err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []string{legacy, twin} {
+ if err := fx.st.SetGrantToken(a, "tok-"+a, now); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if op, _ := fx.st.IsOperator(twin); op {
+ t.Fatal("setup: the twin is an operator")
+ }
+
+ got := recipientSet(fx.srv.alertRecipients())
+ if got[twin] || got[legacy] || got["<error>"] {
+ t.Errorf("alert recipients = %v: want neither the twin nor the non-canonical legacy row", got)
+ }
+
+ fx.srv.cfg.StoreOperators = []string{legacy, twin}
+ got = recipientSet(fx.srv.storeNotificationRecipients())
+ if got[twin] || got[legacy] || got["<error>"] {
+ t.Errorf("store notification recipients = %v: the twin holds no operator bit", got)
+ }
+
+ got = recipientSet(fx.srv.grantRecipients([]string{legacy}))
+ if got[twin] || got[legacy] || got["<error>"] {
+ t.Errorf("grantRecipients(%s) = %v: want it skipped, never lower-cased", legacy, got)
+ }
+
+ // The intended principal still receives: a canonical operator.
+ if err := fx.st.SetOperator("kim@keymail.dev", true); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.SetGrantToken("kim@keymail.dev", "tok-kim", now); err != nil {
+ t.Fatal(err)
+ }
+ fx.srv.cfg.StoreOperators = []string{" Kim@Keymail.dev "}
+ if got := recipientSet(fx.srv.storeNotificationRecipients()); !got["kim@keymail.dev"] {
+ t.Errorf("store notification recipients = %v, want kim@keymail.dev", got)
+ }
+}
diff --git a/internal/console/storenotify.go b/internal/console/storenotify.go
index 247ec4389..a5b739d1b 100644
--- a/internal/console/storenotify.go
+++ b/internal/console/storenotify.go
@@ -51,9 +51,11 @@ func (s *Server) storeNotificationRecipients() (*alertRun, error) {
return nil, fmt.Errorf("operators: %w", err)
}
fleet := make(map[string]bool, len(operators))
+ // Stored rows exactly as they are (identity.go): a legacy non-canonical
+ // operator row is not re-canonicalised into its lower-case twin.
for _, address := range operators {
- if c, ok := canonicalIdentity(address); ok {
- fleet[c] = true
+ if isCanonicalIdentity(address) {
+ fleet[address] = true
}
}
configured := make([]string, 0, len(s.cfg.StoreOperators))
@@ -66,8 +68,9 @@ func (s *Server) storeNotificationRecipients() (*alertRun, error) {
}
func (s *Server) notifyStoreDecided(account string, e *objstore.Entitlement) {
- address, _ := canonicalIdentity(e.Applied.By)
- run, err := s.grantRecipients([]string{address})
+ // The By of a stored record is a principal: used exactly (grantRecipients
+ // skips it when it is not canonical).
+ run, err := s.grantRecipients([]string{e.Applied.By})
if err != nil {
log.Printf("console: store decision %s: recipient: %v", account, err)
return
diff --git a/internal/console/storenotify_test.go b/internal/console/storenotify_test.go
index 39f1de46d..dcd1a7ca0 100644
--- a/internal/console/storenotify_test.go
+++ b/internal/console/storenotify_test.go
@@ -92,7 +92,7 @@ func TestStoreDecisionNoticeByEmail(t *testing.T) {
m := &fakeConsoleMail{ready: true}
fx.srv.consoleMail = m
e := &objstore.Entitlement{
- Applied: &objstore.Applied{By: "Owner@Example.test", Note: "secret applicant note"},
+ Applied: &objstore.Applied{By: "owner@example.test", Note: "secret applicant note"},
Decision: &objstore.Decision{Approved: true, By: "decider@example.test", Reason: "secret reason"},
}
@@ -131,6 +131,23 @@ func TestStoreDecisionNoticeByEmail(t *testing.T) {
}
}
+// H4-M11 round 2: the applicant on a stored record is a principal, used
+// exactly. A legacy non-canonical applicant (Owner@Example.test) is skipped,
+// never lower-cased into owner@example.test, who is somebody else.
+func TestStoreDecisionNoticeSkipsANonCanonicalApplicant(t *testing.T) {
+ fx := storeNotifyFixture(t)
+ m := &fakeConsoleMail{ready: true}
+ fx.srv.consoleMail = m
+ e := &objstore.Entitlement{
+ Applied: &objstore.Applied{By: "Owner@Example.test"},
+ Decision: &objstore.Decision{Approved: true, By: "decider@example.test"},
+ }
+ fx.srv.notifyStoreEntitlement("bab", e)
+ if len(fx.sent) != 0 || len(m.sentCopy()) != 0 {
+ t.Fatalf("a notice went out for a non-canonical applicant: keymail %+v, email %q", fx.sent, m.sentCopy())
+ }
+}
+
func TestStoreNotificationIsBestEffortAndNilSafe(t *testing.T) {
fx := storeNotifyFixture(t)
fx.srv.cfg.StoreOperators = []string{"ops@keymail.dev"}
diff --git a/internal/domains/mint.go b/internal/domains/mint.go
index f8cfe6b27..6927d3730 100644
--- a/internal/domains/mint.go
+++ b/internal/domains/mint.go
@@ -15,6 +15,7 @@ import (
"sync"
"time"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/release"
)
@@ -48,9 +49,11 @@ type AccountManifest struct {
// CLI-created account and a console-created one end up in the same state
// instead of two.
//
- // Always NORMALIZED (NormalizeAddress) before it is written: the console's
+ // Always CANONICAL (identity.Canonical) before it is written: the console's
// memberships primary key is literal text, so an unnormalized address here
- // would materialize a membership the real session can never match.
+ // would materialize a membership the real session can never match, and an
+ // input that cannot be canonical is refused rather than lower-cased into
+ // somebody else's identity.
Owner string `json:"owner,omitempty"`
// Platform is the sqid of the platform account that created this customer
@@ -83,12 +86,6 @@ type AccountManifest struct {
// Deleted reports whether this manifest is a tombstone.
func (m AccountManifest) Deleted() bool { return !m.DeletedAt.IsZero() }
-// NormalizeAddress is the one normalization every keymail address gets before
-// it is stored or compared: trimmed and lowercased. Defined here, next to the
-// manifest field that carries one, so the CLI can apply the console's rule
-// without importing — or opening — console state.
-func NormalizeAddress(a string) string { return strings.ToLower(strings.TrimSpace(a)) }
-
// ValidAddress is the platform's one shape check on a keymail address:
// <local>@<host>, no whitespace. console.ValidAddress delegates to it, so the
// sign-in form, `console member -add` and `carlos accounts create -owner`
@@ -251,9 +248,16 @@ const nextIDReaders = 16
// reusable. The check happens before the first listing, so a refused mint
// writes nothing at all.
func MintAccount(ctx context.Context, s release.Store, name, owner string, created time.Time) (int64, string, error) {
- owner = NormalizeAddress(owner)
- if owner != "" && !ValidAddress(owner) {
- return 0, "", fmt.Errorf("domains: %q is not a keymail address — expected <user>@<host>, e.g. paul@keymail.dev", owner)
+ if strings.TrimSpace(owner) == "" {
+ owner = ""
+ } else {
+ // The identity contract (internal/identity): refused before anything is
+ // normalised or written, so a Kelvin-sign "K" can never become "k".
+ canonical, ok := identity.Canonical(owner)
+ if !ok {
+ return 0, "", fmt.Errorf("domains: %q is not a keymail address: expected <user>@<host> in plain ASCII, e.g. paul@keymail.dev", owner)
+ }
+ owner = canonical
}
id, sqid, _, err := mint(ctx, s, AccountManifest{Name: name, Owner: owner}, created, nil, nil)
return id, sqid, err
diff --git a/internal/domains/mint_test.go b/internal/domains/mint_test.go
index ec52bbfe0..427db3c3d 100644
--- a/internal/domains/mint_test.go
+++ b/internal/domains/mint_test.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/carlosframework/platform/internal/domains"
+ "github.com/carlosframework/platform/internal/identity"
"github.com/carlosframework/platform/internal/release"
)
@@ -191,7 +192,9 @@ func TestMintAccountLeavesTheOwnerOutWhenThereIsNone(t *testing.T) {
// address here is permanent, and the id it consumed is not reusable.
func TestMintAccountRefusesAnUnusableOwner(t *testing.T) {
ctx := t.Context()
- for _, bad := range []string{"paul", "@keymail.dev", "paul@", "paul @keymail.dev"} {
+ // The last two are fold twins of ASCII identities (H4-M11): refused, never
+ // lower-cased into kim@ or treated as sam@.
+ for _, bad := range []string{"paul", "@keymail.dev", "paul@", "paul @keymail.dev", "\u212aim@keymail.dev", "ſam@keymail.dev"} {
s := release.NewDirStore(t.TempDir())
if _, _, err := domains.MintAccount(ctx, s, "Kass", bad, time.Now()); err == nil {
t.Errorf("MintAccount with owner %q succeeded", bad)
@@ -209,8 +212,8 @@ func TestMintAccountRefusesAnUnusableOwner(t *testing.T) {
// an address one of them takes and another refuses is a membership somebody
// can create and nobody can use.
func TestAddressNormalizationAndValidity(t *testing.T) {
- if got := domains.NormalizeAddress(" Paul@Keymail.dev\n"); got != "paul@keymail.dev" {
- t.Errorf("NormalizeAddress = %q", got)
+ if got, ok := identity.Canonical(" Paul@Keymail.dev\n"); !ok || got != "paul@keymail.dev" {
+ t.Errorf("identity.Canonical = %q %v", got, ok)
}
for _, ok := range []string{"paul@keymail.dev", "a@b"} {
if !domains.ValidAddress(ok) {
diff --git a/internal/identity/identity.go b/internal/identity/identity.go
new file mode 100644
index 000000000..e9544a64e
--- /dev/null
+++ b/internal/identity/identity.go
@@ -0,0 +1,52 @@
+// Package identity is the platform's one identity contract (H4-M11).
+//
+// An identity is an address in canonical form: trimmed, printable ASCII
+// only, ASCII letters lower-cased, and <local>@<host>. Every place that
+// GRANTS authority to an address (the console's allowlists, invites and
+// member admin, `console grant`, and account minting's owner) takes typed
+// input through Canonical, which refuses anything that cannot be canonical
+// BEFORE it is normalised or written anywhere. Every place that accepts an
+// identity provider's PROOF uses IsCanonical and refuses rather than
+// rewrites. Stored principals are matched exactly and never re-canonicalised:
+// a legacy row is the principal it names, not its lower-case twin.
+//
+// Never Unicode folding or Unicode lower-casing: strings.EqualFold makes
+// U+017F (long s) equal "s", and strings.ToLower maps U+212A (Kelvin sign)
+// to an ASCII "k". Either turns a different identity into this one, so
+// non-ASCII is refused outright and only ASCII A-Z is ever lower-cased.
+//
+// Keymail issues mailbox names that are already lowercase ASCII. The host
+// half of its addresses is its KEYMAIL_HOST setting, so a deployment whose
+// KEYMAIL_HOST is not lowercase ASCII produces addresses this contract
+// refuses: that setting is a deployment prerequisite.
+package identity
+
+import "strings"
+
+// Canonical returns raw in canonical form, or false when raw cannot be one:
+// a non-ASCII or control byte, or not <local>@<host>.
+func Canonical(raw string) (string, bool) {
+ a := strings.TrimSpace(raw)
+ b := []byte(a)
+ for i, c := range b {
+ switch {
+ case c < 0x21 || c > 0x7e:
+ return "", false
+ case 'A' <= c && c <= 'Z':
+ b[i] = c + ('a' - 'A')
+ }
+ }
+ at := strings.LastIndexByte(a, '@')
+ if at <= 0 || at == len(a)-1 {
+ return "", false
+ }
+ return string(b), true
+}
+
+// IsCanonical reports whether a is ALREADY canonical: the test for an address
+// an identity provider vouched for, or a stored principal, which must be
+// refused or skipped rather than rewritten into somebody else.
+func IsCanonical(a string) bool {
+ c, ok := Canonical(a)
+ return ok && c == a
+}
diff --git a/internal/identity/identity_test.go b/internal/identity/identity_test.go
new file mode 100644
index 000000000..424800723
--- /dev/null
+++ b/internal/identity/identity_test.go
@@ -0,0 +1,30 @@
+package identity
+
+import "testing"
+
+func TestCanonical(t *testing.T) {
+ for _, tc := range []struct {
+ in, want string
+ ok bool
+ }{
+ {"sam@keymail.dev", "sam@keymail.dev", true},
+ {" Sam@Keymail.DEV ", "sam@keymail.dev", true},
+ {"paul@localhost:6245", "paul@localhost:6245", true},
+ {"ſam@keymail.dev", "", false}, // U+017F: EqualFold makes it "s"
+ {"Kim@keymail.dev", "", false}, // Kelvin sign: ToLower makes it "k"
+ {"sİm@keymail.dev", "", false}, // dotted capital I
+ {"sam@keymail.dev\x00", "", false},
+ {"sam keymail.dev", "", false},
+ {"sam@", "", false},
+ {"@keymail.dev", "", false},
+ {"", "", false},
+ } {
+ got, ok := Canonical(tc.in)
+ if got != tc.want || ok != tc.ok {
+ t.Errorf("Canonical(%q) = %q %v, want %q %v", tc.in, got, ok, tc.want, tc.ok)
+ }
+ }
+ if IsCanonical("Sam@keymail.dev") || IsCanonical("ſam@keymail.dev") || !IsCanonical("sam@keymail.dev") {
+ t.Error("IsCanonical must accept only an already-canonical address")
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 83c3aea17..92c8e2029 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -314,3 +314,4 @@ plan14-root-reads-public-share.tsv ed1957bc7d18714e39984e757b73b8c590f1a2a924ca3
plan14-root-reads-gvisor-slice3-containment.tsv 0fdff597ef83fb9966e07c70b4283001eb97f7dfa71a83a19bde92382192eb6b
plan14-root-reads-catchall-stamp-now.tsv c9940b1b6fb0146a30a2fb2b557f898ac6d28ba80df7dfe642cc623b581f347b
plan14-root-reads-gvisor-followups.tsv bf71949458c3c44c86b778a2a3e0d0b352268f5640c28b6b5d2f25bc2a5318b2
+plan14-root-reads-sec-h4-m11-stepup-fold.tsv 7fd594e36c3aa3d9892083bbf9b709f3f9e55239269bc0a167a69e99a0fbe906
diff --git a/internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv b/internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv
new file mode 100644
index 000000000..952243ad0
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-sec-h4-m11-stepup-fold.tsv
@@ -0,0 +1,7 @@
+# Census overlay sec-h4-m11-stepup-fold, written by census-propose (#369). census-ruling-sec-h4-m11-stepup-fold, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-sec-h4-m11-stepup-fold.md.
+# 1 body, 0 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@legacy 0a6a8b6b63a1f44b303affadfd3e8345a782e553901c65b135f21cf410272955 accounts.go createAccountInBucket legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sec-h4-m11-stepup-fold;basis=The --owner input now goes through identity.Canonical (internal/identity) instead of domains.NormalizeAddress: same trim and ASCII lower-casing, but a non-ASCII, control-character or malformed owner is refused (log.Fatalf) before the mint, so the Unicode lower-casing that turned a Kelvin-sign K into "k" is gone. No read added; the bucket read/write sites are unchanged. file:Open@1013 ac15a2d10a3f866b1b8d77d4afd3a6db69b3cd7661a168d8354d0cce10109ca0
+accounts.go createAccountInBucket legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sec-h4-m11-stepup-fold;basis=The --owner input now goes through identity.Canonical (internal/identity) instead of domains.NormalizeAddress: same trim and ASCII lower-casing, but a non-ASCII, control-character or malformed owner is refused (log.Fatalf) before the mint, so the Unicode lower-casing that turned a Kelvin-sign K into "k" is gone. No read added; the bucket read/write sites are unchanged. file:Open@1013 ac15a2d10a3f866b1b8d77d4afd3a6db69b3cd7661a168d8354d0cce10109ca0
+@coverage . cffb6dddebeab5befda21f64cefb47b00fd1559ad2454c8b1920479643e1a793
+@coverage internal/domains b411c78a6df6762ae9d7df34410983024b9b540b128dd696d1a14563aca7a2ed
+@coverage internal/identity 8f992e48c84fa8144620e4cf6a0f3230f76eae30aa4ee48a5db82bc46b572a74