carlos / platform Public

console: a record with a lifetime is refused before the cutover by admission alone

The fix round's test of Important 2 without the migration branch's help:
selfServeAdmits is false before the cutover and a record that already
carries an incarnation gets MV-O198.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev de2ec3cdc074b079aab7ab869235ea74794e2650 parent c36dd63
1 file changed, +19 −0
  • internal/console/selfserve_door_test.go +19 −0

CI failed — run details

CI log
=== gate ===
.amadan/test-gate.sh

amadan: job timed out after 30m0s

amadan: job failed at step gate — its output is above, not at the tail of this log
diff --git a/internal/console/selfserve_door_test.go b/internal/console/selfserve_door_test.go
index 3bb14d047..4bcd1dceb 100644
--- a/internal/console/selfserve_door_test.go
+++ b/internal/console/selfserve_door_test.go
@@ -794,6 +794,25 @@ func TestPrepareMigratesALegacyRecordBoundThenAdmits(t *testing.T) {
if open, _, _ := w.fx.st.SelfServeMoveForHost("bab", "shop", offlineHost); open != nil {
t.Fatalf("a row was admitted before the cutover: %+v", open)
}
+ // A record that already carries a lifetime needs no migration, so
+ // only admission refuses it before the cutover.
+ if w.fx.srv.selfServeAdmits() {
+ t.Fatal("the console admits self-serve moves before the cutover")
+ }
+ w.edit(func(r *provision.Record) error { r.Incarnation = 1; return nil })
+ now = time.Now().Unix()
+ sb := status.Box{Label: "ie-box", GeneratedAt: time.Now(), Metrics: &status.BoxMetrics{BoxID: "ie-box", InstanceID: "i-ie-box", Lanes: []string{"data-uk"},
+ Hosts: map[string]status.HostFacts{offlineHost: {CollectedAt: now, Known: true, Incarnation: 1, ReplicaCollectedAt: now}}}}
+ if err := status.WriteBox(context.Background(), w.fx.rel, sb); err != nil {
+ t.Fatal(err)
+ }
+ code, _, out = rawReq(t, http.MethodPost, strings.TrimSuffix(w.base, "/offline"), owner, ssBody)
+ if code != http.StatusConflict || errorText(out) != "self-serve moves are not enabled on this console" {
+ t.Fatalf("prepare of a record with a lifetime before the cutover = %d %s, want 409 not enabled", code, out)
+ }
+ if open, _, _ := w.fx.st.SelfServeMoveForHost("bab", "shop", offlineHost); open != nil {
+ t.Fatalf("a row was admitted before the cutover: %+v", open)
+ }
})
}