carlos / platform Public

raise-floor: only the running console's release (Astra r1)

Astra r1 NOT READY: P1-1 a moved older tag could name a published release
that lacks the floor commit; P1-2 the binary test didn't compile on
Windows; P2-3 C14's build command didn't stamp a release.

- raise-floor accepts only the running console's own release; its
  stamped commit is the anchor, the checkout's tag must agree, and that
  commit must contain the floor's. Regression: an older tag moved onto
  the floor's commit is refused.
- cmd/console/hostsused_floor_test.go shares servelock_test.go's
  !windows constraint.
- C14 names make build-console SHA=<tag>.
- Luna pass 2 on C14, R3 and the README paragraph, applied verbatim;
  design note section 4 says why and what it costs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev c5a9a576a68f3005bf0e3b913966c1c380e759cf parent eb4abe2
7 files changed, +147 −128
  • README.md +9 −8
  • cmd/console/hostsused_floor_test.go +13 −10
  • docs/superpowers/notes/copy/hosts-floor-names-a-release.md +16 −7
  • docs/superpowers/notes/reviews/ASTRA-FINDINGS-hosts-floor-release-r1.md +20 −0
  • docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md +29 −26
  • internal/console/hostsused_floor.go +24 −34
  • internal/console/hostsused_floor_test.go +36 −43

CI cancelled — superseded by a newer push — run details

