carlos / platform Public

console: per-instance resume lifts the instances hold (ruling #1581)

The old test pinned a 409 for an app-wide resume in per-instance mode;
under Paul's ruling SetAppPause resumes by lifting the hold over every
instance, leaving the app sender's key and per-instance sentinel alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a62d5cc3708bc5886449366758d9a34879c31125 parent 238fa49
1 file changed, +16 −15
  • internal/console/apimail_test.go +16 −15

CI cancelled — superseded by a newer push — 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-u2tbiB
.amadan/test-gate.sh
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/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 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 modernc.org/sqlite v1.55.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading golang.org/x/net v0.62.0
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/sys v0.49.0
go: downloading golang.org/x/mod v0.41.0
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/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading golang.org/x/text v0.43.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/sqlite v1.55.0
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec

amadan: job cancelled — a newer push superseded it
diff --git a/internal/console/apimail_test.go b/internal/console/apimail_test.go
index c21d43cda..dfb7add56 100644
--- a/internal/console/apimail_test.go
+++ b/internal/console/apimail_test.go
@@ -1306,13 +1306,13 @@ func TestAPIEmailPauseCapRaiseDoesNotResume(t *testing.T) {
}
}
-// TestAPIEmailPauseRefusesAResumeInPerInstanceMode: the operator door
-// answers a permanent conflict, never the generic "try again" 502, when
-// asked to resume an app sender that has moved to per-instance senders.
-// Nothing in this release sets PerInstance itself, so this hand-sets it —
-// the point is that a retry can never succeed here, and the operator needs
-// to be told that plainly rather than sent to retry forever.
-func TestAPIEmailPauseRefusesAResumeInPerInstanceMode(t *testing.T) {
+// TestAPIEmailPauseResumeInPerInstanceModeLiftsTheInstancesHold: the
+// operator door, in per-instance mode, resumes by lifting the hold over
+// every instance (Paul's ruling on #1581: mail.SetAppPause decides the
+// target under the app lock). It never reactivates the app sender's own
+// key or clears its per-instance sentinel, which every instance's sends
+// must keep refusing on an old mailer (instance senders decision 2).
+func TestAPIEmailPauseResumeInPerInstanceModeLiftsTheInstancesHold(t *testing.T) {
fx, fake, _, token := emailArmed(t, "code-email-pause-perinstance")
app, domain := "titogo", "titogo.bab.oncarlos.com"
provisionEmail(t, fx, fake, token, app, domain, "hello@"+domain)
@@ -1327,23 +1327,24 @@ func TestAPIEmailPauseRefusesAResumeInPerInstanceMode(t *testing.T) {
t.Fatal(err)
}
sn.PerInstance = true
+ sn.InstancesPause = &mailwire.Pause{At: time.Now()}
if _, err := mail.PutSender(context.Background(), fx.rel, release.OpsAccount, app, sn, etag); err != nil {
t.Fatal(err)
}
status, out := postJSON(t, emailURL(fx, app)+"/pause", map[string]any{"paused": false}, ops)
- if status != http.StatusConflict {
- t.Fatalf("resume in per-instance mode = %d %v, want 409", status, out)
+ if status != http.StatusOK {
+ t.Fatalf("resume in per-instance mode = %d %v, want 200", status, out)
}
- msg, _ := out["error"].(string)
- if !strings.Contains(msg, "per-instance") {
- t.Fatalf("error = %q, want it to name per-instance mode", msg)
+ after, _, err := mail.GetSender(context.Background(), fx.rel, release.OpsAccount, app, mail.SenderAppID)
+ if err != nil {
+ t.Fatal(err)
}
- if strings.Contains(strings.ToLower(msg), "try again") {
- t.Fatalf("refusal promised a retry would help, but this refusal is permanent: %q", msg)
+ if after.InstancesPause != nil {
+ t.Fatalf("the hold over every instance survived the resume: %+v", after.InstancesPause)
}
if emailRecord(t, fx, app).Provisioned.Active {
- t.Fatal("the refused resume left the record active")
+ t.Fatal("the resume reactivated the app sender's own key in per-instance mode")
}
}