Merge remote-tracking branch 'origin/main' into replica-read-lock-1443
29 files changed,
+1,811
−33
docs/parity.md+1 −1docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md+31 −0docs/superpowers/plans/2026-11-26-dpa-pdf.md+83 −0docs/superpowers/reviews/CODEX-FINDINGS-dpa-pdf-branch.md+26 −0docs/superpowers/reviews/CODEX-REVIEW-BRIEF-dpa-pdf-branch.md+31 −0internal/console/approved_dpa_pdf_copy_test.go+141 −0internal/console/claim_invariant_fixtures_test.go+1 −0internal/console/claim_invariant_probes_read_test.go+14 −2internal/console/dpapane.go+19 −4internal/console/dpapane_test.go+1 −1internal/console/dpapdf.go+144 −0internal/console/dpapdf_test.go+374 −0internal/console/dpapdfengine.go+95 −0internal/console/dpapdfengine_test.go+123 −0internal/console/dpapdfroute.go+113 −0internal/console/dpapdfroute_test.go+409 −0internal/console/dparecord.go+49 −20internal/console/icons_test.go+36 −0internal/console/perfwalk_test.go+3 −0internal/console/routedecls.go+1 −0internal/console/server.go+7 −2internal/console/templates/dpa_pdf.html+41 −0internal/console/templates/dpa_pdf_footer.html+12 −0internal/console/templates/dpa_pdf_header.html+12 −0internal/console/templates/dpa_record.html+4 −1internal/console/testdata/claim-routes.txt+1 −0internal/provision/dpa_pdf_census_test.go+37 −0internal/provision/plan9_b8_census_test.go+1 −1parity/parity.tsv+1 −1
CI passed — run details
CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
tofu: downloaded, digest verified
aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
aws: downloaded, digest verified
archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
archive: downloaded, digest verified
installed in /tmp/carlos-opentofu-KDlMi9
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading github.com/benbjohnson/litestream v0.5.14
go: downloading github.com/superfly/ltx v0.5.1
go: downloading 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 golang.org/x/crypto v0.58.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0
go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1
go: downloading golang.org/x/sys v0.49.0
go: downloading golang.org/x/mod v0.41.0
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading golang.org/x/sync v0.24.0
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading github.com/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/lmittmann/tint v1.1.3
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading golang.org/x/text v0.43.0
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 modernc.org/libc v1.74.1
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 (172 s, from +0 s)
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/klauspost/compress v1.20.2
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading 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 (184 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 modernc.org/mathutil v1.7.1
=== gofmt (1 s, from +0 s)
gofmt -l .: clean
=== rest (387 s, from +15 s)
ok github.com/carlosframework/platform/cmd/carlos-media 121.024s
? github.com/carlosframework/platform/cmd/changelog [no test files]
ok github.com/carlosframework/platform/cmd/console 202.128s
ok github.com/carlosframework/platform/cmd/mediaimage 42.151s
ok github.com/carlosframework/platform/cmd/moveprobe 15.594s
ok github.com/carlosframework/platform/cmd/pricebook-export 0.043s
ok github.com/carlosframework/platform/cmd/rootfswitness 0.153s
ok github.com/carlosframework/platform/cmd/runsc-assets 0.171s
ok github.com/carlosframework/platform/cmd/zddprobe 0.971s
ok github.com/carlosframework/platform/internal/agentsock 0.046s
ok github.com/carlosframework/platform/internal/alerting 0.017s
ok github.com/carlosframework/platform/internal/analytics 0.609s
ok github.com/carlosframework/platform/internal/appconfig 41.734s
ok github.com/carlosframework/platform/internal/apperr 0.431s
ok github.com/carlosframework/platform/internal/applog 0.672s
ok github.com/carlosframework/platform/internal/apppolicy 3.009s
ok github.com/carlosframework/platform/internal/assetcache 0.460s
ok github.com/carlosframework/platform/internal/awsinv 0.034s
ok github.com/carlosframework/platform/internal/awsmanaged 11.961s
ok github.com/carlosframework/platform/internal/awsregiongroup 0.503s
ok github.com/carlosframework/platform/internal/awsterminations 0.042s
ok github.com/carlosframework/platform/internal/backupswords 0.015s
ok github.com/carlosframework/platform/internal/billing 0.120s
ok github.com/carlosframework/platform/internal/billing/billingtest 0.064s
ok github.com/carlosframework/platform/internal/billingstripe 1.990s
ok github.com/carlosframework/platform/internal/boxchoice 0.042s
ok github.com/carlosframework/platform/internal/boxid 2.298s
? github.com/carlosframework/platform/internal/boxid/boxidtest [no test files]
? github.com/carlosframework/platform/internal/boxid/internal/signtest [no test files]
ok github.com/carlosframework/platform/internal/boxroles 0.020s
ok github.com/carlosframework/platform/internal/boxself 0.181s
ok github.com/carlosframework/platform/internal/boxvolumes 0.092s
ok github.com/carlosframework/platform/internal/caps 3.094s
ok github.com/carlosframework/platform/internal/certwarm 0.007s
ok github.com/carlosframework/platform/internal/cgroup 1.542s
ok github.com/carlosframework/platform/internal/changelog 3.799s
ok github.com/carlosframework/platform/internal/clamd 0.067s
? github.com/carlosframework/platform/internal/cliflag [no test files]
ok github.com/carlosframework/platform/internal/clireg 0.012s
ok github.com/carlosframework/platform/internal/codehealth 15.916s
ok github.com/carlosframework/platform/internal/compute 0.016s
ok github.com/carlosframework/platform/internal/consolefleet 0.024s
? github.com/carlosframework/platform/internal/controlname [no test files]
? github.com/carlosframework/platform/internal/controlsock [no test files]
ok github.com/carlosframework/platform/internal/dbdoor 10.657s
ok github.com/carlosframework/platform/internal/dbdoor/dbdoortest 0.082s
ok github.com/carlosframework/platform/internal/dbquery 0.020s
ok github.com/carlosframework/platform/internal/dbreads 2.736s
? github.com/carlosframework/platform/internal/dbreads/dbreadstest [no test files]
ok github.com/carlosframework/platform/internal/dbverify 0.032s
ok github.com/carlosframework/platform/internal/demo 0.008s
ok github.com/carlosframework/platform/internal/demobuild 2.670s
ok github.com/carlosframework/platform/internal/democlaim 0.455s
ok github.com/carlosframework/platform/internal/devbox 17.096s
ok github.com/carlosframework/platform/internal/dnsrec 0.024s
ok github.com/carlosframework/platform/internal/docsite 0.145s
ok github.com/carlosframework/platform/internal/domainreg 0.016s
ok github.com/carlosframework/platform/internal/domains 68.392s
ok github.com/carlosframework/platform/internal/doorkey 0.045s
ok github.com/carlosframework/platform/internal/economics 0.018s
ok github.com/carlosframework/platform/internal/edgefence 0.106s
ok github.com/carlosframework/platform/internal/edgeguard 0.453s
? github.com/carlosframework/platform/internal/edgeproof [no test files]
ok github.com/carlosframework/platform/internal/edgesfile 0.174s
ok github.com/carlosframework/platform/internal/egressaddr 0.012s
ok github.com/carlosframework/platform/internal/execsandbox 102.444s
ok github.com/carlosframework/platform/internal/fileacl 0.011s
ok github.com/carlosframework/platform/internal/fleetapi 2.562s
ok github.com/carlosframework/platform/internal/fleetstore 0.013s
ok github.com/carlosframework/platform/internal/fxrate 0.038s
ok github.com/carlosframework/platform/internal/gate 5.075s
ok github.com/carlosframework/platform/internal/genselect 0.120s
ok github.com/carlosframework/platform/internal/geo 0.068s
ok github.com/carlosframework/platform/internal/geoip 0.155s
ok github.com/carlosframework/platform/internal/groupadmission 0.011s
ok github.com/carlosframework/platform/internal/grouprollaws 17.318s
ok github.com/carlosframework/platform/internal/hadeparture 0.031s
ok github.com/carlosframework/platform/internal/hafresh 0.011s
ok github.com/carlosframework/platform/internal/hairpin 0.158s
ok github.com/carlosframework/platform/internal/historyreadback 1.254s
ok github.com/carlosframework/platform/internal/hostactors 19.945s
ok github.com/carlosframework/platform/internal/hostbox 21.773s
ok github.com/carlosframework/platform/internal/hostclaim 2.804s
ok github.com/carlosframework/platform/internal/hostenv 0.065s
ok github.com/carlosframework/platform/internal/hostevidence 0.018s
ok github.com/carlosframework/platform/internal/hostexec 22.503s
ok github.com/carlosframework/platform/internal/hostfence 0.134s
ok github.com/carlosframework/platform/internal/hostfiles 26.319s
ok github.com/carlosframework/platform/internal/hostfloor 0.081s
ok github.com/carlosframework/platform/internal/hostguard 1.481s
ok github.com/carlosframework/platform/internal/hostops 7.482s
? github.com/carlosframework/platform/internal/hostops/fencerelease [no test files]
ok github.com/carlosframework/platform/internal/hostops/internal/fencerelease 0.012s
ok github.com/carlosframework/platform/internal/hostquarantine 0.035s
ok github.com/carlosframework/platform/internal/hostrelocate 1.631s
ok github.com/carlosframework/platform/internal/hostresolve 0.710s
ok github.com/carlosframework/platform/internal/hostwrite 0.006s
ok github.com/carlosframework/platform/internal/infraview 0.010s
ok github.com/carlosframework/platform/internal/ingresshealth 0.018s
ok github.com/carlosframework/platform/internal/ingresshealth/awstg 0.012s
ok github.com/carlosframework/platform/internal/instancectl 62.118s
ok github.com/carlosframework/platform/internal/instanceexec 8.799s
ok github.com/carlosframework/platform/internal/instancefs 0.041s
ok github.com/carlosframework/platform/internal/instancekey 0.005s
ok github.com/carlosframework/platform/internal/instanceupdates 0.021s
ok github.com/carlosframework/platform/internal/interactive 0.703s
ok github.com/carlosframework/platform/internal/launchd 0.009s
ok github.com/carlosframework/platform/internal/layout 23.098s
ok github.com/carlosframework/platform/internal/layout/pubclass 93.476s
ok github.com/carlosframework/platform/internal/lbhealth 0.004s
ok github.com/carlosframework/platform/internal/lease 147.668s
ok github.com/carlosframework/platform/internal/lease/leasetest 1.260s
ok github.com/carlosframework/platform/internal/lease/locktest 0.032s
ok github.com/carlosframework/platform/internal/ledger 0.076s
ok github.com/carlosframework/platform/internal/mail 1.054s
ok github.com/carlosframework/platform/internal/mailer 0.770s
ok github.com/carlosframework/platform/internal/mailsubmit 1.698s
ok github.com/carlosframework/platform/internal/mailwire 0.010s
ok github.com/carlosframework/platform/internal/maintenance 0.168s
ok github.com/carlosframework/platform/internal/maintenanceexec 9.492s
ok github.com/carlosframework/platform/internal/maintenanceguard 0.210s
ok github.com/carlosframework/platform/internal/managedboot 4.189s
? 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.095s
ok github.com/carlosframework/platform/internal/media/mediatest 0.012s
ok github.com/carlosframework/platform/internal/mediaaws 61.330s
ok github.com/carlosframework/platform/internal/mediahandler 43.166s
ok github.com/carlosframework/platform/internal/mediajobs 1.045s
ok github.com/carlosframework/platform/internal/medialocal 10.071s
ok github.com/carlosframework/platform/internal/metrics 0.146s
ok github.com/carlosframework/platform/internal/minorunits 0.011s
ok github.com/carlosframework/platform/internal/moves 52.193s
ok github.com/carlosframework/platform/internal/moves/archive 2.686s
ok github.com/carlosframework/platform/internal/moves/offlinerun 0.078s
ok github.com/carlosframework/platform/internal/namedunits 0.030s
ok github.com/carlosframework/platform/internal/objstore 2.638s
ok github.com/carlosframework/platform/internal/ops 15.523s
ok github.com/carlosframework/platform/internal/pageindex 3.746s
ok github.com/carlosframework/platform/internal/parity 0.124s
? github.com/carlosframework/platform/internal/parity/cmd/parity-doc [no test files]
ok github.com/carlosframework/platform/internal/park 0.720s
ok github.com/carlosframework/platform/internal/perf 0.212s
ok github.com/carlosframework/platform/internal/plans 0.126s
ok github.com/carlosframework/platform/internal/privatefile 0.013s
ok github.com/carlosframework/platform/internal/provision 237.592s
ok github.com/carlosframework/platform/internal/proxyproto 0.936s
ok github.com/carlosframework/platform/internal/publicrelease 0.040s
ok github.com/carlosframework/platform/internal/ratelimit 0.257s
ok github.com/carlosframework/platform/internal/regionlabel 0.058s
ok github.com/carlosframework/platform/internal/regionname 0.047s
ok github.com/carlosframework/platform/internal/registrar 0.020s
ok github.com/carlosframework/platform/internal/registrar/openprovider 0.611s
? github.com/carlosframework/platform/internal/registrar/registrartest [no test files]
ok github.com/carlosframework/platform/internal/registry 81.272s
ok github.com/carlosframework/platform/internal/relay 7.586s
ok github.com/carlosframework/platform/internal/release 97.680s
ok github.com/carlosframework/platform/internal/replicagen 0.036s
ok github.com/carlosframework/platform/internal/replicas 0.091s
ok github.com/carlosframework/platform/internal/reqrec 6.589s
ok github.com/carlosframework/platform/internal/rollout 11.137s
ok github.com/carlosframework/platform/internal/rolloutwords 0.050s
ok github.com/carlosframework/platform/internal/rootaws 94.675s
ok github.com/carlosframework/platform/internal/rootfsimage 1.235s
ok github.com/carlosframework/platform/internal/rootparticipation 0.146s
ok github.com/carlosframework/platform/internal/rootstate 0.067s
ok github.com/carlosframework/platform/internal/runs 0.867s
ok github.com/carlosframework/platform/internal/s3compat 0.052s
ok github.com/carlosframework/platform/internal/s3fake 1.308s
ok github.com/carlosframework/platform/internal/safefile 0.037s
ok github.com/carlosframework/platform/internal/schedule 22.698s
ok github.com/carlosframework/platform/internal/seeds 0.059s
ok github.com/carlosframework/platform/internal/sim/litestreamfacts 5.052s
ok github.com/carlosframework/platform/internal/sim/mediajobs 50.921s
ok github.com/carlosframework/platform/internal/sim/regionha 22.100s
ok github.com/carlosframework/platform/internal/status 0.338s
ok github.com/carlosframework/platform/internal/steering 0.198s
ok github.com/carlosframework/platform/internal/stopevidence 0.489s
ok github.com/carlosframework/platform/internal/storecfg 0.361s
ok github.com/carlosframework/platform/internal/svcrole 0.012s
ok github.com/carlosframework/platform/internal/systemd 5.755s
? github.com/carlosframework/platform/internal/systemdshow [no test files]
ok github.com/carlosframework/platform/internal/team 4.127s
ok github.com/carlosframework/platform/internal/teamcontract 0.247s
ok github.com/carlosframework/platform/internal/telemetry 0.035s
ok github.com/carlosframework/platform/internal/termfence 4.378s
ok github.com/carlosframework/platform/internal/timerspec 0.044s
ok github.com/carlosframework/platform/internal/tsidentity 4.196s
ok github.com/carlosframework/platform/internal/tunnelclient 0.382s
ok github.com/carlosframework/platform/internal/unixdial 0.021s
ok github.com/carlosframework/platform/internal/updatewords 0.035s
ok github.com/carlosframework/platform/internal/upstreamguard 0.019s
? github.com/carlosframework/platform/internal/upstreamguard/guardtest [no test files]
ok github.com/carlosframework/platform/internal/usage 0.036s
ok github.com/carlosframework/platform/internal/version 0.013s
ok github.com/carlosframework/platform/internal/vet 3.010s
ok github.com/carlosframework/platform/internal/zonehost 0.025s
ok github.com/carlosframework/platform/internal/zonehost/route53zones 0.067s
? 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.022s
ok github.com/carlosframework/platform/scripts/pathmapcheck 0.082s
ok github.com/carlosframework/platform/scripts/region-ha-g2/fixture 5.260s
ok github.com/carlosframework/platform/scripts/stateless-replicas-drill 1.207s
ok github.com/carlosframework/platform/scripts/witness-pointer 0.011s
=== cutover-witness (161 s, from +15 s)
ok github.com/carlosframework/platform 2.697s
=== internal_grouproll@0 (272 s, from +73 s)
ok github.com/carlosframework/platform/internal/grouproll 271.297s
=== internal_grouproll@1 (278 s, from +73 s)
ok github.com/carlosframework/platform/internal/grouproll 276.944s
=== internal_activator@0 (150 s, from +150 s)
ok github.com/carlosframework/platform/internal/activator 144.941s
=== internal_activator@1 (132 s, from +150 s)
ok github.com/carlosframework/platform/internal/activator 126.680s
=== internal_activator@2 (137 s, from +150 s)
ok github.com/carlosframework/platform/internal/activator 131.933s
=== internal_activator@3 (160 s, from +150 s)
ok github.com/carlosframework/platform/internal/activator 155.974s
=== root@0 (123 s, from +173 s)
ok github.com/carlosframework/platform 113.168s
=== root@1 (111 s, from +173 s)
ok github.com/carlosframework/platform 102.755s
=== root@2 (123 s, from +173 s)
ok github.com/carlosframework/platform 114.653s
=== root@3 (113 s, from +173 s)
ok github.com/carlosframework/platform 103.159s
=== root@4 (107 s, from +173 s)
ok github.com/carlosframework/platform 98.740s
=== internal_edge@0 (251 s, from +176 s)
ok github.com/carlosframework/platform/internal/edge 242.807s
=== internal_edge@1 (132 s, from +176 s)
ok github.com/carlosframework/platform/internal/edge 122.272s
=== internal_edge@2 (156 s, from +176 s)
ok github.com/carlosframework/platform/internal/edge 148.181s
=== internal_edge@3 (154 s, from +176 s)
ok github.com/carlosframework/platform/internal/edge 145.158s
=== internal_host@0 (176 s, from +222 s)
ok github.com/carlosframework/platform/internal/host 171.594s
=== internal_host@1 (139 s, from +222 s)
ok github.com/carlosframework/platform/internal/host 135.036s
=== internal_host@2 (207 s, from +222 s)
ok github.com/carlosframework/platform/internal/host 203.360s
=== internal_host@3 (222 s, from +222 s)
ok github.com/carlosframework/platform/internal/host 218.101s
=== internal_host@4 (257 s, from +222 s)
ok github.com/carlosframework/platform/internal/host 252.988s
=== internal_host@5 (174 s, from +222 s)
ok github.com/carlosframework/platform/internal/host 169.503s
=== internal_console@0 (155 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 148.080s
=== internal_console@1 (168 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 161.459s
=== internal_console@2 (200 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 193.599s
=== internal_console@3 (240 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 233.800s
=== internal_console@4 (201 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 193.692s
=== internal_console@5 (215 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 208.701s
=== internal_console@6 (203 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 196.394s
=== internal_console@7 (212 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 203.669s
=== internal_console@8 (222 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 215.298s
=== internal_console@9 (213 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 206.506s
=== internal_console@10 (213 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 205.851s
=== internal_console@11 (237 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 230.716s
=== internal_console@12 (280 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 272.139s
=== internal_console@13 (244 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 236.025s
=== internal_console@14 (230 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 223.264s
=== internal_console@15 (248 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 240.650s
=== internal_console@16 (231 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 222.762s
=== internal_console@17 (203 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 194.859s
=== internal_console@18 (203 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 195.507s
=== internal_console@19 (198 s, from +227 s)
ok github.com/carlosframework/platform/internal/console 190.349s
=== internal_console@20 (212 s, from +228 s)
ok github.com/carlosframework/platform/internal/console 205.665s
=== internal_console@21 (229 s, from +228 s)
ok github.com/carlosframework/platform/internal/console 223.294s
=== internal_console@22 (219 s, from +228 s)
ok github.com/carlosframework/platform/internal/console 213.866s
=== internal_console@23 (227 s, from +228 s)
ok github.com/carlosframework/platform/internal/console 220.081s
=== lists: internal_console 226 s, internal_edge 175 s, internal_activator 149 s, internal_host 221 s, root 172 s, internal_grouproll 72 s
=== cpu: the gate used 12851 cpu-seconds in 507 s, about 25.3 of 32 cores; the machine as a whole was 85% busy
=== opentofu ===
opentofu: 39 test files in 11 suites, OpenTofu v1.13.9
initialised in 15 s
ok 17 s infra/modules/box-fence-writer/tests/writer.tftest.hcl Success! 1 passed, 0 failed.
ok 16 s infra/modules/deployment-buckets/tests/console_floors.tftest.hcl Success! 1 passed, 0 failed.
ok 27 s infra/modules/deployment-buckets/tests/data_lifecycle.tftest.hcl Success! 3 passed, 0 failed.
ok 16 s infra/modules/deployment-buckets/tests/db_reads.tftest.hcl Success! 1 passed, 0 failed.
ok 17 s infra/modules/deployment-buckets/tests/evidence.tftest.hcl Success! 1 passed, 0 failed.
ok 28 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 84 s infra/modules/media-engine/tests/media_engine.tftest.hcl Success! 24 passed, 0 failed.
ok 26 s infra/modules/pdf-host/tests/computed.tftest.hcl Success! 2 passed, 0 failed.
ok 57 s infra/modules/pdf-host/tests/pdf_host.tftest.hcl Success! 24 passed, 0 failed.
ok 42 s infra/modules/region-group-operator-document/tests/document.tftest.hcl Success! 12 passed, 0 failed.
ok 22 s infra/modules/region-host/ingress/tests/fixed-targets/tests/targets.tftest.hcl Success! 2 passed, 0 failed.
ok 59 s infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl Success! 30 passed, 0 failed.
ok 45 s infra/modules/region-host/tests/alert_publish.tftest.hcl Success! 18 passed, 0 failed.
ok 42 s infra/modules/region-host/tests/alerts_topic.tftest.hcl Success! 16 passed, 0 failed.
ok 12 s infra/modules/region-host/tests/analytics_prune.tftest.hcl Success! 2 passed, 0 failed.
ok 15 s infra/modules/region-host/tests/console_mail.tftest.hcl Success! 4 passed, 0 failed.
ok 7 s infra/modules/region-host/tests/fixed_state_unchanged.tftest.hcl Success! 1 passed, 0 failed.
ok 72 s infra/modules/region-host/tests/group.tftest.hcl Success! 32 passed, 0 failed.
ok 9 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 5 s infra/modules/region-host/tests/group_isolation.tftest.hcl Success! 1 passed, 0 failed.
ok 36 s infra/modules/region-host/tests/group_operator.tftest.hcl Success! 13 passed, 0 failed.
ok 7 s infra/modules/region-host/tests/group_user_data.tftest.hcl Success! 3 passed, 0 failed.
ok 29 s infra/modules/region-host/tests/health_alarms.tftest.hcl Success! 10 passed, 0 failed.
ok 9 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 24 s infra/modules/region-host/tests/mailer.tftest.hcl Success! 6 passed, 0 failed.
ok 13 s infra/modules/region-host/tests/mailer_group.tftest.hcl Success! 2 passed, 0 failed.
ok 16 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 74 s infra/modules/region-host/tests/store_conversion.tftest.hcl Success! 27 passed, 0 failed.
ok 18 s infra/modules/region-host/tests/store_scanning.tftest.hcl Success! 4 passed, 0 failed.
ok 30 s infra/modules/region-host/tests/store_versioning.tftest.hcl Success! 11 passed, 0 failed.
ok 15 s infra/modules/region-host/tests/store_write_credentials.tftest.hcl Success! 4 passed, 0 failed.
ok 15 s infra/modules/region-host/tests/user_data_ignored.tftest.hcl Success! 3 passed, 0 failed.
ok 9 s infra/modules/region-remote-host/tests/data_lifecycle.tftest.hcl Success! 3 passed, 0 failed.
ok 14 s infra/modules/region-remote-host/tests/no_deployment_bucket.tftest.hcl Success! 5 passed, 0 failed.
ok 30 s infra/modules/scanner-host/tests/scanner_host.tftest.hcl Success! 14 passed, 0 failed.
opentofu: 39 files in 210 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: 66388130 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:36352
Added `local` successfully.
Bucket created successfully `local/contract-bucket`.
Bucket created successfully `local/denied-bucket`.
Created policy `contract-only` successfully.
Added user `scopeduser` successfully.
Attached Policies: [contract-only]
To User: scopeduser
buckets and scoped user ready
=== RUN TestDeliveredContractMinio
=== RUN TestDeliveredContractMinio/put
=== RUN TestDeliveredContractMinio/get_round-trips_the_body
=== RUN TestDeliveredContractMinio/list_shows_the_key
=== RUN TestDeliveredContractMinio/head_and_list_agree_on_the_version
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_its_own_object
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/not_by_PutObjectTagging
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/and_not_by_x-amz-tagging_on_upload
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CreateMultipartUpload
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CopyObject_with_a_REPLACE_tagging_directive
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/but_multipart_itself_is_allowed
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_copy_itself_is_allowed
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/a_POST-policy_forged_tag_with_a_matching_version_is_still_not_a_verdict
=== RUN TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_an_ordinary_tagged-with-something-else_upload_is_allowed
=== RUN TestDeliveredContractMinio/delete_removes_it
=== RUN TestDeliveredContractMinio/cross-bucket_denial
--- PASS: TestDeliveredContractMinio (0.03s)
--- PASS: TestDeliveredContractMinio/put (0.00s)
--- PASS: TestDeliveredContractMinio/get_round-trips_the_body (0.00s)
--- PASS: TestDeliveredContractMinio/list_shows_the_key (0.00s)
--- PASS: TestDeliveredContractMinio/head_and_list_agree_on_the_version (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/not_by_PutObjectTagging (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_its_own_object/and_not_by_x-amz-tagging_on_upload (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route (0.01s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CreateMultipartUpload (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/not_by_CopyObject_with_a_REPLACE_tagging_directive (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/but_multipart_itself_is_allowed (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_copy_itself_is_allowed (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/a_POST-policy_forged_tag_with_a_matching_version_is_still_not_a_verdict (0.00s)
--- PASS: TestDeliveredContractMinio/the_app_cannot_tag_by_any_other_route/and_an_ordinary_tagged-with-something-else_upload_is_allowed (0.00s)
--- PASS: TestDeliveredContractMinio/delete_removes_it (0.00s)
--- PASS: TestDeliveredContractMinio/cross-bucket_denial (0.00s)
PASS
ok github.com/carlosframework/platform/internal/objstore 0.038s
=== RUN TestT4StorageProbeMinio
2026/11/26 13:16:23 moves: T4: STORE: list: operation error S3: ListObjectsV2, https response error StatusCode: 403, RequestID: 18EB9AB633F73A72, HostID: 37de11e94423cb406aa5adee1a981cf646519fd1cd8d866b9d3c224b8d21e922, 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.043s
=== RUN TestS3StoreMinioContract
=== RUN TestS3StoreMinioContract/conditional_get_and_etag_listing
=== RUN TestS3StoreMinioContract/bump_through_every_mutation_path
--- PASS: TestS3StoreMinioContract (0.03s)
--- PASS: TestS3StoreMinioContract/conditional_get_and_etag_listing (0.01s)
--- PASS: TestS3StoreMinioContract/bump_through_every_mutation_path (0.02s)
PASS
ok github.com/carlosframework/platform/internal/release 0.042s
Bucket created successfully `local/analytics-versions`.
local/analytics-versions versioning is enabled
Created policy `analytics-versions` successfully.
Added user `analyticsversions` successfully.
Attached Policies: [analytics-versions]
To User: analyticsversions
=== RUN TestS3StoreMinioVersions
--- PASS: TestS3StoreMinioVersions (0.03s)
PASS
ok github.com/carlosframework/platform/internal/release 0.041s
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.021s
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_tagged
=== RUN TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag
=== RUN TestWriteCredentialContractMinio/refused:_put_beside_the_prefix
=== RUN TestWriteCredentialContractMinio/refused:_read_under_the_prefix
=== RUN TestWriteCredentialContractMinio/refused:_delete
=== RUN TestWriteCredentialContractMinio/refused:_tag
=== RUN TestWriteCredentialContractMinio/refused:_put_outside_the_prefix
=== RUN TestWriteCredentialContractMinio/refused:_put_to_another_bucket
=== RUN TestWriteCredentialContractMinio/refused:_copy_from_the_store
=== RUN TestWriteCredentialContractMinio/refused:_bucket_settings
=== RUN TestWriteCredentialContractMinio/refused:_read_elsewhere
=== RUN TestWriteCredentialContractMinio/refused:_head
=== RUN TestWriteCredentialContractMinio/refused:_list
=== RUN TestWriteCredentialContractMinio/refused:_list_uploads
--- PASS: TestWriteCredentialContractMinio (0.04s)
--- PASS: TestWriteCredentialContractMinio/put_under_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/multipart_under_the_prefix (0.01s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_tagged (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_with_a_platform_tag (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_beside_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_read_under_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_delete (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_tag (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_outside_the_prefix (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_put_to_another_bucket (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:_list (0.00s)
--- PASS: TestWriteCredentialContractMinio/refused:_list_uploads (0.00s)
PASS
ok github.com/carlosframework/platform/internal/objstore 0.048s
=== RUN TestEndToEndMinio
=== RUN TestEndToEndMinio/plan
=== RUN TestEndToEndMinio/roll
=== RUN TestEndToEndMinio/replace
=== RUN TestEndToEndMinio/remove
--- PASS: TestEndToEndMinio (0.47s)
--- PASS: TestEndToEndMinio/plan (0.01s)
--- PASS: TestEndToEndMinio/roll (0.12s)
--- PASS: TestEndToEndMinio/replace (0.15s)
--- PASS: TestEndToEndMinio/remove (0.15s)
PASS
ok github.com/carlosframework/platform/internal/grouproll 0.474s
Bucket created successfully `local/dbf-deploy`.
Bucket created successfully `local/dbf-data-ie`.
Bucket created successfully `local/dbf-data-uk`.
local/dbf-deploy versioning is enabled
Created policy `dbf-console` successfully.
Created policy `dbf-ukbox` successfully.
Added user `dbfconsole` successfully.
Added user `dbfukbox` successfully.
Attached Policies: [dbf-console]
To User: dbfconsole
Attached Policies: [dbf-ukbox]
To User: dbfukbox
=== RUN TestDBForwardMinio
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/26 13:16:32 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000000 txid.db=0000000000000001
2026/11/26 13:16:32 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000001 maxTXID=0000000000000001 size=720
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000001
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000001 txid.db=0000000000000002
2026/11/26 13:16:32 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000002 maxTXID=0000000000000002 size=370
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000002
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000002 txid.db=0000000000000003
2026/11/26 13:16:32 INFO ltx file uploaded system=store db=source.db replica=file level=0 minTXID=0000000000000003 maxTXID=0000000000000003 size=454
2026/11/26 13:16:32 INFO replica sync system=store db=source.db replica=file txid.replica=0000000000000003 txid.db=0000000000000003
2026/11/26 13:16:32 console: CARLOS_SECRETS_PUBKEY is unset, so no region outside the home can be chosen automatically
2026/11/26 13:16:32 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%3A40669: could not determine target mailbox
agent.go:136: dbreads: dbr_chvfa5yb4njnk353okquuqi5u4: planned 3 files (1544 bytes) and restored to 3 in 14ms
agent.go:136: dbreads: dbr_chvfa5yb4njnk353okquuqi5u4: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/26 13:16:33 console: db read dbr_chvfa5yb4njnk353okquuqi5u4: relayed 1 chunks (102 bytes) in 1.006s, ended done
agent.go:136: dbreads: dbr_byezmsllgt2xzensibmjorhfie: planned 1 files (720 bytes) and restored to 1 in 12ms
agent.go:136: dbreads: dbr_byezmsllgt2xzensibmjorhfie: output 5 bytes in 1 confirmed chunks in 2ms
2026/11/26 13:16:34 console: db read dbr_byezmsllgt2xzensibmjorhfie: relayed 1 chunks (102 bytes) in 1.005s, ended done
agent.go:136: dbreads: dbr_ktygxmp2tsusg5h36icjevk26m: planned 3 files (1544 bytes) and held through 3 in 12ms
agent.go:136: dbreads: dbr_ktygxmp2tsusg5h36icjevk26m: output 1544 bytes in 1 confirmed chunks in 1ms
2026/11/26 13:16:35 console: db read dbr_ktygxmp2tsusg5h36icjevk26m: relayed 1 chunks (1641 bytes) in 1.005s, ended done
=== RUN TestDBForwardMinio/by_disconnect
=== NAME TestDBForwardMinio
agent.go:136: dbreads: dbr_bubvt2kzxu5x7bf35ckmsv5beu: planned 3 files (1544 bytes) and restored to 3 in 16ms
2026/11/26 13:16:35 console: db read dbr_bubvt2kzxu5x7bf35ckmsv5beu: relayed 0 chunks (0 bytes) in 26ms, ended client gone
agent.go:136: dbreads: dbr_bubvt2kzxu5x7bf35ckmsv5beu: output 5 bytes in 1 confirmed chunks in 105ms
=== RUN TestDBForwardMinio/by_timeout
=== NAME TestDBForwardMinio
agent.go:136: dbreads: dbr_my7ci7ygmqafmgt26xqrndposi: planned 3 files (1544 bytes) and restored to 3 in 13ms
2026/11/26 13:16:55 console: db read dbr_my7ci7ygmqafmgt26xqrndposi: relayed 0 chunks (0 bytes) in 19.273s, ended no-result
agent.go:136: dbreads: dbr_my7ci7ygmqafmgt26xqrndposi: output 5 bytes in 1 confirmed chunks in 19.25s
--- PASS: TestDBForwardMinio (22.96s)
--- PASS: TestDBForwardMinio/by_disconnect (0.24s)
--- PASS: TestDBForwardMinio/by_timeout (19.38s)
PASS
ok github.com/carlosframework/platform/internal/console 23.002s
Bucket created successfully `local/media-transfers`.
Bucket created successfully `local/media-transfer-results`.
local/media-transfer-results versioning is enabled
Created policy `media-transfers` successfully.
Added user `mediatransfers` successfully.
Attached Policies: [media-transfers]
To User: mediatransfers
=== RUN TestMediaTransfersMinio
upload.go:117: codec: the store already holds video.mp4
upload.go:117: codec: the store already holds video.m3u8
upload.go:117: codec: the store already holds poster.jpg
--- PASS: TestMediaTransfersMinio (0.07s)
PASS
ok github.com/carlosframework/platform/internal/mediaaws 0.077s
Bucket created successfully `local/media-local-store`.
Bucket created successfully `local/media-local-results`.
Created policy `media-local` successfully.
Added user `medialocal` successfully.
Attached Policies: [media-local]
To User: medialocal
=== RUN TestLocalEndToEndMinio
--- PASS: TestLocalEndToEndMinio (0.57s)
PASS
ok github.com/carlosframework/platform/internal/medialocal 0.571s
=== RUN TestHeldHandoverTwoBoxMinio
2026/11/26 13:17:00 edge: mesh key: minted
2026/11/26 13:17:00 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/26 13:17:00 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/26 13:17:00 tenant admission is open. accepting tenant work
2026/11/26 13:17:00 activator: HA placement host=shop-3722ed4a.example.test kind=Place ref=annie reason=roomiest generation=2026-11-26T13:17:00Z lock_generation=0
2026/11/26 13:17:00 lease: t8-3722ed4a/shop-3722ed4a.example.test: HA lease acquired in 4ms (first wake)
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: started carlos-instance@shop\x2d3722ed4a.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/26 13:17:00 activator: shop-3722ed4a.example.test: carlos-instance@shop\x2d3722ed4a.example.test.service launched in 7ms, healthy 0s later
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: woke in 21ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 8ms, replicate 9ms
2026/11/26 13:17:00 lease: t8-3722ed4a/plain-3722ed4a.example.test: acquired in 1ms (client 0s, lock read and write 1ms)
2026/11/26 13:17:00 activator: no replica for plain-3722ed4a.example.test in s3://contract-bucket/t8-3722ed4a/plain-3722ed4a.example.test — booting fresh
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test: started carlos-instance@plain\x2d3722ed4a.example.test.service memory.max=536870912 (build 0s, prepare (dirs 0s, admin token 2ms, instance key 0s, env 4ms, control socket 0s, key gate 0s, logs 0s) 6ms, launch file 0s, gate 0s, root start 1ms)
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test: carlos-instance@plain\x2d3722ed4a.example.test.service launched in 8ms, healthy 0s later
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test: woke in 91ms: checks 0s, lease 2ms, restore 18ms, identity 0s, protect 0s, spawn 8ms, replicate 64ms
2026/11/26 13:17:00 lease: t8-3722ed4a/bot0.shop.bac.sidecar.internal: HA lease acquired in 4ms (first wake)
2026/11/26 13:17:00 activator: bot0.shop.bac.sidecar.internal: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/26 13:17:00 activator: bot0.shop.bac.sidecar.internal: woke in 70ms: checks 0s, lease 5ms, restore 0s, identity 0s, protect 0s, spawn 7ms, settle 0s, replicate 57ms
2026/11/26 13:17:00 activator: next-due probe plain-3722ed4a.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test hibernated
2026/11/26 13:17:00 activator: next-due probe shop-3722ed4a.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/26 13:17:00 activator: bot0.shop.bac.sidecar.internal: released with a marker (clean true, txid 1, files 3:233bb1879bf47a2b34e629c732951de9bdff8eb5f8b5661971a920794ed90b7c) in 9ms: files 1ms, sync 5ms, record 1ms, marker 2ms
2026/11/26 13:17:00 activator: bot0.shop.bac.sidecar.internal hibernated
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: released with a marker (clean true, txid 1, files 3:b60407351966ee1fe92e9dbc6c85a6e76ab7be0719821cdb49290308cec064eb) in 6ms: files 1ms, sync 2ms, record 1ms, marker 2ms
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test hibernated
2026/11/26 13:17:00 lease: t8-3722ed4a/shop-3722ed4a.example.test: HA lease acquired in 3ms (clean marker)
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: restored (other-box)
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: started carlos-instance@shop\x2d3722ed4a.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/26 13:17:00 activator: shop-3722ed4a.example.test: carlos-instance@shop\x2d3722ed4a.example.test.service launched in 2ms, healthy 0s later
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: woke in 86ms: checks 0s, lease 4ms, restore 26ms, identity 0s, protect 0s, spawn 2ms, replicate 54ms
2026/11/26 13:17:00 edge: ha-take shop-3722ed4a.example.test from annie (txn t8-witness, marker generation 1): holder betty, generation 2
2026/11/26 13:17:00 edge: forward shop-3722ed4a.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:18a2193ad6fe63d942d38601e9e07c16 Step:move Result:ok Reasons:[] Fence:t8-witness StartedAt:2026-11-26 13:17:00.606348388 +0000 UTC FinishedAt:2026-11-26 13:17:00.75476516 +0000 UTC Acked:[betty carol] Departed:[] Moved:[{Host:shop-3722ed4a.example.test Holder:betty Gen:2 Confirmed:take}] Released:[{Host:plain-3722ed4a.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:127 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-3722ed4a.example.test <nil> stop plain-3722ed4a.example.test marker=true clean=true <nil> releasing shop-3722ed4a.example.test <nil> stop bot0.shop.bac.sidecar.internal marker=true clean=true <nil> stop shop-3722ed4a.example.test marker=true clean=true <nil> taken shop-3722ed4a.example.test betty <nil> end-moves]
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: DELETE /contract-bucket/t8-3722ed4a/plain-3722ed4a.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-3722ed4a/bot0.shop.bac.sidecar.internal/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-3722ed4a/bot0.shop.bac.sidecar.internal/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/head.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/generations/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0008/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0007/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0006/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0005/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0004/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0008/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0007/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0006/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0005/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0004/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/0009/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/files/0/manifest.json
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/files/0/objects/0000000000000001-fad03e64f056f5636f4ece5d94629eb446654ef17a1b0aa6a103a3260ab349b6
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/files/0/objects/0000000000000003-22541bb428b170dc6d9e8d86f3c4d96ef3d494f5b6821b18d90777389d104101
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0009/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0001/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/0000/0000000000000001-0000000000000001.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0002/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0003/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: LIST /contract-bucket?t8-3722ed4a/shop-3722ed4a.example.test/0000/
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: PUT /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/0000/0000000000000002-0000000000000002.ltx
hadrain_twobox_minio_linux_test.go:1241: S3 during the drain: GET /contract-bucket/t8-3722ed4a/shop-3722ed4a.example.test/lock.json
hadrain_twobox_minio_linux_test.go:1243: drain took 195ms; S3 calls 43 (DELETE lock=1 GET files=3 GET head=1 GET lock=3 GET replica=2 LIST replica=27 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/26 13:17:00 lease: t8-3722ed4a/plain-3722ed4a.example.test: acquired in 2ms (client 0s, lock read and write 2ms)
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test: started carlos-instance@plain\x2d3722ed4a.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/26 13:17:00 activator: plain-3722ed4a.example.test: carlos-instance@plain\x2d3722ed4a.example.test.service launched in 1ms, healthy 0s later
2026/11/26 13:17:00 lease: /tmp/carlos-minio-contract-H0SLKD/g/dw2550379991/data/instances/plain-3722ed4a.example.test/plain-3722ed4a.example.test.db: continuity with the last clean close not proven; snapshot 1-0000000000000001 written before serving
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test: woke in 8ms: checks 0s, lease 2ms, restore 0s, identity 0s, protect 1ms, spawn 2ms, replicate 4ms
2026/11/26 13:17:00 activator: next-due probe shop-3722ed4a.example.test: decode /api/next-due: invalid character 'b' looking for beginning of value — recording none (it sleeps until a request)
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test: released with a marker (clean true, txid 2, files 3:b60407351966ee1fe92e9dbc6c85a6e76ab7be0719821cdb49290308cec064eb) in 4ms: files 1ms, sync 0s, record 1ms, marker 2ms
2026/11/26 13:17:00 activator: shop-3722ed4a.example.test hibernated
2026/11/26 13:17:00 tenant admission is closed for shutdown
2026/11/26 13:17:00 activator: next-due probe plain-3722ed4a.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/26 13:17:00 activator: plain-3722ed4a.example.test hibernated
--- PASS: TestHeldHandoverTwoBoxMinio (0.62s)
=== RUN TestHeldHandoverLostLeaseMinio
2026/11/26 13:17:00 edge: mesh key: minted
2026/11/26 13:17:00 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/26 13:17:00 provision: minted sidecar route bot0.shop.bac.sidecar.internal (app "shop" acct "bac" args ["work"])
2026/11/26 13:17:00 tenant admission is open. accepting tenant work
2026/11/26 13:17:00 activator: HA placement host=shop-74194185.example.test kind=Place ref=annie reason=roomiest generation=2026-11-26T13:17:00Z lock_generation=0
2026/11/26 13:17:00 lease: t8-74194185/shop-74194185.example.test: HA lease acquired in 5ms (first wake)
2026/11/26 13:17:00 activator: shop-74194185.example.test: restored (no-marker): first wake, the prefix proven empty, booting fresh
2026/11/26 13:17:00 activator: shop-74194185.example.test: started carlos-instance@shop\x2d74194185.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/26 13:17:00 activator: shop-74194185.example.test: carlos-instance@shop\x2d74194185.example.test.service launched in 7ms, healthy 0s later
2026/11/26 13:17:01 activator: shop-74194185.example.test: woke in 68ms: checks 0s, lease 6ms, restore 0s, identity 0s, protect 0s, spawn 8ms, replicate 54ms
2026/11/26 13:17:01 activator: next-due probe shop-74194185.example.test: decode /api/next-due: invalid character 'a' looking for beginning of value — recording none (it sleeps until a request)
2026/11/26 13:17:01 activator: final checkpoint shop-74194185.example.test: lease: release marker owed for s3://contract-bucket/t8-74194185/shop-74194185.example.test/lock.json (If-Match "d5e9c8f06e119db3e2c93780880a1b83"): lease: write release marker: operation error S3: PutObject, https response error StatusCode: 503, RequestID: , HostID: , api error ServiceUnavailable: witness: refused
2026/11/26 13:17:01 activator: shop-74194185.example.test hibernated
2026/11/26 13:17:01 activator: handover of shop-74194185.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-74194185.example.test client 4 "
hadrain_twobox_minio_linux_test.go:1486: driver calls: [begin shop-74194185.example.test <nil> releasing shop-74194185.example.test <nil> stop shop-74194185.example.test marker=false clean=false <nil> left shop-74194185.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/26 13:17:01 tenant admission is closed for shutdown
2026/11/26 13:17:01 http: proxy error: context canceled
--- PASS: TestHeldHandoverLostLeaseMinio (0.32s)
PASS
ok github.com/carlosframework/platform/internal/host 0.987s
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/26 13:17:02 lease: instances/gen-1795699022366494922.shop.example.com: HA lease acquired in 5ms (first wake)
2026/11/26 13:17:02 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/26 13:17:02 lease: instances/gen-1795699022366494922.shop.example.com: HA lease acquired in 3ms (holder terminated)
gentake_minio_test.go:308: a second create-only copy onto instances/gen-1795699022366494922.shop.example.com/g-00000000000000000002/0009/0000000000000001-0000000000000001.ltx: <nil> (destination condition honoured: false)
2026/11/26 13:17:02 ERROR retention enforcement failed system=store db=w.example.com.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
=== RUN TestGenerationTakeMinio/switch-412
2026/11/26 13:17:02 lease: instances/gen-1795699022597362717.shop.example.com: HA lease acquired in 4ms (first wake)
2026/11/26 13:17:02 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/26 13:17:02 lease: instances/gen-1795699022597362717.shop.example.com: HA lease acquired in 3ms (clean marker)
=== RUN TestGenerationTakeMinio/copy-version
=== RUN TestGenerationTakeMinio/store-time
2026/11/26 13:17:02 lease: instances/gen-1795699022696478626.shop.example.com: HA lease acquired in 3ms (first wake)
2026/11/26 13:17:02 ERROR retention enforcement failed system=store db=seed.db error="enforce snapshot retention: remove ltx files: lease: invalid or changed generation binding"
2026/11/26 13:17:02 lease: instances/gen-1795699022696478626.shop.example.com: HA lease acquired in 3ms (clean marker)
2026/11/26 13:17:02 lease: instances/gen-1795699022696478626.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/26 13:17:02 lease: instances/gen-1795699022696478626.shop.example.com: HA lease acquired in 2ms (unclean marker)
2026/11/26 13:17:02 lease: instances/gen-1795699022696478626.shop.example.com: HA lease acquired in 3ms (unclean marker)
2026/11/26 13:17:02 lease: instances/gen-1795699022696478626.shop.example.com: HA lease acquired in 3ms (unclean marker)
=== RUN TestGenerationTakeMinio/skew
--- PASS: TestGenerationTakeMinio (0.50s)
--- PASS: TestGenerationTakeMinio/take (0.23s)
--- PASS: TestGenerationTakeMinio/switch-412 (0.09s)
--- PASS: TestGenerationTakeMinio/copy-version (0.01s)
--- PASS: TestGenerationTakeMinio/store-time (0.16s)
--- PASS: TestGenerationTakeMinio/skew (0.01s)
PASS
ok github.com/carlosframework/platform/internal/lease 0.515s
minio contract: PASS
=== staticcheck ===
go version go1.26.10 linux/arm64
go: downloading honnef.co/go/tools v0.8.2
go: downloading golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678
go: downloading github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
go: downloading golang.org/x/sync v0.23.0
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
staticcheck: clean
=== govulncheck ===
go version go1.26.10 linux/arm64
go: downloading golang.org/x/vuln v1.8.0
go: downloading golang.org/x/telemetry v0.0.0-20260908163034-4bcc4b2ee518
go: downloading golang.org/x/tools v0.50.0
govulncheck: scanned github.com/carlosframework/platform, amadan.net/carlos/platform.git/launchctx
GO-2026-6859 called stdlib@v1.26.10, fixed in v1.26.11
HTTP/1 server crash due to MaxBytesReader header race in net/http
excepted until 2027-01-31 (.amadan/govulncheck-exceptions.tsv:9): net/http MaxBytesReader header race, fixed in go1.26.11. CI and releases stay on go1.26.10 because 1.26.11 deadlocks the edge's Expect: 100-continue path (#897, .amadan/go-toolchain.sh); #904 checked every production MaxBytesReader site and found it unreachable.
GO-2026-5932 required golang.org/x/crypto@v0.58.0, fixed in v0.58.1-0.20261009181718-2f1f834330b2
The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues
not fatal: no call path to the vulnerable code
govulncheck: clean (2 finding(s), none called outside .amadan/govulncheck-exceptions.tsv)
=== code-health ===
go version go1.26.10 linux/arm64
codehealth_test.go:42: scanned in 1m51.663s
codehealth_test.go:107: line metrics (code lines, then physical):
file-lines 5471 7324 internal/activator activator_test.go
file-lines 4200 7033 internal/console server.go
file-lines 4175 6358 . apimode.go
file-lines 3785 7224 internal/activator activator.go
file-lines 3530 4459 . apimode_test.go
file-lines 3261 3864 internal/registry registry_test.go
file-lines 3209 6395 internal/host agent.go
file-lines 3094 3992 internal/provision reconcile_test.go
func-lines 870 891 internal/host plan14InstalledClaimLaunch
func-lines 810 1275 internal/provision Reconcile
func-lines 769 1242 internal/console (*Server).handleAPIInstanceCreate
func-lines 688 1243 internal/host runAgent
func-lines 571 908 internal/activator (*Service).doWakeOnce
func-lines 538 546 internal/host runServingParkPeerNamespace
func-lines 519 712 . runRoute
func-lines 509 569 internal/host TestPagingIsRateLimited
func-lines 494 815 internal/release adoptHost
func-lines 441 500 internal/host TestRootInstanceStopExecStop
func-lines 421 436 internal/host (*ClaimWakeAssembly).Build
func-lines 421 437 internal/team TestFixture
func-lines 412 414 internal/console TestDemoProtectionsSourceToLimitAndTakedown
func-lines 408 485 . TestFleetAppServesThroughTheHub
func-lines 402 406 internal/registry (*Registry).haJournal
func-lines 400 868 internal/provision rootReadArchivedChain
func-lines 399 732 internal/release PassFilter
func-lines 390 398 internal/host runFilesSeedPreparationWithLive
func-lines 383 406 internal/console TestDemoSourceToLiveAndUpdate
func-lines 378 898 internal/edge (*Edge).ServeHTTP
func-lines 374 377 internal/host plan14RequiredArtifactsRootRunner
func-lines 371 417 internal/host TestRootEgressKernelProof
func-lines 367 584 internal/console (*Server).handleAPIShip
func-lines 366 636 cmd/console serve
func-lines 364 371 internal/host testRootMigrationBootstrap
func-lines 360 362 internal/edge TestDemoAPIAliasBoundary
func-lines 357 358 internal/registry (*Registry).dispatchRemote
func-lines 355 372 internal/host TestRootSandboxUpdateFromOldBox
func-lines 343 354 internal/analytics Prune
func-lines 340 353 internal/host newColdRootHarness
func-lines 335 557 internal/console (*Store).migrate
func-lines 334 334 internal/host TestPlan12RecoveryRestoreSourceDatabase
func-lines 330 371 internal/edge TestRegionalNameNeverLeavesItsRegion
func-lines 329 471 . runDeploy
func-lines 329 329 internal/host TestPlan12RecoveryRestoreSourceDatabase.func1
func-lines 327 369 internal/edge TestTunnelWebSocketEndToEnd
func-lines 325 455 internal/objstore TestDeliveredContractMinio
func-lines 320 654 internal/appconfig SyncExecWithCallbacks
func-lines 315 318 internal/host plan14TimerIntention
func-lines 311 314 internal/host plan14TimerIntention.func1
func-lines 310 315 internal/hostbox ColdHandover.Run
func-lines 308 309 internal/host rootFilesSeedIsolatedWitness
func-lines 305 323 internal/host hairpinKernelWitness
func-lines 304 308 internal/console TestHAP2ProductionDoors
func-lines 302 329 internal/host TestRootG2PoolIngress
release-importers: . cmd/console internal/activator internal/analytics internal/appconfig internal/apperr internal/applog internal/apppolicy internal/boxid internal/boxvolumes internal/console internal/dbreads internal/dbreads/dbreadstest internal/dbverify internal/demobuild internal/domains internal/doorkey internal/edge internal/edgeproof internal/edgesfile internal/fleetapi internal/grouproll internal/grouprollaws internal/historyreadback internal/host internal/hostactors internal/hostbox internal/hostclaim internal/hostevidence internal/hostexec internal/hostfence internal/hostfiles internal/hostfloor internal/hostguard internal/hostops internal/hostrelocate internal/hostresolve internal/instancectl internal/instanceupdates internal/interactive internal/layout internal/lease internal/ledger internal/mail internal/mailer internal/mailsubmit internal/metrics internal/moves internal/objstore internal/ops internal/park internal/plans internal/provision internal/relay internal/rollout internal/rootfsimage internal/runs internal/s3fake internal/schedule internal/seeds internal/status internal/telemetry internal/usage internal/vet scripts/pathmapcheck scripts/witness-pointer
not scanned (216 files):
cmd/carlos-media/drill_other.go: built only for other systems or tags
cmd/carlos-media/harden_other.go: built only for other systems or tags
cmd/console/fleetsocket_other.go: built only for other systems or tags
cmd/console/servelock_windows.go: built only for other systems or tags
cmd/moveprobe/detach_windows.go: built only for other systems or tags
cmd/rootfswitness/mmap_other.go: built only for other systems or tags
devbox_acl_other.go: built only for other systems or tags
devbox_envfile_darwin_test.go: built only for other systems or tags
devbox_envfile_other.go: built only for other systems or tags
domains_transfer_signals_other.go: built only for other systems or tags
interactive_term_darwin.go: built only for other systems or tags
interactive_term_other.go: built only for other systems or tags
internal/activator/claimprocess_root_other.go: built only for other systems or tags
internal/activator/escrow_stamp_other.go: built only for other systems or tags
internal/activator/fleetreserve_other.go: built only for other systems or tags
internal/activator/harecord_other.go: built only for other systems or tags
internal/activator/ownenv_other.go: built only for other systems or tags
internal/activator/pty_other.go: built only for other systems or tags
internal/activator/race_on_test.go: built only for other systems or tags
internal/activator/rolelaunch_other.go: built only for other systems or tags
internal/assetcache/statfs_other.go: built only for other systems or tags
internal/boxself/io_other.go: built only for other systems or tags
internal/cgroup/cleanup_other.go: built only for other systems or tags
internal/cgroup/cleanup_other_test.go: built only for other systems or tags
internal/cgroup/hostprocs_other.go: built only for other systems or tags
internal/cgroup/recreate_other.go: built only for other systems or tags
internal/cgroup/role_other.go: built only for other systems or tags
internal/cgroup/shim_other.go: built only for other systems or tags
internal/cgroup/strict_other.go: built only for other systems or tags
internal/cgroup/verify_other.go: built only for other systems or tags
internal/console/claim_sql_identity_other.go: built only for other systems or tags
internal/console/geoipverify_other.go: built only for other systems or tags
internal/console/hostreports_process_other.go: built only for other systems or tags
internal/console/replicaview_other.go: built only for other systems or tags
internal/console/restore_sim_nice_other_test.go: built only for other systems or tags
internal/console/scalecost_other_test.go: built only for other systems or tags
internal/console/seedscratch_windows.go: built only for other systems or tags
internal/dbreads/worker_other.go: built only for other systems or tags
internal/demobuild/security_other.go: built only for other systems or tags
internal/democlaim/source_other.go: built only for other systems or tags
internal/devbox/peer_darwin.go: built only for other systems or tags
internal/devbox/peer_darwin_test.go: built only for other systems or tags
internal/devbox/peer_other.go: built only for other systems or tags
internal/devbox/socketcheck_other.go: built only for other systems or tags
internal/domains/certimport_read_portable.go: built only for other systems or tags
internal/edge/devboxpeer_other.go: built only for other systems or tags
internal/edge/hairpin_other.go: built only for other systems or tags
internal/edge/heldbudget_other.go: built only for other systems or tags
internal/edge/purge_listen_unix.go: built only for other systems or tags
internal/edge/purge_listen_windows.go: built only for other systems or tags
internal/edge/race_on_test.go: built only for other systems or tags
internal/edge/replicaconsole_owner_other.go: built only for other systems or tags
internal/edge/replicaconsole_peer_other.go: built only for other systems or tags
internal/edge/replicaconsole_socket_other_test.go: built only for other systems or tags
internal/edge/static_artifact_other.go: built only for other systems or tags
internal/edge/static_recordlock_other.go: built only for other systems or tags
internal/edge/static_sweep_other.go: built only for other systems or tags
internal/execsandbox/cleanup_other.go: built only for other systems or tags
internal/execsandbox/file_other.go: built only for other systems or tags
internal/execsandbox/oci_other.go: built only for other systems or tags
internal/fileacl/fileacl_darwin.go: built only for other systems or tags
internal/fileacl/fileacl_darwin_amd64.s: built only for other systems or tags
internal/fileacl/fileacl_darwin_arm64.s: built only for other systems or tags
internal/fileacl/fileacl_darwin_test.go: built only for other systems or tags
internal/grouproll/state_other.go: built only for other systems or tags
internal/grouprollaws/pty_darwin.go: built only for other systems or tags
internal/grouprollaws/pty_other.go: built only for other systems or tags
internal/hairpin/native_other.go: built only for other systems or tags
internal/host/applylock_other_test.go: built only for other systems or tags
internal/host/bootstrapfs_other.go: built only for other systems or tags
internal/host/boxroles_config_other.go: built only for other systems or tags
internal/host/claimfilesseed_delegation_other.go: built only for other systems or tags
internal/host/claimfilesseed_transport_other.go: built only for other systems or tags
internal/host/claimjournal_containment_other.go: built only for other systems or tags
internal/host/claimjournal_migration_other.go: built only for other systems or tags
internal/host/claimlaunch_kernel_other.go: built only for other systems or tags
internal/host/claimlaunch_rev2_other_test.go: built only for other systems or tags
internal/host/claimproduction_other.go: built only for other systems or tags
internal/host/claimready_other.go: built only for other systems or tags
internal/host/claimroleassembly_other.go: built only for other systems or tags
internal/host/claimservingartifact_other.go: built only for other systems or tags
internal/host/claimservinghandover_reboot_other.go: built only for other systems or tags
internal/host/claimservinghandover_reboot_other_test.go: built only for other systems or tags
internal/host/claimservingpark_other.go: built only for other systems or tags
internal/host/claimstate_other.go: built only for other systems or tags
internal/host/claimstop_kernel_other.go: built only for other systems or tags
internal/host/claimtoken_inventory_other.go: built only for other systems or tags
internal/host/claimunit_dropin_other.go: built only for other systems or tags
internal/host/claimunit_files_other.go: built only for other systems or tags
internal/host/claimunit_migrate_other.go: built only for other systems or tags
internal/host/claimunit_ready_other.go: built only for other systems or tags
internal/host/claimunit_socket_migration_other.go: built only for other systems or tags
internal/host/consolefleet_owner_other.go: built only for other systems or tags
internal/host/dbreads_other.go: built only for other systems or tags
internal/host/egress_rail_other.go: built only for other systems or tags
internal/host/fileowner_other.go: built only for other systems or tags
internal/host/flock_windows.go: built only for other systems or tags
internal/host/group_config_other.go: built only for other systems or tags
internal/host/group_maintenance_other.go: built only for other systems or tags
internal/host/group_maintenance_verbs_other.go: built only for other systems or tags
internal/host/group_receipt_other.go: built only for other systems or tags
internal/host/hadrain_call_other.go: built only for other systems or tags
internal/host/hadrain_socket_other.go: built only for other systems or tags
internal/host/hadrainfence_other.go: built only for other systems or tags
internal/host/headroom_other.go: built only for other systems or tags
internal/host/installchannel_other.go: built only for other systems or tags
internal/host/managedboot_other.go: built only for other systems or tags
internal/host/metrics_nested_other.go: built only for other systems or tags
internal/host/movesfloor_other.go: built only for other systems or tags
internal/host/movesfloorgate_other.go: built only for other systems or tags
internal/host/movesheldrelease_other.go: built only for other systems or tags
internal/host/movesmeasure_other.go: built only for other systems or tags
internal/host/offcloudcredentials_other.go: built only for other systems or tags
internal/host/registrychild_exec_other.go: built only for other systems or tags
internal/host/registrychild_other.go: built only for other systems or tags
internal/host/registryowner_chown_other.go: built only for other systems or tags
internal/host/registryowner_descriptor_unix.go: built only for other systems or tags
internal/host/replicahealth_other.go: built only for other systems or tags
internal/host/rootgeneration_census_other.go: built only for other systems or tags
internal/host/rootgeneration_kernel_other.go: built only for other systems or tags
internal/host/rootgeneration_payload_other.go: built only for other systems or tags
internal/host/rootgeneration_retired_other.go: built only for other systems or tags
internal/host/rootmigration_production_other.go: built only for other systems or tags
internal/host/runscset_other.go: built only for other systems or tags
internal/host/sandboxenv_other.go: built only for other systems or tags
internal/host/statfs_windows.go: built only for other systems or tags
internal/host/systemapply_other.go: built only for other systems or tags
internal/hostbox/census_vendor_other.go: built only for other systems or tags
internal/hostbox/inventory_identity_other.go: built only for other systems or tags
internal/hostbox/journalmigration_other.go: built only for other systems or tags
internal/hostbox/journalnamespace_other.go: built only for other systems or tags
internal/hostbox/journaltrust_other.go: built only for other systems or tags
internal/hostbox/migration_census_other.go: built only for other systems or tags
internal/hostbox/typedpark_other.go: built only for other systems or tags
internal/hostenv/group_other.go: built only for other systems or tags
internal/hostenv/write_other.go: built only for other systems or tags
internal/hostenv/write_other_test.go: built only for other systems or tags
internal/hostexec/clock_other.go: built only for other systems or tags
internal/hostexec/clock_other_test.go: built only for other systems or tags
internal/hostexec/local_other.go: built only for other systems or tags
internal/hostexec/pending_other.go: built only for other systems or tags
internal/hostexec/probe_other.go: built only for other systems or tags
internal/hostexec/rootprocess_other.go: built only for other systems or tags
internal/hostfiles/dir_other.go: built only for other systems or tags
internal/hostfiles/refuse_other.go: built only for other systems or tags
internal/hostfiles/watch_other.go: built only for other systems or tags
internal/hostfloor/controllers_other.go: built only for other systems or tags
internal/hostfloor/image_other.go: built only for other systems or tags
internal/hostguard/flock_other.go: built only for other systems or tags
internal/hostguard/flock_other_test.go: built only for other systems or tags
internal/hostguard/record_other.go: built only for other systems or tags
internal/instancectl/claimexec_other.go: built only for other systems or tags
internal/instancectl/claimexec_socket_other.go: built only for other systems or tags
internal/instancectl/claimlaunch_snapshot_other.go: built only for other systems or tags
internal/instancectl/claimnetwork_other.go: built only for other systems or tags
internal/instancectl/demo_snapshot_other.go: built only for other systems or tags
internal/instancectl/egress_cgroup_other.go: built only for other systems or tags
internal/instancectl/egress_dropin_other.go: built only for other systems or tags
internal/instancectl/fleetsize_other.go: built only for other systems or tags
internal/instancectl/gvisorprobe_other.go: built only for other systems or tags
internal/instancectl/peer_other.go: built only for other systems or tags
internal/instancectl/peer_tuple_other.go: built only for other systems or tags
internal/instancectl/rootfs_identity_other.go: built only for other systems or tags
internal/instanceexec/claimexec_other.go: built only for other systems or tags
internal/instanceexec/exec_rootfs_other.go: built only for other systems or tags
internal/instanceexec/netlink_route_other.go: built only for other systems or tags
internal/instanceexec/probe_gvisor_other.go: built only for other systems or tags
internal/instanceexec/probe_hardening_other.go: built only for other systems or tags
internal/instanceexec/probe_other.go: built only for other systems or tags
internal/instanceexec/probe_rootfs_other.go: built only for other systems or tags
internal/instanceexec/sandbox_other.go: built only for other systems or tags
internal/instanceexec/scope_other.go: built only for other systems or tags
internal/instanceexec/stop_other.go: built only for other systems or tags
internal/instanceexec/tty_other.go: built only for other systems or tags
internal/instancefs/instancefs_other.go: built only for other systems or tags
internal/launchd/activate_darwin.go: built only for other systems or tags
internal/launchd/activate_darwin_amd64.s: built only for other systems or tags
internal/launchd/activate_darwin_arm64.s: built only for other systems or tags
internal/launchd/activate_darwin_test.go: built only for other systems or tags
internal/layout/journal_other.go: built only for other systems or tags
internal/layout/links_other.go: built only for other systems or tags
internal/mailer/keys_other.go: built only for other systems or tags
internal/maintenanceexec/run_other.go: built only for other systems or tags
internal/managedboot/admission_other.go: built only for other systems or tags
internal/managedboot/identity_other.go: built only for other systems or tags
internal/mediahandler/collect_other.go: built only for other systems or tags
internal/mediahandler/procs_other.go: built only for other systems or tags
internal/medialocal/runner_other.go: built only for other systems or tags
internal/moves/archive/open_other.go: built only for other systems or tags
internal/moves/archive/sync_other.go: built only for other systems or tags
internal/ops/flock_windows.go: built only for other systems or tags
internal/park/local_other.go: built only for other systems or tags
internal/privatefile/io_other.go: built only for other systems or tags
internal/proxyproto/peek_other.go: built only for other systems or tags
internal/relay/race_on_test.go: built only for other systems or tags
internal/release/consumedfence_other.go: built only for other systems or tags
internal/release/digestcache_other.go: built only for other systems or tags
internal/rootaws/credentials_other.go: built only for other systems or tags
internal/rootaws/open_darwin.go: built only for other systems or tags
internal/rootfsimage/dir_other.go: built only for other systems or tags
internal/rootstate/authoritydir_other.go: built only for other systems or tags
internal/rootstate/authorityfile_other.go: built only for other systems or tags
internal/rootstate/file_other.go: built only for other systems or tags
internal/rootstate/link_other.go: built only for other systems or tags
internal/rootstate/persistent_other.go: built only for other systems or tags
internal/rootstate/state_other.go: built only for other systems or tags
internal/safefile/file_other.go: built only for other systems or tags
internal/safefile/reap_other.go: built only for other systems or tags
internal/stopevidence/fds_other.go: built only for other systems or tags
internal/stopevidence/fds_other_test.go: built only for other systems or tags
internal/stopevidence/holders_other.go: built only for other systems or tags
internal/stopevidence/reconstruct_other.go: built only for other systems or tags
internal/team/storelock_other.go: built only for other systems or tags
internal/team/storelock_windows.go: built only for other systems or tags
move_offline_run_other.go: built only for other systems or tags
system_group_other.go: built only for other systems or tags
codehealth_test.go:115: fatal 1094 at 474 sites log.Fatal*, (*log.Logger).Fatal* and os.Exit in the root package's production files
codehealth_test.go:115: sleep 1005 at 811 sites time.Sleep in test files
codehealth_test.go:115: db-no-context 885 at 703 sites database calls with no context (dbOpWithoutContext) in production files
codehealth_test.go:115: host-context 188 at 142 sites context.Background and context.TODO in internal/host production files
codehealth_test.go:115: func-lines 18604 at 45 sites functions over 300 code lines (blank and comment-only lines not counted)
codehealth_test.go:115: file-lines 30725 at 8 sites files over 3,000 code lines, counted the same way
codehealth_test.go:115: release-importers 66 at 1 sites packages whose production files import internal/release
codehealth_test.go:119: below the record: file-lines internal/console server.go -: 4200 in the code, the record allows 4210 (make code-health-record lowers it)
--- PASS: TestCodeHealth (111.67s)
PASS
ok github.com/carlosframework/platform/internal/codehealth 113.077s
=== code-health-record ===
go version go1.26.10 linux/arm64
code-health record: comparing with the merge base 631f2258224906deac3cfaf7a940317485cb37cb (main is 631f2258224906deac3cfaf7a940317485cb37cb)
=== RUN TestRecordAgainstBase
--- PASS: TestRecordAgainstBase (0.01s)
PASS
ok github.com/carlosframework/platform/internal/codehealth 0.008s
code-health record: no line went up without a reason
=== race ===
go version go1.26.10 linux/arm64
GATE_RACE=1 .amadan/test-gate.sh
=== internal_systemd@0 (13 s, from +15 s)
ok github.com/carlosframework/platform/internal/systemd 13.543s
=== internal_rootaws@0 (26 s, from +34 s)
ok github.com/carlosframework/platform/internal/rootaws 25.528s
=== internal_activator@0 (269 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 266.955s
=== internal_activator@1 (264 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 261.983s
=== internal_activator@2 (277 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 275.294s
=== internal_activator@3 (424 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 422.397s
=== internal_activator@4 (277 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 274.943s
=== internal_activator@5 (312 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 310.360s
=== internal_activator@6 (319 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 317.631s
=== internal_activator@7 (408 s, from +112 s)
ok github.com/carlosframework/platform/internal/activator 406.724s
=== internal_edge@0 (84 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 81.098s
=== internal_edge@1 (133 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 129.694s
=== internal_edge@2 (222 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 219.066s
=== internal_edge@3 (132 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 128.919s
=== internal_edge@4 (150 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 146.375s
=== internal_edge@5 (237 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 233.937s
=== internal_edge@6 (213 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 209.932s
=== internal_edge@7 (274 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 270.365s
=== internal_edge@8 (231 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 228.167s
=== internal_edge@9 (269 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 266.200s
=== internal_edge@10 (222 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 218.875s
=== internal_edge@11 (219 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 215.608s
=== internal_edge@12 (245 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 241.354s
=== internal_edge@13 (247 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 243.702s
=== internal_edge@14 (194 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 191.154s
=== internal_edge@15 (233 s, from +135 s)
ok github.com/carlosframework/platform/internal/edge 229.507s
=== internal_host@0 (8 s, from +196 s)
ok github.com/carlosframework/platform/internal/host 5.023s
=== internal_host@1 (17 s, from +196 s)
ok github.com/carlosframework/platform/internal/host 13.500s
=== lists: internal_edge 134 s, internal_activator 111 s, internal_host 195 s, internal_rootaws 34 s, internal_systemd 14 s
=== cpu: the gate used 7649 cpu-seconds in 536 s, about 14.3 of 32 cores; the machine as a whole was 44% busy
=== gitleaks ===
go version go1.26.10 linux/arm64
go: downloading github.com/zricethezav/gitleaks/v8 v8.30.1
go: downloading github.com/rs/zerolog v1.33.0
go: downloading github.com/spf13/cobra v1.9.1
go: downloading github.com/charmbracelet/lipgloss v0.5.0
go: downloading github.com/spf13/viper v1.19.0
go: downloading github.com/BobuSumisu/aho-corasick v1.0.3
go: downloading golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa
go: downloading github.com/hashicorp/go-version v1.7.0
go: downloading github.com/Masterminds/sprig/v3 v3.3.0
go: downloading github.com/fatih/semgroup v1.2.0
go: downloading github.com/gitleaks/go-gitdiff v0.9.1
go: downloading github.com/mholt/archives v0.1.2
go: downloading github.com/h2non/filetype v1.1.3
go: downloading golang.org/x/sync v0.11.0
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading github.com/muesli/termenv v0.15.1
go: downloading github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68
go: downloading github.com/huandu/xstrings v1.5.0
go: downloading github.com/spf13/cast v1.7.1
go: downloading golang.org/x/crypto v0.35.0
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading dario.cat/mergo v1.0.1
go: downloading github.com/mattn/go-colorable v0.1.14
go: downloading github.com/mitchellh/copystructure v1.2.0
go: downloading github.com/shopspring/decimal v1.4.0
go: downloading github.com/Masterminds/semver/v3 v3.3.0
go: downloading github.com/spf13/pflag v1.0.6
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading golang.org/x/sys v0.30.0
go: downloading github.com/mitchellh/reflectwalk v1.0.2
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
go: downloading golang.org/x/text v0.22.0
go: downloading github.com/klauspost/compress v1.17.11
go: downloading github.com/sorairolake/lzip-go v0.3.5
go: downloading github.com/minio/minlz v1.0.0
go: downloading github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707
go: downloading github.com/ulikunitz/xz v0.5.12
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/bodgit/sevenzip v1.6.0
go: downloading github.com/nwaples/rardecode/v2 v2.1.0
go: downloading github.com/STARRY-S/zip v0.2.1
go: downloading github.com/klauspost/pgzip v1.2.6
go: downloading github.com/andybalholm/brotli v1.1.2-0.20250424173009-453214e765f3
go: downloading github.com/therootcompany/xz v1.0.1
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/spf13/afero v1.12.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/pelletier/go-toml/v2 v2.2.3
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/subosito/gotenv v1.6.0
go: downloading github.com/magiconair/properties v1.8.9
go: downloading github.com/fsnotify/fsnotify v1.8.0
go: downloading github.com/bodgit/plumbing v1.3.0
go: downloading github.com/bodgit/windows v1.0.1
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading go4.org v0.0.0-20230225012048-214862532bf5
go: downloading github.com/hashicorp/golang-lru/v2 v2.0.7
go: downloading github.com/hashicorp/errwrap v1.1.0
self-test: reported source file: a key
self-test: reported source file: a 64-hex key
self-test: reported source file: a census-shaped entry
self-test: reported source file: a key marked gitleaks:allow
self-test: reported source file: a test's fake value outside tests
self-test: reported allowed file: another key beside its allowed value
self-test: reported a tracked file named gitleaks-gate-sentinel.env
self-test: reported 97 near misses of the names notscanned.go lists
self-test: skipped the 32 files notscanned.go lists
self-test: refused a notscanned.go entry git does not track
self-test: refused a config that does not parse
self-test: refused a config that does not exist
self-test: refused a missing gitleaks binary
self-test: 6 planted keys reported, 130 tracked files judged, 3 broken setups refused
gitleaks: scanned 11719 tracked files; 32 not scanned, by exact path (scripts/gitleaks-gate/notscanned.go)
gitleaks: clean
diff --git a/docs/parity.md b/docs/parity.md| index 97a8ca7ad..8e262fba4 100644 |
| --- a/docs/parity.md |
| +++ b/docs/parity.md |
| @@ -28,7 +28,7 @@ CLI rows are checked against the command registry (`parity/cli.tsv`). |
| | auth-login | cli-only | `auth login` | | | Signs this terminal in; the browser half is an auth row. | |
| | auth-identity | cli-only | `auth whoami`<br>`auth logout`<br>`auth default` | | | This terminal's own identity and default console. | |
| | account-delete | console-only | | `POST /a/{sqid}/delete` | | Deleting an account needs a passkey. | |
| -| dpa-accept | console-only | | `GET /a/{sqid}/settings`<br>`GET /a/{sqid}/settings/dpa`<br>`POST /a/{sqid}/dpa/accept` | | An owner accepts the data processing agreement, and confirms with a passkey. | |
| +| dpa-accept | console-only | | `GET /a/{sqid}/settings`<br>`GET /a/{sqid}/settings/dpa`<br>`GET /a/{sqid}/settings/dpa.pdf`<br>`POST /a/{sqid}/dpa/accept` | | An owner accepts the data processing agreement, and confirms with a passkey. | |
| | plan-keep | gap | | `GET /a/{sqid}/plan/keep`<br>`POST /a/{sqid}/plan/keep` | [wp-cli-verbs](#wp-cli-verbs) | Choosing which apps to keep when a plan lapses. | |
| | getting-started | console-only | | `POST /a/{sqid}/getting-started/hide`<br>`POST /a/{sqid}/getting-started/show`<br>`POST /a/{sqid}/getting-started/skip`<br>`POST /a/{sqid}/getting-started/done` | | A checklist in the page. | |
| | nav-index | console-only | | `GET /a/{sqid}/index`<br>`GET /a/{sqid}/apps/{app}/index`<br>`GET /a/{sqid}/apps/{app}/settings/index` | | Phone navigation pages that list sections. | |
diff --git a/docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md b/docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md| new file mode 100644 |
| index 000000000..82b8d9a4e |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md |
| @@ -0,0 +1,31 @@ |
| +# DPA PDF: copy deck |
| + |
| +Every new user-facing string of the DPA PDF plan (`2026-11-26-dpa-pdf.md`). The gate is |
| +`internal/console/approved_dpa_pdf_copy_test.go` (`TestDPAPDFCopyDeckIsApprovedAndApplied`). |
| + |
| +Approved 2026-11-26 by Paul in copy review, all 18 rows unchanged from the draft, with an |
| +HTML mockup of the PDF as the preview. Rules as `2026-11-25-dpa-acceptance-copy.md`: a row |
| +with `{placeholders}` is checked by the named test, which renders it filled in; other rows are |
| +found literally by the gate once their id is in `dpaPDFCopyBuilt`. The PDF also reuses approved |
| +DPA-C36/C37 (processor line) and DPA-C38 (fingerprint hint) from the acceptance deck. |
| + |
| +| id | where | old | new | checked by | status | |
| +| --- | --- | --- | --- | --- | --- | |
| +| PDF-C01 | internal/console/templates/dpa_pdf.html (pdf) [pdf.title] | (new) | Data processing agreement | gate | approved | |
| +| PDF-C02 | internal/console/templates/dpa_pdf.html (pdf) [pdf.version_line] | (new) | Version {version} | TestDPAPDFCopy | approved | |
| +| PDF-C03 | internal/console/templates/dpa_pdf.html (pdf) [pdf.parties.heading] | (new) | The parties | gate | approved | |
| +| PDF-C04 | internal/console/templates/dpa_pdf.html (pdf) [pdf.parties.processor] | (new) | Processor | gate | approved | |
| +| PDF-C05 | internal/console/templates/dpa_pdf.html (pdf) [pdf.parties.customer] | (new) | Customer | gate | approved | |
| +| PDF-C06 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.heading] | (new) | Acceptance | gate | approved | |
| +| PDF-C07 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.customer_line] | (new) | Accepted electronically in the {console} console by {accepted_by}, on {date} at {time} UTC. | TestDPAPDFCopy | approved | |
| +| PDF-C08 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.signer_line] | (new) | For the customer: {signer_name}, {signer_role}, {legal_name}. | TestDPAPDFCopy | approved | |
| +| PDF-C09 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.processor_line] | (new) | For the processor: {signatory}. The agreement was formed when the customer accepted it. | TestDPAPDFCopy | approved | |
| +| PDF-C10 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.document] | (new) | Agreement text: {url} | TestDPAPDFCopy | approved | |
| +| PDF-C11 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.fingerprint] | (new) | Fingerprint of the text (SHA-256): {sha256} | TestDPAPDFCopy | approved | |
| +| PDF-C12 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.fingerprint_hint] | (new) | The fingerprint changes if a single character of the agreement changes, so it proves which text was accepted. | gate | approved | |
| +| PDF-C13 | internal/console/templates/dpa_pdf.html (pdf) [pdf.exec.record] | (new) | Record {id} in the {console} console. | TestDPAPDFCopy | approved | |
| +| PDF-C14 | internal/console/templates/dpa_pdf_footer.html (footer) [pdf.footer.page] | (new) | Page {page} of {pages} | TestDPAPDFCopy | approved | |
| +| PDF-C15 | internal/console/dpapdfroute.go (filename) [pdf.filename] | (new) | data-processing-agreement-v{version}.pdf | TestDPAPDFCopy | approved | |
| +| PDF-C16 | internal/console/templates/dpa_record.html (button) [record.download] | (new) | Download PDF | gate | approved | |
| +| PDF-C17 | internal/console/dpapdfroute.go (message) [record.pdf_failed] | (new) | We couldn't make the PDF just now. Try again in a minute, or print this page instead. | gate | approved | |
| +| PDF-C18 | internal/console/dpapane.go (confirmation email) [email.pdf_line] | (new) | Download it as a PDF: {pdf_url} | TestDPAAcceptEmailPDFLine | approved | |
diff --git a/docs/superpowers/plans/2026-11-26-dpa-pdf.md b/docs/superpowers/plans/2026-11-26-dpa-pdf.md| new file mode 100644 |
| index 000000000..ea7071a5f |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-26-dpa-pdf.md |
| @@ -0,0 +1,83 @@ |
| +# DPA PDF on headed paper (slice 2) Implementation Plan |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Any member of an account with a DPA in force can download the executed agreement as a PDF on the operator's letterhead. |
| + |
| +**Architecture:** A pure function builds one self-contained HTML document (agreement body, filled-in parties, execution page; logo as an `<img>` data URI) plus header and footer HTML; a small client posts them to the PDF engine the console already proxies for tenants (`Config.PDFEngine`, Gotenberg `forms/chromium/convert/html`) with a 30-second deadline and a 10 MiB response cap; a member-gated route streams the result. Nothing is cached or stored. |
| + |
| +**Tech Stack:** Go, `internal/console` (html/template, net/http, multipart), Gotenberg 8 Chromium route. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-25-dpa-and-retention-design.md` rev 5, §3.8 (and §3.3 for the record). Slice 1 is merged (9553905, 7a4e16e). |
| + |
| +## Global Constraints |
| + |
| +- Route `GET /a/{sqid}/settings/dpa.pdf`: gate `s.account` (any member; byte-identical 404 for non-members), then `allowWrite` as a cost bound, then render. No acceptance in force: the same 404 as the record page gives a member. |
| +- The PDF uses the acceptance's own `DocumentID` and `LetterheadID`, never the current ones. |
| +- The agreement body is `canonicalAgreement`-checked again before it is placed in the HTML; every other value is html/template-escaped. The letterhead logo is embedded as `<img src="data:image/png;base64,...">` or `data:image/svg+xml;base64,...`, never inline SVG markup. No external resource of any kind in the HTML (no `http`, `https` or `//` in any `src`; links in the agreement body may stay, they are text in a PDF). |
| +- Engine call: `forms/chromium/convert/html`, multipart files `index.html`, `header.html`, `footer.html`; A4 (`paperWidth` 8.27, `paperHeight` 11.7), margins 1 inch top and bottom, 0.8 inch sides; `printBackground` true. Overall deadline 30 s; response body cap 10 MiB (`10 << 20`); a non-200 or over-cap answer is an error. Not metered against the account; not routed through the tenant proxy's handler. |
| +- `Config.PDFEngine` empty: the Download PDF button is not shown and the route answers the plain 404. |
| +- Engine failure: status 502 with the approved message, logged with the account sqid and error category only. |
| +- Response: `Content-Type: application/pdf`, `Content-Disposition: attachment; filename="<approved filename>"`, `Cache-Control: no-store`. |
| +- Copy: every new string comes verbatim from the approved deck `docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md`, gated by `approved_dpa_pdf_copy_test.go` (same shape as `approved_dpa_copy_test.go`). No em dashes. |
| +- Local test budget: targeted `-run` only; never the whole console package locally (30+ minutes; CI runs it). `make code-health` must pass; never raise an allowance. |
| +- New route: claim route list, claim fixture and probe, parity.tsv + `make parity-doc`, perfTargets, and the provision record-write census overlay for routeDecls, as slice 1's routes needed. |
| + |
| +## Review Focus |
| + |
| +1. **A logo that is an SVG with a script or external reference (already refused at upload) or a PNG with odd bytes.** Expect the PDF to embed it only as a data-URI image; a test asserts the HTML contains no `<svg` and no `xlink`. |
| +2. **A legal name or address with HTML or line breaks.** Expect escaped text, and the address's line breaks rendered as line breaks, not markup (Task 1 `TestDPAPDFHTMLEscapes`). |
| +3. **The engine is slow, down, or returns a huge or non-PDF body.** Expect 502 with the approved message within the deadline, no partial download (Task 2 tests with a fake engine). |
| +4. **A newer DPA version or letterhead exists.** Expect the PDF to carry the accepted ones (Task 3 `TestDPAPDFUsesAcceptedIDs`). |
| +5. **A member who is not an owner, a non-member, an account with no acceptance.** Expect the PDF for the member, the plain 404 otherwise (Task 3). |
| + |
| +--- |
| + |
| +### Task 0: Mockup and copy deck (lead session, with Paul) |
| + |
| +- [ ] **Step 1:** Draw the PDF as HTML in a scratch directory: page header (logo or wordmark, entity), body (title, parties block, the agreement), execution page, page footer (office, company number, VAT, footer line, "Version", "Page n of m"). Print it to PDF with headless Chromium at A4 and look at every page. |
| +- [ ] **Step 2:** Copy-review every new string (PDF headings and lines, the record page's Download PDF button, the engine-failure message, the email's PDF line, the filename) with the HTML as the preview. |
| +- [ ] **Step 3:** Write the deck and `approved_dpa_pdf_copy_test.go` with an empty built map. Commit. |
| + |
| +### Task 1: The PDF HTML |
| + |
| +**Files:** Create `internal/console/dpapdf.go`, `internal/console/dpapdf_test.go`, `internal/console/templates/dpa_pdf.html`, `dpa_pdf_header.html`, `dpa_pdf_footer.html`. |
| + |
| +**Interfaces:** |
| +- Produces `type dpaPDFInput struct { Acceptance DPAAcceptance; Doc LegalDocument; Letterhead Letterhead; ConsoleName string }` and `func renderDPAPDF(in dpaPDFInput) (index, header, footer []byte, err error)`. |
| +- Consumes `canonicalAgreement` (legalfetch.go), `countryNames`, the slice 1 record helpers in dparecord.go. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestDPAPDFHTMLHasEveryPart` (entity, office, company number, VAT when set, footer line, version, legal name, address, country name, signer name and role, accepted_by, the UTC date, URL, full SHA-256, record id, a sentence from the body, the operator's signatory line); `TestDPAPDFHTMLEscapes` (`<b>` in legal name is escaped; a two-line address renders as two lines); `TestDPAPDFLogoIsDataURIImage` (PNG and SVG logos appear only inside `<img src="data:image/...;base64,`; no `<svg`, no `xlink` anywhere; no logo gives the entity as a wordmark); `TestDPAPDFNoExternalResources` (no `src="http`, `src="//`, `<link`, `<script`, `@import` in any of the three outputs); `TestDPAPDFRefusesNonCanonicalBody` (a stored body that fails `canonicalAgreement` returns an error and no HTML). |
| +- [ ] **Step 2:** Run `go test ./internal/console -run TestDPAPDF -count=1`; expect failures. |
| +- [ ] **Step 3:** Implement with html/template; the header and footer use Chromium's `pageNumber` and `totalPages` classes. |
| +- [ ] **Step 4:** Run; expect PASS. Add deck ids to the built map. |
| +- [ ] **Step 5:** Commit `console: the DPA PDF's HTML on the operator's letterhead`. |
| + |
| +### Task 2: The engine client |
| + |
| +**Files:** Create `internal/console/dpapdfengine.go`, `internal/console/dpapdfengine_test.go`. |
| + |
| +**Interfaces:** Produces `func pdfFromHTML(ctx context.Context, client *http.Client, engine string, index, header, footer []byte) ([]byte, error)` and `const dpaPDFMax = 10 << 20`, `dpaPDFTimeout = 30 * time.Second`. |
| + |
| +- [ ] **Step 1: Failing tests** against an `httptest` fake engine: `TestPDFFromHTMLRequestShape` (POST to `<engine>/forms/chromium/convert/html`, multipart with the three files and the paper and margin fields from Global Constraints); `TestPDFFromHTMLErrors` (500 → error; body over 10 MiB → error, not truncated bytes; a body not starting `%PDF-` → error; a stalled engine → error by the deadline). |
| +- [ ] **Step 2:** Run `go test ./internal/console -run TestPDFFromHTML -count=1`; expect failures. |
| +- [ ] **Step 3:** Implement; reuse the console's engine URL parsing from `apipdf.go` (do not go through the tenant handler or its metering). |
| +- [ ] **Step 4:** Run; expect PASS. |
| +- [ ] **Step 5:** Commit `console: post the DPA PDF to the PDF engine`. |
| + |
| +### Task 3: The route, the button and the email line |
| + |
| +**Files:** Create `internal/console/dpapdfroute.go`, `internal/console/dpapdfroute_test.go`. Modify `dparecord.go`, `templates/dpa_record.html`, `dpapane.go` (the confirmation email), `routedecls.go`, and the census, parity and perf lists. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestDPAPDFDownload` (a member gets 200 `application/pdf` with the approved filename and `no-store`, the fake engine received HTML naming the accepted version); `TestDPAPDFUsesAcceptedIDs` (publish v2 and a new letterhead after acceptance; the HTML sent carries v1 and the old letterhead); `TestDPAPDFGates` (non-member and no-acceptance member get the record page's 404 bytes); `TestDPAPDFNoEngine` (empty `PDFEngine`: no button on the record page, route 404); `TestDPAPDFEngineFailure` (502 with the approved message); `TestDPARecordDownloadButton`; `TestDPAAcceptEmailPDFLine` (the email carries the PDF link line when an engine is configured, and not otherwise). |
| +- [ ] **Step 2:** Run them; expect failures. |
| +- [ ] **Step 3:** Implement; register the route and the census, parity, perf and record-write entries. |
| +- [ ] **Step 4:** Run the tests plus `TestClaim.*Census|TestClaimConsoleRouteCensus|TestConsoleScreensMeetTheBudget|TestDPACopyDeck` and `go test ./internal/provision -run TestPlan9B8RecordWriteCensus -count=1`; expect PASS. |
| +- [ ] **Step 5:** Commit `console: download the DPA as a PDF from the record page`. |
| + |
| +### Task 4: Gate, branch review, release, witness |
| + |
| +- [ ] **Step 1:** `go build ./... && go vet ./internal/console/ && gofmt -l internal/console && make code-health`; push; CI green. |
| +- [ ] **Step 2:** Whole-branch Astra review within the round budget. |
| +- [ ] **Step 3:** Merge (squash, `-expect`), after merging moved main in first. |
| +- [ ] **Step 4:** Dev witness after the next dev roll: a member downloads the PDF for the account Paul accepted on 2026-11-26 and every page is checked. |
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-dpa-pdf-branch.md b/docs/superpowers/reviews/CODEX-FINDINGS-dpa-pdf-branch.md| new file mode 100644 |
| index 000000000..7505080b5 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-dpa-pdf-branch.md |
| @@ -0,0 +1,26 @@ |
| +Reviewed `cc6c77b2..0552118dc0ed3d01fdcd939b09122ae1ce04ddd4` within the brief’s exclusions. No P1 findings. |
| + |
| +1. **P2 — Disabled PDF route can return 500 instead of 404.** [dpapdfroute.go:67](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/dpa-pdf/internal/console/dpapdfroute.go:67) |
| + With `PDFEngine` empty, the handler still loads the acceptance, document and letterhead. A failed DPA query or missing referenced row therefore returns 500 before reaching the disabled-feature check. The plan requires a plain 404 when no engine is configured. |
| + **Fix:** Check `PDFEngine` immediately after successful membership gating, before `dpaLiveRecord`. Add coverage showing disabled downloads remain 404 when a DPA read would fail. |
| + **Fault family:** Disabled-route refusal ordering. |
| + |
| +2. **P3 — “Writes nothing” overstates the route’s behaviour.** [dpa_pdf_census_test.go:13](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/dpa-pdf/internal/provision/dpa_pdf_census_test.go:13) |
| + On PDF failure, `renderDPARecord` calls `accountPage`, which updates the last-account pointer. The claim fixture repeats the same broad assertion. This does **not** invalidate the record-write classification: neither path writes app records, sidecars or bucket objects. |
| + **Fix:** Narrow the comments to those protected records and acknowledge normal page-rendering side effects. |
| + **Fault family:** Accuracy of census explanations. |
| + |
| +Deferred-minor triage: |
| + |
| +- **Before merge:** Fix the disabled-engine ordering above. |
| +- **Keep the planned final witness:** Inspect every printed page after the logo-plus-entity header change. Source inspection cannot establish clipping or pagination. |
| +- **Follow-up only:** Exact-cap and rejected-engine-URL tests; making Print primary on the 502 page; correcting “writes nothing.” |
| +- **No required change:** The mutable deadline is confined to sequential tests; production initializes the client; displaying escaped pending flash errors is acceptable. |
| + |
| +The canonical-body check, data-URI logo construction, escaped base URL, accepted IDs, filename sanitization, and production client’s proxy/redirect restrictions look sound. The census digest matches `routeDecls`, its classification guards remain intact, and the parity and route inventories include the new route. |
| + |
| +Formatting and diff-whitespace checks passed; the new census file passed a targeted gitleaks scan. Targeted Go tests could not start because the read-only sandbox denied Go’s temporary build directory. No files were changed. |
| + |
| +Round 1 has no P1: apply the P2 fix without reopening the review, subject to the repository’s scoped post-fix checks. |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-dpa-pdf-branch.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-dpa-pdf-branch.md| new file mode 100644 |
| index 000000000..9dbabcd7a |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-dpa-pdf-branch.md |
| @@ -0,0 +1,31 @@ |
| +# Review brief: DPA PDF (slice 2) branch, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `dpa-pdf`, commit 0552118dc0ed3d01fdcd939b09122ae1ce04ddd4. |
| +Under review: `cc6c77b2..0552118dc0ed3d01fdcd939b09122ae1ce04ddd4`, excluding docs/superpowers/{specs,reviews} and plans other |
| +than the copy deck `docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md`. |
| +Authorities: spec `docs/superpowers/specs/2026-11-25-dpa-and-retention-design.md` rev 5 §3.8 |
| +(and §3.3), plan `docs/superpowers/plans/2026-11-26-dpa-pdf.md`, AGENTS.md. Slice 1 is merged. |
| + |
| +## Fixed: do not re-argue |
| +- Paul approved the PDF's copy and an HTML mockup of it (2026-11-26). |
| +- Controller rulings and deferred minors: `.superpowers/sdd/2026-11-26-dpa-pdf/progress.md` in |
| + the worktree (git-ignored). Say which deferred minors should be fixed before merge. |
| + |
| +## What to check |
| +1. The trust boundary into the PDF engine: the only raw HTML is the canonical-checked agreement |
| + body; the logo is a data-URI image of an allow-listed type; nothing in the three HTML files |
| + can fetch anything; the <base href> cannot be steered. |
| +2. The route's gates and 404s, the acceptance's own ids, the Content-Disposition header, the |
| + engine client (no proxy, no redirects, deadline, cap, no URL or body in errors or logs). |
| +3. The census and parity edits (an independent Opus reviewer already approved the record-write |
| + re-pin; confirm nothing else is weakened). |
| +4. Anything that would fail CI. |
| + |
| +## Severity |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Follow-up list only. |
| + |
| +Findings ranked with file:line, failure scenario, fix and fault family; then the deferred-minor |
| +triage. End with READY, READY AFTER FIXES or NOT READY. Do not edit files, spawn reviewers or run |
| +full suites (targeted `go test ./internal/console -run '<name>' -count=1` is fine). |
diff --git a/internal/console/approved_dpa_pdf_copy_test.go b/internal/console/approved_dpa_pdf_copy_test.go| new file mode 100644 |
| index 000000000..f82852128 |
| --- /dev/null |
| +++ b/internal/console/approved_dpa_pdf_copy_test.go |
| @@ -0,0 +1,141 @@ |
| +package console |
| + |
| +import ( |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +// The copy gate of the DPA PDF plan |
| +// (docs/superpowers/plans/2026-11-26-dpa-pdf.md), in the burst deck's |
| +// shape (approved_burst_copy_test.go). Its "where" paths are relative to the |
| +// repository root. |
| +const ( |
| + dpaPDFCopyRoot = "../.." |
| + dpaPDFCopyDeckPath = dpaPDFCopyRoot + "/docs/superpowers/plans/2026-11-26-dpa-pdf-copy.md" |
| +) |
| + |
| +// dpaPDFCopyBuilt is every deck row whose text the code or templates carry. |
| +// The task that writes a row's text adds its id here in the same commit. From |
| +// then on a "gate" row's new text must be in its file, and any other row's |
| +// named test must exist. |
| +var dpaPDFCopyBuilt = map[string]bool{ |
| + // Tasks 1 and 3 add their ids here as they write the text. |
| + // Task 1: the PDF's HTML (dpapdf.go and templates/dpa_pdf*.html). |
| + "PDF-C01": true, "PDF-C02": true, "PDF-C03": true, "PDF-C04": true, |
| + "PDF-C05": true, "PDF-C06": true, "PDF-C07": true, "PDF-C08": true, |
| + "PDF-C09": true, "PDF-C10": true, "PDF-C11": true, "PDF-C12": true, |
| + "PDF-C13": true, "PDF-C14": true, |
| + // Task 3: the download's filename and failure (dpapdfroute.go), the |
| + // record page's button and the confirmation email's line. |
| + "PDF-C15": true, "PDF-C16": true, "PDF-C17": true, "PDF-C18": true, |
| +} |
| + |
| +func parseDPAPDFCopyDeck(t *testing.T) []navCopyRow { |
| + t.Helper() |
| + raw, err := os.ReadFile(dpaPDFCopyDeckPath) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var rows []navCopyRow |
| + for _, line := range strings.Split(string(raw), "\n") { |
| + if !strings.HasPrefix(line, "| PDF-") { |
| + continue |
| + } |
| + line = strings.TrimSpace(line) |
| + line = strings.TrimSuffix(strings.TrimPrefix(line, "| "), " |") |
| + cells := strings.Split(line, " | ") |
| + if len(cells) != 6 { |
| + t.Fatalf("deck row has %d cells, want 6: %.60q", len(cells), line) |
| + } |
| + // A pipe inside a cell is escaped as `\|` so the split above leaves it |
| + // alone; put the literal pipe back before the text is compared. |
| + for i := range cells { |
| + cells[i] = strings.ReplaceAll(strings.TrimSpace(cells[i]), `\|`, "|") |
| + } |
| + rows = append(rows, navCopyRow{ |
| + ID: cells[0], Where: cells[1], Old: cells[2], New: cells[3], |
| + CheckedBy: cells[4], Status: cells[5], |
| + }) |
| + } |
| + return rows |
| +} |
| + |
| +func TestDPAPDFCopyDeckIsApprovedAndApplied(t *testing.T) { |
| + rows := parseDPAPDFCopyDeck(t) |
| + if len(rows) < 18 { |
| + t.Fatalf("deck parsed %d rows, want at least 18", len(rows)) |
| + } |
| + byID := map[string]navCopyRow{} |
| + for _, r := range rows { |
| + if _, dup := byID[r.ID]; dup { |
| + t.Errorf("%s appears twice in the deck", r.ID) |
| + } |
| + byID[r.ID] = r |
| + if r.Status != "approved" && r.Status != "removed" { |
| + t.Errorf("%s status is %q, want approved or removed", r.ID, r.Status) |
| + } |
| + if strings.Contains(r.New, "—") { |
| + t.Errorf("%s: new text holds an em dash", r.ID) |
| + } |
| + } |
| + for id := range dpaPDFCopyBuilt { |
| + if _, ok := byID[id]; !ok { |
| + t.Errorf("dpaPDFCopyBuilt names %s, which has no deck row", id) |
| + } |
| + } |
| + |
| + // A named test can live in any package of the repository, so look through |
| + // every test file under the root rather than only this package's. |
| + var sources string |
| + testSources := func() string { |
| + if sources == "" { |
| + var b strings.Builder |
| + err := filepath.WalkDir(dpaPDFCopyRoot, func(p string, d os.DirEntry, err error) error { |
| + if err != nil { |
| + return err |
| + } |
| + if d.IsDir() && (d.Name() == ".git" || d.Name() == ".superpowers") { |
| + return filepath.SkipDir |
| + } |
| + if d.IsDir() || !strings.HasSuffix(p, "_test.go") { |
| + return nil |
| + } |
| + raw, err := os.ReadFile(p) |
| + if err != nil { |
| + return err |
| + } |
| + b.Write(raw) |
| + b.WriteByte('\n') |
| + return nil |
| + }) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + sources = b.String() |
| + } |
| + return sources |
| + } |
| + |
| + for _, r := range rows { |
| + if !dpaPDFCopyBuilt[r.ID] { |
| + continue |
| + } |
| + if r.CheckedBy != "gate" { |
| + if !strings.Contains(testSources(), "func "+r.CheckedBy+"(") { |
| + t.Errorf("%s: its test %s does not exist", r.ID, r.CheckedBy) |
| + } |
| + continue |
| + } |
| + file, _, _ := strings.Cut(r.Where, " ") |
| + raw, err := os.ReadFile(filepath.Join(dpaPDFCopyRoot, file)) |
| + if err != nil { |
| + t.Errorf("%s: %v", r.ID, err) |
| + continue |
| + } |
| + if !strings.Contains(navSpace(string(raw)), navSpace(r.New)) { |
| + t.Errorf("%s: %s does not contain %q", r.ID, file, r.New) |
| + } |
| + } |
| +} |
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go| index fa1ef386d..b9105f06b 100644 |
| --- a/internal/console/claim_invariant_fixtures_test.go |
| +++ b/internal/console/claim_invariant_fixtures_test.go |
| @@ -861,6 +861,7 @@ var claimFixtures = map[string]claimFixture{ |
| "route GET /a/{sqid}/index": claimRead("renders the account's sections as a phone index"), |
| "route GET /a/{sqid}/settings": claimRead("renders account settings"), |
| "route GET /a/{sqid}/settings/dpa": claimRead("renders the account's data processing agreement record; writes nothing"), |
| + "route GET /a/{sqid}/settings/dpa.pdf": claimRead("answers the account's executed data processing agreement as a PDF from the PDF engine; writes no app records, sidecars or bucket objects; the 502 path's page render updates the last-account pointer as the record page does"), |
| "route GET /a/{sqid}/plan/keep": claimRead("renders the keep page (plans 4d) from the plan row, lapse items and an inventory read; writes nothing"), |
| "route GET /a/{sqid}/team": claimRead("renders members and invites"), |
| "route GET /a/{sqid}/trash": claimRead("lists trashed apps; purge is the trash/delete door"), |
diff --git a/internal/console/claim_invariant_probes_read_test.go b/internal/console/claim_invariant_probes_read_test.go| index 1a07fa649..2a3343bd2 100644 |
| --- a/internal/console/claim_invariant_probes_read_test.go |
| +++ b/internal/console/claim_invariant_probes_read_test.go |
| @@ -46,6 +46,15 @@ func claimWorldInstance(t *testing.T, cx *claimCase) { |
| func claimWorldFleet(t *testing.T, cx *claimCase) { t.Helper(); cx.fleet(t) } |
| +// claimWorldDPAPDF is an acceptance in force for account bab and a fake PDF |
| +// engine (dpapdfroute_test.go). |
| +func claimWorldDPAPDF(t *testing.T, cx *claimCase) { |
| + t.Helper() |
| + docID, lhID := dpaWorld(t, cx.consoleFixture) |
| + dpaAcceptFor(t, cx.consoleFixture, docID, lhID) |
| + dpaPDFEngineFor(t, cx.consoleFixture) |
| +} |
| + |
| // claimWorldLapse turns plans on and puts account bab on a lapse (plans 4d). |
| func claimWorldLapse(t *testing.T, cx *claimCase) { |
| t.Helper() |
| @@ -218,8 +227,11 @@ var claimReadProbes = map[string]claimProbe{ |
| "route GET /a/{sqid}/index": claimPageRead(nil, "/a/bab/index", `id="nav-apps"`), |
| "route GET /a/{sqid}/settings": claimPageRead(nil, "/a/bab/settings", "<h1>Account settings</h1>"), |
| "route GET /a/{sqid}/settings/dpa": claimPageRead(nil, "/a/bab/settings/dpa", "<h1>Data processing agreement</h1>"), |
| - "route GET /a/{sqid}/plan/keep": claimPageRead(claimWorldLapse, "/a/bab/plan/keep", "<h1>Choose what stays</h1>"), |
| - "route GET /a/{sqid}/team": claimPageRead(nil, "/a/bab/team", "<h1>Team</h1>", claimFxOwner), |
| + // An acceptance in force and a fake engine: the PDF's bytes. |
| + "route GET /a/{sqid}/settings/dpa.pdf": claimPageRead(claimWorldDPAPDF, "/a/bab/settings/dpa.pdf", |
| + "%PDF-1.7 test"), |
| + "route GET /a/{sqid}/plan/keep": claimPageRead(claimWorldLapse, "/a/bab/plan/keep", "<h1>Choose what stays</h1>"), |
| + "route GET /a/{sqid}/team": claimPageRead(nil, "/a/bab/team", "<h1>Team</h1>", claimFxOwner), |
| "route GET /a/{sqid}/trash": claimPageRead(func(t *testing.T, cx *claimCase) { cx.trash(t, "titogo") }, |
| "/a/bab/trash", "<h1>Trash</h1>", "titogo"), |
| "route GET /a/{sqid}/{$}": claimPageRead(nil, "/a/bab/", "kass"), |
diff --git a/internal/console/dpapane.go b/internal/console/dpapane.go| index c9ed5dde6..b5076843c 100644 |
| --- a/internal/console/dpapane.go |
| +++ b/internal/console/dpapane.go |
| @@ -93,8 +93,9 @@ func dpaObjectText(privacyAddress string) string { |
| // dpaAcceptEmail is the confirmation sent to the accepting owner |
| // (dpa.email.subject and dpa.email.body). A multi-line address is written |
| -// on one line, its lines joined by commas. |
| -func dpaAcceptEmail(doc *LegalDocument, lh *Letterhead, a DPAAcceptance, recordURL string) (subject, body string) { |
| +// on one line, its lines joined by commas. pdfURL, when set (a PDF engine |
| +// is configured), adds email.pdf_line after the record link. |
| +func dpaAcceptEmail(doc *LegalDocument, lh *Letterhead, a DPAAcceptance, recordURL, pdfURL string) (subject, body string) { |
| at := a.AcceptedAt.UTC() |
| address := strings.Join(strings.Split(a.Address, "\n"), ", ") |
| subject = "Data processing agreement accepted for " + a.LegalName |
| @@ -104,11 +105,20 @@ func dpaAcceptEmail(doc *LegalDocument, lh *Letterhead, a DPAAcceptance, recordU |
| "Accepted by: " + a.SignerName + ", " + a.SignerRole + " (" + a.AcceptedBy + ")\n" + |
| "Agreement: " + doc.URL + "\n" + |
| "Fingerprint of the text: " + doc.SHA256 + "\n\n" + |
| - "The record is in your account settings: " + recordURL + "\n\n" + |
| + "The record is in your account settings: " + recordURL + "\n" + dpaEmailPDFLine(pdfURL) + "\n" + |
| "Questions: " + lh.PrivacyAddress |
| return subject, body |
| } |
| +// dpaEmailPDFLine is email.pdf_line and its line break, or nothing when |
| +// there is no PDF to download. |
| +func dpaEmailPDFLine(pdfURL string) string { |
| + if pdfURL == "" { |
| + return "" |
| + } |
| + return "Download it as a PDF: " + pdfURL + "\n" |
| +} |
| + |
| // dpaForm is the acceptance form as typed. |
| type dpaForm struct { |
| LegalName, Address, Country, SignerName, SignerRole string |
| @@ -401,7 +411,12 @@ func (s *Server) handleDPAAccept(w http.ResponseWriter, r *http.Request) { |
| // acceptance row and nowhere else. |
| s.audit(acct, "", addr, "dpa.accept", "version "+doc.Version) |
| - subject, body := dpaAcceptEmail(doc, lh, a, s.cfg.Origin+settings+"/dpa") |
| + // Both links are the console's own origin, never the request's Host. |
| + pdfURL := "" |
| + if s.cfg.PDFEngine != "" { |
| + pdfURL = s.cfg.Origin + dpaPDFURL(acct.Sqid) |
| + } |
| + subject, body := dpaAcceptEmail(doc, lh, a, s.cfg.Origin+settings+"/dpa", pdfURL) |
| mctx, cancel := context.WithTimeout(ctx, dpaMailTimeout) |
| defer cancel() |
| if _, err := s.deliver(mctx, addr, subject, body, dpaMailKeymailShare); err != nil { |
diff --git a/internal/console/dpapane_test.go b/internal/console/dpapane_test.go| index b0f351565..c2708aeb9 100644 |
| --- a/internal/console/dpapane_test.go |
| +++ b/internal/console/dpapane_test.go |
| @@ -515,7 +515,7 @@ func TestDPAAcceptEmailCopy(t *testing.T) { |
| lh := &Letterhead{Entity: "Example Hosting Limited", PrivacyAddress: "privacy@example.com"} |
| a := DPAAcceptance{LegalName: "Shop Limited", Address: "1 Main Street\nDublin", Country: "IE", |
| SignerName: "Ada Lovelace", SignerRole: "Director", AcceptedBy: "ada@example.com", AcceptedAt: at} |
| - subject, body := dpaAcceptEmail(doc, lh, a, "https://console.example.com/a/bab/settings/dpa") |
| + subject, body := dpaAcceptEmail(doc, lh, a, "https://console.example.com/a/bab/settings/dpa", "") |
| if want := oplDeck(t, "DPA-C42", "legal_name", "Shop Limited"); subject != want { |
| t.Errorf("subject = %q, want %q", subject, want) |
| } |
diff --git a/internal/console/dpapdf.go b/internal/console/dpapdf.go| new file mode 100644 |
| index 000000000..644e797b3 |
| --- /dev/null |
| +++ b/internal/console/dpapdf.go |
| @@ -0,0 +1,144 @@ |
| +package console |
| + |
| +import ( |
| + "bytes" |
| + "encoding/base64" |
| + "fmt" |
| + "html/template" |
| + "net/url" |
| + "strconv" |
| + "strings" |
| +) |
| + |
| +// The executed data processing agreement as HTML on the operator's |
| +// letterhead (DPA and retention spec §3.8), for the PDF engine's |
| +// forms/chromium/convert/html: index.html is the document, header.html and |
| +// footer.html are the page header and footer Chromium repeats on every page. |
| +// All three are self-contained: no script, no stylesheet or font to fetch, and |
| +// the logo, if any, is a data: URI image. |
| + |
| +// dpaPDFInput is what the PDF shows: the acceptance and the document and |
| +// letterhead it names, and the console's name. |
| +type dpaPDFInput struct { |
| + Acceptance DPAAcceptance |
| + Doc LegalDocument |
| + Letterhead Letterhead |
| + ConsoleName string |
| +} |
| + |
| +// dpaPDFTemplates are standalone documents, not the console's chrome. The |
| +// console's own set parses them too (templates/*.html), harmlessly. |
| +var dpaPDFTemplates = template.Must(template.New("dpa_pdf.html").ParseFS(tmplFS, |
| + "templates/dpa_pdf.html", "templates/dpa_pdf_header.html", "templates/dpa_pdf_footer.html")) |
| + |
| +// dpaPDFLogoTypes are the logo types embedded; any other gives the wordmark. |
| +var dpaPDFLogoTypes = map[string]bool{"image/png": true, "image/svg+xml": true} |
| + |
| +// dpaPDFDateLayout and dpaPDFTimeLayout are pdf.exec.customer_line's {date} |
| +// and {time}, in UTC. |
| +const ( |
| + dpaPDFDateLayout = "2 January 2006" |
| + dpaPDFTimeLayout = "15:04" |
| +) |
| + |
| +// dpaPDFView is what the three templates read. |
| +type dpaPDFView struct { |
| + Base string // the document site's root, for the body's relative links |
| + Version string |
| + Processor string // dpa.record.processor (+ processor_vat) |
| + |
| + LegalName string |
| + AddressLines []string |
| + Country string |
| + Body template.HTML // canonicalAgreement passed on these bytes |
| + |
| + Console, AcceptedBy, Date, Time string |
| + SignerName, SignerRole string |
| + Signatory string |
| + URL, SHA256 string |
| + RecordID string |
| + |
| + // The page header. |
| + LogoURL template.URL // a data: URI, or empty for the wordmark |
| + Entity string |
| + PrivacyAddress string |
| + |
| + // The page footer. |
| + Office, CompanyNumber, Footer string |
| +} |
| + |
| +// renderDPAPDF builds the PDF's index.html, header.html and footer.html. The |
| +// agreement body goes in as markup only if canonicalAgreement passes on the |
| +// exact stored bytes; otherwise it is an error and no HTML. |
| +func renderDPAPDF(in dpaPDFInput) (index, header, footer []byte, err error) { |
| + if err := canonicalAgreement([]byte(in.Doc.Body)); err != nil { |
| + return nil, nil, nil, fmt.Errorf("dpa pdf: document %d is not canonical: %w", in.Doc.ID, err) |
| + } |
| + a, lh := in.Acceptance, in.Letterhead |
| + country := a.Country |
| + if n, ok := countryNames[country]; ok { |
| + country = n |
| + } |
| + v := dpaPDFView{ |
| + Base: dpaPDFBase(in.Doc.URL), |
| + Version: in.Doc.Version, |
| + Processor: dpaRecordProcessorText(&lh), |
| + LegalName: a.LegalName, |
| + AddressLines: dpaPDFAddressLines(a.Address), |
| + Country: country, |
| + Body: template.HTML(in.Doc.Body), // canonicalAgreement just passed |
| + Console: in.ConsoleName, |
| + AcceptedBy: a.AcceptedBy, |
| + Date: a.AcceptedAt.UTC().Format(dpaPDFDateLayout), |
| + Time: a.AcceptedAt.UTC().Format(dpaPDFTimeLayout), |
| + SignerName: a.SignerName, |
| + SignerRole: a.SignerRole, |
| + Signatory: strings.TrimSuffix(lh.Signatory, "."), // the line adds its own full stop |
| + URL: in.Doc.URL, |
| + SHA256: in.Doc.SHA256, |
| + RecordID: strconv.FormatInt(a.ID, 10), |
| + Entity: lh.Entity, |
| + PrivacyAddress: lh.PrivacyAddress, |
| + Office: lh.RegisteredOffice, |
| + CompanyNumber: lh.CompanyNumber, |
| + Footer: lh.Footer, |
| + } |
| + if len(lh.Logo) > 0 && dpaPDFLogoTypes[lh.LogoType] { |
| + // The type is from the allow-list and base64 has no character that |
| + // needs escaping, so the URI is exactly these bytes. |
| + v.LogoURL = template.URL("data:" + lh.LogoType + ";base64," + base64.StdEncoding.EncodeToString(lh.Logo)) |
| + } |
| + out := make([][]byte, 3) |
| + for i, name := range []string{"dpa_pdf.html", "dpa_pdf_header.html", "dpa_pdf_footer.html"} { |
| + var b bytes.Buffer |
| + if err := dpaPDFTemplates.ExecuteTemplate(&b, name, v); err != nil { |
| + return nil, nil, nil, fmt.Errorf("dpa pdf: %s: %w", name, err) |
| + } |
| + out[i] = b.Bytes() |
| + } |
| + return out[0], out[1], out[2], nil |
| +} |
| + |
| +// dpaPDFBase is the root of the site the document was published on |
| +// ("https://host/"), so a relative link in the body ("/terms/") resolves |
| +// there rather than against the engine's file:// page. Empty, and no base |
| +// element, unless the URL is https with a host. |
| +func dpaPDFBase(docURL string) string { |
| + u, err := url.Parse(docURL) |
| + if err != nil || u.Scheme != "https" || u.Host == "" { |
| + return "" |
| + } |
| + return "https://" + u.Host + "/" |
| +} |
| + |
| +// dpaPDFAddressLines is the address's lines without the blank ones, so no |
| +// empty line prints at either end or between. |
| +func dpaPDFAddressLines(address string) []string { |
| + var lines []string |
| + for _, l := range strings.Split(strings.ReplaceAll(address, "\r\n", "\n"), "\n") { |
| + if strings.TrimSpace(l) != "" { |
| + lines = append(lines, l) |
| + } |
| + } |
| + return lines |
| +} |
diff --git a/internal/console/dpapdf_test.go b/internal/console/dpapdf_test.go| new file mode 100644 |
| index 000000000..f8cfb51fb |
| --- /dev/null |
| +++ b/internal/console/dpapdf_test.go |
| @@ -0,0 +1,374 @@ |
| +package console |
| + |
| +import ( |
| + "encoding/base64" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "golang.org/x/net/html" |
| +) |
| + |
| +// dpaPDFTestBody is a canonical agreement fragment, as publishing stores it. |
| +const dpaPDFTestBody = `<section> |
| +<h2>Who this is between</h2> |
| +<p>It is between Team Tito Limited and the customer named when the agreement was accepted. It is part of our <a href="https://carloku.com/terms/">terms</a>.</p> |
| +</section>` |
| + |
| +func dpaPDFTestInput() dpaPDFInput { |
| + return dpaPDFInput{ |
| + Acceptance: DPAAcceptance{ |
| + ID: 42, AccountID: 7, DocumentID: 3, LetterheadID: 5, |
| + LegalName: "Shop Limited", Address: "1 Example Street\nDublin", Country: "IE", |
| + SignerName: "Ada Lovelace", SignerRole: "Director", |
| + AcceptedBy: "you@example.com", AcceptedIP: "192.0.2.1", |
| + AcceptedAt: time.Date(2026, 11, 26, 10, 14, 59, 0, time.UTC), |
| + }, |
| + Doc: LegalDocument{ |
| + ID: 3, Kind: "dpa", Version: "1", URL: "https://carloku.com/dpa/1/", |
| + BodyURL: "https://carloku.com/dpa/1/agreement.html", Body: dpaPDFTestBody, |
| + SHA256: "3f2a9c1e5b7d4a8f0e6c2b9d1a7f3e5c8b4d0a6e2f9c7b1d5a3e8f0c6b2d9a4e", |
| + }, |
| + Letterhead: Letterhead{ |
| + ID: 5, Entity: "Team Tito Limited", |
| + RegisteredOffice: "27 Frederick Street South, Dublin D02 T254, Ireland", |
| + CompanyNumber: "566334", VATNumber: "IE3384527RH", |
| + Signatory: "For and on behalf of Team Tito Limited", |
| + PrivacyAddress: "privacy@carloku.com", |
| + Footer: "Carloku is run by Team Tito Limited.", |
| + }, |
| + ConsoleName: "Carloku", |
| + } |
| +} |
| + |
| +func renderDPAPDFAll(t *testing.T, in dpaPDFInput) (index, header, footer string) { |
| + t.Helper() |
| + i, h, f, err := renderDPAPDF(in) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return string(i), string(h), string(f) |
| +} |
| + |
| +func TestDPAPDFHTMLHasEveryPart(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + index, header, footer := renderDPAPDFAll(t, in) |
| + all := index + header + footer |
| + for _, want := range []string{ |
| + "Team Tito Limited", |
| + "27 Frederick Street South, Dublin D02 T254, Ireland", |
| + "566334", |
| + "IE3384527RH", |
| + "Carloku is run by Team Tito Limited.", |
| + "Version 1", |
| + "Shop Limited", |
| + "1 Example Street", |
| + "Dublin", |
| + "Ireland", |
| + "Ada Lovelace", |
| + "Director", |
| + "you@example.com", |
| + "26 November 2026", |
| + "10:14", |
| + "https://carloku.com/dpa/1/", |
| + in.Doc.SHA256, |
| + "Record 42", |
| + "It is between Team Tito Limited and the customer named when the agreement was accepted.", |
| + "For and on behalf of Team Tito Limited", |
| + } { |
| + if !strings.Contains(all, want) { |
| + t.Errorf("the PDF's HTML is missing %q", want) |
| + } |
| + } |
| + // The letterhead sits in the page header and the office in the page |
| + // footer, which Chromium repeats on every page. |
| + if !strings.Contains(header, "Team Tito Limited") { |
| + t.Errorf("header has no entity:\n%s", header) |
| + } |
| + for _, want := range []string{"27 Frederick Street South", "Company number 566334", "Carloku is run by Team Tito Limited.", "Version 1"} { |
| + if !strings.Contains(footer, want) { |
| + t.Errorf("footer is missing %q:\n%s", want, footer) |
| + } |
| + } |
| + // The VAT number is in the Processor party line, not the footer. |
| + if strings.Contains(footer, "VAT") { |
| + t.Errorf("footer carries the VAT number:\n%s", footer) |
| + } |
| + if parties := dpaPDFParties(t, index); !strings.Contains(parties, "VAT number IE3384527RH.") { |
| + t.Errorf("the parties block has no VAT number:\n%s", parties) |
| + } |
| + // The agreement is placed as markup, links and all. |
| + if !strings.Contains(index, `<a href="https://carloku.com/terms/">terms</a>`) { |
| + t.Errorf("the agreement body is not placed as markup:\n%s", index) |
| + } |
| + |
| + // No VAT number: none in the footer or the parties. |
| + in.Letterhead.VATNumber = "" |
| + index, _, footer = renderDPAPDFAll(t, in) |
| + if strings.Contains(index+footer, "VAT") { |
| + t.Error("a letterhead with no VAT number still prints one") |
| + } |
| +} |
| + |
| +func TestDPAPDFCopy(t *testing.T) { |
| + index, _, footer := renderDPAPDFAll(t, dpaPDFTestInput()) |
| + for _, want := range []string{ |
| + // PDF-C02 |
| + "Version 1", |
| + // PDF-C07 |
| + "Accepted electronically in the Carloku console by you@example.com, on 26 November 2026 at 10:14 UTC.", |
| + // PDF-C08 |
| + "For the customer: Ada Lovelace, Director, Shop Limited.", |
| + // PDF-C09 |
| + "For the processor: For and on behalf of Team Tito Limited. The agreement was formed when the customer accepted it.", |
| + // PDF-C10 |
| + "Agreement text: https://carloku.com/dpa/1/", |
| + // PDF-C11 |
| + "Fingerprint of the text (SHA-256): <code>3f2a9c1e5b7d4a8f0e6c2b9d1a7f3e5c8b4d0a6e2f9c7b1d5a3e8f0c6b2d9a4e</code>", |
| + // PDF-C13 |
| + "Record 42 in the Carloku console.", |
| + // DPA-C36 and DPA-C37, the processor in the parties block. |
| + "Team Tito Limited, 27 Frederick Street South, Dublin D02 T254, Ireland. Company number 566334. VAT number IE3384527RH.", |
| + } { |
| + if !strings.Contains(index, want) { |
| + t.Errorf("index.html is missing %q", want) |
| + } |
| + } |
| + // PDF-C14, with Chromium's page counters as the values. |
| + if want := `Page <span class="pageNumber"></span> of <span class="totalPages"></span>`; !strings.Contains(footer, want) { |
| + t.Errorf("footer.html is missing %q:\n%s", want, footer) |
| + } |
| + // PDF-C15, the download's filename. A version is free text, so anything |
| + // but a letter, digit, dot, hyphen or underscore becomes a hyphen: the |
| + // name always fits a quoted header value. |
| + for version, filled := range map[string]string{ |
| + "1": "1", |
| + "2026-11.b_2": "2026-11.b_2", |
| + `2 "beta"/x`: "2--beta--x", |
| + "é\r\n": "---", |
| + } { |
| + if got, want := dpaPDFFilename(version), dpaPDFDeck(t, "PDF-C15", "version", filled); got != want { |
| + t.Errorf("dpaPDFFilename(%q) = %q, want %q", version, got, want) |
| + } |
| + } |
| +} |
| + |
| +func TestDPAPDFHTMLEscapes(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + in.Acceptance.LegalName = "Shop <b>Limited</b>" |
| + in.Acceptance.Address = "1 Example Street\r\nDublin <i>2</i>" |
| + index, _, _ := renderDPAPDFAll(t, in) |
| + if strings.Contains(index, "<b>Limited</b>") || !strings.Contains(index, "Shop <b>Limited</b>") { |
| + t.Errorf("the legal name is not escaped:\n%s", index) |
| + } |
| + if !strings.Contains(index, "1 Example Street<br>Dublin <i>2</i>") { |
| + t.Errorf("a two-line address is not two escaped lines:\n%s", index) |
| + } |
| +} |
| + |
| +func TestDPAPDFLogoIsDataURIImage(t *testing.T) { |
| + for _, tc := range []struct { |
| + name, typ string |
| + logo []byte |
| + }{ |
| + // Bytes whose base64 has "+" and "/", which the attribute must keep. |
| + {"png", "image/png", []byte("\x89PNG\r\n\x1a\n\xfb\xef\xff\xfe")}, |
| + {"svg", "image/svg+xml", []byte(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect width="10" height="10"/></svg>`)}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + in.Letterhead.Logo, in.Letterhead.LogoType = tc.logo, tc.typ |
| + index, header, footer := renderDPAPDFAll(t, in) |
| + want := "data:" + tc.typ + ";base64," + base64.StdEncoding.EncodeToString(tc.logo) |
| + if got := dpaPDFSrcs(t, header); len(got) != 1 || got[0] != "img "+want { |
| + t.Errorf("header's sources are %q, want only the %s data URI image", got, tc.typ) |
| + } |
| + if got := dpaPDFSrcs(t, index+footer); len(got) != 0 { |
| + t.Errorf("index and footer have sources %q, want none", got) |
| + } |
| + all := index + header + footer |
| + for _, bad := range []string{"<svg", "xlink"} { |
| + if strings.Contains(all, bad) { |
| + t.Errorf("the output carries %q", bad) |
| + } |
| + } |
| + // The entity name stays visible beside the logo. |
| + if !strings.Contains(header, `class="wordmark"`) { |
| + t.Errorf("a logo is shown without the entity name beside it:\n%s", header) |
| + } |
| + }) |
| + } |
| + t.Run("no logo", func(t *testing.T) { |
| + _, header, _ := renderDPAPDFAll(t, dpaPDFTestInput()) |
| + if strings.Contains(header, "<img") { |
| + t.Errorf("no logo, yet an image:\n%s", header) |
| + } |
| + if !strings.Contains(header, `class="wordmark"`) || !strings.Contains(header, ">Team Tito Limited</") { |
| + t.Errorf("no logo should give the entity as a wordmark:\n%s", header) |
| + } |
| + }) |
| + t.Run("other type", func(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + in.Letterhead.Logo, in.Letterhead.LogoType = []byte("GIF89a"), "image/gif" |
| + _, header, _ := renderDPAPDFAll(t, in) |
| + if strings.Contains(header, "<img") || !strings.Contains(header, `class="wordmark"`) { |
| + t.Errorf("a logo of another type should give the wordmark:\n%s", header) |
| + } |
| + }) |
| +} |
| + |
| +func TestDPAPDFNoExternalResources(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + in.Letterhead.Logo, in.Letterhead.LogoType = []byte("\x89PNG\r\n\x1a\n"), "image/png" |
| + index, header, footer := renderDPAPDFAll(t, in) |
| + for name, out := range map[string]string{"index.html": index, "header.html": header, "footer.html": footer} { |
| + lower := strings.ToLower(out) |
| + for _, bad := range []string{`src="http`, `src="//`, "<link", "<script", "@import", "url(", "@font-face"} { |
| + if strings.Contains(lower, bad) { |
| + t.Errorf("%s carries %q", name, bad) |
| + } |
| + } |
| + if !strings.HasPrefix(out, "<!doctype html>") { |
| + t.Errorf("%s is not a whole HTML document", name) |
| + } |
| + } |
| + // Chromium's header and footer templates need inline styles and an |
| + // explicit font size. |
| + for name, out := range map[string]string{"header.html": header, "footer.html": footer} { |
| + if strings.Contains(out, "<style") || !strings.Contains(out, "font-size:") { |
| + t.Errorf("%s should carry inline styles with a font size:\n%s", name, out) |
| + } |
| + } |
| +} |
| + |
| +func TestDPAPDFRefusesNonCanonicalBody(t *testing.T) { |
| + for _, body := range []string{ |
| + `<p>Hello</p><script>alert(1)</script>`, |
| + `<p>Hello <img src="https://example.com/x.png"></p>`, |
| + `<p>Unclosed`, |
| + `<p onclick="x()">Hi</p>`, |
| + } { |
| + in := dpaPDFTestInput() |
| + in.Doc.Body = body |
| + index, header, footer, err := renderDPAPDF(in) |
| + if err == nil { |
| + t.Errorf("body %q: no error", body) |
| + } |
| + if index != nil || header != nil || footer != nil { |
| + t.Errorf("body %q: HTML returned with the error", body) |
| + } |
| + } |
| +} |
| + |
| +// dpaPDFSrcs is every src attribute in doc as "element value", the value as |
| +// a browser reads it (entities decoded). |
| +func dpaPDFSrcs(t *testing.T, doc string) []string { |
| + t.Helper() |
| + var out []string |
| + z := html.NewTokenizer(strings.NewReader(doc)) |
| + for { |
| + switch z.Next() { |
| + case html.ErrorToken: |
| + return out |
| + case html.StartTagToken, html.SelfClosingTagToken: |
| + tok := z.Token() |
| + for _, a := range tok.Attr { |
| + if a.Key == "src" { |
| + out = append(out, tok.Data+" "+a.Val) |
| + } |
| + } |
| + } |
| + } |
| +} |
| + |
| +// dpaPDFParties is index.html's parties block. |
| +func dpaPDFParties(t *testing.T, index string) string { |
| + t.Helper() |
| + _, rest, ok := strings.Cut(index, `<div class="parties">`) |
| + parties, _, ok2 := strings.Cut(rest, "</div>") |
| + if !ok || !ok2 { |
| + t.Fatalf("index.html has no parties block:\n%s", index) |
| + } |
| + return parties |
| +} |
| + |
| +// dpaPDFText is doc's visible text: its text nodes, not attribute values, |
| +// each trimmed, joined by "|". |
| +func dpaPDFText(doc string) string { |
| + var out []string |
| + z := html.NewTokenizer(strings.NewReader(doc)) |
| + for { |
| + switch z.Next() { |
| + case html.ErrorToken: |
| + return strings.Join(out, "|") |
| + case html.TextToken: |
| + if t := strings.TrimSpace(string(z.Text())); t != "" { |
| + out = append(out, t) |
| + } |
| + } |
| + } |
| +} |
| + |
| +// The header shows the entity name as text, with a logo or without one. |
| +func TestDPAPDFHeaderShowsEntity(t *testing.T) { |
| + for _, tc := range []struct { |
| + name, typ string |
| + logo []byte |
| + }{ |
| + {"no logo", "", nil}, |
| + {"png", "image/png", []byte("\x89PNG\r\n\x1a\n")}, |
| + {"svg", "image/svg+xml", []byte(`<svg xmlns="http://www.w3.org/2000/svg"/>`)}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + in.Letterhead.Logo, in.Letterhead.LogoType = tc.logo, tc.typ |
| + _, header, _, err := renderDPAPDF(in) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if got, want := dpaPDFText(string(header)), "Team Tito Limited|privacy@carloku.com"; got != want { |
| + t.Errorf("header text is %q, want %q", got, want) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// Relative links in the agreement resolve to the site that published it, |
| +// not to the engine's file:// page. |
| +func TestDPAPDFBaseIsTheDocumentSite(t *testing.T) { |
| + for _, tc := range []struct{ url, want string }{ |
| + {"https://example.com/dpa/1/", `<base href="https://example.com/">`}, |
| + {"https://example.com:8443/dpa/1/?x=1#y", `<base href="https://example.com:8443/">`}, |
| + {"http://example.com/dpa/1/", ""}, |
| + {"https:///dpa/1/", ""}, |
| + {"/dpa/1/", ""}, |
| + {"::not a url", ""}, |
| + } { |
| + in := dpaPDFTestInput() |
| + in.Doc.URL = tc.url |
| + in.Doc.Body = `<p>See our <a href="/terms/">terms</a>.</p>` |
| + index, _, _ := renderDPAPDFAll(t, in) |
| + if !strings.Contains(index, `<a href="/terms/">terms</a>`) { |
| + t.Errorf("%s: the relative link is not kept as written:\n%s", tc.url, index) |
| + } |
| + if tc.want == "" { |
| + if strings.Contains(index, "<base") { |
| + t.Errorf("%s: a base element, want none:\n%s", tc.url, index) |
| + } |
| + continue |
| + } |
| + if n := strings.Count(index, "<base"); n != 1 || !strings.Contains(index, tc.want) { |
| + t.Errorf("%s: want exactly %s:\n%s", tc.url, tc.want, index) |
| + } |
| + } |
| +} |
| + |
| +// Blank lines in the address, at either end or between, print nothing. |
| +func TestDPAPDFAddressDropsBlankLines(t *testing.T) { |
| + in := dpaPDFTestInput() |
| + in.Acceptance.Address = "\n \r\n1 Example Street\n\n \t \nDublin\r\n\n" |
| + index, _, _ := renderDPAPDFAll(t, in) |
| + if got, want := dpaPDFParties(t, index), "<span>Shop Limited<br>1 Example Street<br>Dublin<br>Ireland</span>"; !strings.Contains(got, want) { |
| + t.Errorf("customer is not %s:\n%s", want, got) |
| + } |
| +} |
diff --git a/internal/console/dpapdfengine.go b/internal/console/dpapdfengine.go| new file mode 100644 |
| index 000000000..395c230d3 |
| --- /dev/null |
| +++ b/internal/console/dpapdfengine.go |
| @@ -0,0 +1,95 @@ |
| +package console |
| + |
| +import ( |
| + "bytes" |
| + "context" |
| + "errors" |
| + "fmt" |
| + "io" |
| + "mime/multipart" |
| + "net/http" |
| + "net/url" |
| + "time" |
| +) |
| + |
| +const ( |
| + // dpaPDFMax caps the engine's answer; a larger one is an error. |
| + dpaPDFMax = 10 << 20 |
| + // dpaPDFTimeout is the overall deadline for one engine call. |
| + dpaPDFTimeout = 30 * time.Second |
| +) |
| + |
| +// dpaPDFDeadline is dpaPDFTimeout; tests shorten it. |
| +var dpaPDFDeadline = dpaPDFTimeout |
| + |
| +// pdfFromHTML posts the three HTML documents to the engine's Chromium |
| +// route and returns the PDF. It is the operator-side call: it does not use |
| +// the tenant proxy or its metering. Errors are short categories that are |
| +// safe to log; they never carry the engine address or its response. |
| +func pdfFromHTML(ctx context.Context, client *http.Client, engine string, index, header, footer []byte) ([]byte, error) { |
| + base, err := url.Parse(engine) |
| + if err != nil || base.Scheme != "http" || base.Hostname() == "" { |
| + return nil, errors.New("engine unreachable") |
| + } |
| + target := base.JoinPath("forms", "chromium", "convert", "html").String() |
| + |
| + var body bytes.Buffer |
| + mw := multipart.NewWriter(&body) |
| + for _, f := range []struct { |
| + name string |
| + data []byte |
| + }{{"index.html", index}, {"header.html", header}, {"footer.html", footer}} { |
| + // Writes to a bytes.Buffer cannot fail, so errors here are not expected. |
| + part, err := mw.CreateFormFile("files", f.name) |
| + if err != nil { |
| + return nil, errors.New("engine unreachable") |
| + } |
| + _, _ = part.Write(f.data) |
| + } |
| + for _, kv := range [][2]string{ |
| + {"paperWidth", "8.27"}, {"paperHeight", "11.7"}, |
| + {"marginTop", "1"}, {"marginBottom", "1"}, |
| + {"marginLeft", "0.8"}, {"marginRight", "0.8"}, |
| + {"printBackground", "true"}, |
| + } { |
| + // WriteField only writes to the bytes.Buffer, which cannot fail. |
| + _ = mw.WriteField(kv[0], kv[1]) |
| + } |
| + if err := mw.Close(); err != nil { |
| + return nil, errors.New("engine unreachable") |
| + } |
| + |
| + ctx, cancel := context.WithTimeout(ctx, dpaPDFDeadline) |
| + defer cancel() |
| + req, err := http.NewRequestWithContext(ctx, http.MethodPost, target, &body) |
| + if err != nil { |
| + return nil, errors.New("engine unreachable") |
| + } |
| + req.Header.Set("Content-Type", mw.FormDataContentType()) |
| + resp, err := client.Do(req) |
| + if err != nil { |
| + return nil, pdfEngineErr(ctx, err) |
| + } |
| + defer resp.Body.Close() |
| + if resp.StatusCode != http.StatusOK { |
| + return nil, fmt.Errorf("engine status %d", resp.StatusCode) |
| + } |
| + pdf, err := io.ReadAll(io.LimitReader(resp.Body, dpaPDFMax+1)) |
| + if err != nil { |
| + return nil, pdfEngineErr(ctx, err) |
| + } |
| + if len(pdf) > dpaPDFMax { |
| + return nil, errors.New("too large") |
| + } |
| + if !bytes.HasPrefix(pdf, []byte("%PDF-")) { |
| + return nil, errors.New("not a pdf") |
| + } |
| + return pdf, nil |
| +} |
| + |
| +func pdfEngineErr(ctx context.Context, err error) error { |
| + if errors.Is(ctx.Err(), context.DeadlineExceeded) || errors.Is(err, context.DeadlineExceeded) { |
| + return errors.New("timeout") |
| + } |
| + return errors.New("engine unreachable") |
| +} |
diff --git a/internal/console/dpapdfengine_test.go b/internal/console/dpapdfengine_test.go| new file mode 100644 |
| index 000000000..13d867202 |
| --- /dev/null |
| +++ b/internal/console/dpapdfengine_test.go |
| @@ -0,0 +1,123 @@ |
| +package console |
| + |
| +import ( |
| + "bytes" |
| + "io" |
| + "net/http" |
| + "net/http/httptest" |
| + "strings" |
| + "testing" |
| + "time" |
| +) |
| + |
| +func TestPDFFromHTMLRequestShape(t *testing.T) { |
| + want := []byte("%PDF-1.7 exact") |
| + var gotPath, gotMethod string |
| + files := map[string]string{} |
| + fields := map[string]string{} |
| + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + gotPath, gotMethod = r.URL.Path, r.Method |
| + if err := r.ParseMultipartForm(1 << 20); err != nil { |
| + t.Errorf("parse: %v", err) |
| + return |
| + } |
| + for name, hs := range r.MultipartForm.File { |
| + if name != "files" { |
| + t.Errorf("unexpected file field %q", name) |
| + } |
| + for _, h := range hs { |
| + f, _ := h.Open() |
| + b, _ := io.ReadAll(f) |
| + f.Close() |
| + files[h.Filename] = string(b) |
| + } |
| + } |
| + for k, v := range r.MultipartForm.Value { |
| + fields[k] = v[0] |
| + } |
| + _, _ = w.Write(want) |
| + })) |
| + defer srv.Close() |
| + for _, base := range []string{srv.URL, srv.URL + "/"} { |
| + clear(files) |
| + clear(fields) |
| + gotPath, gotMethod = "", "" |
| + got, err := pdfFromHTML(t.Context(), srv.Client(), base, []byte("IDX"), []byte("HDR"), []byte("FTR")) |
| + if err != nil || !bytes.Equal(got, want) { |
| + t.Fatalf("got %q, %v", got, err) |
| + } |
| + if gotMethod != http.MethodPost || gotPath != "/forms/chromium/convert/html" { |
| + t.Fatalf("request %s %s", gotMethod, gotPath) |
| + } |
| + if len(files) != 3 || files["index.html"] != "IDX" || files["header.html"] != "HDR" || files["footer.html"] != "FTR" { |
| + t.Fatalf("files %v", files) |
| + } |
| + wantFields := map[string]string{"paperWidth": "8.27", "paperHeight": "11.7", "marginTop": "1", "marginBottom": "1", "marginLeft": "0.8", "marginRight": "0.8", "printBackground": "true"} |
| + if len(fields) != len(wantFields) { |
| + t.Fatalf("fields %v", fields) |
| + } |
| + for k, v := range wantFields { |
| + if fields[k] != v { |
| + t.Fatalf("field %s = %q, want %q", k, fields[k], v) |
| + } |
| + } |
| + } |
| +} |
| + |
| +func TestPDFFromHTMLErrors(t *testing.T) { |
| + old := dpaPDFDeadline |
| + dpaPDFDeadline = 200 * time.Millisecond |
| + defer func() { dpaPDFDeadline = old }() |
| + stall := make(chan struct{}) |
| + t.Cleanup(func() { close(stall) }) |
| + cases := []struct { |
| + name string |
| + handler http.HandlerFunc |
| + want string |
| + }{ |
| + {"500", func(w http.ResponseWriter, r *http.Request) { |
| + w.WriteHeader(500) |
| + _, _ = w.Write([]byte("secret body")) |
| + }, "engine status 500"}, |
| + {"too large", func(w http.ResponseWriter, r *http.Request) { |
| + b := append([]byte("%PDF-"), make([]byte, dpaPDFMax+1-5)...) |
| + _, _ = w.Write(b) |
| + }, "too large"}, |
| + {"not a pdf", func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte("<html>")) }, "not a pdf"}, |
| + {"stalled", func(w http.ResponseWriter, r *http.Request) { |
| + // Drain the body so the server notices the client hanging up. |
| + _, _ = io.Copy(io.Discard, r.Body) |
| + select { |
| + case <-stall: |
| + case <-time.After(5 * time.Second): |
| + case <-r.Context().Done(): |
| + } |
| + }, "timeout"}, |
| + } |
| + for _, c := range cases { |
| + t.Run(c.name, func(t *testing.T) { |
| + srv := httptest.NewServer(c.handler) |
| + defer srv.Close() |
| + start := time.Now() |
| + got, err := pdfFromHTML(t.Context(), srv.Client(), srv.URL, []byte("i"), []byte("h"), []byte("f")) |
| + if err == nil || got != nil || err.Error() != c.want { |
| + t.Fatalf("got %d bytes, err %v; want %q", len(got), err, c.want) |
| + } |
| + if strings.Contains(err.Error(), srv.URL) || strings.Contains(err.Error(), "secret") { |
| + t.Fatalf("error leaks: %v", err) |
| + } |
| + if time.Since(start) > 5*time.Second { |
| + t.Fatal("deadline not applied") |
| + } |
| + }) |
| + } |
| + t.Run("unreachable", func(t *testing.T) { |
| + srv := httptest.NewServer(http.NotFoundHandler()) |
| + url := srv.URL |
| + srv.Close() |
| + _, err := pdfFromHTML(t.Context(), http.DefaultClient, url, nil, nil, nil) |
| + if err == nil || err.Error() != "engine unreachable" { |
| + t.Fatalf("err %v", err) |
| + } |
| + }) |
| +} |
diff --git a/internal/console/dpapdfroute.go b/internal/console/dpapdfroute.go| new file mode 100644 |
| index 000000000..4d96022e2 |
| --- /dev/null |
| +++ b/internal/console/dpapdfroute.go |
| @@ -0,0 +1,113 @@ |
| +package console |
| + |
| +import ( |
| + "log" |
| + "net/http" |
| + "strconv" |
| + "strings" |
| + "time" |
| +) |
| + |
| +// The executed data processing agreement as a PDF (DPA and retention spec |
| +// §3.8): GET /a/{sqid}/settings/dpa.pdf. Any member may download it. It |
| +// carries the document and letterhead the acceptance itself names, never |
| +// the current ones. |
| + |
| +// dpaPDFFailedText is record.pdf_failed: the engine or the render failed. |
| +const dpaPDFFailedText = "We couldn't make the PDF just now. Try again in a minute, or print this page instead." |
| + |
| +// dpaPDFFilename is pdf.filename, the download's name. The version is free |
| +// text an operator typed, so every character but a letter, digit, dot, |
| +// hyphen or underscore becomes a hyphen: the name always fits a quoted |
| +// Content-Disposition value. |
| +func dpaPDFFilename(version string) string { |
| + safe := strings.Map(func(r rune) rune { |
| + switch { |
| + case r >= 'a' && r <= 'z', r >= 'A' && r <= 'Z', r >= '0' && r <= '9', r == '.', r == '-', r == '_': |
| + return r |
| + } |
| + return '-' |
| + }, version) |
| + return "data-processing-agreement-v" + safe + ".pdf" |
| +} |
| + |
| +// dpaPDFURL is the download's path for an account. |
| +func dpaPDFURL(sqid string) string { return accountSettingsURL(sqid) + "/dpa.pdf" } |
| + |
| +// newDPAPDFClient is the console's client for the PDF engine. The engine is |
| +// internal, so no proxy, and a redirect is answered as it stands (a non-200, |
| +// so an error in pdfFromHTML). pdfFromHTML sets the deadline. |
| +func newDPAPDFClient() *http.Client { |
| + transport := http.DefaultTransport.(*http.Transport).Clone() |
| + transport.Proxy = nil |
| + return &http.Client{Transport: transport, CheckRedirect: func(*http.Request, []*http.Request) error { |
| + return http.ErrUseLastResponse |
| + }} |
| +} |
| + |
| +// dpaPDFConsoleName is the console's name as the PDF's "in the {console} |
| +// console" lines want it: the page chrome's name without a trailing |
| +// " console", so the default "CARLOS console" does not read twice. |
| +func (s *Server) dpaPDFConsoleName() string { |
| + return strings.TrimSuffix(s.brandName(), " console") |
| +} |
| + |
| +// handleDPAPDF answers the PDF. Gates, in order: membership (the |
| +// byte-identical 404 for anyone else); an engine configured (else the |
| +// plain 404, before any read); an acceptance in force (else the 404 the |
| +// record page gives a member); the write limit, as a cost bound. A render or engine failure |
| +// is the record page at 502 with record.pdf_failed, logged with the |
| +// account and the error's category only. |
| +func (s *Server) handleDPAPDF(w http.ResponseWriter, r *http.Request) { |
| + addr, raw, acct, role, ok := s.account(w, r) |
| + if !ok { |
| + return |
| + } |
| + // The feature is off: the plain 404 before any read, so a failing |
| + // read cannot answer 500 for a route that does not exist here. |
| + if s.cfg.PDFEngine == "" { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + ctx := r.Context() |
| + live, doc, lh, err := s.dpaLiveRecord(ctx, acct.ID) |
| + if err != nil { |
| + log.Printf("console: dpa pdf %s: %v", acct.Sqid, err) |
| + http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) |
| + return |
| + } |
| + if live == nil { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + if !s.allowWrite(Principal{Address: addr}, time.Now()) { |
| + s.renderMessage(w, r, http.StatusTooManyRequests, "Refused", dpaRateLimitText) |
| + return |
| + } |
| + failed := func(category string) { |
| + log.Printf("console: dpa pdf %s: %s", acct.Sqid, category) |
| + s.renderDPARecord(w, r, addr, raw, acct, role, http.StatusBadGateway, dpaPDFFailedText) |
| + } |
| + index, header, footer, err := renderDPAPDF(dpaPDFInput{ |
| + Acceptance: *live, Doc: *doc, Letterhead: *lh, ConsoleName: s.dpaPDFConsoleName(), |
| + }) |
| + if err != nil { |
| + // The error names the document and the check that failed; the |
| + // category is enough here. |
| + failed("render") |
| + return |
| + } |
| + pdf, err := pdfFromHTML(ctx, s.dpaPDFHTTP, s.cfg.PDFEngine, index, header, footer) |
| + if err != nil { |
| + // pdfFromHTML's errors are categories already. |
| + failed("pdf engine: " + err.Error()) |
| + return |
| + } |
| + h := w.Header() |
| + h.Set("Content-Type", "application/pdf") |
| + h.Set("Content-Disposition", `attachment; filename="`+dpaPDFFilename(doc.Version)+`"`) |
| + h.Set("Content-Length", strconv.Itoa(len(pdf))) |
| + h.Set("Cache-Control", "no-store") |
| + w.WriteHeader(http.StatusOK) |
| + _, _ = w.Write(pdf) |
| +} |
diff --git a/internal/console/dpapdfroute_test.go b/internal/console/dpapdfroute_test.go| new file mode 100644 |
| index 000000000..6c2e15950 |
| --- /dev/null |
| +++ b/internal/console/dpapdfroute_test.go |
| @@ -0,0 +1,409 @@ |
| +package console |
| + |
| +import ( |
| + "bytes" |
| + "io" |
| + "log" |
| + "net/http" |
| + "net/http/httptest" |
| + "strings" |
| + "sync" |
| + "testing" |
| + "time" |
| +) |
| + |
| +// The DPA PDF download (dpapdfroute.go, spec §3.8): the route, the record |
| +// page's button and the confirmation email's PDF line. |
| + |
| +// dpaPDFDeck is a PDF deck row's text with its {names} filled from kv. |
| +func dpaPDFDeck(t *testing.T, id string, kv ...string) string { |
| + t.Helper() |
| + for _, r := range parseDPAPDFCopyDeck(t) { |
| + if r.ID == id { |
| + s := r.New |
| + for i := 0; i+1 < len(kv); i += 2 { |
| + s = strings.ReplaceAll(s, "{"+kv[i]+"}", kv[i+1]) |
| + } |
| + return s |
| + } |
| + } |
| + t.Fatalf("no deck row %s", id) |
| + return "" |
| +} |
| + |
| +// dpaFakeEngine is a PDF engine that records each index.html it is sent |
| +// and answers status, with "%PDF-1.7 test" when that is 200. |
| +type dpaFakeEngine struct { |
| + mu sync.Mutex |
| + index []string |
| + status int |
| +} |
| + |
| +func (e *dpaFakeEngine) sent() []string { |
| + e.mu.Lock() |
| + defer e.mu.Unlock() |
| + return append([]string(nil), e.index...) |
| +} |
| + |
| +// dpaPDFEngineFor starts a fake engine and points the console at it. |
| +func dpaPDFEngineFor(t *testing.T, fx *consoleFixture) *dpaFakeEngine { |
| + t.Helper() |
| + e := &dpaFakeEngine{status: http.StatusOK} |
| + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + if r.Method != http.MethodPost || r.URL.Path != "/forms/chromium/convert/html" { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + if err := r.ParseMultipartForm(4 << 20); err != nil { |
| + http.Error(w, "bad form", http.StatusBadRequest) |
| + return |
| + } |
| + var index string |
| + for _, h := range r.MultipartForm.File["files"] { |
| + if h.Filename != "index.html" { |
| + continue |
| + } |
| + f, err := h.Open() |
| + if err != nil { |
| + continue |
| + } |
| + b, _ := io.ReadAll(f) |
| + f.Close() |
| + index = string(b) |
| + } |
| + e.mu.Lock() |
| + e.index = append(e.index, index) |
| + status := e.status |
| + e.mu.Unlock() |
| + if status != http.StatusOK { |
| + http.Error(w, "engine trouble", status) |
| + return |
| + } |
| + w.Header().Set("Content-Type", "application/pdf") |
| + _, _ = io.WriteString(w, "%PDF-1.7 test") |
| + })) |
| + t.Cleanup(srv.Close) |
| + fx.srv.cfg.PDFEngine = srv.URL |
| + return e |
| +} |
| + |
| +// dpaGet is a GET with its headers. |
| +func dpaGet(t *testing.T, c *http.Client, u string) (int, http.Header, string) { |
| + t.Helper() |
| + res, err := c.Get(u) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer res.Body.Close() |
| + raw, err := io.ReadAll(res.Body) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return res.StatusCode, res.Header, string(raw) |
| +} |
| + |
| +// dpaMember adds kim as a plain member of the ops account and signs her in. |
| +func dpaMember(t *testing.T, fx *consoleFixture) *http.Client { |
| + t.Helper() |
| + if err := fx.st.AddMember(OpsAccountID, "kim@keymail.dev", RoleMember, time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + c, _ := signInAs(t, fx, "kim@keymail.dev", "code-"+t.Name()+"-kim") |
| + return c |
| +} |
| + |
| +func TestDPAPDFDownload(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + member := dpaMember(t, fx) |
| + docID, lhID := dpaWorld(t, fx) |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + engine := dpaPDFEngineFor(t, fx) |
| + |
| + status, h, body := dpaGet(t, member, fx.u("/settings/dpa.pdf")) |
| + if status != http.StatusOK || body != "%PDF-1.7 test" { |
| + t.Fatalf("download = %d %q", status, body) |
| + } |
| + if ct := h.Get("Content-Type"); ct != "application/pdf" { |
| + t.Errorf("Content-Type = %q", ct) |
| + } |
| + if cd, want := h.Get("Content-Disposition"), `attachment; filename="`+dpaPDFDeck(t, "PDF-C15", "version", "1")+`"`; cd != want { |
| + t.Errorf("Content-Disposition = %q, want %q", cd, want) |
| + } |
| + if cc := h.Get("Cache-Control"); cc != "no-store" { |
| + t.Errorf("Cache-Control = %q", cc) |
| + } |
| + sent := engine.sent() |
| + if len(sent) != 1 { |
| + t.Fatalf("engine got %d requests, want 1", len(sent)) |
| + } |
| + for _, want := range []string{"Version 1", "https://example.com/dpa/1/", oplDigest([]byte(oplFragment)), |
| + "Shop <Limited>", "Example Hosting Limited"} { |
| + if !strings.Contains(sent[0], want) { |
| + t.Errorf("the HTML sent lacks %q", want) |
| + } |
| + } |
| +} |
| + |
| +func TestDPAPDFUsesAcceptedIDs(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + c := signInPaul(t, fx) |
| + docID, lhID := dpaWorld(t, fx) |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + // A newer letterhead and a newer version, already effective, published |
| + // after the acceptance. |
| + dpaLetterhead(t, fx, "Newer Hosting Limited") |
| + dpaPublish(t, fx, "2", dpaFragmentV2, time.Now().Add(-time.Minute)) |
| + engine := dpaPDFEngineFor(t, fx) |
| + |
| + status, h, _ := dpaGet(t, c, fx.u("/settings/dpa.pdf")) |
| + if status != http.StatusOK { |
| + t.Fatalf("download = %d", status) |
| + } |
| + if cd := h.Get("Content-Disposition"); !strings.Contains(cd, dpaPDFDeck(t, "PDF-C15", "version", "1")) { |
| + t.Errorf("Content-Disposition = %q, want version 1's name", cd) |
| + } |
| + sent := engine.sent() |
| + if len(sent) != 1 { |
| + t.Fatalf("engine got %d requests, want 1", len(sent)) |
| + } |
| + for _, want := range []string{"https://example.com/dpa/1/", "Example Hosting Limited", oplDigest([]byte(oplFragment))} { |
| + if !strings.Contains(sent[0], want) { |
| + t.Errorf("the HTML sent lacks the accepted %q", want) |
| + } |
| + } |
| + for _, bad := range []string{"Newer Hosting", "example.com/dpa/2/", oplDigest([]byte(dpaFragmentV2)), "version 2"} { |
| + if strings.Contains(sent[0], bad) { |
| + t.Errorf("the HTML sent carries the current %q, not the accepted one", bad) |
| + } |
| + } |
| +} |
| + |
| +func TestDPAPDFGates(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + member := dpaMember(t, fx) |
| + owner := signInPaul(t, fx) |
| + stranger, _ := signInAs(t, fx, "eve@keymail.dev", "code-dpa-pdf-stranger") |
| + docID, lhID := dpaWorld(t, fx) |
| + engine := dpaPDFEngineFor(t, fx) |
| + |
| + // No acceptance in force: the record page's 404 for a member, and the |
| + // same for an owner (whose record page is the "none yet" page instead). |
| + _, _, recordMember := get(t, member, fx.u("/settings/dpa")) |
| + _, _, unrouted := get(t, member, fx.ts.URL+"/no/such/path") |
| + if recordMember != unrouted { |
| + t.Fatalf("the record page's member 404 is not the plain one") |
| + } |
| + for name, c := range map[string]*http.Client{"member": member, "owner": owner} { |
| + if s, _, b := get(t, c, fx.u("/settings/dpa.pdf")); s != http.StatusNotFound || b != recordMember { |
| + t.Errorf("%s with no acceptance = %d, want the record page's 404", name, s) |
| + } |
| + } |
| + |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + // A non-member: the byte-identical 404. |
| + if s, _, b := get(t, stranger, fx.u("/settings/dpa.pdf")); s != http.StatusNotFound || b != unrouted { |
| + t.Errorf("non-member = %d, want the byte-identical 404", s) |
| + } |
| + // Signed out: no page either. |
| + if s, _, _ := get(t, newBrowser(t), fx.u("/settings/dpa.pdf")); s == http.StatusOK { |
| + t.Errorf("signed out = %d", s) |
| + } |
| + if n := len(engine.sent()); n != 0 { |
| + t.Fatalf("engine called %d times by refused requests", n) |
| + } |
| + |
| + // Over the write limit: the DPA pages' refusal, and no engine call. |
| + fx.srv.cli.write = newRateLimiter(1, time.Hour) |
| + if !fx.srv.allowWrite(Principal{Address: "kim@keymail.dev"}, time.Now()) { |
| + t.Fatal("the fresh limiter refused the first write") |
| + } |
| + s, _, b := get(t, member, fx.u("/settings/dpa.pdf")) |
| + if s != http.StatusTooManyRequests || !strings.Contains(oplText(b), dpaRateLimitText) { |
| + t.Errorf("over the limit = %d, want 429 with %q:\n%s", s, dpaRateLimitText, b) |
| + } |
| + if n := len(engine.sent()); n != 0 { |
| + t.Errorf("engine called %d times over the limit", n) |
| + } |
| +} |
| + |
| +func TestDPAPDFNoEngine(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + c := signInPaul(t, fx) |
| + docID, lhID := dpaWorld(t, fx) |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + |
| + _, _, page := get(t, c, fx.u("/settings/dpa")) |
| + if strings.Contains(page, dpaPDFDeck(t, "PDF-C16")) || strings.Contains(page, "dpa.pdf") { |
| + t.Errorf("record page offers the PDF with no engine:\n%s", page) |
| + } |
| + if !strings.Contains(page, `<button type="button" onclick="window.print()">`) { |
| + t.Errorf("print is not the main button with no engine:\n%s", page) |
| + } |
| + status, _, body := get(t, c, fx.u("/settings/dpa.pdf")) |
| + _, _, unrouted := get(t, c, fx.ts.URL+"/no/such/path") |
| + if status != http.StatusNotFound || body != unrouted { |
| + t.Errorf("no engine = %d, want the plain 404", status) |
| + } |
| +} |
| + |
| +// With no engine the route is the plain 404 before any read: a failing |
| +// acceptance read is a 500 only once an engine is configured. |
| +func TestDPAPDFNoEngineSkipsReads(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + c := signInPaul(t, fx) |
| + docID, lhID := dpaWorld(t, fx) |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + if _, err := fx.st.db.Exec(`ALTER TABLE dpa_acceptances RENAME TO dpa_acceptances_gone`); err != nil { |
| + t.Fatal(err) |
| + } |
| + status, _, body := get(t, c, fx.u("/settings/dpa.pdf")) |
| + _, _, unrouted := get(t, c, fx.ts.URL+"/no/such/path") |
| + if status != http.StatusNotFound || body != unrouted { |
| + t.Errorf("no engine, failing read = %d, want the plain 404", status) |
| + } |
| + dpaPDFEngineFor(t, fx) |
| + if s, _, _ := get(t, c, fx.u("/settings/dpa.pdf")); s != http.StatusInternalServerError { |
| + t.Errorf("with an engine the failing read = %d, want 500 (the read must fail for this test to mean anything)", s) |
| + } |
| +} |
| + |
| +func TestDPAPDFEngineFailure(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + member := dpaMember(t, fx) |
| + docID, lhID := dpaWorld(t, fx) |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + engine := dpaPDFEngineFor(t, fx) |
| + engine.status = http.StatusInternalServerError |
| + |
| + var logs bytes.Buffer |
| + prev := log.Writer() |
| + log.SetOutput(&logs) |
| + t.Cleanup(func() { log.SetOutput(prev) }) |
| + |
| + want := dpaPDFDeck(t, "PDF-C17") |
| + status, h, body := dpaGet(t, member, fx.u("/settings/dpa.pdf")) |
| + log.SetOutput(prev) |
| + if status != http.StatusBadGateway || !strings.Contains(oplText(body), want) { |
| + t.Fatalf("engine failure = %d, want 502 with %q:\n%s", status, want, body) |
| + } |
| + if cd := h.Get("Content-Disposition"); cd != "" || strings.Contains(h.Get("Content-Type"), "pdf") { |
| + t.Errorf("a failure answers as a download: %q %q", cd, h.Get("Content-Type")) |
| + } |
| + // The page is the record, so "print this page" prints the record, and |
| + // print is the main button with the download beside it. |
| + page := oplText(body) |
| + if !strings.Contains(page, "Ada Lovelace, Director (paul@keymail.dev)") { |
| + t.Errorf("the failure page is not the record:\n%s", body) |
| + } |
| + printBtn := `<button type="button" onclick="window.print()">` + oplDeck(t, "DPA-C39") + "</button>" |
| + download := `<a class="btn btn-secondary" href="` + fx.path("/settings/dpa.pdf") + `">` + dpaPDFDeck(t, "PDF-C16") + "</a>" |
| + if pi, di := strings.Index(page, printBtn), strings.Index(page, download); pi < 0 || di < 0 || pi > di { |
| + t.Errorf("the failure page does not lead with print, then the download:\n%s", page) |
| + } |
| + line := logs.String() |
| + if !strings.Contains(line, "dpa pdf "+fx.sqid) || !strings.Contains(line, "engine status 500") { |
| + t.Errorf("log = %q, want the sqid and the category", line) |
| + } |
| + if strings.Contains(line, fx.srv.cfg.PDFEngine) || strings.Contains(line, "engine trouble") || strings.Contains(line, "Shop") { |
| + t.Errorf("log carries more than the category: %q", line) |
| + } |
| + |
| + // A stored body that no longer passes canonicalAgreement: the same 502, |
| + // and the engine is not called. |
| + fx2 := newConsoleFixture(t) |
| + c2 := signInPaul(t, fx2) |
| + bad := dpaPublish(t, fx2, "1", "<section><script>alert(1)</script></section>\n", time.Now().Add(-time.Hour)) |
| + dpaAcceptFor(t, fx2, bad, dpaLetterhead(t, fx2, "Example Hosting Limited")) |
| + engine2 := dpaPDFEngineFor(t, fx2) |
| + if s, _, b := get(t, c2, fx2.u("/settings/dpa.pdf")); s != http.StatusBadGateway || !strings.Contains(oplText(b), want) { |
| + t.Errorf("render failure = %d, want 502 with %q", s, want) |
| + } |
| + if n := len(engine2.sent()); n != 0 { |
| + t.Errorf("engine called %d times for a body that failed the check", n) |
| + } |
| +} |
| + |
| +func TestDPARecordDownloadButton(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + member := dpaMember(t, fx) |
| + docID, lhID := dpaWorld(t, fx) |
| + dpaAcceptFor(t, fx, docID, lhID) |
| + dpaPDFEngineFor(t, fx) |
| + |
| + status, _, raw := get(t, member, fx.u("/settings/dpa")) |
| + if status != http.StatusOK { |
| + t.Fatalf("record = %d", status) |
| + } |
| + body := oplText(raw) |
| + for _, want := range []string{ |
| + `<a class="btn" href="` + fx.path("/settings/dpa.pdf") + `">` + dpaPDFDeck(t, "PDF-C16") + `</a>`, |
| + `<button type="button" class="btn-secondary" onclick="window.print()">` + oplDeck(t, "DPA-C39") + "</button>", |
| + } { |
| + if !strings.Contains(body, want) { |
| + t.Errorf("record lacks %q:\n%s", want, body) |
| + } |
| + } |
| + if strings.Index(body, dpaPDFDeck(t, "PDF-C16")) > strings.Index(body, oplDeck(t, "DPA-C39")) { |
| + t.Errorf("Download PDF is not the first button") |
| + } |
| + |
| + // The owner's "none yet" page has nothing to download. |
| + fx2 := newConsoleFixture(t) |
| + c2 := signInPaul(t, fx2) |
| + dpaWorld(t, fx2) |
| + dpaPDFEngineFor(t, fx2) |
| + if _, _, none := get(t, c2, fx2.u("/settings/dpa")); strings.Contains(none, "dpa.pdf") { |
| + t.Errorf("the none-yet page offers a PDF:\n%s", none) |
| + } |
| +} |
| + |
| +func TestDPAAcceptEmailPDFLine(t *testing.T) { |
| + at := time.Date(2026, 11, 25, 9, 5, 0, 0, time.UTC) |
| + doc := &LegalDocument{Version: "3", URL: "https://example.com/dpa/3/", SHA256: "abc123"} |
| + lh := &Letterhead{Entity: "Example Hosting Limited", PrivacyAddress: "privacy@example.com"} |
| + a := DPAAcceptance{LegalName: "Shop Limited", Address: "1 Main Street", Country: "IE", |
| + SignerName: "Ada Lovelace", SignerRole: "Director", AcceptedBy: "ada@example.com", AcceptedAt: at} |
| + const record = "https://console.example.com/a/bab/settings/dpa" |
| + const pdf = "https://console.example.com/a/bab/settings/dpa.pdf" |
| + line := dpaPDFDeck(t, "PDF-C18", "pdf_url", pdf) |
| + |
| + _, with := dpaAcceptEmail(doc, lh, a, record, pdf) |
| + if !strings.Contains(with, record+"\n"+line+"\n\n") { |
| + t.Errorf("with an engine, the PDF line %q does not follow the record link:\n%s", line, with) |
| + } |
| + _, without := dpaAcceptEmail(doc, lh, a, record, "") |
| + if strings.Contains(without, "PDF") || strings.Contains(without, "dpa.pdf") { |
| + t.Errorf("without an engine, the email mentions a PDF:\n%s", without) |
| + } |
| + if with != strings.Replace(without, record+"\n", record+"\n"+line+"\n", 1) { |
| + t.Errorf("the PDF line changes more than its own line:\n%s\n---\n%s", with, without) |
| + } |
| + |
| + // Through the accept POST: the PDF URL is the console's own origin. |
| + for _, engine := range []bool{true, false} { |
| + fx := newConsoleFixture(t) |
| + c := signInPaul(t, fx) |
| + csrf := sessionToken(t, fx, c) |
| + dpaWorld(t, fx) |
| + if engine { |
| + dpaPDFEngineFor(t, fx) |
| + } |
| + mail := dpaCaptureMail(fx) |
| + dpaFreshAs(t, fx, c, "paul@keymail.dev") |
| + h := dpaHidden(t, dpaSettings(t, fx, c)) |
| + if s, _, b := postForm(t, c, fx.u("/dpa/accept"), dpaPost(csrf, h)); s != http.StatusSeeOther { |
| + t.Fatalf("accept = %d:\n%s", s, b) |
| + } |
| + mail.mu.Lock() |
| + if len(mail.sent) != 1 { |
| + mail.mu.Unlock() |
| + t.Fatalf("%d deliveries, want 1", len(mail.sent)) |
| + } |
| + got := mail.sent[0].body |
| + mail.mu.Unlock() |
| + want := dpaPDFDeck(t, "PDF-C18", "pdf_url", fx.srv.cfg.Origin+fx.path("/settings/dpa.pdf")) |
| + if engine != strings.Contains(got, want) { |
| + t.Errorf("engine %v: email PDF line present = %v, want %v:\n%s", engine, !engine, engine, got) |
| + } |
| + } |
| +} |
diff --git a/internal/console/dparecord.go b/internal/console/dparecord.go| index 817fbc999..86a82e676 100644 |
| --- a/internal/console/dparecord.go |
| +++ b/internal/console/dparecord.go |
| @@ -1,7 +1,9 @@ |
| package console |
| import ( |
| + "context" |
| "errors" |
| + "fmt" |
| "log" |
| "net/http" |
| "strings" |
| @@ -29,6 +31,8 @@ type dpaRecordView struct { |
| DigestShort string |
| Processor string |
| SettingsURL string |
| + PDFURL string // the download, when an engine is configured |
| + PDFFailed bool // the download just failed: print is the main button |
| } |
| // dpaRecordWhenLayout is dpa.record.row.when's value format. |
| @@ -68,13 +72,45 @@ func (s *Server) handleDPARecord(w http.ResponseWriter, r *http.Request) { |
| if !ok { |
| return |
| } |
| - fail := func(what string, err error) { |
| - log.Printf("console: dpa record %s: %s: %v", acct.Sqid, what, err) |
| + s.renderDPARecord(w, r, addr, raw, acct, role, http.StatusOK, "") |
| +} |
| + |
| +// dpaLiveRecord is the account's acceptance in force and the document and |
| +// letterhead it names; all nil when none is in force. A gone document or |
| +// letterhead is an error. |
| +func (s *Server) dpaLiveRecord(ctx context.Context, accountID int64) (*DPAAcceptance, *LegalDocument, *Letterhead, error) { |
| + live, err := s.store.LiveDPA(ctx, accountID) |
| + if err != nil { |
| + return nil, nil, nil, fmt.Errorf("live acceptance: %w", err) |
| + } |
| + if live == nil { |
| + return nil, nil, nil, nil |
| + } |
| + doc, err := s.store.LegalDocument(ctx, live.DocumentID) |
| + if err != nil { |
| + return nil, nil, nil, fmt.Errorf("document: %w", err) |
| + } |
| + lh, err := s.store.LetterheadByID(ctx, live.LetterheadID) |
| + if err != nil { |
| + return nil, nil, nil, fmt.Errorf("letterhead: %w", err) |
| + } |
| + if doc == nil || lh == nil { |
| + return nil, nil, nil, fmt.Errorf("acceptance references: %w", errDPARecordMissing) |
| + } |
| + return live, doc, lh, nil |
| +} |
| + |
| +// renderDPARecord renders the record page for a viewer the caller has |
| +// admitted as a member, with status. failed, when set, is a banner: the |
| +// PDF download (dpapdfroute.go) answers its failure with this page. |
| +func (s *Server) renderDPARecord(w http.ResponseWriter, r *http.Request, addr, raw string, acct *Account, role string, status int, failed string) { |
| + fail := func(err error) { |
| + log.Printf("console: dpa record %s: %v", acct.Sqid, err) |
| http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) |
| } |
| - live, err := s.store.LiveDPA(r.Context(), acct.ID) |
| + live, doc, lh, err := s.dpaLiveRecord(r.Context(), acct.ID) |
| if err != nil { |
| - fail("live acceptance", err) |
| + fail(err) |
| return |
| } |
| v := &dpaRecordView{SettingsURL: accountSettingsURL(acct.Sqid)} |
| @@ -84,23 +120,9 @@ func (s *Server) handleDPARecord(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| } else { |
| - doc, err := s.store.LegalDocument(r.Context(), live.DocumentID) |
| - if err != nil { |
| - fail("document", err) |
| - return |
| - } |
| - lh, err := s.store.LetterheadByID(r.Context(), live.LetterheadID) |
| - if err != nil { |
| - fail("letterhead", err) |
| - return |
| - } |
| docs, err := s.store.LegalDocuments(r.Context(), "dpa") |
| if err != nil { |
| - fail("documents", err) |
| - return |
| - } |
| - if doc == nil || lh == nil { |
| - fail("acceptance references", errDPARecordMissing) |
| + fail(fmt.Errorf("documents: %w", err)) |
| return |
| } |
| inForce := dpaInForce(*live, docs, nil, s.now()) |
| @@ -121,12 +143,19 @@ func (s *Server) handleDPARecord(w http.ResponseWriter, r *http.Request) { |
| v.InForce = inForce.Version |
| v.Digest, v.DigestShort = doc.SHA256, dpaShortDigest(doc.SHA256) |
| v.Processor = dpaRecordProcessorText(lh) |
| + if s.cfg.PDFEngine != "" { |
| + v.PDFURL = dpaPDFURL(acct.Sqid) |
| + } |
| } |
| p := s.accountPage(w, r, addr, raw, acct, role) |
| p.Title = "Data processing agreement" |
| p.ActiveNav = "settings" |
| p.DPARecord = v |
| - s.render(w, http.StatusOK, "dpa_record", p) |
| + if failed != "" { |
| + p.FlashErr = failed |
| + v.PDFFailed = true |
| + } |
| + s.render(w, status, "dpa_record", p) |
| } |
| // errDPARecordMissing: an acceptance names a document or letterhead that is gone. |
diff --git a/internal/console/icons_test.go b/internal/console/icons_test.go| index 12fa98230..26eb6244f 100644 |
| --- a/internal/console/icons_test.go |
| +++ b/internal/console/icons_test.go |
| @@ -64,6 +64,8 @@ func TestSwitcherChromeIsInlineSVGNotTextGlyphs(t *testing.T) { |
| // sameOriginAssetTags is the exact shape it may use. The demo claim page |
| // may load only its embedded demo_claim.js through the same asset helper. |
| // Its shared console styles are inline and covered by an exact CSP hash. |
| +// The DPA PDF's page header (dpa_pdf_header.html) may carry its one logo |
| +// image, whose src is always a data: URI built in dpapdf.go. |
| func TestConsoleTemplatesFetchNothingOffOrigin(t *testing.T) { |
| err := fs.WalkDir(tmplFS, ".", func(path string, d fs.DirEntry, err error) error { |
| if err != nil || d.IsDir() { |
| @@ -111,6 +113,32 @@ func TestConsoleTemplatesOffOriginCheckRefusesLiteralURLsInTheShell(t *testing.T |
| } |
| } |
| +// The DPA PDF header's allowance is its one logo tag, exactly: another image, |
| +// a second logo tag, or the logo tag in another template still fails. |
| +func TestConsoleTemplatesOffOriginCheckAllowsOnlyThePDFLogo(t *testing.T) { |
| + header, err := tmplFS.ReadFile("templates/dpa_pdf_header.html") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !strings.Contains(string(header), dpaPDFHeaderLogoTag) { |
| + t.Fatal("dpa_pdf_header.html no longer has the logo tag the allowance names") |
| + } |
| + if got := offOriginFetches("templates/dpa_pdf_header.html", string(header)); len(got) != 0 { |
| + t.Fatalf("the shipped dpa_pdf_header.html should pass, found %q", got) |
| + } |
| + for _, tc := range []struct{ name, path, src string }{ |
| + {"https image", "templates/dpa_pdf_header.html", string(header) + `<img src="https://example.com/x.png">`}, |
| + {"second logo tag", "templates/dpa_pdf_header.html", string(header) + dpaPDFHeaderLogoTag}, |
| + {"logo tag in another template", "templates/dpa_pdf.html", dpaPDFHeaderLogoTag}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + if got := offOriginFetches(tc.path, tc.src); len(got) == 0 { |
| + t.Errorf("%s passed the off-origin check", tc.name) |
| + } |
| + }) |
| + } |
| +} |
| + |
| // offOriginFetches returns every banned spelling found in a template. |
| func offOriginFetches(path, src string) []string { |
| banned := []string{ |
| @@ -133,6 +161,9 @@ func offOriginFetches(path, src string) []string { |
| if path == "templates/demo_claim.html" { |
| src = strings.ReplaceAll(src, `<script src="{{asset "demo_claim.js"}}"></script>`, "") |
| } |
| + if path == "templates/dpa_pdf_header.html" { |
| + src = strings.Replace(src, dpaPDFHeaderLogoTag, "", 1) |
| + } |
| var found []string |
| for _, bad := range banned { |
| if strings.Contains(src, bad) { |
| @@ -156,6 +187,11 @@ var sameOriginAssetTags = func() *regexp.Regexp { |
| `|<script` + attr + `\s+src=` + asset + attr + `\s*>`) |
| }() |
| +// dpaPDFHeaderLogoTag is the DPA PDF header's logo image, exactly. Its |
| +// LogoURL is a template.URL that renderDPAPDF only ever sets to a data: URI |
| +// (TestDPAPDFLogoIsDataURIImage). |
| +const dpaPDFHeaderLogoTag = `<img src="{{.LogoURL}}" alt="{{.Entity}}" style="display: block; max-height: 28pt; max-width: 3in;">` |
| + |
| var iconCall = regexp.MustCompile(`{{\s*icon\s+"([^"]*)"\s*}}`) |
| // icon returns "" for an unknown slug so a typo cannot 500 a page mid-render. |
diff --git a/internal/console/perfwalk_test.go b/internal/console/perfwalk_test.go| index 974a8a725..f534bc9a2 100644 |
| --- a/internal/console/perfwalk_test.go |
| +++ b/internal/console/perfwalk_test.go |
| @@ -529,6 +529,9 @@ func perfTargets(fx *consoleFixture) map[string][]perfTarget { |
| for _, p := range []string{"billing", "billing/continue", "billing/done"} { |
| m["GET /a/{sqid}/"+p] = []perfTarget{{Path: fx.path("/" + p), Expect: http.StatusNotFound}} |
| } |
| + // The walk's world has no PDF engine (and the owner no acceptance), so |
| + // the DPA PDF answers the plain 404 before any render (dpapdfroute.go). |
| + m["GET /a/{sqid}/settings/dpa.pdf"] = []perfTarget{{Path: fx.path("/settings/dpa.pdf"), Expect: http.StatusNotFound}} |
| // GET /upgrade has no parameter but is gated the same way (billingpage.go). |
| m["GET /upgrade"] = []perfTarget{{Path: "/upgrade", Expect: http.StatusNotFound}} |
| // The operator billing pages answer the missing-route 404 with billing |
diff --git a/internal/console/routedecls.go b/internal/console/routedecls.go| index 28ba17b87..f9ce14ab0 100644 |
| --- a/internal/console/routedecls.go |
| +++ b/internal/console/routedecls.go |
| @@ -119,6 +119,7 @@ var routeDecls = []routeDecl{ |
| {Pattern: "POST /a/{sqid}/store/apply", Handler: (*Server).handleStoreApplyPage}, |
| {Pattern: "POST /a/{sqid}/dpa/accept", Handler: (*Server).handleDPAAccept}, |
| {Pattern: "GET /a/{sqid}/settings/dpa", Handler: (*Server).handleDPARecord}, |
| + {Pattern: "GET /a/{sqid}/settings/dpa.pdf", Handler: (*Server).handleDPAPDF}, |
| {Pattern: "GET /fleet/metrics", Handler: (*Server).handleFleetMetrics}, |
| // Fleet alerts (alertpages.go): the operator pages, same gate. Their |
| // writes are registered without a method, as the economics doors below |
diff --git a/internal/console/server.go b/internal/console/server.go| index 378d3d91f..b89f0ee5f 100644 |
| --- a/internal/console/server.go |
| +++ b/internal/console/server.go |
| @@ -1171,8 +1171,12 @@ type Server struct { |
| // at its own server. dpaAcceptHook, when set (tests only), runs in |
| // handleDPAAccept after its checks and before the acceptance is |
| // recorded (dpapane.go). |
| - legalHTTP *http.Client |
| - dpaAcceptHook func() |
| + legalHTTP *http.Client |
| + dpaAcceptHook func() |
| + // dpaPDFHTTP posts the DPA PDF's HTML to the PDF engine |
| + // (dpapdfroute.go): newDPAPDFClient, set in NewServer; a test may |
| + // replace it. |
| + dpaPDFHTTP *http.Client |
| alertSeal atomic.Pointer[connectorSeal] |
| alertTests alertTestWindow |
| alertClock func() time.Time |
| @@ -2081,6 +2085,7 @@ func NewServer(cfg Config, st *Store) (*Server, error) { |
| billing: newBillingRuntime(cfg.Billing), |
| seen: map[string]time.Time{}, |
| legalHTTP: newLegalHTTPClient(), |
| + dpaPDFHTTP: newDPAPDFClient(), |
| } |
| s.initMedia() |
| if capacity, err := parseHACapacityConfig(cfg.HACapacityConfig, cfg.HARegions, cfg.HomeRegion); err != nil { |
diff --git a/internal/console/templates/dpa_pdf.html b/internal/console/templates/dpa_pdf.html| new file mode 100644 |
| index 000000000..5c1a613f7 |
| --- /dev/null |
| +++ b/internal/console/templates/dpa_pdf.html |
| @@ -0,0 +1,41 @@ |
| +<!doctype html> |
| +<html lang="en"> |
| +<head> |
| +<meta charset="utf-8"> |
| +{{if .Base}}<base href="{{.Base}}"> |
| +{{end}}<title>Data processing agreement</title> |
| +<style> |
| +body { font: 10.5pt/1.5 Georgia, 'Times New Roman', serif; color: #111; margin: 0; } |
| +h1 { font: 700 22pt/1.2 Helvetica, Arial, sans-serif; margin: 0 0 4pt; } |
| +.ver { color: #555; margin: 0 0 18pt; } |
| +h2 { font: 700 12pt Helvetica, Arial, sans-serif; margin: 18pt 0 6pt; } |
| +h3 { font: 700 10.5pt Helvetica, Arial, sans-serif; margin: 12pt 0 4pt; } |
| +a { color: inherit; } |
| +.parties { display: grid; grid-template-columns: 7em 1fr; gap: 4pt 12pt; border: 1px solid #ccc; padding: 10pt; margin-bottom: 18pt; break-inside: avoid; } |
| +.parties b { font-family: Helvetica, Arial, sans-serif; font-size: 9pt; text-transform: uppercase; letter-spacing: .06em; color: #555; } |
| +.exec { break-before: page; } |
| +code { font: 9pt ui-monospace, Menlo, monospace; word-break: break-all; } |
| +.hint { font-size: 9pt; color: #555; } |
| +</style> |
| +</head> |
| +<body> |
| +<h1>Data processing agreement</h1> |
| +<p class="ver">Version {{.Version}}</p> |
| +<h2>The parties</h2> |
| +<div class="parties"><b>Processor</b><span>{{.Processor}}</span> |
| +<b>Customer</b><span>{{.LegalName}}{{range .AddressLines}}<br>{{.}}{{end}}<br>{{.Country}}</span></div> |
| +<div class="agreement"> |
| +{{.Body}} |
| +</div> |
| +<section class="exec"> |
| +<h2>Acceptance</h2> |
| +<p>Accepted electronically in the {{.Console}} console by {{.AcceptedBy}}, on {{.Date}} at {{.Time}} UTC.</p> |
| +<p>For the customer: {{.SignerName}}, {{.SignerRole}}, {{.LegalName}}.</p> |
| +<p>For the processor: {{.Signatory}}. The agreement was formed when the customer accepted it.</p> |
| +<p>Agreement text: {{.URL}}</p> |
| +<p>Fingerprint of the text (SHA-256): <code>{{.SHA256}}</code></p> |
| +<p class="hint">The fingerprint changes if a single character of the agreement changes, so it proves which text was accepted.</p> |
| +<p>Record {{.RecordID}} in the {{.Console}} console.</p> |
| +</section> |
| +</body> |
| +</html> |
diff --git a/internal/console/templates/dpa_pdf_footer.html b/internal/console/templates/dpa_pdf_footer.html| new file mode 100644 |
| index 000000000..442949c5b |
| --- /dev/null |
| +++ b/internal/console/templates/dpa_pdf_footer.html |
| @@ -0,0 +1,12 @@ |
| +<!doctype html> |
| +<html lang="en"> |
| +<head><meta charset="utf-8"></head> |
| +<body style="margin: 0;"> |
| +<div style="box-sizing: border-box; width: 100%; padding: 0.3in 0.8in 0; font-family: Helvetica, Arial, sans-serif; font-size: 8pt; color: #555; -webkit-print-color-adjust: exact;"> |
| +<div style="display: flex; justify-content: space-between; gap: 12pt; border-top: 1px solid #999; padding-top: 6pt;"> |
| +<span>{{.Office}} · Company number {{.CompanyNumber}}{{if .Footer}} · {{.Footer}}{{end}}</span> |
| +<span style="white-space: nowrap;">Version {{.Version}} · Page <span class="pageNumber"></span> of <span class="totalPages"></span></span> |
| +</div> |
| +</div> |
| +</body> |
| +</html> |
diff --git a/internal/console/templates/dpa_pdf_header.html b/internal/console/templates/dpa_pdf_header.html| new file mode 100644 |
| index 000000000..350491a2e |
| --- /dev/null |
| +++ b/internal/console/templates/dpa_pdf_header.html |
| @@ -0,0 +1,12 @@ |
| +<!doctype html> |
| +<html lang="en"> |
| +<head><meta charset="utf-8"></head> |
| +<body style="margin: 0;"> |
| +<div style="box-sizing: border-box; width: 100%; padding: 0.3in 0.8in 0; font-family: Helvetica, Arial, sans-serif; font-size: 8pt; color: #555; -webkit-print-color-adjust: exact;"> |
| +<div style="display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid #999; padding-bottom: 6pt;"> |
| +<span style="display: flex; align-items: center; gap: 8pt;"> |
| +{{- if .LogoURL}}<img src="{{.LogoURL}}" alt="{{.Entity}}" style="display: block; max-height: 28pt; max-width: 3in;">{{end -}} |
| +<span class="wordmark" style="font-weight: 700; font-size: 16pt; letter-spacing: .01em; color: #111;">{{.Entity}}</span></span><span style="font-size: 8pt;">{{.PrivacyAddress}}</span></div> |
| +</div> |
| +</body> |
| +</html> |
diff --git a/internal/console/templates/dpa_record.html b/internal/console/templates/dpa_record.html| index 28374f22a..ec9b895f6 100644 |
| --- a/internal/console/templates/dpa_record.html |
| +++ b/internal/console/templates/dpa_record.html |
| @@ -5,6 +5,7 @@ |
| <h1>Data processing agreement</h1> |
| <p class="lede">The record of what was accepted, and by whom.</p> |
| </div> |
| +{{with $.FlashErr}}<p class="banner error no-print">{{.}}</p>{{end}} |
| {{if .Live}}<div class="tablewrap"> |
| <table> |
| <tr><th>Customer</th><td>{{.LegalName}}<br>{{range .AddressLines}}{{.}}<br>{{end}}{{.Country}}</td></tr> |
| @@ -17,7 +18,9 @@ |
| </table> |
| </div> |
| <p class="small">The fingerprint changes if a single character of the agreement changes, so it proves which text was accepted.</p> |
| -<p class="no-print"><button type="button" onclick="window.print()">Print this record</button> |
| +<p class="no-print">{{if and .PDFURL (not .PDFFailed)}}<a class="btn" href="{{.PDFURL}}">Download PDF</a> |
| +<button type="button" class="btn-secondary" onclick="window.print()">Print this record</button>{{else}}<button type="button" onclick="window.print()">Print this record</button>{{with .PDFURL}} |
| +<a class="btn btn-secondary" href="{{.}}">Download PDF</a>{{end}}{{end}} |
| <a class="btn btn-secondary" href="{{.SettingsURL}}">Back to settings</a></p> |
| {{else}}<p>No agreement is in force yet. You can accept one in account settings.</p> |
| <p class="no-print"><a class="btn btn-secondary" href="{{.SettingsURL}}">Back to settings</a></p> |
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt| index 79cd853f6..864fb88f7 100644 |
| --- a/internal/console/testdata/claim-routes.txt |
| +++ b/internal/console/testdata/claim-routes.txt |
| @@ -65,6 +65,7 @@ route GET /a/{sqid}/index |
| route GET /a/{sqid}/plan/keep |
| route GET /a/{sqid}/settings |
| route GET /a/{sqid}/settings/dpa |
| +route GET /a/{sqid}/settings/dpa.pdf |
| route GET /a/{sqid}/team |
| route GET /a/{sqid}/trash |
| route GET /a/{sqid}/{$} |
diff --git a/internal/provision/dpa_pdf_census_test.go b/internal/provision/dpa_pdf_census_test.go| new file mode 100644 |
| index 000000000..1577b6d2b |
| --- /dev/null |
| +++ b/internal/provision/dpa_pdf_census_test.go |
| @@ -0,0 +1,37 @@ |
| +package provision |
| + |
| +// dpaPDFWriteCensusInventory is the record-write census for branch dpa-pdf |
| +// (the DPA as a PDF, DPA and retention spec §3.8), layered on |
| +// certImport1429WriteCensusInventory (the inventory |
| +// TestPlan9B8RecordWriteCensus used before this branch). Reviewed by the |
| +// branch author against the source. No record write is added, moved or |
| +// reclassified; one key-site table is re-pinned: |
| +// |
| +// - var routeDecls (console): one new declaration, GET |
| +// /a/{sqid}/settings/dpa.pdf (handleDPAPDF, dpapdfroute.go), for |
| +// account members. It reads the console database's legal tables and |
| +// posts HTML to the PDF engine. It writes no app records, sidecars or |
| +// bucket objects; the 502 path's page render updates the last-account |
| +// pointer as the record page does. The instances and sidecars literals |
| +// are unchanged: still key-site. |
| +func dpaPDFWriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), certImport1429WriteCensusInventory()...) |
| + repins := []censusEntry{ |
| + {"internal/console/routedecls.go", "var routeDecls", "key-site", "lit:instances,lit:sidecars", "185c96c2315a3653c11521806e97df2a07bb2c6c2948a358983a30948b2a39ff"}, |
| + } |
| + for _, r := range repins { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + if e.Class != r.Class || e.Kinds != r.Kinds { |
| + panic("dpa-pdf re-pin changes the class or kinds of " + r.File + ":" + r.Unit) |
| + } |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + panic("dpa-pdf re-pin of an unlisted unit " + r.File + ":" + r.Unit) |
| + } |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index 48e48cf01..520b27bc4 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) { |
| if len(got) < 100 { |
| t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root) |
| } |
| - inventory := certImport1429WriteCensusInventory() |
| + inventory := dpaPDFWriteCensusInventory() |
| problems := append(censusDiff(inventory, got), censusPolicy(inventory)...) |
| if len(problems) > 0 { |
| t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n ")) |
diff --git a/parity/parity.tsv b/parity/parity.tsv| index 2671e1202..066ac3e2a 100644 |
| --- a/parity/parity.tsv |
| +++ b/parity/parity.tsv |
| @@ -184,7 +184,7 @@ cli-tokens account gap GET /settings ; GET /auth/cli/tokens ; POST /auth/cli/to |
| auth-login account cli-only auth login Signs this terminal in; the browser half is an auth row. |
| auth-identity account cli-only auth whoami ; auth logout ; auth default This terminal's own identity and default console. |
| account-delete account console-only POST /a/{sqid}/delete Deleting an account needs a passkey. |
| -dpa-accept account console-only GET /a/{sqid}/settings ; GET /a/{sqid}/settings/dpa ; POST /a/{sqid}/dpa/accept An owner accepts the data processing agreement, and confirms with a passkey. |
| +dpa-accept account console-only GET /a/{sqid}/settings ; GET /a/{sqid}/settings/dpa ; GET /a/{sqid}/settings/dpa.pdf ; POST /a/{sqid}/dpa/accept An owner accepts the data processing agreement, and confirms with a passkey. |
| plan-keep account gap GET /a/{sqid}/plan/keep ; POST /a/{sqid}/plan/keep wp-cli-verbs Choosing which apps to keep when a plan lapses. |
| getting-started account console-only POST /a/{sqid}/getting-started/hide ; POST /a/{sqid}/getting-started/show ; POST /a/{sqid}/getting-started/skip ; POST /a/{sqid}/getting-started/done A checklist in the page. |
| nav-index account console-only GET /a/{sqid}/index ; GET /a/{sqid}/apps/{app}/index ; GET /a/{sqid}/apps/{app}/settings/index Phone navigation pages that list sections. |