diff --git a/README.md b/README.md
index f02a29b69..0c001bb43 100644
--- a/README.md
+++ b/README.md
@@ -398,14 +398,15 @@ the floor, and `carlos accounts migrate` refuses to run below it.
A floor written by a console that wasn't a release names only a commit.
`carlos accounts migrate` can't tell whether a release contains a commit,
-so it refuses every release. Give the floor the oldest release that
-contains the commit. In a platform checkout with its tags fetched,
-`git tag --contains <commit>` lists tags that contain it; choose the oldest
-release by version. Then, with the deployment
-bucket's credentials and a release console at that release or later, run
-`console hosts-used raise-floor -release vX.Y.Z -checkout <checkout>`. It
-checks that the release contains the floor's commit and writes the release
-and its commit as the floor.
+so it refuses every release. Give the floor a release: with the deployment
+bucket's credentials and the vX.Y.Z release console, run `console
+hosts-used raise-floor -release vX.Y.Z -checkout <checkout>` in a platform
+checkout with its tags fetched. It accepts only the running console's
+release. The console's stamped commit identifies its source commit, and
+the checkout's tag must agree; a local tag alone isn't trusted because it
+can be moved. It checks that this commit contains the floor's commit, then
+writes the release and commit as the floor. Builds older than that release
+are refused from then on, so roll it out to every console and box first.
**Restores.** Restoring the console's database alone is safe. A restore of
the control bucket must keep every object under `control/hosts-used/`. If
diff --git a/cmd/console/hostsused_floor_test.go b/cmd/console/hostsused_floor_test.go
index b5edd6d83..e3582039a 100644
--- a/cmd/console/hostsused_floor_test.go
+++ b/cmd/console/hostsused_floor_test.go
@@ -1,3 +1,5 @@
+//go:build !windows
+
package main
import (
@@ -14,8 +16,9 @@ import (
// TestHostsUsedRaiseFloorThroughTheBinary (hosts-floor-names-a-release
// design): a release console, run with a platform checkout, gives a floor
-// that names only a commit the release that contains it, and refuses a
-// release that does not, writing nothing. It needs no console database and
+// that names only a commit its own release when that release contains it,
+// and refuses another release, writing nothing. buildConsole is
+// servelock_test.go's, so this file shares its build constraint. It needs no console database and
// no serve lock: it writes only the floor, conditionally.
func TestHostsUsedRaiseFloorThroughTheBinary(t *testing.T) {
if _, err := exec.LookPath("git"); err != nil {
@@ -42,7 +45,7 @@ func TestHostsUsedRaiseFloorThroughTheBinary(t *testing.T) {
commit("before")
git("tag", "-a", "v9.9.7", "-m", "carlos v9.9.7")
floor := commit("the floor")
- tagged := commit("released")
+ commit("released")
git("tag", "-a", "v9.9.8", "-m", "carlos v9.9.8")
built := commit("this console")
git("tag", "-a", "v9.9.9", "-m", "carlos v9.9.9")
@@ -69,21 +72,21 @@ func TestHostsUsedRaiseFloorThroughTheBinary(t *testing.T) {
return string(out)
}
- out := run("hosts-used", "raise-floor", "-release", "v9.9.7", "-checkout", repo)
- if !strings.Contains(out, "v9.9.7 doesn't contain the floor's commit, "+floor+".") {
- t.Fatalf("raise-floor to a release without the floor printed:\n%s", out)
+ out := run("hosts-used", "raise-floor", "-release", "v9.9.8", "-checkout", repo)
+ if !strings.Contains(out, "This console is v9.9.9, not v9.9.8.") {
+ t.Fatalf("raise-floor to another release printed:\n%s", out)
}
if f, _, err := provision.ReadHostsFloor(context.Background(), store); err != nil || f == nil || *f != bare {
t.Fatalf("floor after the refusal = %+v %v, want %+v", f, err, bare)
}
- out = run("hosts-used", "raise-floor", "-release", "v9.9.8", "-checkout", repo)
- want := "The hostname history's floor is now v9.9.8 (" + tagged + "). It was " + floor[:8] + " (" + floor + ")."
+ out = run("hosts-used", "raise-floor", "-release", "v9.9.9", "-checkout", repo)
+ want := "The hostname history's floor is now v9.9.9 (" + built + "). It was " + floor[:8] + " (" + floor + ")."
if !strings.Contains(out, want) {
t.Fatalf("raise-floor printed:\n%s\nwant %q", out, want)
}
- if f, _, err := provision.ReadHostsFloor(context.Background(), store); err != nil || f == nil || *f != (provision.HostsFloor{Version: "v9.9.8", Commit: tagged}) {
- t.Fatalf("floor = %+v %v, want v9.9.8 at %s", f, err, tagged)
+ if f, _, err := provision.ReadHostsFloor(context.Background(), store); err != nil || f == nil || *f != (provision.HostsFloor{Version: "v9.9.9", Commit: built}) {
+ t.Fatalf("floor = %+v %v, want v9.9.9 at %s", f, err, built)
}
if _, err := os.Stat(db); !os.IsNotExist(err) {
t.Fatalf("raise-floor opened a console database: %v", err)
diff --git a/docs/superpowers/notes/copy/hosts-floor-names-a-release.md b/docs/superpowers/notes/copy/hosts-floor-names-a-release.md
index d8cd9eb12..58c4fe309 100644
--- a/docs/superpowers/notes/copy/hosts-floor-names-a-release.md
+++ b/docs/superpowers/notes/copy/hosts-floor-names-a-release.md
@@ -1,23 +1,22 @@
# The floor names a release: approved copy
-approved by delegated Luna pass on Paul's standing rule, 2026-11-05 (gpt-6-luna, `codex exec -s read-only`): every string approved as drafted except the README's new paragraph, rewritten by Luna and applied verbatim. Placeholders are in angle brackets. Design: docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md.
+approved by delegated Luna pass on Paul's standing rule, 2026-11-05 (gpt-6-luna, `codex exec -s read-only`). Pass 1: every string approved as drafted except the README's new paragraph, rewritten by Luna. Pass 2, after Astra r1 restricted raise-floor to the running console's release: C14 (now names SHA=<tag>, Astra r1 P2-3) approved; R3 and the README paragraph rewritten by Luna. R10 was removed. All applied verbatim. Placeholders are in angle brackets. Design: docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md.
## Strings
C14 (`console hosts-used activate`, a console that isn't a release build, before anything is written):
-This console isn't a release build, so the history's floor can't name a release. Build it from a release tag with make build-console, then run this again.
+This console isn't a release build, so the history's floor can't name a release. Build it from a release tag with make build-console SHA=<tag>, then run this again.
`console hosts-used raise-floor`:
R1 <name> isn't a release tag. Name one like v0.34.4.
R2 This console isn't a release build, so it can't vouch for a release. Run this with a release console.
-R3 This console is <build>, older than <release>. Run this with <release> or later.
+R3 This console is <build>, not <release>. Run this with the <release> console. Its stamped commit identifies the commit for that release.
R4 The hostname history has no floor yet. Completing the history writes one.
R5 The floor already names a release, <version>.
R6 The floor doesn't name a full commit, so the checkout can't show that <release> contains it.
R7 The checkout has no tag <release>. Fetch the platform repo's tags, then run this again.
R8 The checkout doesn't have commit <commit>. Fetch the platform repo, then run this again.
R9 The checkout's tag <release> names <tag commit>, but this console was built from <commit>.
-R10 <release> (<tag commit>) isn't in the history of this console's commit, <commit>.
R11 <release> doesn't contain the floor's commit, <commit>. Name a later release.
R12 The floor changed while this ran. Run this again.
R13 The hostname history's floor is now <release> (<commit>). It was <old version> (<old commit>).
@@ -34,10 +33,12 @@ README, "Releasing the platform" step 2, last sentence:
README, "The history's floor", replacing "Completing refuses a console that doesn't name its commit.":
Completing refuses a console that isn't a release build or doesn't name its commit.
-README, "The history's floor", new paragraph (Luna's rewrite):
-A floor written by a console that wasn't a release names only a commit. `carlos accounts migrate` can't tell whether a release contains a commit, so it refuses every release. Give the floor the oldest release that contains the commit. In a platform checkout with its tags fetched, `git tag --contains <commit>` lists tags that contain it; choose the oldest release by version. Then, with the deployment bucket's credentials and a release console at that release or later, run `console hosts-used raise-floor -release vX.Y.Z -checkout <checkout>`. It checks that the release contains the floor's commit and writes the release and its commit as the floor.
+README, "The history's floor", new paragraph (Luna's pass 2 rewrite):
+A floor written by a console that wasn't a release names only a commit. `carlos accounts migrate` can't tell whether a release contains a commit, so it refuses every release. Give the floor a release: with the deployment bucket's credentials and the vX.Y.Z release console, run `console hosts-used raise-floor -release vX.Y.Z -checkout <checkout>` in a platform checkout with its tags fetched. It accepts only the running console's release. The console's stamped commit identifies its source commit, and the checkout's tag must agree; a local tag alone isn't trusted because it can be moved. It checks that this commit contains the floor's commit, then writes the release and commit as the floor. Builds older than that release are refused from then on, so roll it out to every console and box first.
-## Luna's reply, whole
+## Luna's replies, whole
+
+Pass 1:
```
C14 APPROVE
@@ -60,3 +61,11 @@ README step 2 APPROVE
README floor sentence APPROVE
README new paragraph REWRITE: A floor written by a console that wasn't a release names only a commit. `carlos accounts migrate` can't tell whether a release contains a commit, so it refuses every release. Give the floor the oldest release that contains the commit. In a platform checkout with its tags fetched, `git tag --contains <commit>` lists tags that contain it; choose the oldest release by version. Then, with the deployment bucket's credentials and a release console at that release or later, run `console hosts-used raise-floor -release vX.Y.Z -checkout <checkout>`. It checks that the release contains the floor's commit and writes the release and its commit as the floor.
```
+
+Pass 2:
+
+```
+C14 APPROVE
+R3 REWRITE: This console is <build>, not <release>. Run this with the <release> console. Its stamped commit identifies the commit for that release.
+README REWRITE: A floor written by a console that wasn't a release names only a commit. `carlos accounts migrate` can't tell whether a release contains a commit, so it refuses every release. Give the floor a release: with the deployment bucket's credentials and the vX.Y.Z release console, run `console hosts-used raise-floor -release vX.Y.Z -checkout <checkout>` in a platform checkout with its tags fetched. It accepts only the running console's release. The console's stamped commit identifies its source commit, and the checkout's tag must agree; a local tag alone isn't trusted because it can be moved. It checks that this commit contains the floor's commit, then writes the release and commit as the floor. Builds older than that release are refused from then on, so roll it out to every console and box first.
+```
diff --git a/docs/superpowers/notes/reviews/ASTRA-FINDINGS-hosts-floor-release-r1.md b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-hosts-floor-release-r1.md
new file mode 100644
index 000000000..2bb148b72
--- /dev/null
+++ b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-hosts-floor-release-r1.md
@@ -0,0 +1,20 @@
+1. **P1 — Raise-floor: a moved older tag can lower the effective floor.**
+ [hostsused_floor.go:153](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/internal/console/hostsused_floor.go:153) checks an older tag’s ancestry, but does not establish that it identifies the published release. If local `v0.28.28` is moved to `50c0cb14`, a newer release console passes both ancestry checks and writes that version as the floor. The published `v0.28.28` then passes [accounts_hostsused.go:65](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/accounts_hostsused.go:65), despite lacking the original floor commit. Read-only Git checks verified that published `v0.28.28` lacks `50c0cb14`, while `v0.34.3` contains it.
+ **Fix:** require authenticated release-to-commit evidence for older releases; otherwise restrict raising to the running console’s own release and exact stamped commit. Add a regression covering an older tag moved to a valid ancestor.
+ **Fault family:** release identity—the release comparison must never admit a build lacking the original floor commit.
+
+2. **P1 — Tests: the new binary test does not compile on Windows.**
+ [hostsused_floor_test.go:51](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/cmd/console/hostsused_floor_test.go:51) calls `buildConsole`, whose same-package definition is in [servelock_test.go:46](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/cmd/console/servelock_test.go:46), behind `//go:build !windows`. The new file has no corresponding constraint. `GOOS=windows go list` confirms that it includes the caller and excludes the helper. The similarly named helper in `main_test.go` belongs to the separate `main_test` package. Windows test compilation therefore encounters an undefined identifier.
+ **Fix:** add the matching build constraint, or move the helper into a portable test file and make the test portable.
+ **Fault family:** platform-specific test dependency closure.
+
+3. **P2 — Activation refusal: the suggested build command does not produce a release stamp.**
+ [hostsused_floor.go:28](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/internal/console/hostsused_floor.go:28) instructs operators to build from a release tag with `make build-console`. However, [Makefile:1](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/Makefile:1) sets `SHA` to the short commit even when HEAD is a release tag. Following that instruction produces another build that activation refuses.
+ **Fix:** specify `make build-console SHA=vX.Y.Z` from the corresponding tag, matching the README’s release recipe.
+ **Fault family:** actionable refusal—the prescribed recovery must satisfy the failed check.
+
+Targeted Go tests could not start because the read-only sandbox prevented creation of Go’s temporary work directory. Formatting and diff checks passed. The 31-release ancestry claim was verified.
+
+**Census envelope `.`: APPROVE.** I read [accounts_hostsused.go:33](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/accounts_hostsused.go:33) through line 70 and [hostsused.go:205](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/internal/provision/hostsused.go:205) through line 218. The root-package change preserves the acceptance predicate and existing read; it changes refusal text only. It introduces no new root access or weakened check. Independently recomputing the envelope matched [the proposed fingerprint](/home/paulca/amadan.net/carlos/platform-hosts-floor-release/internal/provision/testdata/plan14-root-reads-hosts-floor-release.tsv:3).
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md b/docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md
index 9225b1d47..0ee4dbb94 100644
--- a/docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md
+++ b/docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md
@@ -47,38 +47,41 @@ flagship's is affected.
build, so a new floor always names a release and its commit. It cannot
recur.
- `console hosts-used raise-floor -release vX.Y.Z -checkout <dir>` gives
- an existing commit floor the release that contains it, on the proof of
- the operator's checkout.
+ an existing commit floor the release of the console running it, when
+ the operator's checkout shows that release contains the commit.
## 4. raise-floor
It accepts only when all hold, and writes nothing otherwise:
-- `-release` is a release tag, and the console running it is a release build
- with a full commit, at that release or later (the build cannot vouch for a
- release above it);
+- `-release` is a release tag, and it is the release of the console running
+ the verb, which is a release build with a full stamped commit;
- the floor exists, names no release, and names a full commit;
-- the checkout's `refs/tags/<release>` names a commit (through an annotated
- tag), and that commit is this console's own when the release is this
- console's, or an ancestor of this console's stamped commit when it is
- older. The tag is the operator's evidence; the binary's stamped commit
- anchors it;
-- the tag's commit contains the floor's commit (`git merge-base
- --is-ancestor`). Commits are full object names, checked with `cat-file -t`
- to be commits, so a ref named like one cannot stand in for it.
-
-It writes `{"version": "<release>", "commit": "<tag's commit>"}` with
-If-Match on the etag it read: a floor changed meanwhile is not overwritten
-(the history's conditional-update discipline). It takes no serve lock and no
-console database: only `activate` (under the lock) writes the floor besides
-it. So it runs where the checkout is, with the deployment bucket's
-credentials.
-
-The oldest release that contains the floor commit (`git tag --contains`)
-keeps the floor exactly where it was. Flagship's goes to v0.28.29: all 31
-releases from v0.28.29 on contain 50c0cb14 and none before it does, so the
-release comparison accepts exactly the releases the commit check would. A
-build genuinely older than the floor is still refused by every check.
+- the checkout's `refs/tags/<release>` names (through an annotated tag)
+ exactly this console's stamped commit;
+- this console's commit contains the floor's commit (`git merge-base
+ --is-ancestor`). Commits are full object names, checked with `cat-file
+ -t` to be commits, so a ref named like one cannot stand in for it.
+
+It writes `{"version": "<release>", "commit": "<this console's commit>"}`
+with If-Match on the etag it read: a floor changed meanwhile is not
+overwritten (the history's conditional-update discipline). It takes no serve
+lock and no console database: only `activate` (under the lock) writes the
+floor besides it. So it runs where the checkout is, with the deployment
+bucket's credentials.
+
+**Only this console's release.** Round 1 allowed an older release named by
+the checkout's tag, which would keep the floor exactly where it was (for
+flagship, v0.28.29, the oldest of the 31 releases that contain 50c0cb14).
+Astra r1 P1-1: a local tag can be moved. With v0.28.28 moved onto 50c0cb14,
+both ancestry checks pass and the floor names v0.28.28, which the published
+v0.28.28 (without 50c0cb14) then meets. Only the binary's stamped commit
+vouches for which commit its own release is, so the verb names that release
+and no other. The cost: the floor rises to the release that runs it, and
+builds between the commit and that release are refused from then on. Roll
+the release everywhere first. Flagship's floor goes to the release carrying
+this change, which every flagship box and console runs before it is raised.
+A build genuinely older than the floor is still refused by every check.
## 5. The CLI's message
diff --git a/internal/console/hostsused_floor.go b/internal/console/hostsused_floor.go
index b9e05098d..cc48920ce 100644
--- a/internal/console/hostsused_floor.go
+++ b/internal/console/hostsused_floor.go
@@ -20,23 +20,23 @@ import (
// commit. A floor that names only a commit (flagship's, written by a console
// rolled from a checkout) therefore refused every release. Activation now
// writes a release floor only, and `console hosts-used raise-floor` gives an
-// existing commit floor the release that contains it, on the proof of an
-// operator's platform checkout.
+// existing commit floor the release of the console running it, when an
+// operator's platform checkout shows that release contains the commit.
// The approved strings (docs/superpowers/notes/copy/hosts-floor-names-a-release.md).
const (
- msgHostsFloorNotARelease = "This console isn't a release build, so the history's floor can't name a release. Build it from a release tag with make build-console, then run this again." // C14
- msgFloorBuildNotARelease = "This console isn't a release build, so it can't vouch for a release. Run this with a release console." // R2
- msgFloorNone = "The hostname history has no floor yet. Completing the history writes one." // R4
- msgFloorChanged = "The floor changed while this ran. Run this again." // R12
+ msgHostsFloorNotARelease = "This console isn't a release build, so the history's floor can't name a release. Build it from a release tag with make build-console SHA=<tag>, then run this again." // C14
+ msgFloorBuildNotARelease = "This console isn't a release build, so it can't vouch for a release. Run this with a release console." // R2
+ msgFloorNone = "The hostname history has no floor yet. Completing the history writes one." // R4
+ msgFloorChanged = "The floor changed while this ran. Run this again." // R12
)
func msgFloorNotARelease(name string) string { // R1
return name + " isn't a release tag. Name one like v0.34.4."
}
-func msgFloorBuildOlder(build, rel string) string { // R3
- return "This console is " + build + ", older than " + rel + ". Run this with " + rel + " or later."
+func msgFloorNotThisRelease(build, rel string) string { // R3
+ return "This console is " + build + ", not " + rel + ". Run this with the " + rel + " console. Its stamped commit identifies the commit for that release."
}
func msgFloorAlreadyARelease(v string) string { // R5
@@ -59,10 +59,6 @@ func msgFloorTagNotThisBuild(rel, tagged, built string) string { // R9
return "The checkout's tag " + rel + " names " + tagged + ", but this console was built from " + built + "."
}
-func msgFloorTagNotInBuild(rel, tagged, built string) string { // R10
- return rel + " (" + tagged + ") isn't in the history of this console's commit, " + built + "."
-}
-
func msgFloorNotContained(rel, floor string) string { // R11
return rel + " doesn't contain the floor's commit, " + floor + ". Name a later release."
}
@@ -110,24 +106,24 @@ func (e CheckoutMissingError) Error() string {
return "console: the checkout has no commit " + e.Commit
}
-// RaiseHostsFloor gives a floor that names only a commit the release rel,
-// and the commit rel's tag names, when the checkout shows that commit
-// contains the floor's and build (this console) is rel or later: rel's own
-// commit when it is rel, or a descendant of it. The checkout's tag is the
-// operator's evidence; the build's stamped commit anchors it. The write is
-// conditional on the floor read, so a floor changed meanwhile is not
+// RaiseHostsFloor gives a floor that names only a commit the release rel
+// and its commit, when build (this console) is rel and the checkout shows
+// that build's stamped commit contains the floor's. rel must be this
+// console's own release: its stamped commit is the only evidence of which
+// commit a release is, since a local tag can be moved (Astra r1 P1-1: an
+// older tag moved onto the floor's commit would name a published release
+// that lacks it). The checkout's tag must agree with the stamp. The write
+// is conditional on the floor read, so a floor changed meanwhile is not
// overwritten. Every refusal writes nothing.
func RaiseHostsFloor(ctx context.Context, store release.Store, build provision.HostsFloor, rel string, co FloorCheckout) (from, to provision.HostsFloor, err error) {
- want, ok := releaseTag(rel)
- if !ok {
+ if !IsReleaseTag(rel) {
return from, to, errors.New(msgFloorNotARelease(rel))
}
- have, ok := releaseTag(build.Version)
- if !ok || !fullCommit.MatchString(build.Commit) {
+ if !IsReleaseTag(build.Version) || !fullCommit.MatchString(build.Commit) {
return from, to, errors.New(msgFloorBuildNotARelease)
}
- if have.Compare(want) < 0 {
- return from, to, errors.New(msgFloorBuildOlder(build.Version, rel))
+ if build.Version != rel {
+ return from, to, errors.New(msgFloorNotThisRelease(build.Version, rel))
}
floor, etag, err := provision.ReadHostsFloor(ctx, store)
if err != nil {
@@ -150,21 +146,15 @@ func RaiseHostsFloor(ctx context.Context, store release.Store, build provision.H
if err != nil {
return from, to, err
}
- if have.Compare(want) == 0 {
- if tagged != build.Commit {
- return from, to, errors.New(msgFloorTagNotThisBuild(rel, tagged, build.Commit))
- }
- } else if ok, err := co.Contains(ctx, build.Commit, tagged); err != nil {
- return from, to, checkoutRefusal(err)
- } else if !ok {
- return from, to, errors.New(msgFloorTagNotInBuild(rel, tagged, build.Commit))
+ if tagged != build.Commit {
+ return from, to, errors.New(msgFloorTagNotThisBuild(rel, tagged, build.Commit))
}
- if ok, err := co.Contains(ctx, tagged, floor.Commit); err != nil {
+ if ok, err := co.Contains(ctx, build.Commit, floor.Commit); err != nil {
return from, to, checkoutRefusal(err)
} else if !ok {
return from, to, errors.New(msgFloorNotContained(rel, floor.Commit))
}
- to = provision.HostsFloor{Version: rel, Commit: tagged}
+ to = provision.HostsFloor{Version: rel, Commit: build.Commit}
if _, err := provision.WriteHostsFloor(ctx, store, to, etag); errors.Is(err, release.ErrCASConflict) {
return from, provision.HostsFloor{}, errors.New(msgFloorChanged)
} else if err != nil {
diff --git a/internal/console/hostsused_floor_test.go b/internal/console/hostsused_floor_test.go
index 627ad8de9..bbaf7d74a 100644
--- a/internal/console/hostsused_floor_test.go
+++ b/internal/console/hostsused_floor_test.go
@@ -2,8 +2,8 @@ package console
// The floor names a release (docs/superpowers/specs/2026-11-05-hosts-floor-names-a-release-design.md):
// RaiseHostsFloor turns a floor that names only a commit into one that names
-// a release containing it, on an operator checkout's proof, and Activate
-// writes a release floor only.
+// this console's release, when an operator checkout shows the release
+// contains it, and Activate writes a release floor only.
import (
"context"
@@ -92,37 +92,29 @@ func readFloor(t *testing.T, st release.Store) *provision.HostsFloor {
return f
}
-// TestRaiseFloorNamesAReleaseThatContainsIt: a floor naming only a commit
-// becomes the named release and the commit its tag names, when that
-// release contains the floor's commit and this console is that release or
-// later.
-func TestRaiseFloorNamesAReleaseThatContainsIt(t *testing.T) {
- for _, c := range []struct {
- name string
- build provision.HostsFloor
- rel string
- want provision.HostsFloor
- }{
- {"an older release than this console", provision.HostsFloor{Version: "v0.34.4", Commit: c4}, "v0.28.29", provision.HostsFloor{Version: "v0.28.29", Commit: c2}},
- {"this console's own release", provision.HostsFloor{Version: "v0.34.4", Commit: c4}, "v0.34.4", provision.HostsFloor{Version: "v0.34.4", Commit: c4}},
- } {
- t.Run(c.name, func(t *testing.T) {
- st := floorStore(t, &bareFloor)
- from, to, err := RaiseHostsFloor(context.Background(), st, c.build, c.rel, newFakeCheckout())
- if err != nil {
- t.Fatal(err)
- }
- if from != bareFloor || to != c.want {
- t.Fatalf("raised %+v to %+v, want %+v to %+v", from, to, bareFloor, c.want)
- }
- if got := readFloor(t, st); got == nil || *got != c.want {
- t.Fatalf("floor = %+v, want %+v", got, c.want)
- }
- })
+// TestRaiseFloorNamesThisConsolesRelease: a floor naming only a commit
+// becomes this console's release and its stamped commit, when the
+// checkout's tag for that release is that commit and it contains the
+// floor's commit.
+func TestRaiseFloorNamesThisConsolesRelease(t *testing.T) {
+ build := provision.HostsFloor{Version: "v0.34.4", Commit: c4}
+ st := floorStore(t, &bareFloor)
+ from, to, err := RaiseHostsFloor(context.Background(), st, build, "v0.34.4", newFakeCheckout())
+ if err != nil {
+ t.Fatal(err)
+ }
+ if from != bareFloor || to != build {
+ t.Fatalf("raised %+v to %+v, want %+v to %+v", from, to, bareFloor, build)
+ }
+ if got := readFloor(t, st); got == nil || *got != build {
+ t.Fatalf("floor = %+v, want %+v", got, build)
}
}
-// TestRaiseFloorRefuses: every refusal writes nothing, and says why.
+// TestRaiseFloorRefuses: every refusal writes nothing, and says why. A
+// release other than this console's is refused whatever the checkout's
+// tags say: a local tag can be moved, and only this console's stamped
+// commit vouches for which commit its release is (Astra r1 P1-1).
func TestRaiseFloorRefuses(t *testing.T) {
release4 := provision.HostsFloor{Version: "v0.34.4", Commit: c4}
releaseFloor := provision.HostsFloor{Version: "v0.33.0", Commit: c0}
@@ -136,19 +128,20 @@ func TestRaiseFloorRefuses(t *testing.T) {
}{
{"a name that is not a release", &bareFloor, release4, "v0.34", nil, msgFloorNotARelease("v0.34")},
{"a branch name", &bareFloor, release4, "main", nil, msgFloorNotARelease("main")},
- {"a dev console", &bareFloor, provision.HostsFloor{Version: "dev", Commit: c4}, "v0.28.29", nil, msgFloorBuildNotARelease},
- {"a console stamped with a commit", &bareFloor, provision.HostsFloor{Version: c4[:8], Commit: c4}, "v0.28.29", nil, msgFloorBuildNotARelease},
- {"a console with no full commit", &bareFloor, provision.HostsFloor{Version: "v0.34.4", Commit: c4[:12]}, "v0.28.29", nil, msgFloorBuildNotARelease},
- {"a console older than the release", &bareFloor, provision.HostsFloor{Version: "v0.34.3", Commit: c3}, "v0.34.4", nil, msgFloorBuildOlder("v0.34.3", "v0.34.4")},
- {"no floor", nil, release4, "v0.28.29", nil, msgFloorNone},
- {"a floor that names a release", &releaseFloor, release4, "v0.28.29", nil, msgFloorAlreadyARelease("v0.33.0")},
- {"a floor with no full commit", &provision.HostsFloor{Version: "50c0cb14", Commit: "50c0cb14"}, release4, "v0.28.29", nil, msgFloorNoFullCommit("v0.28.29")},
- {"no such tag", &bareFloor, release4, "v0.29.0", nil, msgFloorNoTag("v0.29.0")},
- {"a release without the floor's commit", &bareFloor, release4, "v0.28.28", nil, msgFloorNotContained("v0.28.28", floorC)},
+ {"a dev console", &bareFloor, provision.HostsFloor{Version: "dev", Commit: c4}, "v0.34.4", nil, msgFloorBuildNotARelease},
+ {"a console stamped with a commit", &bareFloor, provision.HostsFloor{Version: c4[:8], Commit: c4}, "v0.34.4", nil, msgFloorBuildNotARelease},
+ {"a console with no full commit", &bareFloor, provision.HostsFloor{Version: "v0.34.4", Commit: c4[:12]}, "v0.34.4", nil, msgFloorBuildNotARelease},
+ {"a release newer than this console", &bareFloor, provision.HostsFloor{Version: "v0.34.3", Commit: c3}, "v0.34.4", nil, msgFloorNotThisRelease("v0.34.3", "v0.34.4")},
+ {"a release older than this console", &bareFloor, release4, "v0.28.29", nil, msgFloorNotThisRelease("v0.34.4", "v0.28.29")},
+ {"an older tag moved onto the floor", &bareFloor, release4, "v0.28.28", func(f *fakeCheckout) { f.tags["v0.28.28"] = floorC }, msgFloorNotThisRelease("v0.34.4", "v0.28.28")},
+ {"no floor", nil, release4, "v0.34.4", nil, msgFloorNone},
+ {"a floor that names a release", &releaseFloor, release4, "v0.34.4", nil, msgFloorAlreadyARelease("v0.33.0")},
+ {"a floor with no full commit", &provision.HostsFloor{Version: "50c0cb14", Commit: "50c0cb14"}, release4, "v0.34.4", nil, msgFloorNoFullCommit("v0.34.4")},
+ {"no such tag", &bareFloor, release4, "v0.34.4", func(f *fakeCheckout) { delete(f.tags, "v0.34.4") }, msgFloorNoTag("v0.34.4")},
{"the tag is not this console's commit", &bareFloor, release4, "v0.34.4", func(f *fakeCheckout) { f.tags["v0.34.4"] = c3 }, msgFloorTagNotThisBuild("v0.34.4", c3, c4)},
- {"the tag is after this console's commit", &bareFloor, release4, "v0.28.29", func(f *fakeCheckout) { f.order = []string{c0, floorC, c4, c2} }, msgFloorTagNotInBuild("v0.28.29", c2, c4)},
- {"this console's commit is not in the checkout", &bareFloor, provision.HostsFloor{Version: "v0.34.4", Commit: stray}, "v0.28.29", nil, msgFloorCheckoutMissing(stray)},
- {"the floor's commit is not in the checkout", &provision.HostsFloor{Version: stray[:8], Commit: stray}, release4, "v0.28.29", nil, msgFloorCheckoutMissing(stray)},
+ {"this console does not contain the floor", &bareFloor, release4, "v0.34.4", func(f *fakeCheckout) { f.order = []string{c0, c2, c3, c4, floorC} }, msgFloorNotContained("v0.34.4", floorC)},
+ {"this console's commit is not in the checkout", &bareFloor, provision.HostsFloor{Version: "v0.34.4", Commit: stray}, "v0.34.4", func(f *fakeCheckout) { f.tags["v0.34.4"] = stray }, msgFloorCheckoutMissing(stray)},
+ {"the floor's commit is not in the checkout", &provision.HostsFloor{Version: stray[:8], Commit: stray}, release4, "v0.34.4", nil, msgFloorCheckoutMissing(stray)},
} {
t.Run(c.name, func(t *testing.T) {
st := floorStore(t, c.floor)
@@ -183,7 +176,7 @@ func TestRaiseFloorLosesARace(t *testing.T) {
t.Fatal(err)
}
}
- _, _, err := RaiseHostsFloor(context.Background(), st, provision.HostsFloor{Version: "v0.34.4", Commit: c4}, "v0.28.29", co)
+ _, _, err := RaiseHostsFloor(context.Background(), st, provision.HostsFloor{Version: "v0.34.4", Commit: c4}, "v0.34.4", co)
if err == nil || err.Error() != msgFloorChanged {
t.Fatalf("err = %v, want %q", err, msgFloorChanged)
}