carlos / platform Public

Tests: check the values SA4006 found captured and never read

Seven tests took a value to check and then never checked it. Each now
does; all pass, so none of them was hiding a failure.

- domains detach of a catch-all: the "detached" line is printed.
- move door, home with a data bucket: the accepted move registers one.
- interactive refusals: a stranger's 404 writes nothing.
- domain check, browser path: the 429 carries the rate copy.
- LiftTombstone on a lifted tombstone writes nothing.
- CompareDuty refusing an adoption without a receipt is not an error
  (an error would have passed the old check vacuously).
- relay record round trip: Get returns the etag Put returned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 8692f18ae3580b4d1e09a1490cf05683637b8b14 parent 0660092
7 files changed, +17 −7
  • domains_cli_test.go +3 −0
  • internal/console/apiinstancemove_home_test.go +3 −0
  • internal/console/apiinteractive_test.go +1 −0
  • internal/console/domainbuy_fix_test.go +2 −2
  • internal/lease/tombstone_test.go +3 −0
  • internal/registry/ha_duties_test.go +2 −2
  • internal/relay/record_test.go +3 −3
diff --git a/domains_cli_test.go b/domains_cli_test.go
index fec921a8a..a672161e2 100644
--- a/domains_cli_test.go
+++ b/domains_cli_test.go
@@ -826,6 +826,9 @@ func TestRunDomainsInstanceCatchall(t *testing.T) {
if !strings.HasSuffix(fc.lastDetachPath, "/domains/*.teams.example.com") {
t.Fatalf("detach path = %s", fc.lastDetachPath)
}
+ if !strings.Contains(buf.String(), "detached *.teams.example.com") {
+ t.Fatalf("stdout = %q, want the detached confirmation", buf.String())
+ }
}
// TestAPISessionDomainPlacements: domainPlacements GETs the placements door
diff --git a/internal/console/apiinstancemove_home_test.go b/internal/console/apiinstancemove_home_test.go
index a04de01c5..eb44310d2 100644
--- a/internal/console/apiinstancemove_home_test.go
+++ b/internal/console/apiinstancemove_home_test.go
@@ -213,6 +213,9 @@ func TestMoveDoorHomeStagingFromItsEdgesFile(t *testing.T) {
if code, _, out := rawReq(t, http.MethodPost, moveURL, token, `{"region":"ie"}`); code != http.StatusAccepted {
t.Fatalf("home with a data bucket = %d %s, want 202", code, out)
}
+ if n := homeMoveRegistrations(t, fx); n != 1 {
+ t.Fatalf("an accepted move registered %d moves, want 1", n)
+ }
// The list names the home by its name, and never as an empty code.
caps := map[string]placementCapability{
diff --git a/internal/console/apiinteractive_test.go b/internal/console/apiinteractive_test.go
index ec2d0cfa3..69c28f009 100644
--- a/internal/console/apiinteractive_test.go
+++ b/internal/console/apiinteractive_test.go
@@ -368,6 +368,7 @@ func TestInteractiveRefusalsInOrder(t *testing.T) {
s.cli.instances.allow(hashToken(fx.alice), time.Now())
code, h, out := ixGet(t, fx, ixHost, stranger)
assertNotFound(t, "2 a stranger", canonicalNotFound(t), code, h, out)
+ ixNothingWritten(t, fx, ixHost, snap)
steps := []step{
{"3 host claims", fx.alice, ixHost, http.StatusConflict, claimInteractiveUnsupportedMsg, func() { s.cfg.HostClaim = false }},
diff --git a/internal/console/domainbuy_fix_test.go b/internal/console/domainbuy_fix_test.go
index 7dbca6960..dfa2b0633 100644
--- a/internal/console/domainbuy_fix_test.go
+++ b/internal/console/domainbuy_fix_test.go
@@ -216,8 +216,8 @@ func TestCheckLimiterPerAccountAndDeployment(t *testing.T) {
f.setUser("owner" + f.acct.Sqid + "@example.com")
signUp(t, f.consoleFixture, browser, "limited")
status, _, body = postForm(t, browser, f.ts.URL+"/a/"+f.acct.Sqid+"/apps/kass/domains/check", map[string][]string{"csrf": {sessionToken(t, f.consoleFixture, browser)}, "name": {"shop.com"}})
- if status != 429 {
- t.Errorf("browser budget: status %d", status)
+ if status != 429 || !strings.Contains(body, domainBuyCopy["rate"]) {
+ t.Errorf("browser budget: %d %s", status, body)
}
// Six independent paid accounts can spend at most 120 deployment tokens.
for i := 0; i < 6; i++ {
diff --git a/internal/lease/tombstone_test.go b/internal/lease/tombstone_test.go
index 7ff69f51e..1ba75b0e9 100644
--- a/internal/lease/tombstone_test.go
+++ b/internal/lease/tombstone_test.go
@@ -668,6 +668,9 @@ func TestLiftTombstoneAlreadyLifted(t *testing.T) {
t.Fatalf("already lifted: lifted %v err %v", lifted, err)
}
}
+ if s.writeCount() != writes {
+ t.Fatal("lifting a lifted tombstone again wrote")
+ }
// An own tombstone that simply ran out is lifted too.
s.putLock(t, tombLoc, tombMove, 4, time.Now().Add(-48*time.Hour))
writes = s.writeCount()
diff --git a/internal/registry/ha_duties_test.go b/internal/registry/ha_duties_test.go
index 654fc541b..9bfddb863 100644
--- a/internal/registry/ha_duties_test.go
+++ b/internal/registry/ha_duties_test.go
@@ -259,8 +259,8 @@ func TestHAAdoptDutyPersistence(t *testing.T) {
ctx := context.Background()
s := adoptState(t, r)
ok, err := r.CompareDuty(ctx, "shop.example.com", "life", s.Revision, DutyState{Basis: "adopted"})
- if ok {
- t.Fatal("minted adoption without receipt")
+ if ok || err != nil {
+ t.Fatalf("adoption without a receipt = %v %v, want a refusal that is not an error", ok, err)
}
ok, err = r.CompareDuty(ctx, "shop.example.com", "life", s.Revision, DutyState{Basis: "local-release", HolderRef: "peer", HolderIID: "i-peer"})
if err != nil || !ok {
diff --git a/internal/relay/record_test.go b/internal/relay/record_test.go
index de6345014..1e8704707 100644
--- a/internal/relay/record_test.go
+++ b/internal/relay/record_test.go
@@ -29,8 +29,8 @@ func TestRecordRoundTrip(t *testing.T) {
if _, err := PutRecord(ctx, s, "abc", "meet", &Record{}, "stale-etag"); !errors.Is(err, release.ErrCASConflict) {
t.Fatalf("stale put = %v, want CAS conflict", err)
}
- r, _, _ = GetRecord(ctx, s, "abc", "meet")
- if !r.Enabled || r.Op != 1 {
- t.Fatalf("record = %+v", r)
+ r, got, err := GetRecord(ctx, s, "abc", "meet")
+ if err != nil || !r.Enabled || r.Op != 1 || got != etag {
+ t.Fatalf("record = %+v etag %q %v, want the put's etag %q", r, got, err, etag)
}
}