carlos / platform Public

host: the commit's park scopes through Plan 5 Task 2's helpers (Plan 3 Task 7, H7)

commitScopes now calls moves.SourceLocationScope (the source's location
from the flip) and moves.StagingScope (the staging lane to the seal's
bound) from main, replacing the interim construction; the scopes are
unchanged. A test pins the commit's parks to the helpers' values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 55892ff0365770e08e1c47580a4a040dcc337538 parent bfa0327
2 files changed, +39 −7
  • internal/host/movesland_commit_test.go +31 −0
  • internal/host/moveslandcommit.go +8 −7
diff --git a/internal/host/movesland_commit_test.go b/internal/host/movesland_commit_test.go
index 74446c39a..c9f3d74f5 100644
--- a/internal/host/movesland_commit_test.go
+++ b/internal/host/movesland_commit_test.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/carlosframework/platform/internal/hostclaim"
+ "github.com/carlosframework/platform/internal/moves"
"github.com/carlosframework/platform/internal/provision"
)
@@ -150,3 +151,33 @@ func TestCommittedOpenWaitsUnarmed(t *testing.T) {
}
_ = context.Background
}
+
+// The commit's scopes are Plan 5 Task 2's helpers' (H7): the source's
+// location from the flip, the staging lane to the seal's bound.
+func TestCommitScopesAreThePlan5Helpers(t *testing.T) {
+ h, _ := probedLanding(t)
+ h.land(t)
+ rec := h.read(t, p1Host)
+ c := h.claim(t)
+ seal, err := journalledSeal(c)
+ if err != nil {
+ t.Fatal(err)
+ }
+ wantSource := moves.SourceLocationScope(*c.Holder, *rec.Move.FlippedAt)
+ wantStaging := moves.StagingScope(p1Host, p1ID, c.Holder.Incarnation, seal.Bound())
+ var source, staging bool
+ for _, o := range c.Obligations {
+ if o.Kind != "park-replica" || o.Park == nil {
+ continue
+ }
+ switch *o.Park {
+ case wantSource:
+ source = true
+ case wantStaging:
+ staging = true
+ }
+ }
+ if !source || !staging {
+ t.Fatalf("the commit's parks are not the helpers' %+v and %+v: %+v", wantSource, wantStaging, c.Obligations)
+ }
+}
diff --git a/internal/host/moveslandcommit.go b/internal/host/moveslandcommit.go
index 9ee12ca27..5c995d670 100644
--- a/internal/host/moveslandcommit.go
+++ b/internal/host/moveslandcommit.go
@@ -147,19 +147,20 @@ func (l *landingRun) commitClaim(ctx context.Context) error {
return nil
}
-// commitScopes are the parks the commit queues: the source region's location
-// scoped from the flip (H7), and the staging lane scoped to the seal's
-// bound.
+// commitScopes are the parks the commit queues, through Plan 5 Task 2's
+// scope helpers: the source region's location scoped from the flip (H7,
+// moves.SourceLocationScope), and the staging lane scoped to the seal's
+// bound (moves.StagingScope).
func (l *landingRun) commitScopes(c *hostclaim.Claim) (source, staging hostclaim.ParkScope, err error) {
- if source, err = sourceLocationParkScope(l.rec, *c.Holder); err != nil {
- return source, staging, err
+ m := l.rec.Move
+ if m == nil || m.FlippedAt == nil {
+ return source, staging, errors.New("the source's location park needs the flip's time")
}
seal, err := journalledSeal(c)
if err != nil {
return source, staging, err
}
- staging = hostclaim.ParkScope{Location: moves.ScopeLocation(l.rec.Host, l.g.ID), Incarnation: c.Holder.Incarnation, EvidenceAt: seal.Bound().UTC(), RequestLimit: cutRequestLimit}
- return source, staging, nil
+ return moves.SourceLocationScope(*c.Holder, *m.FlippedAt), moves.StagingScope(l.rec.Host, l.g.ID, c.Holder.Incarnation, seal.Bound()), nil
}
// open is the conditional open: under the host's hold lock, with the record