carlos / platform Public

hostbox, genselect: name moves.ReplicaSource as a twin of the generation prefix rule (F28(d))

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 214539f46258795129c55dafa6c9b76f51d81625 parent 05fdae5
2 files changed, +6 −0
  • internal/genselect/select.go +3 −0
  • internal/hostbox/writer.go +3 −0
diff --git a/internal/genselect/select.go b/internal/genselect/select.go
index 70e6ad3c8..2dc4acad0 100644
--- a/internal/genselect/select.go
+++ b/internal/genselect/select.go
@@ -114,6 +114,9 @@ func generation(s string) bool { return component(s) && s != hostclaim.RootGener
func versionID(s string) bool { return strings.TrimSpace(s) != "" && s != "null" }
+// prefix is a generation's prefix under location. Twins of the rule:
+// hostbox.GenerationPrefix and moves.ReplicaSource (whose keep is
+// coordinates' level-file test); the three change together.
func prefix(location, gen string) string {
if gen == hostclaim.RootGeneration {
return location
diff --git a/internal/hostbox/writer.go b/internal/hostbox/writer.go
index db938995a..1a388184a 100644
--- a/internal/hostbox/writer.go
+++ b/internal/hostbox/writer.go
@@ -55,6 +55,9 @@ func (w Writer) Published(ctx context.Context, observed hostclaim.Observed) (hos
return hostclaim.Update(ctx, w.Claims, observed, hostclaim.PublishGeneration(c.Op.ID, c.Op.Phase, c.Holder.Session, c.Holder.Generation, w.Region, w.NewID))
}
+// GenerationPrefix is a holder's generation prefix. Twins of its rule:
+// genselect's prefix and coordinates, and moves.ReplicaSource (which also
+// covers the root generation); the three change together.
func GenerationPrefix(holder hostclaim.Holder) (string, error) {
generation := holder.Generation
if holder.Session == 0 || generation == "" || generation == hostclaim.RootGeneration || generation == "." || generation == ".." || strings.ContainsAny(generation, "/\\\x00") || holder.Location == "" {