carlos / platform Public

mailer: SES client as a method value; binary ceiling 64 -> 65 MB

CI's cross step failed at 66,977,954 bytes linux/arm64, over the 64 MB
tripwire (.amadan/ci.d/20-cross@5, discussion #275). The cause was the
#275 pattern: AWSClients stored *sesv2.Client in the mailer.SES
interface, so html/template's method retention kept every sesv2 method
(about 3.1 MB). It is now stored as its bound SendEmail
(mailer.sesSendFunc), and dumpdep shows no sesv2.Client itab.

What is left is growth meant by the feature: about 520 KB (sesv2's
SendEmail path, internal/mailer, mailsubmit, mailwire, net/mail), on a
main that was 63,766,690 bytes, 233 KB under the ceiling. The ceiling
goes to 65 MB with that reason in the script; 65 MB still fails a repeat
of #275.

Census: the internal/mailer envelope is re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 05591a0ec7e72d02aa879eecaac12e4048b93c17 parent ea9fd04
3 files changed, +21 −4
  • .amadan/ci.d/20-cross@5 +8 −2
  • internal/mailer/ses.go +12 −1
  • internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv +1 −1

CI passed — run details

diff --git a/.amadan/ci.d/20-cross@5 b/.amadan/ci.d/20-cross@5
index b40d06de7..2b244d66d 100755
--- a/.amadan/ci.d/20-cross@5
+++ b/.amadan/ci.d/20-cross@5
@@ -77,7 +77,13 @@ GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build ./...
# was 52,887,714 bytes, 112 KB under 53 MB, after ordinary growth with no SDK
# client in an interface. The ceiling is a tripwire for #275-style accidents,
# not a size budget: 64 MB leaves about 11 MB for ordinary growth and still
-# fails a repeat of #275 (about 14 MB on top of today's size). It is a
+# fails a repeat of #275 (about 14 MB on top of today's size). Raised to
+# 65 MB on 2026-11-14 for platform mail submission (the box-local mailer,
+# carlos mailer): main was 63,766,690 bytes, 233 KB under 64 MB, and the
+# mailer adds about 520 KB (sesv2's SendEmail path, internal/mailer,
+# mailsubmit, mailwire, net/mail). Its SES client is stored as a method
+# value (mailer.sesSendFunc); stored in the interface it had added 3.1 MB,
+# which this tripwire caught. 65 MB still fails a repeat of #275. It is a
# ceiling and not an equality on purpose. If you are here because it fired, look for an SDK client stored in
# an interface, which html/template's method retention then drags in whole:
#
@@ -89,7 +95,7 @@ GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build ./...
# and STS stay whole whatever this repo does. Raise the number only for
# growth you meant, and say why in the commit.
if [ "$GOOS/$GOARCH" = "linux/arm64" ]; then
- max_bytes=64000000
+ max_bytes=65000000
size_dir=$(mktemp -d)
trap 'rm -rf "$size_dir"' EXIT
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-s -w" -o "$size_dir/carlos" .
diff --git a/internal/mailer/ses.go b/internal/mailer/ses.go
index 6a8911ec9..b3544f473 100644
--- a/internal/mailer/ses.go
+++ b/internal/mailer/ses.go
@@ -24,6 +24,17 @@ type SES interface {
SendEmail(ctx context.Context, in *sesv2.SendEmailInput, opts ...func(*sesv2.Options)) (*sesv2.SendEmailOutput, error)
}
+// sesSendFunc is SES as a method value. The production client is stored
+// as its bound SendEmail, never as *sesv2.Client in the SES interface:
+// html/template's method retention would keep every exported method of a
+// client stored in an interface, about 3 MB of sesv2 in the platform
+// binary (.amadan/ci.d/20-cross@5, discussion #275).
+type sesSendFunc func(ctx context.Context, in *sesv2.SendEmailInput, opts ...func(*sesv2.Options)) (*sesv2.SendEmailOutput, error)
+
+func (f sesSendFunc) SendEmail(ctx context.Context, in *sesv2.SendEmailInput, opts ...func(*sesv2.Options)) (*sesv2.SendEmailOutput, error) {
+ return f(ctx, in, opts...)
+}
+
// awsConfigs builds the mailer's two AWS configs from one key: SES in the
// mail region, S3 in the deployment bucket's region. Both come from
// rootaws.LoadStaticConfig, which refuses AWS_PROFILE, empties the shared
@@ -49,7 +60,7 @@ func AWSClients(mailRegion, deployRegion, bucket string) func(context.Context, K
if err != nil {
return nil, nil, err
}
- return sesv2.NewFromConfig(sesCfg), release.NewS3StoreFromConfig(s3Cfg, bucket), nil
+ return sesSendFunc(sesv2.NewFromConfig(sesCfg).SendEmail), release.NewS3StoreFromConfig(s3Cfg, bucket), nil
}
}
diff --git a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
index 38f7936e8..042035ae5 100644
--- a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
+++ b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
@@ -95,7 +95,7 @@ internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-
@coverage internal/host/units 63a333f0bb4a354fdde9802089f4ec6794cdfbf774c20fbd48cffab805cd022c
@coverage internal/hostenv 6c96c4abe8548fe3cf12d3a220de3e2917c3edfa5320b1662ea76bdf364d24b5
@coverage internal/instancectl 811493ad636a21f5f8e7f2336e8e58055fd2a83f53dd71ef689cd90232e7d3df
-@coverage internal/mailer ae1f06f419c6a2f9057453f89db9440cead790f181633d04b19946f4bbaff806
+@coverage internal/mailer 68d76c7fda5ed89f1924a0ddcb777635879d6c08ff0daf66d005cf5032337757
@coverage internal/mailsubmit 519123e15891e0802427595306d8caca1fd7f4f861ae1a2ec70e1c10f012e263
@coverage internal/mailwire 0242392c670a0f61b875056b0d79576ccb69c2e29f56735cbb191e7d038222a0
@coverage internal/moves 9390702695d308a327f5572f4ff5967718141c5d385dff7671ff1e2c825ef407