carlos / platform Public

release, host: strictly ordered pointer stamps; floors admit newer or same

Fix round 1, promotion ordering (Astra P1-1, P1-2; Fable P2-2 and the
same-second ping-pong). The same-second rule let History decide: a
pointer at the floor's stamp passed if it listed the admitted version.
History names versions, not an order of promotions, so a saved v1
listing v2 passed after v2 (Astra's case), RollbackSystem (which pops
History) was refused for good in the same second, and three app writes
in one second could be alternated.

Publication: every signer waits past the head it replaces
(waitPastPromotedAt) before it signs: promote (every promote, not only
--retry), rollback, fast-track, resign, PrepareSystemPromotion and
PrepareSystemRollback. Stamps of one channel strictly increase; a
publisher whose clock is more than 2 s behind the head refuses loudly.

Boxes: the app watermark and the system floor admit a strictly later
stamp, or the very pointer already admitted, read again (a retry), by
identity: PointerIdentity / SystemPointerIdentity, the sha256 of the
verified payload. A system cancellation fence keeps its pointer's
identity. The system floor's second file is seen-pointers.json (never
released, replaces seen-versions.json); a channel with a stamp and no
identity yet admits an equal stamp once, as before.

Tests: TestWatermarkAtTheSameSecondAdmitsOnlyThePointerItRecords and
TestSystemSeenAdmitsOnlyANewerStampOrTheAdmittedPointer (Astra's v1/v2
case refused), TestWatermarkThreeWritesInASecondCannotBeReplayed and
TestSystemRollbackInTheSameSecondIsFollowedAndNothingReplays (a real
Rollback/RollbackSystem straight after the promote is followed, nothing
earlier replays). TestHunt_H6_M11 now asserts the publisher's half.

