carlos / platform Public

console: record a restore origin on a fresh create (#658)

markHost now also reports what its mark step saw (markObservation: the
result, whether the mark was fresh, whether the mode read active);
markForCreate hands that back, and markBeforeCreate answers as before.

The lifetime create core sets Allocation.RestoreOrigin before
BeginAllocation only for the instance door's plain create (a context flag,
restore_origin.go, set by handleAPIInstanceCreate for that one call), a
data kind, a fresh mark read under an active history, lifetimes on, and no
seed, demo or demo-claim marker on the record. The seed, import, attach and
demo writers and recovery never set it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 25eab9396d6d6d11942d177e5f7f1908f4607059 parent 39266be
6 files changed, +393 −23
  • internal/console/apiinstances.go +8 −2
  • internal/console/hostsused.go +29 −18
  • internal/console/lifetimes_create.go +10 −1
  • internal/console/lifetimes_store.go +4 −2
  • internal/console/restore_origin.go +30 −0
  • internal/console/restore_origin_test.go +312 −0
diff --git a/internal/console/apiinstances.go b/internal/console/apiinstances.go
index fca5082a3..940b18c09 100644
--- a/internal/console/apiinstances.go
+++ b/internal/console/apiinstances.go
@@ -2508,9 +2508,15 @@ func (s *Server) handleAPIInstanceCreate(w http.ResponseWriter, r *http.Request)
}
case lifetimesUnit(ctx):
// Dispatch by the admitted unit (lifetimes.go): the lifetime
- // create, which answers the record as written.
+ // create, which answers the record as written. A seeded or imported
+ // create left this handler above; this plain one may record a
+ // restore origin (restore_origin.go), and only for this call.
var created *provision.Record
- if created, recordWriteErr = s.createRecordWithLifetime(ctx, rec, lifetime); recordWriteErr == nil {
+ originCtx := ctx
+ if req.From == nil && req.Import == nil {
+ originCtx = withOriginEligible(ctx)
+ }
+ if created, recordWriteErr = s.createRecordWithLifetime(originCtx, rec, lifetime); recordWriteErr == nil {
rec = *created
}
default:
diff --git a/internal/console/hostsused.go b/internal/console/hostsused.go
index 15133cf81..d3868a2f5 100644
--- a/internal/console/hostsused.go
+++ b/internal/console/hostsused.go
@@ -597,18 +597,27 @@ const (
markConflict // a mark was there already, and the history is active
)
+// markObservation is what one mark step saw: its result, whether
+// MarkHostUsed wrote the mark (fresh), and whether the mode it read was
+// active. The two observations are the restore origin's evidence
+// (restore_origin.go); result alone decides the create, as it always has.
+type markObservation struct {
+ result markResult
+ fresh, active bool
+}
+
// markHost is the mark step: the mode, then the create-only mark. A refusal
-// is the door's answer; otherwise it reports whether the create may go on.
-// A conflict once active is the caller's to judge (markForCreate,
-// markBeforeCreate).
-func (s *Server) markHost(ctx context.Context, u provision.HostUse) (markResult, *doorRefusal) {
+// is the door's answer (and a zero observation); otherwise it reports
+// whether the create may go on, and what it observed. A conflict once
+// active is the caller's to judge (markForCreate, markBeforeCreate).
+func (s *Server) markHost(ctx context.Context, u provision.HostUse) (markObservation, *doorRefusal) {
mode, err := s.hostsMode(ctx)
if err != nil {
log.Printf("console: hosts used: read the mode for %s: %v", u.Host, err)
- return 0, &doorRefusal{Status: http.StatusServiceUnavailable, Msg: msgHostUnchecked(u.Host)}
+ return markObservation{}, &doorRefusal{Status: http.StatusServiceUnavailable, Msg: msgHostUnchecked(u.Host)}
}
if mode == provision.HostsModeInvalidated {
- return 0, &doorRefusal{Status: http.StatusServiceUnavailable, Msg: msgHostsInvalidated}
+ return markObservation{}, &doorRefusal{Status: http.StatusServiceUnavailable, Msg: msgHostsInvalidated}
}
if u.At.IsZero() {
u.At = time.Now().UTC()
@@ -616,27 +625,29 @@ func (s *Server) markHost(ctx context.Context, u provision.HostUse) (markResult,
fresh, err := provision.MarkHostUsed(ctx, s.cfg.Releases, u)
if err != nil {
log.Printf("console: hosts used: mark %s: %v", u.Host, err)
- return 0, &doorRefusal{Status: http.StatusServiceUnavailable, Msg: msgHostUnchecked(u.Host)}
+ return markObservation{}, &doorRefusal{Status: http.StatusServiceUnavailable, Msg: msgHostUnchecked(u.Host)}
}
+ obs := markObservation{result: markConflict, fresh: fresh, active: mode == provision.HostsModeActive}
if fresh || mode != provision.HostsModeActive {
- return markPass, nil
+ obs.result = markPass
}
- return markConflict, nil
+ return obs, nil
}
// markForCreate marks u.Host for a create whose door has already settled
// that no record of its own stands under the key (the lifetime create's
// step 2). A mark already there refuses once the history is active (S1),
-// whoever wrote it: an earlier record's, or a concurrent create's.
-func (s *Server) markForCreate(ctx context.Context, u provision.HostUse) *doorRefusal {
- res, ref := s.markHost(ctx, u)
+// whoever wrote it: an earlier record's, or a concurrent create's. It hands
+// back what the mark step observed, for the restore origin.
+func (s *Server) markForCreate(ctx context.Context, u provision.HostUse) (markObservation, *doorRefusal) {
+ obs, ref := s.markHost(ctx, u)
if ref != nil {
- return ref
+ return markObservation{}, ref
}
- if res == markConflict {
- return &doorRefusal{Status: http.StatusConflict, Msg: msgHostUsed(u.Host)}
+ if obs.result == markConflict {
+ return markObservation{}, &doorRefusal{Status: http.StatusConflict, Msg: msgHostUsed(u.Host)}
}
- return nil
+ return obs, nil
}
// markBeforeCreate is the mark for a create-only writer that has not read
@@ -646,11 +657,11 @@ func (s *Server) markForCreate(ctx context.Context, u provision.HostUse) *doorRe
// landed gets the door's ordinary answer and not S1. Anything else is S1. A
// failed read refuses (S2). The read costs nothing until a mark conflicts.
func (s *Server) markBeforeCreate(ctx context.Context, u provision.HostUse, key string) error {
- res, ref := s.markHost(ctx, u)
+ obs, ref := s.markHost(ctx, u)
if ref != nil {
return &hostsUsedError{*ref}
}
- if res != markConflict {
+ if obs.result != markConflict {
return nil
}
_, _, err := s.cfg.Releases.Get(ctx, key)
diff --git a/internal/console/lifetimes_create.go b/internal/console/lifetimes_create.go
index bf5db326a..3a345a182 100644
--- a/internal/console/lifetimes_create.go
+++ b/internal/console/lifetimes_create.go
@@ -135,14 +135,23 @@ func (s *Server) createRecordWithLifetimeLocked(ctx context.Context, rec provisi
// (gateDataCreate) and marks its hostname after every check above,
// step 2's record read among them, and before anything is persisted. Nothing is durable yet, so a refusal leaves
// nothing behind.
+ var obs markObservation
if rec.DataKind() {
if ref := s.gateDataCreate(ctx, rec.Host, rec.Region); ref != nil {
return nil, &hostsUsedError{*ref}
}
- if ref := s.markForCreate(ctx, recordUse(rec)); ref != nil {
+ var ref *doorRefusal
+ if obs, ref = s.markForCreate(ctx, recordUse(rec)); ref != nil {
return nil, &hostsUsedError{*ref}
}
}
+ // The restore origin (restore_origin.go; #658 spec §4 stage 2 item 3):
+ // only the instance door's plain create, and only when this create's own
+ // mark step read the history active and wrote the mark fresh, with
+ // lifetimes on. The record's own seed and demo markers are a second
+ // check, never the first. A restore never sets it (it sets RestoreOf).
+ a.RestoreOrigin = originEligible(ctx) && rec.DataKind() && obs.fresh && obs.active && s.lifetimesOn() &&
+ rec.Seed == nil && rec.Demo == nil && rec.DemoClaim == nil
if err := s.store.BeginAllocation(a); err != nil {
return nil, fmt.Errorf("console: lifetimes: begin allocation of %s: %w", host, err)
}
diff --git a/internal/console/lifetimes_store.go b/internal/console/lifetimes_store.go
index 4af775188..6581f3061 100644
--- a/internal/console/lifetimes_store.go
+++ b/internal/console/lifetimes_store.go
@@ -58,8 +58,10 @@ type Allocation struct {
// removes it at step 5; recovery removes it, observed afresh, before
// it commits the allocation.
PrevOwnerKey string
- // RestoreOrigin marks an allocation made by an instance restore;
- // RestoreOf is the op id of the retirement it restores, "" otherwise.
+ // RestoreOrigin marks the allocation of a fresh create a later instance
+ // restore may build on (restore_origin.go; the create core sets it).
+ // RestoreOf is, on a restore's own allocation, the op id of the
+ // retirement it restores, "" otherwise.
RestoreOrigin bool
RestoreOf string
}
diff --git a/internal/console/restore_origin.go b/internal/console/restore_origin.go
new file mode 100644
index 000000000..c765ed649
--- /dev/null
+++ b/internal/console/restore_origin.go
@@ -0,0 +1,30 @@
+package console
+
+import "context"
+
+// The restore origin (instance restore #658, spec §4 stage 2 item 3). An
+// allocation carries restore_origin when the create that began it was a
+// plain create through the instance door (handleAPIInstanceCreate, with no
+// `from` and no import) and, at its own mark step, lifetimes were on, the
+// history's mode read active, and the mark was fresh: this create wrote it.
+// A restore checks for that row before it will bring the hostname back.
+//
+// Only the instance door's plain create sets the flag below, on the context
+// it hands the lifetime create core, and only for that one call. Every other
+// caller of the core (the seed and import doors, the attach door, the demo
+// writers, the sibling-label undo) and recovery never set it, so their
+// allocations never carry an origin, whatever their record looks like.
+
+type originEligibleKey struct{}
+
+// withOriginEligible marks ctx as the instance door's plain create, the one
+// create that may record a restore origin.
+func withOriginEligible(ctx context.Context) context.Context {
+ return context.WithValue(ctx, originEligibleKey{}, true)
+}
+
+// originEligible reports whether ctx came through withOriginEligible.
+func originEligible(ctx context.Context) bool {
+ v, _ := ctx.Value(originEligibleKey{}).(bool)
+ return v
+}
diff --git a/internal/console/restore_origin_test.go b/internal/console/restore_origin_test.go
new file mode 100644
index 000000000..9b05fb68e
--- /dev/null
+++ b/internal/console/restore_origin_test.go
@@ -0,0 +1,312 @@
+package console
+
+// The restore origin (instance restore #658, plan Task 3; spec §4 stage 2
+// item 3): the create door's own plain create records restore_origin on its
+// allocation when, at its mark step, lifetimes were on, the history was
+// active and the mark was fresh. Nothing else records it.
+
+import (
+ "context"
+ "errors"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/provision"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// lineage is HostLineage(host), failing the test on an error.
+func lineage(t *testing.T, st *Store, host string) []Allocation {
+ t.Helper()
+ rows, err := st.HostLineage(host)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return rows
+}
+
+// noOrigin fails when any allocation of host carries a restore column.
+func noOrigin(t *testing.T, st *Store, host string) []Allocation {
+ t.Helper()
+ rows := lineage(t, st, host)
+ for _, a := range rows {
+ if a.RestoreOrigin || a.RestoreOf != "" {
+ t.Fatalf("allocation %+v of %s carries a restore column, want neither", a, host)
+ }
+ }
+ return rows
+}
+
+// TestOriginOnFreshActiveCreate: a plain data-kind create through the door,
+// lifetimes on and the history active, records its origin.
+func TestOriginOnFreshActiveCreate(t *testing.T) {
+ l := newLtOn(t)
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeActive})
+ if code, out := l.create(t, ltOne); code != http.StatusCreated {
+ t.Fatalf("create = %d %s", code, out)
+ }
+ rows := lineage(t, l.fx.st, ltOne)
+ if len(rows) != 1 || !rows[0].RestoreOrigin || rows[0].RestoreOf != "" || rows[0].State != lifetimeCommitted {
+ t.Fatalf("lineage of %s = %+v, want one committed row with the origin", ltOne, rows)
+ }
+}
+
+// TestNoOriginBeforeActivation: the same create before the history is
+// active (incomplete) records no origin, though its mark is fresh.
+func TestNoOriginBeforeActivation(t *testing.T) {
+ l := newLtOn(t)
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeIncomplete})
+ if code, out := l.create(t, ltOne); code != http.StatusCreated {
+ t.Fatalf("create = %d %s", code, out)
+ }
+ if !marked(t, l.fx.rel, ltOne) {
+ t.Fatal("fixture: the create did not mark")
+ }
+ if rows := noOrigin(t, l.fx.st, ltOne); len(rows) != 1 {
+ t.Fatalf("lineage of %s = %+v, want one row", ltOne, rows)
+ }
+}
+
+// TestNoOriginOnSeed: with lifetimes on and the history active, the seed
+// (`from`) and import doors write their allocation with no origin, while the
+// instance door, the control, records one. The seed doors run the same core
+// as the instance door; only the door's own flag sets the origin.
+func TestNoOriginOnSeed(t *testing.T) {
+ for _, tc := range []struct {
+ door string
+ origin bool
+ }{{"instance", true}, {"seed", false}, {"import", false}} {
+ t.Run(tc.door, func(t *testing.T) {
+ clock := useLifetimesClock(t)
+ c := markDoorCase(t, tc.door)
+ turnLifetimesOn(t, c.fx.srv, clock)
+ forceHostsMode(t, c.fx.srv, provision.HostsModeActive)
+ if code, out := c.create(t); code != c.created {
+ t.Fatalf("create = %d %s, want %d", code, out, c.created)
+ }
+ if !recordPresent(t, c, c.recordKey) {
+ t.Fatal("no record after the create")
+ }
+ rows := lineage(t, c.fx.st, c.host)
+ if len(rows) != 1 {
+ t.Fatalf("lineage of %s = %+v, want one row", c.host, rows)
+ }
+ if rows[0].RestoreOrigin != tc.origin || rows[0].RestoreOf != "" {
+ t.Fatalf("allocation %+v, want origin %v", rows[0], tc.origin)
+ }
+ })
+ }
+}
+
+// markDoorCase builds the markDoors case named door.
+func markDoorCase(t *testing.T, door string) markCase {
+ t.Helper()
+ for _, d := range markDoors {
+ if d.name == door {
+ return d.build(t)
+ }
+ }
+ t.Fatalf("no mark door %q", door)
+ return markCase{}
+}
+
+// TestNoOriginOnExemptKind: a static create, which never marks, records no
+// origin (it may write an allocation row; that row carries neither column).
+func TestNoOriginOnExemptKind(t *testing.T) {
+ l := newLtOn(t)
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeActive})
+ host := "site.shop.example.com"
+ if code, out := createAs(t, l.lifetimesFx, `{"host":"`+host+`","kind":"static"}`); code != http.StatusCreated {
+ t.Fatalf("static create = %d %s", code, out)
+ }
+ if marked(t, l.fx.rel, host) {
+ t.Fatal("fixture: the static create marked its hostname")
+ }
+ noOrigin(t, l.fx.st, host)
+}
+
+// TestNoOriginLifetimesOff: with lifetimes off the create writes no
+// allocation row at all, so nothing can carry an origin.
+func TestNoOriginLifetimesOff(t *testing.T) {
+ l := newLifetimesFx(t)
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeActive})
+ if code, out := createAs(t, l, `{"host":"`+ltOne+`"}`); code != http.StatusCreated {
+ t.Fatalf("create = %d %s", code, out)
+ }
+ if !marked(t, l.fx.rel, ltOne) {
+ t.Fatal("fixture: the create did not mark")
+ }
+ if rows := lineage(t, l.fx.st, ltOne); len(rows) != 0 {
+ t.Fatalf("lineage of %s = %+v, want none with lifetimes off", ltOne, rows)
+ }
+}
+
+// TestMarkStepUnchangedForCreates: the doors' answers at the mark step are
+// what they were. Once active, a hostname marked already is S1 and nothing
+// is persisted; before activation it passes, the first mark kept.
+func TestMarkStepUnchangedForCreates(t *testing.T) {
+ other := provision.HostUse{Host: ltOne, Account: "zzz", App: "gone", Kind: "instance", Source: "test"}
+ t.Run("active", func(t *testing.T) {
+ l := newLtOn(t)
+ if _, err := provision.MarkHostUsed(context.Background(), l.fx.rel, other); err != nil {
+ t.Fatal(err)
+ }
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeActive})
+ if code, out := l.create(t, ltOne); code != http.StatusConflict || ltErr(out) != msgHostUsed(ltOne) {
+ t.Fatalf("create of a marked host once active = %d %s, want 409 %q", code, out, msgHostUsed(ltOne))
+ }
+ if rows := lineage(t, l.fx.st, ltOne); len(rows) != 0 {
+ t.Fatalf("lineage = %+v, want none", rows)
+ }
+ if raw, _ := rawOf(t, l.fx.rel, ltApp, ltOne); raw != nil {
+ t.Fatalf("a record was written over a marked host: %s", raw)
+ }
+ })
+ t.Run("incomplete", func(t *testing.T) {
+ l := newLtOn(t)
+ if _, err := provision.MarkHostUsed(context.Background(), l.fx.rel, other); err != nil {
+ t.Fatal(err)
+ }
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeIncomplete})
+ if code, out := l.create(t, ltOne); code != http.StatusCreated {
+ t.Fatalf("create of a marked host before activation = %d %s, want 201", code, out)
+ }
+ // Not fresh and not active: no origin either way.
+ if rows := noOrigin(t, l.fx.st, ltOne); len(rows) != 1 {
+ t.Fatalf("lineage = %+v, want one row", rows)
+ }
+ })
+}
+
+// TestNoOriginWithoutTheDoorFlag: the lifetime create core called as every
+// other door calls it (no withOriginEligible) records no origin for a plain
+// data-kind record, with lifetimes on, the history active and a fresh mark.
+// With the flag it does; with the flag and a seed marker on the record it
+// does not (the second check).
+func TestNoOriginWithoutTheDoorFlag(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ flag bool
+ seeded bool
+ origin bool
+ }{{"no flag", false, false, false}, {"flag", true, false, true}, {"flag on a seeded record", true, true, false}} {
+ t.Run(tc.name, func(t *testing.T) {
+ l := newLtOn(t)
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeActive})
+ rec := provision.Record{Schema: 1, Host: ltOne, Slug: "one", App: ltApp, Account: "bab", Channel: "stable", CreatedAt: time.Now().UTC()}
+ if tc.seeded {
+ rec.Seed = &provision.SeedSource{ID: "s-1", Kind: "replica", From: "src.shop.example.com", State: "staged", By: "alice@keymail.dev", At: time.Now().UTC()}
+ }
+ life, err := l.fx.st.AppLife(OpsAccountID, ltApp)
+ if err != nil || life == nil {
+ t.Fatalf("app life = %+v %v", life, err)
+ }
+ ctx := onCtx(t, l.fx.srv)
+ if tc.flag {
+ ctx = withOriginEligible(ctx)
+ }
+ if _, err := l.fx.srv.createRecordWithLifetime(ctx, rec, life.Lifetime); err != nil {
+ t.Fatalf("create = %v", err)
+ }
+ if !marked(t, l.fx.rel, ltOne) {
+ t.Fatal("fixture: the create did not mark")
+ }
+ rows := lineage(t, l.fx.st, ltOne)
+ if len(rows) != 1 || rows[0].RestoreOrigin != tc.origin || rows[0].RestoreOf != "" {
+ t.Fatalf("lineage of %s = %+v, want one row with origin %v", ltOne, rows, tc.origin)
+ }
+ })
+ }
+}
+
+// TestMarkHostObservations: markHost's result and refusals are what they
+// were; it only adds what it saw. markForCreate and markBeforeCreate answer
+// exactly as before for every mode and mark.
+func TestMarkHostObservations(t *testing.T) {
+ ctx := context.Background()
+ other := provision.HostUse{Host: ltOne, Account: "zzz", App: "gone", Kind: "instance", Source: "test"}
+ use := provision.HostUse{Host: ltOne, Account: "bab", App: ltApp, Kind: "instance", Source: "create"}
+ for _, tc := range []struct {
+ mode string
+ premark bool
+ want markObservation
+ }{
+ {provision.HostsModeIncomplete, false, markObservation{result: markPass, fresh: true}},
+ {provision.HostsModeIncomplete, true, markObservation{result: markPass}},
+ {provision.HostsModeActive, false, markObservation{result: markPass, fresh: true, active: true}},
+ {provision.HostsModeActive, true, markObservation{result: markConflict, active: true}},
+ } {
+ name := tc.mode
+ if tc.premark {
+ name += " marked"
+ }
+ t.Run(name, func(t *testing.T) {
+ setup := func(t *testing.T) ltOn {
+ t.Helper()
+ l := newLtOn(t)
+ if tc.premark {
+ if _, err := provision.MarkHostUsed(ctx, l.fx.rel, other); err != nil {
+ t.Fatal(err)
+ }
+ }
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: tc.mode})
+ return l
+ }
+ t.Run("markHost", func(t *testing.T) {
+ l := setup(t)
+ obs, ref := l.fx.srv.markHost(ctx, use)
+ if ref != nil || obs != tc.want {
+ t.Fatalf("markHost = %+v %+v, want %+v", obs, ref, tc.want)
+ }
+ })
+ t.Run("markForCreate", func(t *testing.T) {
+ l := setup(t)
+ obs, ref := l.fx.srv.markForCreate(ctx, use)
+ if tc.want.result == markConflict {
+ if ref == nil || ref.Status != http.StatusConflict || ref.Msg != msgHostUsed(ltOne) || obs != (markObservation{}) {
+ t.Fatalf("markForCreate = %+v %+v, want S1 and no observation", obs, ref)
+ }
+ return
+ }
+ if ref != nil || obs != tc.want {
+ t.Fatalf("markForCreate = %+v %+v, want %+v", obs, ref, tc.want)
+ }
+ })
+ t.Run("markBeforeCreate", func(t *testing.T) {
+ l := setup(t)
+ key := recKey(ltApp, ltOne)
+ err := l.fx.srv.markBeforeCreate(ctx, use, key)
+ if tc.want.result != markConflict {
+ if err != nil {
+ t.Fatalf("markBeforeCreate = %v, want nil", err)
+ }
+ return
+ }
+ var hu *hostsUsedError
+ if !errors.As(err, &hu) || hu.ref.Status != http.StatusConflict || hu.ref.Msg != msgHostUsed(ltOne) {
+ t.Fatalf("markBeforeCreate with no record = %v, want S1", err)
+ }
+ // A record of its own under the key: the write's own answer.
+ legacyRecord(t, l.fx.rel, ltOne, "stable")
+ if err := l.fx.srv.markBeforeCreate(ctx, use, key); !errors.Is(err, release.ErrCASConflict) {
+ t.Fatalf("markBeforeCreate with its record there = %v, want ErrCASConflict", err)
+ }
+ })
+ })
+ }
+ t.Run("invalidated", func(t *testing.T) {
+ l := newLtOn(t)
+ forceHostsState(t, l.fx.srv, provision.HostsState{Mode: provision.HostsModeInvalidated, Reason: "test"})
+ obs, ref := l.fx.srv.markHost(ctx, use)
+ if ref == nil || ref.Status != http.StatusServiceUnavailable || ref.Msg != msgHostsInvalidated || obs != (markObservation{}) {
+ t.Fatalf("markHost once invalidated = %+v %+v, want S5 and no observation", obs, ref)
+ }
+ if obs, ref := l.fx.srv.markForCreate(ctx, use); ref == nil || ref.Msg != msgHostsInvalidated || obs != (markObservation{}) {
+ t.Fatalf("markForCreate once invalidated = %+v %+v, want S5", obs, ref)
+ }
+ if marked(t, l.fx.rel, ltOne) {
+ t.Fatal("an invalidated history marked the hostname")
+ }
+ })
+}