carlos / platform Public

mail: per-instance holds decided inside the CAS (Task 4 R1)

Astra round 1 on Task 4, three P1s: the plan hold's eligibility was
judged outside the CAS (a newer hold could be cleared, a day's replaced
by an hour's), a carried rate hold could be replaced by a plan hold, and
a carried cap hold never lifted. SetInstancesPauseIf asks its condition
of the hold read inside the CAS; enforcement writes only over no hold or
an hour's; resume clears only the exact stale hold it judged; a cap
pause is no longer carried onto every instance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 891562cf9f76b34933046708e240257d5d6c764a parent cf32b99
5 files changed, +223 −33
  • docs/superpowers/plans/CODEX-FINDINGS-instance-senders-1-T4-R1.md +27 −0
  • internal/console/planmail_instance.go +33 −20
  • internal/console/planmail_instance_test.go +79 −0
  • internal/mail/perinstance.go +28 −13
  • internal/mail/perinstance_test.go +56 −0

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-30odO9
.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 golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.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 golang.org/x/sys v0.49.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading golang.org/x/mod v0.41.0
go: downloading github.com/oschwald/maxminddb-golang v1.13.1
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.38
go: downloading github.com/lmittmann/tint v1.1.3
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/pion/randutil v0.1.0
go: downloading golang.org/x/text v0.43.0
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec

amadan: job cancelled — a newer push superseded it
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-instance-senders-1-T4-R1.md b/docs/superpowers/plans/CODEX-FINDINGS-instance-senders-1-T4-R1.md
new file mode 100644
index 000000000..4a1b84a58
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-instance-senders-1-T4-R1.md
@@ -0,0 +1,27 @@
+# Task 4 review, round 1 (Astra, gpt-6-astra, on 86a793ccd)
+
+1. **P1 — Pause eligibility is checked outside the CAS mutation.**
+ Evidence: [planmail_instance.go:49](internal/console/planmail_instance.go:49), [perinstance.go:130](internal/mail/perinstance.go:130). Resume reads an expired hold and checks spending, then unconditionally clears whatever hold the mutation reads. A concurrent enforcement can install a current-day hold between those operations; resume deletes it. Similarly, hourly enforcement can overwrite a daily hold installed after its initial read.
+
+ **Invariant broken:** automatic changes must preserve a newer or stronger pause. The claim gate covers the setter, not the earlier eligibility reads.
+ **Fix:** evaluate pause eligibility against the record inside the CAS callback, including each retry, as `SetSenderPausedIf` does. Add deterministic interleaving tests for replacement-before-clear and daily-before-hourly-write.
+
+2. **P1 — Daily plan enforcement replaces a carried rate hold.**
+ Evidence: [planmail_instance.go:30](internal/console/planmail_instance.go:30). When `InstancesPause.Kind == rate` and the requested kind is `plan`, every preservation condition is false. Enforcement replaces the rate hold with a plan hold, which subsequently clears at the day roll.
+
+ **Failure scenario:** enable per-instance mode on an app paused for bounce/complaint rate, then enforce its exhausted daily allowance. The permanent abuse hold becomes temporary.
+ **Invariant broken:** rate holds never automatically resume.
+ **Fix:** preserve rate and other non-expiring holds; permit only the intended hourly-to-daily upgrade. Test rate-hold preservation through enforcement and the next day’s resume.
+
+3. **P1 — A carried cap hold never clears at the day roll.**
+ Evidence: [perinstance.go:89](internal/mail/perinstance.go:89), [planmail_instance.go:54](internal/console/planmail_instance.go:54), [mailcounts.go:266](internal/console/mailcounts.go:266). Enabling the mode copies a cap pause into `InstancesPause`. The new resume helper accepts only plan pauses, while the existing resume helper skips per-instance app senders.
+
+ **Failure scenario:** switch a capped app to per-instance mode; its inherited hold remains after midnight indefinitely unless another operation replaces or clears it.
+ **Invariant broken:** cap pauses expire on the UTC day roll.
+ **Fix:** provide a conditional day-roll resume for carried cap holds while preserving manual/rate holds and the per-instance sentinel. Add a switch-with-cap → next-day regression test.
+
+No additional P2 or P3 findings. Task 3’s serialization redesign remains outside this review.
+
+`git diff --check` and formatting checks on the new implementation/test files passed. Focused tests could not start: Go’s work-directory creation failed under the read-only sandbox. No files were edited.
+
+**NOT READY**
\ No newline at end of file
diff --git a/internal/console/planmail_instance.go b/internal/console/planmail_instance.go
index 6620f7acb..dac30a579 100644
--- a/internal/console/planmail_instance.go
+++ b/internal/console/planmail_instance.go
@@ -15,10 +15,12 @@ import (
)
// planPausePerInstanceApp reads the app sender first. For a per-instance
-// app it holds every instance with the plan pause of this kind (or leaves a
-// day's hold in place over an hour's request), audits it, and reports
-// handled, so the caller skips the app's sender enumeration. For any other
-// app it reports not handled and writes nothing.
+// app it holds every instance with the plan pause of this kind, reports
+// handled (so the caller skips the app's sender enumeration), and audits a
+// write. The hold is written only when, as read inside the CAS, there is
+// none or there is the hour's and this is the day's: a day's, manual or
+// rate hold is never replaced (Task 4 review P1-1, P1-2). For any other app
+// it reports not handled and writes nothing.
func (s *Server) planPausePerInstanceApp(ctx context.Context, acct *Account, app, kind, audit string, now time.Time) (bool, error) {
sn, _, err := mail.GetSender(ctx, s.cfg.Releases, acct.Sqid, app, mail.SenderAppID)
if err != nil {
@@ -27,42 +29,53 @@ func (s *Server) planPausePerInstanceApp(ctx context.Context, acct *Account, app
if sn == nil || !sn.PerInstance {
return false, nil
}
- if cur := sn.InstancesPause; cur != nil {
- // A held day is not downgraded to an hour; a manual hold stays.
- if cur.Kind == kind || cur.Kind == mail.PauseKindPlan || cur.Kind == "" ||
- (cur.Kind != mail.PauseKindPlanHour && kind == mail.PauseKindPlanHour) {
- return true, nil
- }
+ wrote := false
+ cond := func(cur *mailwire.Pause) bool {
+ wrote = cur == nil || (cur.Kind == mail.PauseKindPlanHour && kind == mail.PauseKindPlan)
+ return wrote
}
- if _, err := mail.SetInstancesPause(ctx, s.claimMailStore(), acct.Sqid, app, &mailwire.Pause{Kind: kind, At: now}); err != nil {
+ if _, err := mail.SetInstancesPauseIf(ctx, s.claimMailStore(), acct.Sqid, app, &mailwire.Pause{Kind: kind, At: now}, cond); err != nil {
return true, err
}
- s.audit(acct, app, "ses", "mail.paused", fmt.Sprintf("%s (every instance): %s", app, audit))
+ if wrote {
+ s.audit(acct, app, "ses", "mail.paused", fmt.Sprintf("%s (every instance): %s", app, audit))
+ }
return true, nil
}
// resumePlanInstancesPause lifts a per-instance app's plan hold under the
-// same rule as every other plan hold: the pause is from an earlier UTC day
+// same rule as every other plan hold: the hold is from an earlier UTC day
// (or hour, for the hourly hold) and planMailSpent says the allowance is
-// free. A manual or rate hold never lifts here.
+// free. The clear re-asks, inside the CAS, that the hold is still exactly
+// the one judged stale, so a hold written meanwhile survives. A manual or
+// rate hold never lifts here.
func (s *Server) resumePlanInstancesPause(ctx context.Context, acct *Account, app string, now time.Time) error {
sn, _, err := mail.GetSender(ctx, s.cfg.Releases, acct.Sqid, app, mail.SenderAppID)
if err != nil || sn == nil || !sn.PerInstance || sn.InstancesPause == nil {
return err
}
- pz := sn.InstancesPause
- stale := (pz.Kind == mail.PauseKindPlan && pz.LiftsAtDayRoll() && pz.At.UTC().Format("2006-01-02") < now.UTC().Format("2006-01-02")) ||
- (pz.LiftsAtHourRoll() && mailHour(pz.At) < mailHour(now))
- if !stale {
+ seen := *sn.InstancesPause
+ stale := func(pz *mailwire.Pause) bool {
+ return pz != nil &&
+ ((pz.Kind == mail.PauseKindPlan && pz.At.UTC().Format("2006-01-02") < now.UTC().Format("2006-01-02")) ||
+ (pz.Kind == mail.PauseKindPlanHour && mailHour(pz.At) < mailHour(now)))
+ }
+ if !stale(&seen) {
return nil
}
spent, err := s.planMailSpent(ctx, acct.Sqid, now)
if err != nil || spent {
return err
}
- if _, err := mail.SetInstancesPause(ctx, s.claimMailStore(), acct.Sqid, app, nil); err != nil {
+ cleared := false
+ if _, err := mail.SetInstancesPauseIf(ctx, s.claimMailStore(), acct.Sqid, app, nil, func(cur *mailwire.Pause) bool {
+ cleared = cur != nil && cur.Kind == seen.Kind && cur.At.Equal(seen.At) && stale(cur)
+ return cleared
+ }); err != nil {
return err
}
- s.audit(acct, app, "ses", "mail.resumed", fmt.Sprintf("%s (every instance): plan hold lifted", app))
+ if cleared {
+ s.audit(acct, app, "ses", "mail.resumed", fmt.Sprintf("%s (every instance): plan hold lifted", app))
+ }
return nil
}
diff --git a/internal/console/planmail_instance_test.go b/internal/console/planmail_instance_test.go
index ad3ac531f..b38ccb8ea 100644
--- a/internal/console/planmail_instance_test.go
+++ b/internal/console/planmail_instance_test.go
@@ -72,3 +72,82 @@ func TestPlanPausePerInstanceApp(t *testing.T) {
t.Fatalf("not lifted on the day roll: %+v", app.InstancesPause)
}
}
+
+// perInstanceShop puts the fixture's shop app in per-instance mode.
+func perInstanceShop(t *testing.T, fx *consoleFixture) {
+ t.Helper()
+ ctx := context.Background()
+ sn, etag, err := mail.GetSender(ctx, fx.rel, release.OpsAccount, "shop", mail.SenderAppID)
+ if err != nil || sn == nil {
+ t.Fatalf("sender: %v", err)
+ }
+ reapedAt := planMailNow.Add(-time.Hour)
+ sn.Provisioned = nil
+ sn.Submission = &mailwire.Submission{On: true, At: planMailNow.Add(-8 * 24 * time.Hour), AppUserReapedAt: &reapedAt}
+ if _, err := mail.PutSender(ctx, fx.rel, release.OpsAccount, "shop", sn, etag); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := mail.SetPerInstance(ctx, fx.rel, release.OpsAccount, "shop", true, "op", planMailNow); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func instancesHold(t *testing.T, fx *consoleFixture) *mailwire.Pause {
+ t.Helper()
+ sn, _, err := mail.GetSender(context.Background(), fx.rel, release.OpsAccount, "shop", mail.SenderAppID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return sn.InstancesPause
+}
+
+// A rate hold over every instance survives the day's plan enforcement and
+// the next day's resume (Task 4 review P1-2); a day's hold survives an
+// hour's enforcement (P1-1).
+func TestPlanPausePreservesStrongerHolds(t *testing.T) {
+ ctx := context.Background()
+ fx := planMailFixture(t)
+ perInstanceShop(t, fx)
+ rate := &mailwire.Pause{Kind: mail.PauseKindRate, At: planMailNow.Add(-time.Hour)}
+ if _, err := mail.SetInstancesPause(ctx, fx.rel, release.OpsAccount, "shop", rate); err != nil {
+ t.Fatal(err)
+ }
+ acct, _ := fx.st.AccountBySqid(fx.sqid)
+ if _, err := fx.srv.planPausePerInstanceApp(ctx, acct, "shop", mail.PauseKindPlan, "test", planMailNow); err != nil {
+ t.Fatal(err)
+ }
+ if h := instancesHold(t, fx); h == nil || h.Kind != mail.PauseKindRate {
+ t.Fatalf("the rate hold was replaced: %+v", h)
+ }
+ if err := fx.srv.resumePlanInstancesPause(ctx, acct, "shop", planMailNow.Add(24*time.Hour)); err != nil {
+ t.Fatal(err)
+ }
+ if h := instancesHold(t, fx); h == nil || h.Kind != mail.PauseKindRate {
+ t.Fatalf("the rate hold lifted on the day roll: %+v", h)
+ }
+
+ fx2 := planMailFixture(t)
+ perInstanceShop(t, fx2)
+ acct2, _ := fx2.st.AccountBySqid(fx2.sqid)
+ if _, err := fx2.srv.planPausePerInstanceApp(ctx, acct2, "shop", mail.PauseKindPlan, "day", planMailNow); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := fx2.srv.planPausePerInstanceApp(ctx, acct2, "shop", mail.PauseKindPlanHour, "hour", planMailNow.Add(time.Minute)); err != nil {
+ t.Fatal(err)
+ }
+ if h := instancesHold(t, fx2); h == nil || h.Kind != mail.PauseKindPlan {
+ t.Fatalf("an hour's enforcement replaced the day's hold: %+v", h)
+ }
+ // And an hour's hold is upgraded to the day's.
+ fx3 := planMailFixture(t)
+ perInstanceShop(t, fx3)
+ acct3, _ := fx3.st.AccountBySqid(fx3.sqid)
+ for _, k := range []string{mail.PauseKindPlanHour, mail.PauseKindPlan} {
+ if _, err := fx3.srv.planPausePerInstanceApp(ctx, acct3, "shop", k, k, planMailNow); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if h := instancesHold(t, fx3); h == nil || h.Kind != mail.PauseKindPlan {
+ t.Fatalf("hour not upgraded to day: %+v", h)
+ }
+}
diff --git a/internal/mail/perinstance.go b/internal/mail/perinstance.go
index af8d21414..a969b6e13 100644
--- a/internal/mail/perinstance.go
+++ b/internal/mail/perinstance.go
@@ -83,10 +83,13 @@ func claimUnserializedSetPerInstance(ctx context.Context, s release.Store, acct,
if sn.PerInstance && sn.Pause != nil && sn.Pause.Kind == PauseKindPerInstance {
return false, nil
}
- // An app-wide pause already in force (manual, plan) keeps holding
- // every instance: it moves to InstancesPause, which the mailer
- // reads for every instance sender.
- if sn.Pause != nil && sn.Pause.Kind != PauseKindPerInstance && sn.InstancesPause == nil {
+ // An app-wide hold already in force (manual, rate, plan) keeps
+ // holding every instance: it moves to InstancesPause, which the
+ // mailer reads for every instance sender. A CAP pause is the app
+ // sender's own daily cap, which no instance sends against (each
+ // has its own), so it is not carried (Task 4 review P1-3).
+ if sn.Pause != nil && sn.Pause.Kind != PauseKindPerInstance && sn.Pause.Kind != PauseKindCap &&
+ sn.InstancesPause == nil {
sn.InstancesPause = sn.Pause
}
sn.PerInstance = true
@@ -128,15 +131,19 @@ func SetPerInstance(ctx context.Context, s release.Store, acct, app string, on b
return out, err
}
-func claimUnserializedSetInstancesPause(ctx context.Context, s release.Store, acct, app string, p *mailwire.Pause) (*Sender, error) {
+func claimUnserializedSetInstancesPause(ctx context.Context, s release.Store, acct, app string, p *mailwire.Pause,
+ cond func(cur *mailwire.Pause) bool) (*Sender, error) {
return mutateAppSender(ctx, s, acct, app, func(sn *Sender) (bool, error) {
if !sn.PerInstance {
return false, nil
}
- if p == nil && sn.InstancesPause == nil {
+ // The condition is asked of the hold as read inside this CAS, on every
+ // retry, so a newer or stronger hold written meanwhile is never
+ // replaced or cleared (as SetSenderPausedIf asks its own).
+ if cond != nil && !cond(sn.InstancesPause) {
return false, nil
}
- if p != nil && sn.InstancesPause != nil && sn.InstancesPause.Kind == p.Kind {
+ if p == nil && sn.InstancesPause == nil {
return false, nil
}
sn.InstancesPause = p
@@ -144,20 +151,28 @@ func claimUnserializedSetInstancesPause(ctx context.Context, s release.Store, ac
})
}
-// SetInstancesPause writes (or, nil, clears) the app sender's hold over
-// every instance sender of a per-instance app (decision 16 (a)): the
-// account plan pause, one write the mailer reads for every instance.
-func SetInstancesPause(ctx context.Context, s release.Store, acct, app string, p *mailwire.Pause) (*Sender, error) {
+// SetInstancesPauseIf writes (or, nil, clears) the app sender's hold over
+// every instance sender of a per-instance app (decision 16 (a)), only when
+// cond holds of the current hold as read inside the CAS. A nil cond always
+// writes.
+func SetInstancesPauseIf(ctx context.Context, s release.Store, acct, app string, p *mailwire.Pause,
+ cond func(cur *mailwire.Pause) bool) (*Sender, error) {
+ defer lockMailApp(acct, app)()
if _, enabled := s.(ClaimMailStore); !enabled {
- return claimUnserializedSetInstancesPause(ctx, s, acct, app, p)
+ return claimUnserializedSetInstancesPause(ctx, s, acct, app, p, cond)
}
var out *Sender
err := WithClaimMailResource(ctx, s, func(ctx context.Context) error {
return claimMailAdmitted(ctx, s, acct, claimMailPlan{Apps: []string{app}}, func(ctx context.Context) error {
var err error
- out, err = claimUnserializedSetInstancesPause(ctx, s, acct, app, p)
+ out, err = claimUnserializedSetInstancesPause(ctx, s, acct, app, p, cond)
return err
})
})
return out, err
}
+
+// SetInstancesPause is SetInstancesPauseIf with no condition.
+func SetInstancesPause(ctx context.Context, s release.Store, acct, app string, p *mailwire.Pause) (*Sender, error) {
+ return SetInstancesPauseIf(ctx, s, acct, app, p, nil)
+}
diff --git a/internal/mail/perinstance_test.go b/internal/mail/perinstance_test.go
index c45d5fe71..4bd95f3dd 100644
--- a/internal/mail/perinstance_test.go
+++ b/internal/mail/perinstance_test.go
@@ -123,3 +123,59 @@ func TestResumeAppSenderRefusedPerInstance(t *testing.T) {
t.Fatalf("resume of a per-instance app sender: %v, want ErrPerInstance", err)
}
}
+
+// The hold's condition is asked inside the CAS: a resume that judged an
+// older hold stale does not clear a newer one written meanwhile (Task 4
+// review P1-1).
+func TestSetInstancesPauseIfPreservesNewerHold(t *testing.T) {
+ ctx := context.Background()
+ s := release.NewDirStore(t.TempDir())
+ addrFixture(t, s)
+ reaped(t, s)
+ if _, err := SetPerInstance(ctx, s, tAcct, tApp, true, "op", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ old := &mailwire.Pause{Kind: PauseKindPlan, At: time.Date(2026, 11, 29, 9, 0, 0, 0, time.UTC)}
+ if _, err := SetInstancesPause(ctx, s, tAcct, tApp, old); err != nil {
+ t.Fatal(err)
+ }
+ seen := *old
+ // Meanwhile, today's hold replaces it.
+ newer := &mailwire.Pause{Kind: PauseKindPlan, At: time.Date(2026, 11, 30, 9, 0, 0, 0, time.UTC)}
+ if _, err := SetInstancesPause(ctx, s, tAcct, tApp, newer); err != nil {
+ t.Fatal(err)
+ }
+ sn, err := SetInstancesPauseIf(ctx, s, tAcct, tApp, nil, func(cur *mailwire.Pause) bool {
+ return cur != nil && cur.Kind == seen.Kind && cur.At.Equal(seen.At)
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ if sn.InstancesPause == nil || !sn.InstancesPause.At.Equal(newer.At) {
+ t.Fatalf("the newer hold was cleared: %+v", sn.InstancesPause)
+ }
+}
+
+// A cap pause is the app sender's own daily cap; it is not carried onto
+// every instance when the mode goes on (Task 4 review P1-3). A rate hold is.
+func TestSetPerInstanceCarriesRateNotCap(t *testing.T) {
+ ctx := context.Background()
+ for kind, carried := range map[string]bool{PauseKindCap: false, PauseKindRate: true, PauseKindPlan: true} {
+ s := release.NewDirStore(t.TempDir())
+ addrFixture(t, s)
+ reaped(t, s)
+ if _, err := mutateAppSender(ctx, s, tAcct, tApp, func(sn *Sender) (bool, error) {
+ sn.Pause = &mailwire.Pause{Kind: kind, At: time.Now()}
+ return true, nil
+ }); err != nil {
+ t.Fatal(err)
+ }
+ sn, err := SetPerInstance(ctx, s, tAcct, tApp, true, "op", time.Now())
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := sn.InstancesPause != nil && sn.InstancesPause.Kind == kind; got != carried {
+ t.Errorf("%s: carried = %v, want %v (%+v)", kind, got, carried, sn.InstancesPause)
+ }
+ }
+}