Cost: tests that write one channel several times now wait up to a
second per write (TestPromoteHistoryCapTen 11 s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 1244f0b74ca026007fe1453e58e7ec81f296c4fd parent 009dfee
12 files changed, +345 −160
  • internal/host/hunt_H6-M11_test.go +21 −20
  • internal/host/installchannel.go +6 −6
  • internal/host/installchannel_test.go +2 −2
  • internal/host/systemapply.go +8 −8
  • internal/host/systemleg.go +2 −2
  • internal/host/systemseen_test.go +111 −40
  • internal/host/systemstate.go +30 −32
  • internal/release/release.go +23 −14
  • internal/release/resign.go +3 −0
  • internal/release/systempointer.go +24 −0
  • internal/release/watermark.go +41 −18
  • internal/release/watermark_test.go +74 −18
diff --git a/internal/host/hunt_H6-M11_test.go b/internal/host/hunt_H6-M11_test.go
index 38ecee8c5..841f45b53 100644
--- a/internal/host/hunt_H6-M11_test.go
+++ b/internal/host/hunt_H6-M11_test.go
@@ -50,29 +50,30 @@ func huntScriptCandidate(f *applyFixture, version string) {
}
// H6-M11: two distinct signed promotions A (v2) then B (v3) of the same
-// channel within one second carry equal PromotedAt. The box accepts B; a
-// bucket writer restores A's saved wrapper. SECURE expectation: A is refused
-// as a superseded promotion, by the agent and by root.
+// channel within one second used to carry equal PromotedAt. The box accepts
+// B; a bucket writer restores A's saved wrapper. SECURE expectation: A is
+// refused as a superseded promotion, by the agent and by root.
+//
+// Since fix round 1 the publisher cannot sign them in one second: B waits
+// past A's stamp (waitPastPromotedAt), which this test asserts as it starts
+// both inside one second. The box-side rule at an equal stamp (only the
+// admitted pointer itself) is TestSystemSeenAdmitsOnlyANewerStampOrTheAdmittedPointer's.
func TestHunt_H6_M11_SameSecondSupersededPromotionIsRefused(t *testing.T) {
var (
- f *applyFixture
- pA, pB *release.SystemPointer
- savedA []byte
- bodyA = []byte("#!/bin/sh\necho carlos v2\n")
- bodyB = []byte("#!/bin/sh\necho carlos v3\n")
- gotEqual bool
+ f *applyFixture
+ pA, pB *release.SystemPointer
+ savedA []byte
+ bodyA = []byte("#!/bin/sh\necho carlos v2\n")
+ bodyB = []byte("#!/bin/sh\necho carlos v3\n")
)
- for attempt := 0; attempt < 5 && !gotEqual; attempt++ {
- // Start just after a second boundary so both promotes land in it.
- now := time.Now()
- time.Sleep(time.Until(now.Truncate(time.Second).Add(time.Second + 5*time.Millisecond)))
- f = newApplyFixture(t, "stable", "v1")
- pA, savedA = huntPromoteRaw(t, f, "v2", bodyA)
- pB, _ = huntPromoteRaw(t, f, "v3", bodyB)
- gotEqual = pA.PromotedAt.Equal(pB.PromotedAt)
- }
- if !gotEqual {
- t.Skip("could not land two promotions in one second")
+ // Start just after a second boundary so both promotes are asked for in it.
+ now := time.Now()
+ time.Sleep(time.Until(now.Truncate(time.Second).Add(time.Second + 5*time.Millisecond)))
+ f = newApplyFixture(t, "stable", "v1")
+ pA, savedA = huntPromoteRaw(t, f, "v2", bodyA)
+ pB, _ = huntPromoteRaw(t, f, "v3", bodyB)
+ if !pB.PromotedAt.After(pA.PromotedAt) {
+ t.Fatalf("publisher: B stamped %s, not after A's %s", pB.PromotedAt, pA.PromotedAt)
}
if pA.Current.Version == pB.Current.Version {
t.Fatal("setup: A and B must be different promotions")
diff --git a/internal/host/installchannel.go b/internal/host/installchannel.go
index b13785ab3..7f87c7daf 100644
--- a/internal/host/installchannel.go
+++ b/internal/host/installchannel.go
@@ -312,13 +312,13 @@ func (in channelInstall) install(ctx context.Context) (channelInstalled, error)
if err != nil {
return got, fmt.Errorf("this box's replay floor could not be read, so nothing was installed: %w", err)
}
- versions, err := readSystemSeenVersions(a.optDir)
+ ids, err := readSystemSeenPointers(a.optDir)
if err != nil {
return got, fmt.Errorf("this box's replay floor could not be read, so nothing was installed: %w", err)
}
- if !systemSeenAdmits(seen, versions, a.channel, p) {
- return got, fmt.Errorf("replay: the %s channel names %s promoted %s, not after the pointer this box already followed (%s promoted %s), so nothing was installed",
- a.channel, p.Current.Version, p.PromotedAt.Format(time.RFC3339), versions[a.channel], seen[a.channel].Format(time.RFC3339))
+ if !systemSeenAdmits(seen, ids, a.channel, p) {
+ return got, fmt.Errorf("replay: the %s channel names %s promoted %s, not after the pointer this box already followed (promoted %s), so nothing was installed",
+ a.channel, p.Current.Version, p.PromotedAt.Format(time.RFC3339), seen[a.channel].Format(time.RFC3339))
}
var policy *hostfloor.Policy
var policyFloor hostfloor.Verified
@@ -477,10 +477,10 @@ func (in channelInstall) install(ctx context.Context) (channelInstalled, error)
if seen, err = readSystemSeen(a.optDir); err != nil {
return got, err
}
- if versions, err = readSystemSeenVersions(a.optDir); err != nil {
+ if ids, err = readSystemSeenPointers(a.optDir); err != nil {
return got, err
}
- if err := systemSeenAdvance(a.optDir, seen, versions, a.channel, p); err != nil {
+ if err := systemSeenAdvance(a.optDir, seen, ids, a.channel, p); err != nil {
return got, err
}
if err := writeJSONDurable(a.file("applied.json"), systemApplied{Version: p.Current.Version, Channel: a.channel, At: a.ops.now().UTC()}, 0o644); err != nil {
diff --git a/internal/host/installchannel_test.go b/internal/host/installchannel_test.go
index 11ff8eb0d..b8fe12952 100644
--- a/internal/host/installchannel_test.go
+++ b/internal/host/installchannel_test.go
@@ -585,7 +585,7 @@ func TestGroupInstallFloorObservation(t *testing.T) {
}
// install-channel holds the channel to the box's replay floor (hunt H6-M11,
-// seen.json and seen-versions.json) as an update does: a box that has
+// seen.json and seen-pointers.json) as an update does: a box that has
// already followed a later promote, with no applied.json (an update cut off
// before it, or a forged no-op that was deferred), is not installed from a
// saved older pointer a bucket writer put back at the channel key. Nothing
@@ -605,7 +605,7 @@ func TestInstallChannelRefusesAPointerOlderThanTheBoxFollowed(t *testing.T) {
t.Fatal(err)
}
seen, _ := readSystemSeen(f.a.optDir)
- versions, _ := readSystemSeenVersions(f.a.optDir)
+ versions, _ := readSystemSeenPointers(f.a.optDir)
if err := systemSeenAdvance(f.a.optDir, seen, versions, "stable", followed); err != nil {
t.Fatal(err)
}
diff --git a/internal/host/systemapply.go b/internal/host/systemapply.go
index 52b5fff7f..9a1244e55 100644
--- a/internal/host/systemapply.go
+++ b/internal/host/systemapply.go
@@ -547,18 +547,18 @@ func (a *systemApplier) runLocked(ctx context.Context, recover bool, operation f
if err != nil {
return a.record(req, fmt.Errorf("%w: seen.json unreadable: %v", errSystemRefused, err))
}
- versions, err := readSystemSeenVersions(a.optDir)
+ ids, err := readSystemSeenPointers(a.optDir)
if err != nil {
- return a.record(req, fmt.Errorf("%w: seen-versions.json unreadable: %v", errSystemRefused, err))
+ return a.record(req, fmt.Errorf("%w: seen-pointers.json unreadable: %v", errSystemRefused, err))
}
// The replay floor (hunt H6-M11): a pointer no newer than the one this
- // box already followed, unless it is that pointer or its same-second
- // successor. systemSeenAdmits says which.
- if !systemSeenAdmits(seen, versions, a.channel, p) {
- return a.record(req, fmt.Errorf("%w: replay — pointer %s promoted %s is not after the %s watermark %s (%s)", errSystemRefused,
- p.Current.Version, p.PromotedAt.Format(time.RFC3339), a.channel, seen[a.channel].Format(time.RFC3339), versions[a.channel]))
+ // box already followed, unless it is that very pointer read again.
+ // systemSeenAdmits says which.
+ if !systemSeenAdmits(seen, ids, a.channel, p) {
+ return a.record(req, fmt.Errorf("%w: replay — pointer %s promoted %s is not after the %s watermark %s, and is not the pointer admitted there", errSystemRefused,
+ p.Current.Version, p.PromotedAt.Format(time.RFC3339), a.channel, seen[a.channel].Format(time.RFC3339)))
}
- if err := systemSeenAdvance(a.optDir, seen, versions, a.channel, p); err != nil {
+ if err := systemSeenAdvance(a.optDir, seen, ids, a.channel, p); err != nil {
return err
}
// Whether there is anything to install is the installed binary's to
diff --git a/internal/host/systemleg.go b/internal/host/systemleg.go
index a74e4abf0..f7ca1fb1f 100644
--- a/internal/host/systemleg.go
+++ b/internal/host/systemleg.go
@@ -132,8 +132,8 @@ func (l *systemLeg) observe(ctx context.Context) {
return
}
seen, _ := readSystemSeen(l.optDir)
- versions, _ := readSystemSeenVersions(l.optDir)
- if !systemSeenAdmits(seen, versions, l.channel, p) {
+ ids, _ := readSystemSeenPointers(l.optDir)
+ if !systemSeenAdmits(seen, ids, l.channel, p) {
return // root would refuse it as a replay
}
if res, _ := readSystemResult(l.optDir); res.matches(l.channel, p.Current.Version, p.PromotedAt) && res.terminal() {
diff --git a/internal/host/systemseen_test.go b/internal/host/systemseen_test.go
index 1eb3c09d6..aba66ed71 100644
--- a/internal/host/systemseen_test.go
+++ b/internal/host/systemseen_test.go
@@ -11,11 +11,12 @@ import (
"github.com/carlosframework/platform/internal/release"
)
-// The replay floor's same-second rule (hunt H6-M11), on the helper both
-// halves of the box call. PromoteSystem stamps whole seconds, so the stamp
-// alone cannot tell the pointer this box followed from a saved predecessor
-// signed in the same second; the admitted version beside it can.
-func TestSystemSeenAdmitsSameSecondSuccessorNotPredecessor(t *testing.T) {
+// The replay floor (hunt H6-M11, fix round 1), on the helper both halves of
+// the box call: a strictly later stamp, or the admitted pointer itself read
+// again, and nothing else. History plays no part: Astra's case (v1 listing
+// v2, then v2 listing v1 and v2, in one second) would have let the saved v1
+// back in.
+func TestSystemSeenAdmitsOnlyANewerStampOrTheAdmittedPointer(t *testing.T) {
at := time.Date(2026, 10, 25, 8, 0, 0, 0, time.UTC)
ptr := func(version string, promoted time.Time, history ...string) *release.SystemPointer {
p := &release.SystemPointer{Channel: "stable", Current: release.SystemRelease{Version: version}, PromotedAt: promoted}
@@ -24,49 +25,119 @@ func TestSystemSeenAdmitsSameSecondSuccessorNotPredecessor(t *testing.T) {
}
return p
}
+ admitted := ptr("v2", at, "v1", "v2")
seen := systemSeen{"stable": at}
- versions := systemSeenVersions{"stable": "v3"}
+ ids := systemSeenPointers{"stable": release.SystemPointerIdentity(admitted)}
+ fenced := *admitted
+ fenced.CancellationID = "c-1"
cases := []struct {
- name string
- seen systemSeen
- versions systemSeenVersions
- p *release.SystemPointer
- want bool
+ name string
+ seen systemSeen
+ ids systemSeenPointers
+ p *release.SystemPointer
+ want bool
}{
- {"no entry for the channel admits the first pointer", systemSeen{}, systemSeenVersions{}, ptr("v2", at, "v1"), true},
- {"strictly later is news", seen, versions, ptr("v4", at.Add(time.Second), "v3"), true},
- {"strictly later is news whatever it lists", seen, versions, ptr("v2", at.Add(time.Second)), true},
- {"older is a replay", seen, versions, ptr("v4", at.Add(-time.Second), "v3"), false},
- {"same second, the admitted pointer again (a retry)", seen, versions, ptr("v3", at, "v2"), true},
- {"same second, a successor listing the admitted version", seen, versions, ptr("v4", at, "v3", "v2"), true},
- {"same second, a saved predecessor", seen, versions, ptr("v2", at, "v1"), false},
- {"same second, a stranger", seen, versions, ptr("v9", at), false},
- {"same second with no admitted version recorded keeps the stamp-only rule", seen, systemSeenVersions{}, ptr("v2", at, "v1"), true},
- {"another channel's entry is not this channel's", systemSeen{"canary": at.Add(time.Hour)}, systemSeenVersions{"canary": "v9"}, ptr("v2", at), true},
+ {"no entry for the channel admits the first pointer", systemSeen{}, systemSeenPointers{}, ptr("v2", at, "v1"), true},
+ {"strictly later is news", seen, ids, ptr("v4", at.Add(time.Second), "v2"), true},
+ {"strictly later is news whatever it lists", seen, ids, ptr("v1", at.Add(time.Second)), true},
+ {"older is a replay", seen, ids, ptr("v4", at.Add(-time.Second), "v2"), false},
+ {"same second, the admitted pointer again (a retry)", seen, ids, ptr("v2", at, "v1", "v2"), true},
+ {"same second, the admitted pointer's cancellation fence", seen, ids, &fenced, true},
+ {"same second, a saved v1 listing the admitted v2 (Astra P1-1)", seen, ids, ptr("v1", at, "v2"), false},
+ {"same second, the admitted version in another pointer", seen, ids, ptr("v2", at, "v1"), false},
+ {"same second, a stranger", seen, ids, ptr("v9", at), false},
+ {"same second with no identity recorded admits once, as before", seen, systemSeenPointers{}, ptr("v1", at), true},
+ {"another channel's entry is not this channel's", systemSeen{"canary": at.Add(time.Hour)}, systemSeenPointers{"canary": "x"}, ptr("v2", at), true},
}
for _, c := range cases {
- if got := systemSeenAdmits(c.seen, c.versions, "stable", c.p); got != c.want {
+ if got := systemSeenAdmits(c.seen, c.ids, "stable", c.p); got != c.want {
t.Errorf("%s: admits = %v, want %v", c.name, got, c.want)
}
}
}
-func writeSeenFixture(t *testing.T, optDir string, seen systemSeen, versions systemSeenVersions) {
+// Real publications (Astra P1-2): promotes, an immediate RollbackSystem and
+// another promote of one channel, as fast as they can be written. Each is
+// stamped strictly after the head it replaced, so a box that follows every
+// one of them in turn admits each, and none of the earlier pointers, put
+// back afterwards, is admitted again.
+func TestSystemRollbackInTheSameSecondIsFollowedAndNothingReplays(t *testing.T) {
+ ctx := context.Background()
+ f := newLegFixture(t, "stable", "v1")
+ read := func() (*release.SystemPointer, []byte) {
+ t.Helper()
+ p, _, err := release.GetSystemPointer(ctx, f.store, f.leg.pub, release.SystemComponentRouter, "stable")
+ if err != nil {
+ t.Fatal(err)
+ }
+ raw, _, err := f.store.Get(ctx, release.SystemPointerKey(release.SystemComponentRouter, "stable"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ return p, raw
+ }
+ seen, ids := systemSeen{}, systemSeenPointers{}
+ var followed []*release.SystemPointer
+ follow := func(what string) {
+ t.Helper()
+ p, _ := read()
+ if !systemSeenAdmits(seen, ids, "stable", p) {
+ t.Fatalf("%s (%s promoted %s) refused by the floor", what, p.Current.Version, p.PromotedAt)
+ }
+ seen["stable"], ids["stable"] = p.PromotedAt, release.SystemPointerIdentity(p)
+ followed = append(followed, p)
+ }
+ f.promote("v1", []byte("one"), 0)
+ follow("first promote")
+ f.promote("v2", []byte("two"), 0)
+ follow("promote")
+ if _, err := release.RollbackSystem(ctx, f.store, release.RootSigner(f.priv), release.SystemComponentRouter, "stable", release.SystemPromoteOptions{}); err != nil {
+ t.Fatalf("RollbackSystem right after the promote: %v", err)
+ }
+ follow("rollback")
+ if p := followed[len(followed)-1]; p.Current.Version != "v1" {
+ t.Fatalf("rollback names %s, want v1", p.Current.Version)
+ }
+ f.promote("v3", []byte("three"), 0)
+ follow("promote after the rollback")
+ for i := 1; i < len(followed); i++ {
+ if !followed[i].PromotedAt.After(followed[i-1].PromotedAt) {
+ t.Fatalf("write %d stamped %s, not after %s", i, followed[i].PromotedAt, followed[i-1].PromotedAt)
+ }
+ }
+ for i, p := range followed[:len(followed)-1] {
+ if systemSeenAdmits(seen, ids, "stable", p) {
+ t.Fatalf("write %d (%s promoted %s) replays past the floor", i, p.Current.Version, p.PromotedAt)
+ }
+ }
+}
+
+func writeSeenFixture(t *testing.T, optDir string, seen systemSeen, ids systemSeenPointers) {
t.Helper()
os.MkdirAll(systemRootDir(optDir), 0o755)
if err := writeJSONDurable(filepath.Join(systemRootDir(optDir), "seen.json"), seen, 0o644); err != nil {
t.Fatal(err)
}
- if err := writeJSONDurable(filepath.Join(systemRootDir(optDir), "seen-versions.json"), versions, 0o644); err != nil {
+ if err := writeJSONDurable(filepath.Join(systemRootDir(optDir), "seen-pointers.json"), ids, 0o644); err != nil {
+ t.Fatal(err)
+ }
+}
+
+// pointerID is the identity of the pointer the fixture's channel names now.
+func pointerID(t *testing.T, a *systemApplier) string {
+ t.Helper()
+ p, err := a.verifyPointer(context.Background())
+ if err != nil {
t.Fatal(err)
}
+ return release.SystemPointerIdentity(p)
}
// A genuine next promotion, stamped strictly after the watermark, still
// passes the floor and is installed; both halves of the watermark advance.
func TestApplyStrictlyLaterPromotionPassesTheFloor(t *testing.T) {
f, req := applyHappy(t)
- writeSeenFixture(t, f.a.optDir, systemSeen{"stable": req.PromotedAt.Add(-time.Second)}, systemSeenVersions{"stable": "v1"})
+ writeSeenFixture(t, f.a.optDir, systemSeen{"stable": req.PromotedAt.Add(-time.Second)}, systemSeenPointers{"stable": "an-older-pointer"})
if err := f.a.Run(context.Background(), false); err != nil {
t.Fatal(err)
}
@@ -74,19 +145,19 @@ func TestApplyStrictlyLaterPromotionPassesTheFloor(t *testing.T) {
t.Fatalf("result %+v, on disk %q", r, f.onDisk())
}
seen, _ := readSystemSeen(f.a.optDir)
- versions, _ := readSystemSeenVersions(f.a.optDir)
- if !seen["stable"].Equal(req.PromotedAt) || versions["stable"] != "v2" {
- t.Fatalf("watermark = %v / %v, want %v / v2", seen["stable"], versions["stable"], req.PromotedAt)
+ ids, _ := readSystemSeenPointers(f.a.optDir)
+ if want := pointerID(t, f.a); !seen["stable"].Equal(req.PromotedAt) || ids["stable"] != want {
+ t.Fatalf("watermark = %v / %v, want %v / %v", seen["stable"], ids["stable"], req.PromotedAt, want)
}
}
// Root's half of H6-M11 without racing a second boundary: the watermark
-// says a different version was admitted at this exact stamp, so the pointer
-// is a same-second predecessor put back, and is refused with the box as it
-// was. The same version at the same stamp is the retry the spec allows.
+// says a different pointer was admitted at this exact stamp, so this one is
+// a replay, and is refused with the box as it was. The admitted pointer
+// itself at the same stamp is the retry the spec allows.
func TestApplySameSecondSupersededPromotionIsRefusedButARetryProceeds(t *testing.T) {
f, req := applyHappy(t)
- writeSeenFixture(t, f.a.optDir, systemSeen{"stable": req.PromotedAt}, systemSeenVersions{"stable": "v3"})
+ writeSeenFixture(t, f.a.optDir, systemSeen{"stable": req.PromotedAt}, systemSeenPointers{"stable": "another-pointer"})
if err := f.a.Run(context.Background(), false); err != nil {
t.Fatal(err)
}
@@ -94,10 +165,10 @@ func TestApplySameSecondSupersededPromotionIsRefusedButARetryProceeds(t *testing
if r == nil || r.Outcome != systemOutcomeRefused || !strings.Contains(r.Reason, "replay") || f.onDisk() != "v1" {
t.Fatalf("result %+v, on disk %q", r, f.onDisk())
}
- if versions, _ := readSystemSeenVersions(f.a.optDir); versions["stable"] != "v3" {
- t.Fatalf("a refused replay moved the watermark: %v", versions)
+ if ids, _ := readSystemSeenPointers(f.a.optDir); ids["stable"] != "another-pointer" {
+ t.Fatalf("a refused replay moved the watermark: %v", ids)
}
- writeSeenFixture(t, f.a.optDir, systemSeen{"stable": req.PromotedAt}, systemSeenVersions{"stable": "v2"})
+ writeSeenFixture(t, f.a.optDir, systemSeen{"stable": req.PromotedAt}, systemSeenPointers{"stable": pointerID(t, f.a)})
if err := f.a.Run(context.Background(), false); err != nil {
t.Fatal(err)
}
@@ -137,9 +208,9 @@ func TestApplyNoOpRequestForAnotherBuildIsDeferredNotNoted(t *testing.T) {
}
// The agent's half of H6-M11 without racing a second boundary: root's
-// watermark names another version at the pointer's exact stamp, so the agent
-// schedules nothing for it; with the pointer's own version recorded it is a
-// retry and is requested.
+// watermark names another pointer at this pointer's exact stamp, so the
+// agent schedules nothing for it; with this pointer recorded it is a retry
+// and is requested.
func TestSystemLegSkipsASameSecondSupersededPromotion(t *testing.T) {
f := newLegFixture(t, "stable", "v1")
f.promote("v2", []byte("x"), 0)
@@ -147,7 +218,7 @@ func TestSystemLegSkipsASameSecondSupersededPromotion(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- writeSeenFixture(t, f.opt, systemSeen{"stable": p.PromotedAt}, systemSeenVersions{"stable": "v3"})
+ writeSeenFixture(t, f.opt, systemSeen{"stable": p.PromotedAt}, systemSeenPointers{"stable": "another-pointer"})
f.leg.observe(context.Background())
f.leg.tick(context.Background(), f.now)
if f.leg.pending != nil {
@@ -156,7 +227,7 @@ func TestSystemLegSkipsASameSecondSupersededPromotion(t *testing.T) {
if _, err := f.marker(); err == nil {
t.Fatal("requested a pointer root would refuse as a replay")
}
- writeSeenFixture(t, f.opt, systemSeen{"stable": p.PromotedAt}, systemSeenVersions{"stable": "v2"})
+ writeSeenFixture(t, f.opt, systemSeen{"stable": p.PromotedAt}, systemSeenPointers{"stable": release.SystemPointerIdentity(p)})
f.leg.observe(context.Background())
f.leg.tick(context.Background(), f.now)
if r := f.request(); r == nil || r.Version != "v2" || r.NoOp {
diff --git a/internal/host/systemstate.go b/internal/host/systemstate.go
index 73002222c..871af2697 100644
--- a/internal/host/systemstate.go
+++ b/internal/host/systemstate.go
@@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"regexp"
- "slices"
"time"
"github.com/carlosframework/platform/internal/release"
@@ -94,27 +93,25 @@ type systemApplied struct {
// has verified. Advanced on every verified pointer, including no-ops.
type systemSeen map[string]time.Time
-// systemSeenVersions is the other half of the watermark (hunt H6-M11): the
-// version of the pointer root admitted at seen.json's stamp, per channel,
-// in seen-versions.json beside it. PromoteSystem stamps whole seconds, so
-// two promotions of one channel in one second share a PromotedAt, and the
-// stamp alone cannot tell the one this box followed from a saved
-// predecessor put back at the channel key. A channel with a stamp but no
-// version (a box that last admitted a pointer before this file existed)
-// keeps the stamp-only rule until its next admission.
-type systemSeenVersions map[string]string
+// systemSeenPointers is the other half of the watermark (hunt H6-M11): the
+// identity (release.SystemPointerIdentity) of the pointer root admitted at
+// seen.json's stamp, per channel, in seen-pointers.json beside it. A
+// channel with a stamp but no identity (a box that last admitted a pointer
+// before this file existed) admits an equal stamp once, as it did before,
+// and records its identity then.
+type systemSeenPointers map[string]string
// systemSeenAdmits is the replay floor both halves of the box apply to a
// verified pointer: the agent before it schedules one (systemleg.go), root
-// before it acts on one (systemapply.go). It is the system-pointer twin of
-// release's watermark.admits. A later stamp is news. An older stamp is a
-// replay. The same stamp needs a closer look: the pointer already admitted
-// (a retry of the same promote, which the spec allows) passes; a successor
-// signed in the same second lists the admitted version at History[0], since
-// PromoteSystem and RollbackSystem both put the head they replace there,
-// and passes; a pointer saved before the admitted head lists neither and is
-// refused.
-func systemSeenAdmits(seen systemSeen, versions systemSeenVersions, channel string, p *release.SystemPointer) bool {
+// before it acts on one (systemapply.go, installchannel.go). It is the
+// system-pointer twin of release's watermark.admits. A strictly later stamp
+// is news. Every system signer stamps a new head strictly after the one it
+// replaces (PrepareSystemPromotion and PrepareSystemRollback wait past it),
+// so at the floor's own stamp only the pointer already admitted passes, read
+// again (a retry, or the cancellation fence that re-signs it). Anything
+// else at that stamp, or older, is a replay. RollbackSystem pops History,
+// so history could never tell a rollback from a replay; the stamp does.
+func systemSeenAdmits(seen systemSeen, ids systemSeenPointers, channel string, p *release.SystemPointer) bool {
wm, ok := seen[channel]
switch {
case !ok || p.PromotedAt.After(wm):
@@ -122,24 +119,25 @@ func systemSeenAdmits(seen systemSeen, versions systemSeenVersions, channel stri
case p.PromotedAt.Before(wm):
return false
}
- admitted, known := versions[channel]
+ admitted, known := ids[channel]
if !known {
return true
}
- return p.Current.Version == admitted || slices.ContainsFunc(p.History, func(r release.SystemRelease) bool { return r.Version == admitted })
+ return release.SystemPointerIdentity(p) == admitted
}
// systemSeenAdvance records p as the newest pointer admitted on channel,
-// seen.json first and then seen-versions.json, both durable. A version write
-// that fails leaves the stamp in place with the previous version beside it,
-// which the next admission overwrites; the floor reads both.
-func systemSeenAdvance(optDir string, seen systemSeen, versions systemSeenVersions, channel string, p *release.SystemPointer) error {
+// seen.json first and then seen-pointers.json, both durable. An identity
+// write that fails leaves the stamp in place with the previous identity
+// beside it, which refuses the new pointer at that stamp until the next
+// admission writes it (fail closed).
+func systemSeenAdvance(optDir string, seen systemSeen, ids systemSeenPointers, channel string, p *release.SystemPointer) error {
seen[channel] = p.PromotedAt
- versions[channel] = p.Current.Version
+ ids[channel] = release.SystemPointerIdentity(p)
if err := writeJSONDurable(filepath.Join(systemRootDir(optDir), "seen.json"), seen, 0o644); err != nil {
return err
}
- return writeJSONDurable(filepath.Join(systemRootDir(optDir), "seen-versions.json"), versions, 0o644)
+ return writeJSONDurable(filepath.Join(systemRootDir(optDir), "seen-pointers.json"), ids, 0o644)
}
// systemJournal is the open transaction. Written before every box-changing
@@ -257,14 +255,14 @@ func readSystemSeen(optDir string) (systemSeen, error) {
return s, err
}
-func readSystemSeenVersions(optDir string) (systemSeenVersions, error) {
- v := systemSeenVersions{}
- err := readJSONFile(filepath.Join(systemRootDir(optDir), "seen-versions.json"), &v)
+func readSystemSeenPointers(optDir string) (systemSeenPointers, error) {
+ v := systemSeenPointers{}
+ err := readJSONFile(filepath.Join(systemRootDir(optDir), "seen-pointers.json"), &v)
if errors.Is(err, os.ErrNotExist) {
- return systemSeenVersions{}, nil
+ return systemSeenPointers{}, nil
}
if v == nil {
- v = systemSeenVersions{}
+ v = systemSeenPointers{}
}
return v, err
}
diff --git a/internal/release/release.go b/internal/release/release.go
index ad0a5acad..6c2749f0f 100644
--- a/internal/release/release.go
+++ b/internal/release/release.go
@@ -1024,16 +1024,15 @@ func (sg Signer) claimRawPromote(ctx context.Context, s Store, acct, app, channe
if expectVersion != "" && old.Version != expectVersion {
return fmt.Errorf("promote --retry renews a promotion: %s now names %s, not %s", channel, old.Version, expectVersion)
}
- // A retry's whole effect is a new PromotedAt, so freshness is checked
+ // Every new head is stamped strictly after the head it replaces (hunt
+ // H3-M5 fix round 1): a box's channel floor admits only a strictly newer
+ // stamp, so two writes in one second must never share one. Checked
// HERE, against the pointer whose etag guards the write, not against an
- // earlier read: a concurrent retry that renewed the same version in
- // between would otherwise be re-stamped with its own second-truncated
- // time, and a box that refused that promotion would stay blocked behind
- // a "successful" retry (final review F7).
- if expectVersion != "" {
- if err := waitPastPromotedAt(ctx, channel, old.PromotedAt); err != nil {
- return err
- }
+ // earlier read: a concurrent write in between would otherwise be
+ // re-stamped with its own second-truncated time (final review F7). A
+ // first promote has a zero predecessor and never waits.
+ if err := waitPastPromotedAt(ctx, channel, old.PromotedAt); err != nil {
+ return fmt.Errorf("promote: %w", err)
}
if authorize != nil {
// Between the pointer read and the conditional write, so the write
@@ -1096,11 +1095,15 @@ func (sg Signer) claimRawPromote(ctx context.Context, s Store, acct, app, channe
return err
}
-// waitPastPromotedAt returns once the stamp signPointer would produce (now,
-// truncated to the second) is strictly after prev, waiting into the next
-// second if it must. The wait is bounded at 2 s: a prev further ahead than
+// waitPastPromotedAt returns once the stamp signPointer (or
+// signSystemPointer) would produce (now, truncated to the second) is
+// strictly after prev, waiting into the next second if it must. Every
+// signer of an app or system pointer calls it with the stamp of the head it
+// replaces, so a channel's stamps strictly increase and a box's floor needs
+// no other ordering. The wait is bounded at 2 s: a prev further ahead than
// that is clock skew, and it refuses rather than write a stamp that is not
-// newer.
+// newer, so skew between two publishers fails loudly here instead of every
+// box refusing the later write as a replay.
func waitPastPromotedAt(ctx context.Context, channel string, prev time.Time) error {
if time.Now().UTC().Truncate(time.Second).After(prev) {
return nil
@@ -1113,7 +1116,7 @@ func waitPastPromotedAt(ctx context.Context, channel string, prev time.Time) err
case <-t.C:
}
if !time.Now().UTC().Truncate(time.Second).After(prev) {
- return fmt.Errorf("promote --retry: %s was promoted at %s, ahead of this clock; nothing was written",
+ return fmt.Errorf("%s was last written at %s, ahead of this clock; nothing was written",
channel, prev.Format(time.RFC3339))
}
return nil
@@ -1466,6 +1469,9 @@ func (sg Signer) claimRawRollbackAuthorized(ctx context.Context, s Store, acct,
if len(old.History) == 0 {
return fmt.Errorf("rollback: %s/%s has no previous version recorded", app, channel)
}
+ if err := waitPastPromotedAt(ctx, channel, old.PromotedAt); err != nil {
+ return fmt.Errorf("rollback: %w", err)
+ }
if authorize != nil {
pipe, perr := GetPipeline(ctx, s, pub, acct, app)
if perr != nil {
@@ -1553,6 +1559,9 @@ func claimRawFastTrack(ctx context.Context, s Store, priv ed25519.PrivateKey, ac
if old.FastTrack {
return old.Version, nil
}
+ if err := waitPastPromotedAt(ctx, channel, old.PromotedAt); err != nil {
+ return "", fmt.Errorf("fast-track: %w", err)
+ }
marker, merr := ReadDigestMarker(ctx, s, sg.verifyPub(), acct)
if merr != nil {
return "", fmt.Errorf(TextMarkerUnreadable, "fast-track", acct, merr)
diff --git a/internal/release/resign.go b/internal/release/resign.go
index 986a86bdb..1b976c9e5 100644
--- a/internal/release/resign.go
+++ b/internal/release/resign.go
@@ -126,6 +126,9 @@ func (sg Signer) claimRawResign(ctx context.Context, s Store, plan *ResignPlan,
if old.FastTrack && sg.scope != nil {
return fmt.Errorf("resign: %s carries a fast-track waiver, which only the root key may sign", plan.Channel)
}
+ if err := waitPastPromotedAt(ctx, plan.Channel, old.PromotedAt); err != nil {
+ return fmt.Errorf("resign: %w", err)
+ }
wrapper, err := signPointer(sg, &next)
if err != nil {
return err
diff --git a/internal/release/systempointer.go b/internal/release/systempointer.go
index 4d53086d2..086b30a47 100644
--- a/internal/release/systempointer.go
+++ b/internal/release/systempointer.go
@@ -3,7 +3,9 @@ package release
import (
"context"
"crypto/ed25519"
+ "crypto/sha256"
"encoding/base64"
+ "encoding/hex"
"encoding/json"
"errors"
"fmt"
@@ -325,6 +327,11 @@ func PrepareSystemPromotion(ctx context.Context, s Store, sg Signer, component,
if old, err = verifySystemPointer(sg.verifyPub(), body, component, channel); err != nil {
return SystemPublication{}, err
}
+ // Strictly after the pointer it replaces, a cancellation included
+ // (waitPastPromotedAt): a box's replay floor admits only a newer stamp.
+ if err := waitPastPromotedAt(ctx, channel, old.PromotedAt); err != nil {
+ return SystemPublication{}, fmt.Errorf("system promote: %w", err)
+ }
}
if old != nil && old.CancellationID != "" && old.Current.Version == "" {
old = nil
@@ -387,6 +394,9 @@ func PrepareSystemRollback(ctx context.Context, s Store, sg Signer, component, c
if len(old.History) == 0 {
return SystemPublication{}, ErrNoSystemHistory
}
+ if err := waitPastPromotedAt(ctx, channel, old.PromotedAt); err != nil {
+ return SystemPublication{}, fmt.Errorf("system rollback: %w", err)
+ }
next := &SystemPointer{ActivationID: id,
Component: component, Channel: channel,
Current: old.History[0], History: old.History[1:], Spread: old.Spread,
@@ -401,3 +411,17 @@ func PrepareSystemRollback(ctx context.Context, s Store, sg Signer, component, c
}
return SystemPublication{Component: component, Channel: channel, ID: id, ExpectedETag: etag, Before: body, After: wrapper}, nil
}
+
+// SystemPointerIdentity names one signed system pointer by its content: the
+// sha256 of the verified payload re-marshalled, the cancellation mark left
+// out. Two reads of the same signed pointer have the same identity, and so
+// does a cancellation fence (CancelSystemPublication), which re-signs the
+// pointer it fences with every field and its stamp kept: the box has
+// already followed exactly that release. Two different pointers do not.
+func SystemPointerIdentity(p *SystemPointer) string {
+ q := *p
+ q.CancellationID = ""
+ raw, _ := json.Marshal(&q)
+ sum := sha256.Sum256(raw)
+ return hex.EncodeToString(sum[:])
+}
diff --git a/internal/release/watermark.go b/internal/release/watermark.go
index e9ab9a972..82c498b6e 100644
--- a/internal/release/watermark.go
+++ b/internal/release/watermark.go
@@ -1,6 +1,8 @@
package release
import (
+ "crypto/sha256"
+ "encoding/hex"
"encoding/json"
"errors"
"fmt"
@@ -8,7 +10,6 @@ import (
"log"
"os"
"path/filepath"
- "slices"
"strings"
"time"
@@ -16,11 +17,12 @@ import (
"github.com/carlosframework/platform/internal/safefile"
)
-// watermark is one channel's floor on this box: the promoted_at and version
-// of the newest pointer it admitted (hunt H3-M5). It is the app-pointer twin
-// of the system pointer's seen.json floor (internal/host/systemapply.go): a
-// verified pointer older than the floor is a saved pointer put back, and is
-// refused however good its signature.
+// watermark is one channel's floor on this box: the promoted_at, version and
+// identity (PointerIdentity) of the newest pointer it admitted (hunt H3-M5).
+// It is the app-pointer twin of the system pointer's seen.json floor
+// (internal/host/systemstate.go): a verified pointer not newer than the
+// floor, other than the floor's own pointer read again, is a saved pointer
+// put back, and is refused however good its signature.
//
// durable says the floor on disk is at least this one. A floor remembered
// after a write failed is not; it still refuses what it must, and the write
@@ -28,28 +30,49 @@ import (
type watermark struct {
At time.Time `json:"promoted_at"`
Version string `json:"version"`
+ ID string `json:"pointer,omitempty"`
durable bool
}
+// PointerIdentity names one signed channel pointer by its content: the
+// sha256 of the verified payload re-marshalled. Two reads of the same signed
+// pointer have the same identity; two different pointers, the same stamp or
+// not, do not.
+func PointerIdentity(p *ChannelPointer) string {
+ raw, _ := json.Marshal(p)
+ sum := sha256.Sum256(raw)
+ return hex.EncodeToString(sum[:])
+}
+
+// is reports whether p is the pointer this floor records. A floor written
+// without an identity (none was ever released) falls back to the version.
+func (wm watermark) is(p *ChannelPointer) bool {
+ if wm.ID == "" {
+ return p.Version == wm.Version
+ }
+ return PointerIdentity(p) == wm.ID
+}
+
// watermarkPath is a channel's floor: <dir>/<acct>/<app>/<channel>.watermark,
// beside the channel's digest mark, with "/" escaped as markPath does.
func watermarkPath(dir, acct, app, channel string) string {
return filepath.Join(dir, watermarkRel(acct, app, channel))
}
-// admits reports whether p may follow this floor. A later promoted_at is
-// news. The same promoted_at needs a closer look: signPointer stamps whole
-// seconds, so a promote and its rollback, or two promotes, can share one.
-// Promote and Rollback both put the head they replace at History[0], so a
-// successor signed in the floor's second lists the floor's version, and a
-// pointer saved before the floor's head cannot. The pointer already admitted
-// is the other same-second case. Anything older is a replay.
+// admits reports whether p may follow this floor: a strictly later
+// promoted_at, or the very pointer the floor records, read again (every
+// pass re-reads the head). Every signer stamps a new head strictly after
+// the one it replaces (waitPastPromotedAt), so a different pointer at the
+// floor's stamp, or an older one, is never a legitimate successor: it is a
+// replay, whatever its history lists (fix round 1: History names versions,
+// not an order of promotions, so it cannot tell a successor from a saved
+// pointer).
func (wm watermark) admits(p *ChannelPointer) bool {
switch {
case wm.At.IsZero() || p.PromotedAt.After(wm.At):
return true
case p.PromotedAt.Equal(wm.At):
- return p.Version == wm.Version || slices.Contains(p.History, wm.Version)
+ return wm.is(p)
}
return false
}
@@ -86,7 +109,7 @@ func (r *DigestRatchet) admitWatermark(acct string, p *ChannelPointer) error {
// Memory alone settles the two common cases: the pointer this process
// already admitted, and a replay. Anything else (a newer pointer, a
// same-second successor, a floor not yet on disk) goes to the disk.
- if mem.durable && p.PromotedAt.Equal(mem.At) && p.Version == mem.Version {
+ if mem.durable && p.PromotedAt.Equal(mem.At) && mem.is(p) {
return nil
}
if p.PromotedAt.Before(mem.At) {
@@ -102,12 +125,12 @@ func (r *DigestRatchet) admitWatermark(acct string, p *ChannelPointer) error {
floor = later(mem, disk)
}
if !floor.admits(p) {
- floor.durable = floor.At.Equal(disk.At) && floor.Version == disk.Version
+ floor.durable = floor.At.Equal(disk.At) && floor.Version == disk.Version && floor.ID == disk.ID
r.floor[k] = floor
return r.replayed(acct, p, floor)
}
- next := watermark{At: p.PromotedAt, Version: p.Version, durable: true}
- if r.own == "" || (disk.At.Equal(p.PromotedAt) && disk.Version == p.Version) {
+ next := watermark{At: p.PromotedAt, Version: p.Version, ID: PointerIdentity(p), durable: true}
+ if r.own == "" || (disk.At.Equal(p.PromotedAt) && disk.ID == next.ID) {
r.floor[k] = next // nothing to persist, or the disk already says so
return nil
}
diff --git a/internal/release/watermark_test.go b/internal/release/watermark_test.go
index b2ead2c2f..579ec4b66 100644
--- a/internal/release/watermark_test.go
+++ b/internal/release/watermark_test.go
@@ -48,29 +48,84 @@ func TestWatermarkRefusesAnOlderPointer(t *testing.T) {
}
}
-// signPointer stamps whole seconds, so two pointers of one channel can share
-// a promoted_at. The successor lists the head it replaced at History[0] (both
-// Promote and Rollback do); the replayed predecessor cannot list its
-// successor. That is how the floor tells them apart at the same second.
-func TestWatermarkAtTheSameSecondAdmitsOnlyASuccessor(t *testing.T) {
+// At the floor's own stamp only the pointer the floor records passes, read
+// again (fix round 1). History is no evidence of order: Astra's case, v1
+// listing v2 and then v2 listing v1 and v2 in one second, would have let the
+// saved v1 back in under the old same-second rule.
+func TestWatermarkAtTheSameSecondAdmitsOnlyThePointerItRecords(t *testing.T) {
r := NewDigestRatchet(t.TempDir(), nil, false)
at := time.Date(2026, 10, 1, 12, 0, 0, 0, time.UTC)
- if err := r.Admit("bab", stamped("stable", "v1", at)); err != nil {
+ v2 := stamped("stable", "v2", at, "v1", "v2")
+ if err := r.Admit("bab", v2); err != nil {
t.Fatal(err)
}
- if err := r.Admit("bab", stamped("stable", "v2", at, "v1")); err != nil {
- t.Fatalf("a successor promoted in the same second: %v", err)
+ if err := r.Admit("bab", stamped("stable", "v2", at, "v1", "v2")); err != nil {
+ t.Fatalf("the admitted pointer read again: %v", err)
}
- if err := r.Admit("bab", stamped("stable", "v1", at)); !errors.Is(err, ErrPointerReplayed) {
- t.Fatalf("the predecessor put back in the same second: %v, want ErrPointerReplayed", err)
+ for name, p := range map[string]*ChannelPointer{
+ "a saved v1 listing the admitted v2 (Astra P1-1)": stamped("stable", "v1", at, "v2"),
+ "the admitted version in another pointer": stamped("stable", "v2", at, "v1"),
+ "a stranger": stamped("stable", "v0", at),
+ } {
+ if err := r.Admit("bab", p); !errors.Is(err, ErrPointerReplayed) {
+ t.Fatalf("%s at the floor's stamp: %v, want ErrPointerReplayed", name, err)
+ }
}
- // A rollback in the same second lists v2 and goes through.
- if err := r.Admit("bab", stamped("stable", "v1", at, "v2")); err != nil {
- t.Fatalf("a same-second rollback: %v", err)
+ // And from disk, in a new process: the identity is part of the floor.
+ if err := NewDigestRatchet(r.own, nil, false).Admit("bab", stamped("stable", "v1", at, "v2")); !errors.Is(err, ErrPointerReplayed) {
+ t.Fatalf("a new process admitted the same-second v1: %v", err)
}
- // A pointer that neither is the head nor descends from it is refused.
- if err := r.Admit("bab", stamped("stable", "v0", at)); !errors.Is(err, ErrPointerReplayed) {
- t.Fatalf("an unrelated pointer at the same second: %v", err)
+}
+
+// Real publications: promote, rollback and promote of one channel as fast as
+// they can be written, the ping-pong Fable named. Each signer waits past the
+// head it replaces (waitPastPromotedAt), so the stamps strictly increase,
+// every write is followed in turn, and none of the earlier pointers, put
+// back afterwards, is admitted again.
+func TestWatermarkThreeWritesInASecondCannotBeReplayed(t *testing.T) {
+ s := NewDirStore(t.TempDir())
+ ctx := context.Background()
+ priv, pub := testKeys(t)
+ shipRelease(t, s, "bab", "shop", "v1", adoptPlatform, []byte("v1"))
+ shipRelease(t, s, "bab", "shop", "v2", adoptPlatform, []byte("v2"))
+ r := NewDigestRatchet(t.TempDir(), nil, false)
+ var followed []*ChannelPointer
+ follow := func(what string) {
+ t.Helper()
+ p, err := Channel(ctx, s, pub, "bab", "shop", "stable")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := r.Admit("bab", p); err != nil {
+ t.Fatalf("%s (%s promoted %s): %v", what, p.Version, p.PromotedAt, err)
+ }
+ followed = append(followed, p)
+ }
+ if err := Promote(ctx, s, priv, "bab", "shop", "stable", "v1"); err != nil {
+ t.Fatal(err)
+ }
+ follow("first promote")
+ if err := Promote(ctx, s, priv, "bab", "shop", "stable", "v2"); err != nil {
+ t.Fatal(err)
+ }
+ follow("promote")
+ if err := Rollback(ctx, s, priv, "bab", "shop", "stable"); err != nil {
+ t.Fatalf("Rollback right after the promote: %v", err)
+ }
+ follow("rollback")
+ if err := Promote(ctx, s, priv, "bab", "shop", "stable", "v2"); err != nil {
+ t.Fatal(err)
+ }
+ follow("promote after the rollback")
+ for i := 1; i < len(followed); i++ {
+ if !followed[i].PromotedAt.After(followed[i-1].PromotedAt) {
+ t.Fatalf("write %d stamped %s, not after %s", i, followed[i].PromotedAt, followed[i-1].PromotedAt)
+ }
+ }
+ for i, p := range followed[:len(followed)-1] {
+ if err := r.Admit("bab", p); !errors.Is(err, ErrPointerReplayed) {
+ t.Fatalf("write %d (%s promoted %s) put back: %v, want ErrPointerReplayed", i, p.Version, p.PromotedAt, err)
+ }
}
}
@@ -137,8 +192,9 @@ func TestWatermarkThatCannotBeReadRefusesRetryably(t *testing.T) {
// The property the brief insists on: a real rollback still works. Rollback
// re-signs the channel with a fresh promoted_at, so the pointer that puts v1
-// back is newer than the floor v2 raised (or, within the same second, lists
-// v2 as the head it replaced) and the box follows it, while the saved v1
+// back is newer than the floor v2 raised (Rollback waits past it if it must,
+// so this one, run straight after the promote, is the same-second case end to
+// end) and the box follows it, while the saved v1
// pointer a bucket writer puts back is refused. The two look alike to every
// check but this one.
func TestWatermarkLetsARollbackThroughAndRefusesTheReplay(t *testing.T) {