system: the rootfs floor moves to the console, before any activation reservation
Task 15 round 4, Paul's final ruling after Astra round 3 (the box refusal did not fit the activation reservation protocol): - carlos system update and rollback refuse to move a channel whose current pointer is at v0.29.0 or later to a release below it, or one whose version does not parse, before any reservation is made, unless --allow-below-rootfs-floor is passed (logged). promoteHostUpdate and rollbackHostUpdate, the only promotion paths, both ask rootfsFloorGate. - The override is part of the reservation's request digest, and a pending rollback's signed pointer carries it, so a retry with another override is refused, never handed the held pointer. - The agent's path never refuses a published pointer for the floor. Only an apply run by hand (no INVOCATION_ID: systemApplyHandRun, the one split) judges the box's installed version, returns the operator an error and records no result. The automatic rollback and --recover are untouched. - RFS-3-C30 and C31 are now the console's, C32's help covers three commands, C33 and C34 are the hand-run apply's; all pending the copy pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 files changed,
+567
−221
approved_rootfs_copy_test.go+1 −0docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md+8 −6internal/console/apisystemupdate.go+18 −3internal/console/apisystemupdate_test.go+63 −20internal/console/hostactivation.go+27 −8internal/console/hostactivation_test.go+14 −6internal/console/plan9_b_test.go+2 −2internal/console/rootfsfloor.go+60 −0internal/console/rootfsfloor_test.go+128 −0internal/host/systemapply.go+37 −26internal/host/systemapply_rootfs_test.go+171 −126internal/release/layoutintent.go+15 −12internal/release/systempointer.go+15 −9plan3_groups_test.go+2 −2system.go+6 −1
diff --git a/approved_rootfs_copy_test.go b/approved_rootfs_copy_test.go| index 96c1b7dea..a2474c7eb 100644 |
| --- a/approved_rootfs_copy_test.go |
| +++ b/approved_rootfs_copy_test.go |
| @@ -67,6 +67,7 @@ var rootfsCopyIDs = []string{ |
| "RFS-3-C21", "RFS-3-C22", "RFS-3-C23", "RFS-3-C24", |
| "RFS-3-C25", "RFS-3-C26", "RFS-3-C27", "RFS-3-C28", |
| "RFS-3-C29", "RFS-3-C30", "RFS-3-C31", "RFS-3-C32", |
| + "RFS-3-C33", "RFS-3-C34", |
| // Plan 4 |
| "RFS-4-C01", "RFS-4-C02", "RFS-4-C03", "RFS-4-C04", |
| "RFS-4-C05", "RFS-4-C06", "RFS-4-C07", "RFS-4-C08", |
diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md| index b48627bdb..9f7914ffd 100644 |
| --- a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md |
| +++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md |
| @@ -197,11 +197,13 @@ From the plan: Every row goes to the deck in Task 1 and reaches code only once a |
| | RFS-3-C27 | docs/site/cli.md (carlos run, a paragraph) | For a rootfs app the command after -- runs inside the instance's image and is found on the image's PATH. | approved | |
| | RFS-3-C28 | docs/site/cli.md (carlos run, the same paragraph) (live until Plan 6 Task 16 strikes it, replaced by RFS-6-C62) | carlos run does not reach instances on a customer fleet yet. | approved | |
| | RFS-3-C29 | internal/rolloutwords/words.go (EventReleaseLeaseLost) | the release command of build %s was stopped because this box no longer holds the instance. it runs again on the next attempt | approved | |
| -| RFS-3-C30 | internal/host/systemapply.go (systemApplyRootfsFloorRefusal, a refused update's reason: the installed release, the floor, the candidate) | this box runs %s, so it installs only %s or later, the releases that run rootfs instances. %s is not one. to install it anyway, promote it with --allow-below-rootfs-floor | pending | |
| -| RFS-3-C31 | internal/host/systemapply.go (systemApplyRootfsFloorOverride, the log warning when the override lets a release below the floor through: the candidate, the floor, the candidate) | installing %s below %s with --allow-below-rootfs-floor: this box may have rootfs instances that %s cannot run | pending | |
| -| RFS-3-C32 | internal/release/layoutintent.go (RootfsFloorOverrideUsage, the --allow-below-rootfs-floor help on carlos system update and carlos system apply) | install a release below v0.29.0 on boxes running v0.29.0 or later, which may have rootfs instances that release cannot run | pending | |
| +| RFS-3-C30 | internal/console/rootfsfloor.go (consoleRootfsFloorRefusal, carlos system update and rollback refused at a channel on the rootfs floor: the channel, its release, the floor, the target) | %s runs %s, so it takes only %s or later, the releases that run rootfs instances. %s is not one. to move it there anyway, pass --allow-below-rootfs-floor | pending | |
| +| RFS-3-C31 | internal/console/rootfsfloor.go (consoleRootfsFloorOverride, the console log warning when the override moves a channel below the floor: the target, the floor, the channel, the target) | moving to %s below %s on %s with --allow-below-rootfs-floor: boxes on it may have rootfs instances that %s cannot run | pending | |
| +| RFS-3-C32 | internal/release/layoutintent.go (RootfsFloorOverrideUsage, the --allow-below-rootfs-floor help on carlos system update, rollback and apply) | allow a release below v0.29.0 where v0.29.0 or later runs now. boxes may have rootfs instances that release cannot run | pending | |
| +| RFS-3-C33 | internal/host/systemapply.go (systemApplyRootfsFloorRefusal, a hand-run carlos system apply refused on a box on the rootfs floor: the installed release, the floor, the candidate) | this box runs %s, so carlos system apply installs only %s or later here, the releases that run rootfs instances. %s is not one. to install it anyway, pass --allow-below-rootfs-floor | pending | |
| +| RFS-3-C34 | internal/host/systemapply.go (systemApplyRootfsFloorOverride, the hand-run apply's log warning when the override lets a release below the floor through: the candidate, the floor, the candidate) | installing %s below %s with --allow-below-rootfs-floor: this box may have rootfs instances that %s cannot run | pending | |
| -From the plan: Count: 29 rows, 28 live, 1 struck (RFS-3-C13). Since then (Task 15 round 3, 2026-10-26): 32 rows, 30 live, 2 struck (RFS-3-C13, RFS-3-C25); RFS-3-C30 to C32 are pending the copy pass. (RFS-3-C28 is live until Plan 6 Task 16 marks it struck when runs reach fleet boxes, R7.) |
| +From the plan: Count: 29 rows, 28 live, 1 struck (RFS-3-C13). Since then (Task 15 rounds 3 and 4, 2026-10-26/27): 34 rows, 32 live, 2 struck (RFS-3-C13, RFS-3-C25); RFS-3-C30 to C34 are pending the copy pass. The floor moved to the console in round 4, so C30 and C31 are the console's and C33 and C34 the hand-run apply's. (RFS-3-C28 is live until Plan 6 Task 16 marks it struck when runs reach fleet boxes, R7.) |
| Plan 3's file cells were set on 2026-10-26 (Plan 3 pre-flight, row 8.3) to the one file that holds each literal, with the old where-it-appears text kept as the note, so the gate's applied-text check can read them. C05 to C07 also format through `ReleaseError.Error`, named in the note. RFS-3-C13 was struck the same day (pre-flight row 3.1): host lifecycle claims are shelved, and Plan 3 adds no reader of the claim switch. The texts are unchanged. |
| @@ -541,8 +543,8 @@ strike them (Astra R2 finding 5). |
| - Plan 1: 85 live, 0 struck, 85 rows |
| - Plan 2: 12 live, 0 struck, 12 rows |
| -- Plan 3: 30 live, 2 struck, 32 rows |
| +- Plan 3: 32 live, 2 struck, 34 rows |
| - Plan 4: 138 live, 0 struck, 138 rows |
| - Plan 5: 44 live, 0 struck, 44 rows |
| - Plan 6: 64 live, 0 struck, 64 rows |
| -- Total: 373 live, 2 struck, 375 rows |
| +- Total: 375 live, 2 struck, 377 rows |
diff --git a/internal/console/apisystemupdate.go b/internal/console/apisystemupdate.go| index f5470d82f..9941ebe2f 100644 |
| --- a/internal/console/apisystemupdate.go |
| +++ b/internal/console/apisystemupdate.go |
| @@ -336,8 +336,8 @@ type systemUpdateRequest struct { |
| Upload string `json:"upload"` |
| Spread string `json:"spread"` |
| // AllowBelowRootfsFloor is `carlos system update |
| - // --allow-below-rootfs-floor`, carried onto the pointer |
| - // (release.SystemPointer.AllowBelowRootfsFloor). |
| + // --allow-below-rootfs-floor`: the rootfs floor's override |
| + // (rootfsfloor.go), part of the activation request's identity. |
| AllowBelowRootfsFloor bool `json:"allow_below_rootfs_floor"` |
| } |
| @@ -399,6 +399,15 @@ func (s *Server) handleAPISystemUpdate(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| } |
| + // The rootfs floor, the same way, for a named release: the job asks |
| + // again before it reserves or writes (promoteHostUpdate), which also |
| + // covers the latest release and an upload. |
| + if in.Version != "" { |
| + if err := s.rootfsFloorGate(r.Context(), in.Component, in.Channel, in.Version, in.AllowBelowRootfsFloor); errors.Is(err, errRootfsFloorPromotion) { |
| + jsonError(w, http.StatusConflict, err.Error()) |
| + return |
| + } |
| + } |
| id, job, busy := s.startSystemJob(in.Component, in.Channel) |
| if busy != "" { |
| writeJSON(w, http.StatusConflict, map[string]string{ |
| @@ -814,6 +823,9 @@ func (s *Server) handleAPISystemRollback(w http.ResponseWriter, r *http.Request) |
| var in struct { |
| Component string `json:"component"` |
| Channel string `json:"channel"` |
| + // AllowBelowRootfsFloor is `carlos system rollback |
| + // --allow-below-rootfs-floor` (rootfsfloor.go). |
| + AllowBelowRootfsFloor bool `json:"allow_below_rootfs_floor"` |
| } |
| if !readJSONStrictLimit(w, r, &in, 1<<10) { |
| return |
| @@ -843,9 +855,12 @@ func (s *Server) handleAPISystemRollback(w http.ResponseWriter, r *http.Request) |
| return |
| } |
| } |
| - p, err := s.rollbackHostUpdate(r.Context(), in.Component, in.Channel, addr) |
| + p, err := s.rollbackHostUpdate(r.Context(), in.Component, in.Channel, addr, in.AllowBelowRootfsFloor) |
| var held activationHeldError |
| switch { |
| + case errors.Is(err, errRootfsFloorPromotion): |
| + jsonError(w, http.StatusConflict, err.Error()) |
| + return |
| case errors.Is(err, release.ErrCASConflict): |
| // M-6: the pointer moved between the read and the conditional |
| // write. No retry: a rollback pops history, so repeating it against |
diff --git a/internal/console/apisystemupdate_test.go b/internal/console/apisystemupdate_test.go| index d8ca0b578..2592334e8 100644 |
| --- a/internal/console/apisystemupdate_test.go |
| +++ b/internal/console/apisystemupdate_test.go |
| @@ -541,33 +541,76 @@ func mustGetObject(t *testing.T, fx *consoleFixture, key string) []byte { |
| return raw |
| } |
| -// `carlos system update --allow-below-rootfs-floor` reaches the pointer |
| -// the boxes read (rootfs apps Plan 3, Task 15 round 3), and only for that |
| -// promote. |
| -func TestSystemUpdateCarriesTheRootfsFloorOverride(t *testing.T) { |
| +// `carlos system update` and `carlos system rollback` refuse to move a |
| +// channel at the rootfs floor below it without --allow-below-rootfs-floor |
| +// (rootfs apps Plan 3, Task 15 round 4): a named version at the door, the |
| +// latest release inside the job, both before anything is reserved or |
| +// written; the override goes through and is signed onto that pointer only. |
| +func TestSystemDoorsRefuseBelowTheRootfsFloor(t *testing.T) { |
| fx := newConsoleFixture(t) |
| systemFeed(t, fx, map[string][]byte{"carlos-linux-arm64": []byte("ELF arm64")}) |
| seedBox(t, fx, "ie", "linux-arm64", "canary", "v0.17.0") |
| owner := cliToken(t, fx, "paul@keymail.dev", "code-sys-floor") |
| - for _, allow := range []bool{true, false} { |
| - in := map[string]any{"channel": "canary", "spread": "0s"} |
| - if allow { |
| - in["allow_below_rootfs_floor"] = true |
| - } |
| - st, out := postJSON(t, fx.ts.URL+"/api/cli/system/update", in, owner) |
| - if st != http.StatusOK { |
| - t.Fatalf("update = %d %v", st, out) |
| - } |
| - if job := waitJob(t, fx, owner, str(t, out, "job")); job["error"] != "" { |
| - t.Fatalf("job failed: %v", job) |
| + ctx := context.Background() |
| + sg := release.RootSigner(fx.priv) |
| + rel := func(v string) release.SystemRelease { |
| + return release.SystemRelease{Version: v, Artifacts: map[string]release.SystemArtifact{"linux-arm64": {Key: release.SystemArtifactKey(v, "linux-arm64"), SHA256: strings.Repeat("a", 64)}}} |
| + } |
| + for _, v := range []string{"v0.17.0", "v0.29.0"} { |
| + if _, err := release.PromoteSystem(ctx, fx.rel, sg, "router", "canary", rel(v), release.SystemPromoteOptions{}); err != nil { |
| + t.Fatal(err) |
| } |
| - p, _, err := release.GetSystemPointer(context.Background(), fx.rel, fx.pub, "router", "canary") |
| + time.Sleep(1100 * time.Millisecond) |
| + } |
| + want := "canary runs v0.29.0, so it takes only v0.29.0 or later, the releases that run rootfs instances. %s is not one. to move it there anyway, pass --allow-below-rootfs-floor" |
| + pointer := func() *release.SystemPointer { |
| + p, _, err := release.GetSystemPointer(ctx, fx.rel, fx.pub, "router", "canary") |
| if err != nil { |
| t.Fatal(err) |
| } |
| - if p.AllowBelowRootfsFloor != allow { |
| - t.Fatalf("allow=%v: the pointer's override is %v", allow, p.AllowBelowRootfsFloor) |
| - } |
| - time.Sleep(1100 * time.Millisecond) |
| + return p |
| + } |
| + |
| + st, out := postJSON(t, fx.ts.URL+"/api/cli/system/update", map[string]any{"channel": "canary", "version": "v0.18.0"}, owner) |
| + if st != http.StatusConflict || str(t, out, "error") != fmt.Sprintf(want, "v0.18.0") { |
| + t.Fatalf("update to a named v0.18.0 = %d %v", st, out) |
| + } |
| + st, out = postJSON(t, fx.ts.URL+"/api/cli/system/rollback", map[string]any{"channel": "canary"}, owner) |
| + if st != http.StatusConflict || str(t, out, "error") != fmt.Sprintf(want, "v0.17.0") { |
| + t.Fatalf("rollback to v0.17.0 = %d %v", st, out) |
| + } |
| + st, out = postJSON(t, fx.ts.URL+"/api/cli/system/update", map[string]any{"channel": "canary", "spread": "0s"}, owner) |
| + if st != http.StatusOK { |
| + t.Fatalf("update to the latest = %d %v", st, out) |
| + } |
| + if job := waitJob(t, fx, owner, str(t, out, "job")); job["error"] != fmt.Sprintf(want, "v0.18.0") { |
| + t.Fatalf("the latest (v0.18.0) job = %v", job) |
| + } |
| + if p := pointer(); p.Current.Version != "v0.29.0" { |
| + t.Fatalf("a refused promotion moved the pointer to %s", p.Current.Version) |
| + } |
| + |
| + st, out = postJSON(t, fx.ts.URL+"/api/cli/system/update", map[string]any{"channel": "canary", "spread": "0s", "allow_below_rootfs_floor": true}, owner) |
| + if st != http.StatusOK { |
| + t.Fatalf("update with the override = %d %v", st, out) |
| + } |
| + if job := waitJob(t, fx, owner, str(t, out, "job")); job["error"] != "" { |
| + t.Fatalf("the override's job failed: %v", job) |
| + } |
| + if p := pointer(); p.Current.Version != "v0.18.0" || !p.AllowBelowRootfsFloor { |
| + t.Fatalf("the override's pointer = %+v", p) |
| + } |
| + time.Sleep(1100 * time.Millisecond) |
| + // Below the floor now: a rollback to v0.29.0 needs no override, and the |
| + // pointer it writes carries none. |
| + if st, out := postJSON(t, fx.ts.URL+"/api/cli/system/rollback", map[string]any{"channel": "canary"}, owner); st != http.StatusOK { |
| + t.Fatalf("rollback to v0.29.0 = %d %v", st, out) |
| + } |
| + if p := pointer(); p.Current.Version != "v0.29.0" || p.AllowBelowRootfsFloor { |
| + t.Fatalf("the rollback's pointer = %+v", p) |
| + } |
| + time.Sleep(1100 * time.Millisecond) |
| + if st, out := postJSON(t, fx.ts.URL+"/api/cli/system/rollback", map[string]any{"channel": "canary", "allow_below_rootfs_floor": true}, owner); st != http.StatusOK || str(t, out, "version") != "v0.17.0" { |
| + t.Fatalf("rollback below the floor with the override = %d %v", st, out) |
| } |
| } |
diff --git a/internal/console/hostactivation.go b/internal/console/hostactivation.go| index e16af9dba..98587ddc3 100644 |
| --- a/internal/console/hostactivation.go |
| +++ b/internal/console/hostactivation.go |
| @@ -109,12 +109,16 @@ func (s *Server) reserveHostUpdate(ctx context.Context, rel *release.SystemRelea |
| } |
| requestRelease := *rel |
| requestRelease.ReleasedAt = time.Time{} |
| + // The rootfs floor override is part of the request (Task 15 round 4): a |
| + // retry that asks with a different override is another request, so it |
| + // meets the held reservation and is refused, never handed its pointer. |
| request, err := json.Marshal(struct { |
| - Channel string |
| - Mode string |
| - Release release.SystemRelease |
| - Spread time.Duration |
| - }{channel, mode, requestRelease, options.Spread}) |
| + Channel string |
| + Mode string |
| + Release release.SystemRelease |
| + Spread time.Duration |
| + AllowBelowRootfsFloor bool |
| + }{channel, mode, requestRelease, options.Spread, options.AllowBelowRootfsFloor}) |
| if err != nil { |
| return "", err |
| } |
| @@ -139,7 +143,7 @@ func (s *Server) reserveHostUpdate(ctx context.Context, rel *release.SystemRelea |
| id := hex.EncodeToString(nonce[:]) |
| var publication release.SystemPublication |
| if mode == "rollback" { |
| - publication, err = release.PrepareSystemRollback(ctx, s.cfg.Releases, release.RootSigner(s.cfg.Key), "router", channel, options.Actor, id, expectedETag...) |
| + publication, err = release.PrepareSystemRollback(ctx, s.cfg.Releases, release.RootSigner(s.cfg.Key), "router", channel, options, id, expectedETag...) |
| } else { |
| publication, err = release.PrepareSystemPromotion(ctx, s.cfg.Releases, release.RootSigner(s.cfg.Key), "router", channel, *rel, options, id) |
| } |
| @@ -195,6 +199,9 @@ func (s *Server) reserveHostUpdate(ctx context.Context, rel *release.SystemRelea |
| } |
| func (s *Server) promoteHostUpdate(ctx context.Context, rel release.SystemRelease, component, channel string, options release.SystemPromoteOptions) (*release.SystemPointer, error) { |
| + if err := s.rootfsFloorGate(ctx, component, channel, rel.Version, options.AllowBelowRootfsFloor); err != nil { |
| + return nil, err |
| + } |
| id, err := s.reserveHostUpdate(ctx, &rel, channel, "promote", options) |
| if err != nil { |
| return nil, err |
| @@ -206,7 +213,7 @@ func (s *Server) promoteHostUpdate(ctx context.Context, rel release.SystemReleas |
| return d.PublishActivation(ctx, id) |
| } |
| -func (s *Server) rollbackHostUpdate(ctx context.Context, component, channel, actor string) (*release.SystemPointer, error) { |
| +func (s *Server) rollbackHostUpdate(ctx context.Context, component, channel, actor string, allowBelowRootfsFloor bool) (*release.SystemPointer, error) { |
| d := hostactors.Directory{Store: s.cfg.Releases, PublicKey: release.RootSigner(s.cfg.Key).RootPublicKey(), Bucket: s.cfg.Bucket} |
| floor, err := hostfloor.Read(ctx, s.cfg.Releases, d.PublicKey, s.cfg.Bucket) |
| if err == nil { |
| @@ -222,6 +229,15 @@ func (s *Server) rollbackHostUpdate(ctx context.Context, component, channel, act |
| if h.UpdateMode != "rollback" || h.FloorSHA256 != floor.Digest { |
| return nil, activationHeldError{id: id, component: component, channel: channel} |
| } |
| + // A retry with another rootfs floor override is another |
| + // request: refused, never handed the held pointer. |
| + held, err := h.Publication.Verify(d.PublicKey) |
| + if err != nil { |
| + return nil, err |
| + } |
| + if held.AllowBelowRootfsFloor != allowBelowRootfsFloor { |
| + return nil, activationHeldError{id: id, component: component, channel: channel} |
| + } |
| return d.PublishActivation(ctx, id) |
| } |
| } else if !errors.Is(err, os.ErrNotExist) { |
| @@ -235,7 +251,10 @@ func (s *Server) rollbackHostUpdate(ctx context.Context, component, channel, act |
| return nil, release.ErrNoSystemHistory |
| } |
| target := current.History[0] |
| - id, err := s.reserveHostUpdate(ctx, &target, channel, "rollback", release.SystemPromoteOptions{Actor: actor}, etag) |
| + if err := s.rootfsFloorGate(ctx, component, channel, target.Version, allowBelowRootfsFloor); err != nil { |
| + return nil, err |
| + } |
| + id, err := s.reserveHostUpdate(ctx, &target, channel, "rollback", release.SystemPromoteOptions{Actor: actor, AllowBelowRootfsFloor: allowBelowRootfsFloor}, etag) |
| if err != nil { |
| return nil, err |
| } |
diff --git a/internal/console/hostactivation_test.go b/internal/console/hostactivation_test.go| index c25e54aa7..ceab5c7a5 100644 |
| --- a/internal/console/hostactivation_test.go |
| +++ b/internal/console/hostactivation_test.go |
| @@ -44,6 +44,14 @@ func (s *activationFaultStore) Get(ctx context.Context, key string) ([]byte, str |
| } |
| func activationFixture(t *testing.T) (*Server, hostactors.Directory, release.SystemRelease) { |
| + t.Helper() |
| + return activationFixtureAt(t, "v1.0.0", "v1.1.0", "v1.0.0") |
| +} |
| + |
| +// activationFixtureAt is activationFixture with the box's release (the |
| +// channel's current pointer), the target (its History[0]) and the host |
| +// floor's minimum release named. |
| +func activationFixtureAt(t *testing.T, oldVersion, nextVersion, floorMin string) (*Server, hostactors.Directory, release.SystemRelease) { |
| t.Helper() |
| ctx := t.Context() |
| pub, key, err := ed25519.GenerateKey(nil) |
| @@ -53,8 +61,8 @@ func activationFixture(t *testing.T) (*Server, hostactors.Directory, release.Sys |
| store := release.NewDirStore(t.TempDir()) |
| s := &Server{cfg: Config{Releases: store, Key: key, Bucket: "bucket"}} |
| sg := release.RootSigner(key) |
| - old := release.SystemRelease{Version: "v1.0.0", Source: "release:v1.0.0", ReleaseTag: "v1.0.0", MovesProtocol: 1, Artifacts: map[string]release.SystemArtifact{"linux-amd64": {Key: release.SystemArtifactKey("v1.0.0", "linux-amd64"), SHA256: strings.Repeat("a", 64)}}} |
| - next := release.SystemRelease{Version: "v1.1.0", Source: "release:v1.1.0", ReleaseTag: "v1.1.0", MovesProtocol: 1, Artifacts: map[string]release.SystemArtifact{"linux-amd64": {Key: release.SystemArtifactKey("v1.1.0", "linux-amd64"), SHA256: strings.Repeat("b", 64)}}} |
| + old := release.SystemRelease{Version: oldVersion, Source: "release:" + oldVersion, ReleaseTag: oldVersion, MovesProtocol: 1, Artifacts: map[string]release.SystemArtifact{"linux-amd64": {Key: release.SystemArtifactKey(oldVersion, "linux-amd64"), SHA256: strings.Repeat("a", 64)}}} |
| + next := release.SystemRelease{Version: nextVersion, Source: "release:" + nextVersion, ReleaseTag: nextVersion, MovesProtocol: 1, Artifacts: map[string]release.SystemArtifact{"linux-amd64": {Key: release.SystemArtifactKey(nextVersion, "linux-amd64"), SHA256: strings.Repeat("b", 64)}}} |
| for _, rel := range []release.SystemRelease{next, old} { |
| if _, err := release.PromoteSystem(ctx, store, sg, "router", "stable", rel, release.SystemPromoteOptions{}); err != nil { |
| t.Fatal(err) |
| @@ -67,7 +75,7 @@ func activationFixture(t *testing.T) (*Server, hostactors.Directory, release.Sys |
| t.Fatal(err) |
| } |
| } |
| - if err := hostfloor.Publish(ctx, store, sg, "bucket", hostfloor.Floor{Min: 1, MinRelease: "v1.0.0"}); err != nil { |
| + if err := hostfloor.Publish(ctx, store, sg, "bucket", hostfloor.Floor{Min: 1, MinRelease: floorMin}); err != nil { |
| t.Fatal(err) |
| } |
| floor, err := hostfloor.Read(ctx, store, pub, "bucket") |
| @@ -151,7 +159,7 @@ func TestHostRollbackResumesWithoutPoppingAgain(t *testing.T) { |
| s, d, _ := activationFixture(t) |
| broken := &activationFaultStore{Store: d.Store, fail: true} |
| s.cfg.Releases = broken |
| - if _, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator"); err == nil { |
| + if _, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator", false); err == nil { |
| t.Fatal("missing injected failure") |
| } |
| before, err := d.Read(t.Context()) |
| @@ -162,11 +170,11 @@ func TestHostRollbackResumesWithoutPoppingAgain(t *testing.T) { |
| for id = range before.Roster.Activations { |
| } |
| s.cfg.Releases = d.Store |
| - first, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator") |
| + first, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator", false) |
| if err != nil || first.ActivationID != id || first.Current.Version != "v1.1.0" { |
| t.Fatal(first, err) |
| } |
| - second, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator") |
| + second, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator", false) |
| if err != nil || second.ActivationID != id || len(second.History) != len(first.History) { |
| t.Fatal(second, err) |
| } |
diff --git a/internal/console/plan9_b_test.go b/internal/console/plan9_b_test.go| index 45de111bd..1a7286983 100644 |
| --- a/internal/console/plan9_b_test.go |
| +++ b/internal/console/plan9_b_test.go |
| @@ -197,7 +197,7 @@ func TestPlan9OperatorCancelsAnUnpublishedActivation(t *testing.T) { |
| held := plan9Roster(t, fx.srv) |
| stale := *held.Roster.Activations[id].Publication |
| // The wedge: a different request for the channel is refused while held. |
| - if _, err := fx.srv.rollbackHostUpdate(ctx, "router", "stable", "paul@keymail.dev"); err == nil { |
| + if _, err := fx.srv.rollbackHostUpdate(ctx, "router", "stable", "paul@keymail.dev", false); err == nil { |
| t.Fatal("rollback succeeded through a held activation") |
| } |
| if fx.srv.cfg.Releases == nil { |
| @@ -235,7 +235,7 @@ func TestPlan9OperatorCancelsAnUnpublishedActivation(t *testing.T) { |
| if st, out := postJSON(t, fx.ts.URL+"/api/cli/system/activation/cancel", map[string]string{"channel": "stable"}, owner); st != http.StatusNotFound { |
| t.Fatalf("cancel with nothing held = %d %v, want 404", st, out) |
| } |
| - p, err := fx.srv.rollbackHostUpdate(ctx, "router", "stable", "paul@keymail.dev") |
| + p, err := fx.srv.rollbackHostUpdate(ctx, "router", "stable", "paul@keymail.dev", false) |
| if err != nil || p.Current.Version != "v1.1.0" { |
| t.Fatalf("rollback after cancel = %v, %v", p, err) |
| } |
diff --git a/internal/console/rootfsfloor.go b/internal/console/rootfsfloor.go| new file mode 100644 |
| index 000000000..f91191d21 |
| --- /dev/null |
| +++ b/internal/console/rootfsfloor.go |
| @@ -0,0 +1,60 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "fmt" |
| + "log" |
| + "os" |
| + |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// The rootfs floor at the console (rootfs apps spec §5.6; Paul's ruling, |
| +// Task 15 round 4): a channel whose current pointer names |
| +// release.RootfsLifecycleFloor or later is never moved to a release below |
| +// it, or to one whose version does not parse, unless the operator passes |
| +// --allow-below-rootfs-floor. Every promotion that publishes a pointer |
| +// (promoteHostUpdate, rollbackHostUpdate) asks rootfsFloorGate first, |
| +// before any activation reservation exists, so no box is ever handed a |
| +// pointer it would refuse and no reservation waits on one. |
| + |
| +// consoleRootfsFloorRefusal (RFS-3-C30) takes the channel, its current |
| +// release, the floor and the target. |
| +const consoleRootfsFloorRefusal = "%s runs %s, so it takes only %s or later, the releases that run rootfs instances. %s is not one. to move it there anyway, pass --allow-below-rootfs-floor" |
| + |
| +// consoleRootfsFloorOverride (RFS-3-C31) takes the target, the floor, the |
| +// channel and the target again. |
| +const consoleRootfsFloorOverride = "moving to %s below %s on %s with --allow-below-rootfs-floor: boxes on it may have rootfs instances that %s cannot run" |
| + |
| +// errRootfsFloorPromotion is a promotion the rootfs floor refused. |
| +var errRootfsFloorPromotion = errors.New("rootfs floor") |
| + |
| +type rootfsFloorError struct{ msg string } |
| + |
| +func (e rootfsFloorError) Error() string { return e.msg } |
| +func (e rootfsFloorError) Unwrap() error { return errRootfsFloorPromotion } |
| + |
| +// rootfsFloorGate refuses moving component/channel to target while the |
| +// channel's current pointer is at or above the floor and target is below |
| +// it or does not parse; allow is the operator's override, which is logged. |
| +// A channel with no pointer yet has nothing to protect. A pointer that |
| +// cannot be read refuses: the promotion cannot tell what it would replace. |
| +func (s *Server) rootfsFloorGate(ctx context.Context, component, channel, target string, allow bool) error { |
| + cur, _, err := release.GetSystemPointer(ctx, s.cfg.Releases, release.RootSigner(s.cfg.Key).RootPublicKey(), component, channel) |
| + if errors.Is(err, os.ErrNotExist) { |
| + return nil |
| + } |
| + if err != nil { |
| + return err |
| + } |
| + if release.RootfsFloorAllows(cur.Current.Version, target) { |
| + return nil |
| + } |
| + floor := "v" + release.RootfsLifecycleFloor.String() |
| + if allow { |
| + log.Printf("console: system: "+consoleRootfsFloorOverride, target, floor, channel, target) |
| + return nil |
| + } |
| + return rootfsFloorError{msg: fmt.Sprintf(consoleRootfsFloorRefusal, channel, cur.Current.Version, floor, target)} |
| +} |
diff --git a/internal/console/rootfsfloor_test.go b/internal/console/rootfsfloor_test.go| new file mode 100644 |
| index 000000000..9b749d140 |
| --- /dev/null |
| +++ b/internal/console/rootfsfloor_test.go |
| @@ -0,0 +1,128 @@ |
| +package console |
| + |
| +import ( |
| + "errors" |
| + "testing" |
| + |
| + "github.com/carlosframework/platform/internal/hostactors" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// noActivations fails the test if the roster holds any reservation. |
| +func noActivations(t *testing.T, d hostactors.Directory) { |
| + t.Helper() |
| + o, err := d.Read(t.Context()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(o.Roster.Activations) != 0 { |
| + t.Fatalf("a reservation was made: %v", o.Roster.Activations) |
| + } |
| +} |
| + |
| +func currentVersion(t *testing.T, s *Server, d hostactors.Directory) string { |
| + t.Helper() |
| + p, _, err := release.GetSystemPointer(t.Context(), d.Store, d.PublicKey, "router", "stable") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return p.Current.Version |
| +} |
| + |
| +// [Task 15 round 4] A channel at the rootfs floor is never promoted or |
| +// rolled back below it, or to a release whose version does not parse, |
| +// without the override, and the refusal comes before any activation |
| +// reservation exists, so no box is handed a pointer and nothing is left |
| +// to settle. |
| +func TestRootfsFloorRefusesBeforeReservation(t *testing.T) { |
| + s, d, target := activationFixtureAt(t, "v0.29.0", "v0.28.25", "v0.28.0") |
| + want := "stable runs v0.29.0, so it takes only v0.29.0 or later, the releases that run rootfs instances. v0.28.25 is not one. to move it there anyway, pass --allow-below-rootfs-floor" |
| + if _, err := s.promoteHostUpdate(t.Context(), target, "router", "stable", release.SystemPromoteOptions{}); !errors.Is(err, errRootfsFloorPromotion) || err.Error() != want { |
| + t.Fatalf("promote below the floor = %v\nwant %q", err, want) |
| + } |
| + noActivations(t, d) |
| + if _, err := s.rollbackHostUpdate(t.Context(), "router", "stable", "operator", false); !errors.Is(err, errRootfsFloorPromotion) || err.Error() != want { |
| + t.Fatalf("rollback below the floor = %v\nwant %q", err, want) |
| + } |
| + noActivations(t, d) |
| + if v := currentVersion(t, s, d); v != "v0.29.0" { |
| + t.Fatalf("the pointer moved to %s", v) |
| + } |
| + for target, refused := range map[string]bool{"4f3c2a1": true, "": true, "v0.28.99": true, "v0.29.0": false, "v0.30.1": false} { |
| + err := s.rootfsFloorGate(t.Context(), "router", "stable", target, false) |
| + if errors.Is(err, errRootfsFloorPromotion) != refused { |
| + t.Errorf("rootfsFloorGate(%q) = %v, refused want %v", target, err, refused) |
| + } |
| + } |
| + // A channel with no pointer yet has nothing to protect. |
| + if err := s.rootfsFloorGate(t.Context(), "router", "canary", "v0.28.25", false); err != nil { |
| + t.Errorf("a channel with no pointer = %v", err) |
| + } |
| + |
| + // With the override the promotion reserves and publishes, and the |
| + // pointer records it. |
| + p, err := s.promoteHostUpdate(t.Context(), target, "router", "stable", release.SystemPromoteOptions{AllowBelowRootfsFloor: true}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if p.Current.Version != "v0.28.25" || !p.AllowBelowRootfsFloor { |
| + t.Fatalf("the override's promotion = %+v", p) |
| + } |
| +} |
| + |
| +// A channel below the floor moves as before, with or without the override. |
| +func TestRootfsFloorLeavesAChannelBelowItAlone(t *testing.T) { |
| + s, _, target := activationFixtureAt(t, "v0.28.20", "v0.28.25", "v0.28.0") |
| + if p, err := s.promoteHostUpdate(t.Context(), target, "router", "stable", release.SystemPromoteOptions{}); err != nil || p.Current.Version != "v0.28.25" { |
| + t.Fatalf("promote below the floor from below it = %+v, %v", p, err) |
| + } |
| +} |
| + |
| +// [Task 15 round 4] The override is part of the reservation's request: |
| +// a retry whose override differs from a pending reservation is refused, |
| +// never handed its signed pointer. Both transitions, for a promote and a |
| +// rollback, each after a failed publication and a console restart. The |
| +// channel is below the floor, so only the request identity tells the two |
| +// requests apart. |
| +func TestRootfsFloorOverrideIsPartOfTheRequest(t *testing.T) { |
| + for _, first := range []bool{true, false} { |
| + for _, mode := range []string{"promote", "rollback"} { |
| + t.Run(mode, func(t *testing.T) { |
| + s, d, target := activationFixtureAt(t, "v0.28.20", "v0.28.25", "v0.28.0") |
| + move := func(s *Server, allow bool) (*release.SystemPointer, error) { |
| + if mode == "rollback" { |
| + return s.rollbackHostUpdate(t.Context(), "router", "stable", "operator", allow) |
| + } |
| + return s.promoteHostUpdate(t.Context(), target, "router", "stable", release.SystemPromoteOptions{AllowBelowRootfsFloor: allow}) |
| + } |
| + // The first request reserves, and its publication fails. |
| + s.cfg.Releases = &activationFaultStore{Store: d.Store, fail: true} |
| + if _, err := move(s, first); err == nil { |
| + t.Fatal("the failed publication succeeded") |
| + } |
| + o, err := d.Read(t.Context()) |
| + if err != nil || len(o.Roster.Activations) != 1 { |
| + t.Fatalf("after the failed publication: %v, %v", o.Roster.Activations, err) |
| + } |
| + // A restarted console, the other override: refused. |
| + restarted := &Server{cfg: s.cfg} |
| + restarted.cfg.Releases = d.Store |
| + var held activationHeldError |
| + if _, err := move(restarted, !first); !errors.As(err, &held) { |
| + t.Fatalf("allow %v after a held allow %v = %v, want the held reservation's refusal", !first, first, err) |
| + } |
| + if v := currentVersion(t, restarted, d); v != "v0.28.20" { |
| + t.Fatalf("the refused retry published: the pointer is at %s", v) |
| + } |
| + // The same override publishes the held reservation, as signed. |
| + p, err := move(restarted, first) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if p.Current.Version != "v0.28.25" || p.AllowBelowRootfsFloor != first { |
| + t.Fatalf("the held reservation published %+v, want v0.28.25 with override %v", p, first) |
| + } |
| + }) |
| + } |
| + } |
| +} |
diff --git a/internal/host/systemapply.go b/internal/host/systemapply.go| index 7757bef7c..a3a209695 100644 |
| --- a/internal/host/systemapply.go |
| +++ b/internal/host/systemapply.go |
| @@ -131,7 +131,7 @@ func RunSystemApply(args []string) { |
| rootMoves: rootMovesFloorIdentity, ops: productionSysOps(), openStore: openSystemStore, channel: channel, |
| optDir: release.OptDir(), dataDir: dataDir(), etcDir: "/etc", build: version.Build, |
| platform: runtime.GOOS + "-" + runtime.GOARCH, soak: systemGateSoak, |
| - allowBelowRootfsFloor: *allowBelowRootfsFloor, |
| + handRun: systemApplyHandRun(os.Getenv), allowBelowRootfsFloor: *allowBelowRootfsFloor, |
| } |
| a.readEnvironment(os.Getenv) |
| a.floorHook = installFloorHook // decided under the apply lock, in Run |
| @@ -250,9 +250,11 @@ type systemApplier struct { |
| // layout, to see whether anything on the box is still nested. Nil means |
| // openSystemRegistry over dataDir. |
| openRegistry func() (*registry.Registry, error) |
| - // allowBelowRootfsFloor is `carlos system apply |
| - // --allow-below-rootfs-floor`: the operator's override of the rootfs |
| - // floor (rootfsFloorRefusal), as the pointer's own flag is. |
| + // handRun is systemApplyHandRun's answer: an operator ran this apply by |
| + // hand, outside the system units. Only then does the box judge the |
| + // rootfs floor itself (handRunRootfsFloor). allowBelowRootfsFloor is |
| + // that run's `--allow-below-rootfs-floor`. |
| + handRun bool |
| allowBelowRootfsFloor bool |
| channel string |
| optDir string |
| @@ -440,10 +442,14 @@ func (a *systemApplier) Run(ctx context.Context, recover bool) (retErr error) { |
| if p.Current.Version == installed { |
| return a.writeResult(req, systemOutcomeNoted, "") |
| } |
| - // The rootfs floor, before anything is begun, staged or run: a box on a |
| - // release that runs rootfs instances never installs one that cannot. |
| - if err := a.rootfsFloorRefusal(installed, p); err != nil { |
| - return a.record(req, err) |
| + // The rootfs floor is the console's (console/rootfsfloor.go): it judges |
| + // every promotion before it reserves or publishes, so the agent's path |
| + // never refuses a published pointer for it. Only an apply an operator |
| + // runs by hand judges it here, and leaves the request as it found it. |
| + if a.handRun { |
| + if err := a.handRunRootfsFloor(installed, p.Current.Version); err != nil { |
| + return err |
| + } |
| } |
| // The claim release floor's transaction (Plan 8) first, as on main; |
| // then the moves activation check. Either one refusing refuses; a |
| @@ -466,41 +472,46 @@ func (a *systemApplier) Run(ctx context.Context, recover bool) (retErr error) { |
| return a.install(ctx, req, p, staged) |
| } |
| -// systemApplyRootfsFloorRefusal (RFS-3-C30) takes the installed release, |
| +// systemApplyHandRun reports whether this apply was run by hand: systemd |
| +// sets INVOCATION_ID for every unit it runs, carlos-system-update.service |
| +// (the agent's path) and carlos-system-recover.service included, and an |
| +// operator's shell does not. It is the one place the two paths split. |
| +func systemApplyHandRun(getenv func(string) string) bool { |
| + return getenv("INVOCATION_ID") == "" |
| +} |
| + |
| +// systemApplyRootfsFloorRefusal (RFS-3-C33) takes the installed release, |
| // the floor and the candidate. |
| -const systemApplyRootfsFloorRefusal = "this box runs %s, so it installs only %s or later, the releases that run rootfs instances. %s is not one. to install it anyway, promote it with --allow-below-rootfs-floor" |
| +const systemApplyRootfsFloorRefusal = "this box runs %s, so carlos system apply installs only %s or later here, the releases that run rootfs instances. %s is not one. to install it anyway, pass --allow-below-rootfs-floor" |
| -// systemApplyRootfsFloorOverride (RFS-3-C31) takes the candidate, the floor |
| +// systemApplyRootfsFloorOverride (RFS-3-C34) takes the candidate, the floor |
| // and the candidate again. |
| const systemApplyRootfsFloorOverride = "installing %s below %s with --allow-below-rootfs-floor: this box may have rootfs instances that %s cannot run" |
| -// rootfsFloorRefusal is the rootfs floor (rootfs apps spec §5.6; Paul's |
| -// ruling, Task 15 round 3). A box whose installed release is at or above |
| +// handRunRootfsFloor is the rootfs floor of an apply run by hand (Paul's |
| +// ruling, Task 15 round 4). A box whose installed release is at or above |
| // release.RootfsLifecycleFloor refuses a candidate below it, or one whose |
| -// version does not parse, whatever rows it has: by the box's version |
| -// alone, so no registry read, fence or race stands between the check and |
| -// the handover. The refusal is terminal for that promote. A box below the |
| -// floor installs as on main. installed is onDiskBuild's answer, the source |
| +// version does not parse, whatever rows it has, unless the operator passed |
| +// --allow-below-rootfs-floor (logged). The refusal is an error for the |
| +// operator's shell and records no result: the request stays for the |
| +// agent's path, which the console has already judged, so no activation is |
| +// ever left unsettled by it. installed is onDiskBuild's answer, the source |
| // the update gate reads; when it cannot be read, this process's own build |
| -// (the installed binary is what runs this apply) stands in. The operator's |
| -// override (the pointer's AllowBelowRootfsFloor, or this command's flag) |
| -// lets a deliberate downgrade through with a warning. The gate's automatic |
| -// rollback restores .prev through rollback and restoreFiles, which never |
| -// come here. |
| -func (a *systemApplier) rootfsFloorRefusal(installed string, p *release.SystemPointer) error { |
| +// stands in. The gate's automatic rollback and --recover restore .prev |
| +// through rollback and restoreFiles, which never come here. |
| +func (a *systemApplier) handRunRootfsFloor(installed, target string) error { |
| if installed == "" { |
| installed = a.build |
| } |
| - target := p.Current.Version |
| if release.RootfsFloorAllows(installed, target) { |
| return nil |
| } |
| floor := "v" + release.RootfsLifecycleFloor.String() |
| - if a.allowBelowRootfsFloor || p.AllowBelowRootfsFloor { |
| + if a.allowBelowRootfsFloor { |
| a.ops.logf("system apply: "+systemApplyRootfsFloorOverride, target, floor, target) |
| return nil |
| } |
| - return fmt.Errorf("%w: "+systemApplyRootfsFloorRefusal, errSystemRefused, installed, floor, target) |
| + return fmt.Errorf(systemApplyRootfsFloorRefusal, installed, floor, target) |
| } |
| // waitForLock is --recover's bounded wait for the apply lock: poll |
diff --git a/internal/host/systemapply_rootfs_test.go b/internal/host/systemapply_rootfs_test.go| index a18f44589..f4ab83413 100644 |
| --- a/internal/host/systemapply_rootfs_test.go |
| +++ b/internal/host/systemapply_rootfs_test.go |
| @@ -9,8 +9,6 @@ package host |
| import ( |
| "context" |
| - "crypto/sha256" |
| - "encoding/hex" |
| "fmt" |
| "go/ast" |
| "go/parser" |
| @@ -21,8 +19,6 @@ import ( |
| "strings" |
| "testing" |
| "time" |
| - |
| - "github.com/carlosframework/platform/internal/release" |
| ) |
| // captureLogs collects the applier's log lines. |
| @@ -49,61 +45,68 @@ func (f *applyFixture) stagedNeverRan() { |
| } |
| } |
| -// promoteAllowing re-promotes version with the operator's override on the |
| -// pointer, as `carlos system update --allow-below-rootfs-floor` does, and |
| -// writes the agent's request for it. |
| -func (f *applyFixture) promoteAllowing(version string) systemRequest { |
| - f.t.Helper() |
| - body := []byte("#!/bin/sh\necho carlos " + version + "\n") |
| - sum := sha256.Sum256(body) |
| - rel := release.SystemRelease{Version: version, Artifacts: map[string]release.SystemArtifact{ |
| - "linux-arm64": {Key: release.SystemArtifactKey(version, "linux-arm64"), SHA256: hex.EncodeToString(sum[:])}}} |
| - f.store.Put(context.Background(), rel.Artifacts["linux-arm64"].Key, body, "") |
| - p, err := release.PromoteSystem(context.Background(), f.store, release.RootSigner(f.priv), "router", f.a.channel, rel, |
| - release.SystemPromoteOptions{AllowBelowRootfsFloor: true}) |
| - if err != nil { |
| - f.t.Fatal(err) |
| - } |
| - if !p.AllowBelowRootfsFloor { |
| - f.t.Fatal("the promote did not carry the override") |
| - } |
| - req := systemRequest{Version: version, PromotedAt: p.PromotedAt, SeenAt: f.now} |
| - writeJSONDurable(systemRequestPath(f.a.dataDir), req, 0o644) |
| - return req |
| +func handRunRefusalFor(installed, candidate string) string { |
| + return "this box runs " + installed + ", so carlos system apply installs only v0.29.0 or later here, the releases that run rootfs instances. " + |
| + candidate + " is not one. to install it anyway, pass --allow-below-rootfs-floor" |
| } |
| -func rootfsFloorRefusalFor(installed, candidate string) string { |
| - return "refused: this box runs " + installed + ", so it installs only v0.29.0 or later, the releases that run rootfs instances. " + |
| - candidate + " is not one. to install it anyway, promote it with --allow-below-rootfs-floor" |
| +// The one place the two paths split: systemd sets INVOCATION_ID for every |
| +// unit, so the agent's update unit and the recover unit are never a hand run. |
| +func TestSystemApplyHandRunIsOutsideSystemd(t *testing.T) { |
| + if systemApplyHandRun(func(string) string { return "" }) != true { |
| + t.Error("a shell without INVOCATION_ID is not a hand run") |
| + } |
| + if systemApplyHandRun(func(k string) string { |
| + if k == "INVOCATION_ID" { |
| + return "0123abcd" |
| + } |
| + return "" |
| + }) { |
| + t.Error("a systemd unit is a hand run") |
| + } |
| } |
| -// A box on the floor refuses a candidate below it and one whose version |
| -// does not parse, before anything is begun or staged, by version alone: |
| -// the box has no rootfs row at all. The refusal is terminal for that |
| -// promote, and its reason is the log line. |
| -func TestApplyRefusesBelowTheRootfsFloorOnAFloorBox(t *testing.T) { |
| - for _, candidate := range []string{"v0.28.25", "v0.28.99", "4f3c2a1"} { |
| +// [Task 15 round 4] The agent's path never refuses a published pointer for |
| +// the rootfs floor: the console judged the promotion before it reserved or |
| +// published it. A floor box installs what it was handed, below the floor |
| +// or unparseable alike, so no activation is left unsettled by the floor. |
| +func TestAgentPathNeverRefusesForTheRootfsFloor(t *testing.T) { |
| + for _, candidate := range []string{"v0.28.25", "4f3c2a1"} { |
| t.Run(candidate, func(t *testing.T) { |
| f, req := floorFixture(t, "v0.29.0", candidate) |
| - f.seedRoutes(flatRow(f.a.dataDir, "flat.example.com")) |
| - f.stagedNeverRan() |
| - logs := f.captureLogs() |
| + if f.a.handRun { |
| + t.Fatal("the fixture's applier is a hand run") |
| + } |
| if err := f.a.Run(context.Background(), false); err != nil { |
| t.Fatal(err) |
| } |
| - r := f.result() |
| - if r == nil || r.Outcome != systemOutcomeRefused || !r.matches("stable", candidate, req.PromotedAt) { |
| - t.Fatalf("result = %+v", r) |
| + if r := f.result(); r == nil || r.Outcome != systemOutcomeApplied || !r.matches("stable", candidate, req.PromotedAt) { |
| + t.Fatalf("result = %+v, want applied", r) |
| } |
| - want := rootfsFloorRefusalFor("v0.29.0", candidate) |
| - if r.Reason != want { |
| - t.Fatalf("reason = %q\nwant %q", r.Reason, want) |
| + }) |
| + } |
| +} |
| + |
| +// An apply run by hand on a floor box refuses a candidate below the floor |
| +// and one whose version does not parse, before anything is begun or |
| +// staged, by version alone. The refusal is the operator's error: no |
| +// result is recorded and the request stays for the agent's path. |
| +func TestHandRunApplyRefusesBelowTheRootfsFloor(t *testing.T) { |
| + for _, candidate := range []string{"v0.28.25", "v0.28.99", "4f3c2a1"} { |
| + t.Run(candidate, func(t *testing.T) { |
| + f, _ := floorFixture(t, "v0.29.0", candidate) |
| + f.a.handRun = true |
| + f.seedRoutes(flatRow(f.a.dataDir, "flat.example.com")) |
| + f.stagedNeverRan() |
| + err := f.a.Run(context.Background(), false) |
| + if err == nil || err.Error() != handRunRefusalFor("v0.29.0", candidate) { |
| + t.Fatalf("Run = %v\nwant %q", err, handRunRefusalFor("v0.29.0", candidate)) |
| } |
| - if !r.terminal() { |
| - t.Fatal("the refusal is not terminal: the agent would ask again") |
| + if r := f.result(); r != nil && r.Version == candidate { |
| + t.Fatalf("a hand-run refusal recorded a result: %+v", r) |
| } |
| - if !slicesContainsSubstr(*logs, want) { |
| - t.Errorf("no log line carries the refusal: %v", *logs) |
| + if _, err := os.Stat(systemRequestPath(f.a.dataDir)); err != nil { |
| + t.Fatalf("the request is gone: %v", err) |
| } |
| if f.onDisk() != "v0.29.0" { |
| t.Fatalf("on disk %q, want v0.29.0", f.onDisk()) |
| @@ -118,51 +121,32 @@ func TestApplyRefusesBelowTheRootfsFloorOnAFloorBox(t *testing.T) { |
| } |
| } |
| -// The operator's override lets a deliberate downgrade through, with a |
| -// warning in the log: on the pointer (`carlos system update |
| -// --allow-below-rootfs-floor`) or on `carlos system apply` itself. |
| -func TestApplyRootfsFloorOverrideLetsADowngradeThrough(t *testing.T) { |
| - for _, via := range []string{"pointer", "flag"} { |
| - t.Run(via, func(t *testing.T) { |
| - f, req := floorFixture(t, "v0.29.0", "v0.28.25") |
| - if via == "pointer" { |
| - req = f.promoteAllowing("v0.28.25") |
| - } else { |
| - f.a.allowBelowRootfsFloor = true |
| - } |
| - logs := f.captureLogs() |
| - if err := f.a.Run(context.Background(), false); err != nil { |
| - t.Fatal(err) |
| - } |
| - if r := f.result(); r == nil || r.Outcome != systemOutcomeApplied || !r.matches("stable", "v0.28.25", req.PromotedAt) { |
| - t.Fatalf("result = %+v, want applied", r) |
| - } |
| - if f.onDisk() != "v0.28.25" { |
| - t.Fatalf("on disk %q, want v0.28.25", f.onDisk()) |
| - } |
| - warn := "installing v0.28.25 below v0.29.0 with --allow-below-rootfs-floor: this box may have rootfs instances that v0.28.25 cannot run" |
| - if !slicesContainsSubstr(*logs, warn) { |
| - t.Errorf("no warning in the log: %v", *logs) |
| - } |
| - }) |
| - } |
| - // A later promote of the same version without the override is refused |
| - // again: the override belongs to the one pointer write. |
| - f, _ := floorFixture(t, "v0.29.0", "v0.28.25") |
| - f.promoteAllowing("v0.28.25") |
| - req := f.promote("v0.28.25", []byte("#!/bin/sh\necho carlos v0.28.25\n"), false) |
| +// The hand run's --allow-below-rootfs-floor lets a deliberate downgrade |
| +// through, with a warning in the log. |
| +func TestHandRunApplyOverrideLetsADowngradeThrough(t *testing.T) { |
| + f, req := floorFixture(t, "v0.29.0", "v0.28.25") |
| + f.a.handRun, f.a.allowBelowRootfsFloor = true, true |
| + logs := f.captureLogs() |
| if err := f.a.Run(context.Background(), false); err != nil { |
| t.Fatal(err) |
| } |
| - if r := f.result(); r == nil || r.Outcome != systemOutcomeRefused || !r.matches("stable", "v0.28.25", req.PromotedAt) { |
| - t.Fatalf("a promote after the overriding one = %+v, want refused", r) |
| + if r := f.result(); r == nil || r.Outcome != systemOutcomeApplied || !r.matches("stable", "v0.28.25", req.PromotedAt) { |
| + t.Fatalf("result = %+v, want applied", r) |
| + } |
| + if f.onDisk() != "v0.28.25" { |
| + t.Fatalf("on disk %q, want v0.28.25", f.onDisk()) |
| + } |
| + warn := "installing v0.28.25 below v0.29.0 with --allow-below-rootfs-floor: this box may have rootfs instances that v0.28.25 cannot run" |
| + if !slicesContainsSubstr(*logs, warn) { |
| + t.Errorf("no warning in the log: %v", *logs) |
| } |
| } |
| -// A box below the floor installs as on main, Plan 2's release included, |
| -// and so does one whose own version does not parse. A box on the floor |
| -// installs any release at or above it, older ones included. |
| -func TestApplyRootfsFloorAllowsAsOnMain(t *testing.T) { |
| +// A hand run on a box below the floor installs as on main, Plan 2's |
| +// release included, and so does one whose own version does not parse. A |
| +// box on the floor installs any release at or above it, older ones |
| +// included. |
| +func TestHandRunApplyAllowsAsOnMain(t *testing.T) { |
| for _, tc := range []struct{ installed, candidate string }{ |
| {"v0.28.24", "v0.28.25"}, |
| {"v0.28.26", "v0.28.25"}, |
| @@ -172,6 +156,7 @@ func TestApplyRootfsFloorAllowsAsOnMain(t *testing.T) { |
| } { |
| t.Run(tc.installed+"->"+tc.candidate, func(t *testing.T) { |
| f, req := floorFixture(t, tc.installed, tc.candidate) |
| + f.a.handRun = true |
| if err := f.a.Run(context.Background(), false); err != nil { |
| t.Fatal(err) |
| } |
| @@ -180,8 +165,8 @@ func TestApplyRootfsFloorAllowsAsOnMain(t *testing.T) { |
| } |
| }) |
| } |
| - // An installed version that does not parse (a local build): as on main. |
| f, req := applyHappyVersion(t, "v0.28.25") |
| + f.a.handRun = true |
| if err := f.a.Run(context.Background(), false); err != nil { |
| t.Fatal(err) |
| } |
| @@ -191,54 +176,63 @@ func TestApplyRootfsFloorAllowsAsOnMain(t *testing.T) { |
| } |
| // When the installed binary cannot be asked its version, this process's |
| -// own build (the installed binary runs the apply) stands in, so a floor |
| -// box still refuses. |
| -func TestApplyRootfsFloorFallsBackToThisBuild(t *testing.T) { |
| - f, req := floorFixture(t, "v0.29.0", "v0.28.25") |
| +// own build (the installed binary runs the apply) stands in. |
| +func TestHandRunApplyRootfsFloorFallsBackToThisBuild(t *testing.T) { |
| + f, _ := floorFixture(t, "v0.29.0", "v0.28.25") |
| + f.a.handRun = true |
| os.WriteFile(systemBinaryPath(f.a.optDir), []byte("#!/bin/sh\nexit 1\n"), 0o755) |
| f.a.build = "v0.29.0" |
| - if err := f.a.Run(context.Background(), false); err != nil { |
| - t.Fatal(err) |
| - } |
| - r := f.result() |
| - if r == nil || r.Outcome != systemOutcomeRefused || !r.matches("stable", "v0.28.25", req.PromotedAt) || |
| - r.Reason != rootfsFloorRefusalFor("v0.29.0", "v0.28.25") { |
| - t.Fatalf("result = %+v, want the floor's refusal", r) |
| + if err := f.a.Run(context.Background(), false); err == nil || err.Error() != handRunRefusalFor("v0.29.0", "v0.28.25") { |
| + t.Fatalf("Run = %v, want the hand run's refusal", err) |
| } |
| } |
| -// The gate's automatic rollback never meets the floor: a floor box whose |
| -// install fails its gate goes back to .prev, and a rollback whose .prev is |
| -// below the floor restores it all the same (rollback and restoreFiles do |
| -// not pass through rootfsFloorRefusal). |
| +// The gate's automatic rollback and --recover never meet the floor, on |
| +// either path: a floor box whose install fails its gate goes back to |
| +// .prev, and a rollback whose .prev is below the floor restores it all the |
| +// same (rollback and restoreFiles do not pass through handRunRootfsFloor). |
| func TestRootfsFloorLeavesTheAutomaticRollbackAlone(t *testing.T) { |
| - f, req := floorFixture(t, "v0.29.0", "v0.29.1") |
| - // v0.29.1 never comes up; v0.29.0 does once it is back on disk. |
| - f.edgeUp = false |
| - orig := f.a.ops.systemctl |
| - f.a.ops.systemctl = func(args ...string) (string, error) { |
| - if args[0] == "restart" { |
| - if b, _ := os.ReadFile(systemBinaryPath(f.a.optDir)); strings.Contains(string(b), "carlos v0.29.0\n") { |
| - f.edgeUp = true |
| + for _, handRun := range []bool{false, true} { |
| + f, req := floorFixture(t, "v0.29.0", "v0.29.1") |
| + f.a.handRun = handRun |
| + // v0.29.1 never comes up; v0.29.0 does once it is back on disk. |
| + f.edgeUp = false |
| + orig := f.a.ops.systemctl |
| + f.a.ops.systemctl = func(args ...string) (string, error) { |
| + if args[0] == "restart" { |
| + if b, _ := os.ReadFile(systemBinaryPath(f.a.optDir)); strings.Contains(string(b), "carlos v0.29.0\n") { |
| + f.edgeUp = true |
| + } |
| } |
| + return orig(args...) |
| + } |
| + if err := f.a.Run(context.Background(), false); err == nil { |
| + t.Fatal("a failed gate must exit non-zero") |
| + } |
| + if r := f.result(); r == nil || r.Outcome != systemOutcomeRolledBack || !r.matches("stable", "v0.29.1", req.PromotedAt) { |
| + t.Fatalf("handRun=%v: result = %+v, want rolled back", handRun, r) |
| + } |
| + if f.onDisk() != "v0.29.0" { |
| + t.Fatalf("handRun=%v: on disk %q after the rollback, want v0.29.0", handRun, f.onDisk()) |
| } |
| - return orig(args...) |
| - } |
| - if err := f.a.Run(context.Background(), false); err == nil { |
| - t.Fatal("a failed gate must exit non-zero") |
| - } |
| - if r := f.result(); r == nil || r.Outcome != systemOutcomeRolledBack || !r.matches("stable", "v0.29.1", req.PromotedAt) { |
| - t.Fatalf("result = %+v, want rolled back", r) |
| - } |
| - if f.onDisk() != "v0.29.0" { |
| - t.Fatalf("on disk %q after the rollback, want v0.29.0", f.onDisk()) |
| - } |
| - f, req = floorFixture(t, "v0.29.0", "v0.29.1") |
| - j := f.brokenBox("v0.29.1", "v0.28.25", "") |
| - f.a.rollback(context.Background(), req, "gate: test", &j) |
| - if r := f.result(); r == nil || r.Outcome != systemOutcomeRolledBack || f.onDisk() != "v0.28.25" { |
| - t.Fatalf("rollback to a below-floor .prev: result %+v, on disk %q", r, f.onDisk()) |
| + f, req = floorFixture(t, "v0.29.0", "v0.29.1") |
| + f.a.handRun = handRun |
| + j := f.brokenBox("v0.29.1", "v0.28.25", "") |
| + f.a.rollback(context.Background(), req, "gate: test", &j) |
| + if r := f.result(); r == nil || r.Outcome != systemOutcomeRolledBack || f.onDisk() != "v0.28.25" { |
| + t.Fatalf("handRun=%v: rollback to a below-floor .prev: result %+v, on disk %q", handRun, r, f.onDisk()) |
| + } |
| + // --recover: a broken install with its journal open goes back to a |
| + // below-floor .prev. |
| + f, _ = floorFixture(t, "v0.29.0", "v0.29.1") |
| + f.a.handRun = handRun |
| + f.brokenBox("v0.29.1", "v0.28.25", "") |
| + f.edgeStartedThisBoot = false |
| + _ = f.a.Run(context.Background(), true) |
| + if f.onDisk() != "v0.28.25" { |
| + t.Fatalf("handRun=%v: --recover left %q on disk, want v0.28.25", handRun, f.onDisk()) |
| + } |
| } |
| } |
| @@ -307,3 +301,54 @@ func registryOpeners(fset *token.FileSet, f *ast.File) []string { |
| }) |
| return problems |
| } |
| + |
| +// [Task 15 round 4] The agent's path cannot reach the refusal: the one |
| +// call of handRunRootfsFloor in systemapply.go is inside `if a.handRun`, |
| +// and handRun is set only from systemApplyHandRun. |
| +func TestHandRunRootfsFloorIsOnlyBehindHandRun(t *testing.T) { |
| + fset := token.NewFileSet() |
| + f, err := parser.ParseFile(fset, "systemapply.go", nil, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + calls, guarded := 0, 0 |
| + var stack []ast.Node |
| + ast.Inspect(f, func(n ast.Node) bool { |
| + if n == nil { |
| + stack = stack[:len(stack)-1] |
| + return false |
| + } |
| + stack = append(stack, n) |
| + if call, ok := n.(*ast.CallExpr); ok { |
| + if sel, ok := call.Fun.(*ast.SelectorExpr); ok && sel.Sel.Name == "handRunRootfsFloor" { |
| + calls++ |
| + for _, outer := range stack { |
| + if ifs, ok := outer.(*ast.IfStmt); ok { |
| + if c, ok := ifs.Cond.(*ast.SelectorExpr); ok && c.Sel.Name == "handRun" { |
| + guarded++ |
| + break |
| + } |
| + } |
| + } |
| + } |
| + } |
| + if kv, ok := n.(*ast.KeyValueExpr); ok { |
| + if k, ok := kv.Key.(*ast.Ident); ok && k.Name == "handRun" { |
| + if c, ok := kv.Value.(*ast.CallExpr); !ok || fmt.Sprint(c.Fun) != "systemApplyHandRun" { |
| + t.Errorf("%s: handRun is set from something other than systemApplyHandRun", fset.Position(kv.Pos())) |
| + } |
| + } |
| + } |
| + if as, ok := n.(*ast.AssignStmt); ok { |
| + for _, l := range as.Lhs { |
| + if sel, ok := l.(*ast.SelectorExpr); ok && sel.Sel.Name == "handRun" { |
| + t.Errorf("%s: handRun is assigned outside the applier's construction", fset.Position(as.Pos())) |
| + } |
| + } |
| + } |
| + return true |
| + }) |
| + if calls != 1 || guarded != 1 { |
| + t.Fatalf("handRunRootfsFloor: %d calls, %d behind `if a.handRun`; want 1 and 1", calls, guarded) |
| + } |
| +} |
diff --git a/internal/release/layoutintent.go b/internal/release/layoutintent.go| index 8f6d79b20..912148049 100644 |
| --- a/internal/release/layoutintent.go |
| +++ b/internal/release/layoutintent.go |
| @@ -220,25 +220,28 @@ var LayoutFloor = SemVer{Major: 0, Minor: 25, Patch: 0} |
| // contains Group A MUST be v0.29.0, and no release without Group A may be |
| // numbered v0.29.0 or later. |
| // |
| -// The box-side guard (host/systemapply.go): a box whose installed release |
| -// is at or above this floor refuses a candidate below it, or whose version |
| -// does not parse, whatever rows the box has (Paul's ruling, Task 15 round |
| -// 3), unless the operator passes RootfsFloorOverrideFlag. |
| -// TestRootfsLifecycleFloorIsPinned pins it. |
| +// The floor is judged by the console (console/rootfsfloor.go, Paul's |
| +// ruling, Task 15 round 4): a channel whose current pointer is at or above |
| +// it is never moved below it, or to a release whose version does not |
| +// parse, unless the operator passes RootfsFloorOverrideFlag; the check |
| +// comes before any activation reservation. An apply an operator runs by |
| +// hand on a box judges the box's installed release the same way |
| +// (host/systemapply.go). TestRootfsLifecycleFloorIsPinned pins it. |
| var RootfsLifecycleFloor = SemVer{Major: 0, Minor: 29, Patch: 0} |
| // RootfsFloorOverrideFlag is the override's flag name, on `carlos system |
| -// update` and `carlos system apply`. |
| +// update`, `carlos system rollback` and `carlos system apply`. |
| const RootfsFloorOverrideFlag = "allow-below-rootfs-floor" |
| // RootfsFloorOverrideUsage (RFS-3-C32) is the override flag's help text, |
| -// shared by both commands. |
| -const RootfsFloorOverrideUsage = "install a release below v0.29.0 on boxes running v0.29.0 or later, which may have rootfs instances that release cannot run" |
| +// shared by the three commands. |
| +const RootfsFloorOverrideUsage = "allow a release below v0.29.0 where v0.29.0 or later runs now. boxes may have rootfs instances that release cannot run" |
| -// RootfsFloorAllows reports whether a box running installed may install |
| -// candidate under the rootfs floor without the override: always on a box |
| -// below the floor (or whose own version does not parse), and on one at or |
| -// above it only a candidate whose version parses at or above it. |
| +// RootfsFloorAllows reports whether a channel (or a box) running installed |
| +// may move to candidate under the rootfs floor without the override: |
| +// always when installed is below the floor or does not parse, and when it |
| +// is at or above it only to a candidate whose version parses at or above |
| +// it. |
| func RootfsFloorAllows(installed, candidate string) bool { |
| in, ok := ParseReleaseVersion(installed) |
| if !ok || in.Compare(RootfsLifecycleFloor) < 0 { |
diff --git a/internal/release/systempointer.go b/internal/release/systempointer.go| index 116220b13..3fd4b4efb 100644 |
| --- a/internal/release/systempointer.go |
| +++ b/internal/release/systempointer.go |
| @@ -29,11 +29,12 @@ type SystemPointer struct { |
| Spread string `json:"spread"` |
| PromotedAt time.Time `json:"promoted_at"` // of THIS write; the box's replay guard reads only this |
| Audit []Promotion `json:"audit,omitempty"` |
| - // AllowBelowRootfsFloor is the operator's override of the rootfs floor |
| - // for THIS write (`carlos system update --allow-below-rootfs-floor`): a |
| - // box on RootfsLifecycleFloor or later installs Current even though it |
| - // is below the floor or its version does not parse. Every later write |
| - // starts without it; a box before this field ignores it. |
| + // AllowBelowRootfsFloor records that THIS write moved the channel below |
| + // RootfsLifecycleFloor on the operator's override (`carlos system |
| + // update` or `rollback` --allow-below-rootfs-floor). The console judges |
| + // the floor before it reserves or writes (console/rootfsfloor.go); the |
| + // flag is signed so a held activation's override can be compared with a |
| + // retry's. Boxes do not read it. Every later write starts without it. |
| AllowBelowRootfsFloor bool `json:"allow_below_rootfs_floor,omitempty"` |
| } |
| @@ -256,7 +257,9 @@ func GetSystemPointer(ctx context.Context, s Store, pub ed25519.PublicKey, compo |
| type SystemPromoteOptions struct { |
| Actor string |
| Spread time.Duration // 0 = hotfix, every box at once; unset in the CLI means the default |
| - // AllowBelowRootfsFloor sets SystemPointer.AllowBelowRootfsFloor. |
| + // AllowBelowRootfsFloor is the operator's rootfs floor override; it is |
| + // part of an activation request's identity and is signed onto the |
| + // pointer (SystemPointer.AllowBelowRootfsFloor). |
| AllowBelowRootfsFloor bool |
| } |
| @@ -319,14 +322,16 @@ func PrepareSystemPromotion(ctx context.Context, s Store, sg Signer, component, |
| // It writes a NEW pointer — new PromotedAt — so every box's replay guard |
| // sees a promote, not a replay. |
| func RollbackSystem(ctx context.Context, s Store, sg Signer, component, channel, actor string, expectedETag ...string) (*SystemPointer, error) { |
| - prepared, err := PrepareSystemRollback(ctx, s, sg, component, channel, actor, "", expectedETag...) |
| + prepared, err := PrepareSystemRollback(ctx, s, sg, component, channel, SystemPromoteOptions{Actor: actor}, "", expectedETag...) |
| if err != nil { |
| return nil, err |
| } |
| return PublishSystemPublication(ctx, s, sg.verifyPub(), prepared) |
| } |
| -func PrepareSystemRollback(ctx context.Context, s Store, sg Signer, component, channel, actor, id string, expectedETag ...string) (SystemPublication, error) { |
| +// PrepareSystemRollback takes the actor and the rootfs floor override from |
| +// o; the rollback keeps the old pointer's spread. |
| +func PrepareSystemRollback(ctx context.Context, s Store, sg Signer, component, channel string, o SystemPromoteOptions, id string, expectedETag ...string) (SystemPublication, error) { |
| key := SystemPointerKey(component, channel) |
| body, etag, err := s.Get(ctx, key) |
| if err != nil { |
| @@ -345,7 +350,8 @@ func PrepareSystemRollback(ctx context.Context, s Store, sg Signer, component, c |
| next := &SystemPointer{ActivationID: id, |
| Component: component, Channel: channel, |
| Current: old.History[0], History: old.History[1:], Spread: old.Spread, |
| - Audit: prependCapped(Promotion{Version: old.History[0].Version, From: old.Current.Version, To: channel, Actor: actor, At: time.Now().UTC()}, old.Audit, auditMax), |
| + Audit: prependCapped(Promotion{Version: old.History[0].Version, From: old.Current.Version, To: channel, Actor: o.Actor, At: time.Now().UTC()}, old.Audit, auditMax), |
| + AllowBelowRootfsFloor: o.AllowBelowRootfsFloor, |
| } |
| wrapper, err := signSystemPointer(sg, next) |
| if err != nil { |
diff --git a/plan3_groups_test.go b/plan3_groups_test.go| index ef31f2f81..5c50387f7 100644 |
| --- a/plan3_groups_test.go |
| +++ b/plan3_groups_test.go |
| @@ -34,9 +34,9 @@ import ( |
| // The three copy sets, pinned. RFS-3-C13 is struck (pre-flight 3.1) and |
| // in no set; so is RFS-3-C25 (Paul's Task 15 round 3 ruling), whose place |
| -// RFS-3-C30 to C32 take. |
| +// RFS-3-C30 to C34 take. |
| var ( |
| - plan3CopyA = plan3IDs(11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 30, 31, 32) |
| + plan3CopyA = plan3IDs(11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 30, 31, 32, 33, 34) |
| plan3CopyR = plan3IDs(1, 2, 3, 4, 5, 6, 7, 29) |
| plan3CopyW = plan3IDs(8, 9, 10) |
| ) |
diff --git a/system.go b/system.go| index 6533ec100..2fd4cc2a6 100644 |
| --- a/system.go |
| +++ b/system.go |
| @@ -573,6 +573,7 @@ func runSystemRollback(args []string) { |
| consoleFlag := consoleOption(fs, "console origin (default: the only logged-in one)") |
| channel := fs.String("channel", "", "canary or stable (required)") |
| yes := fs.Bool("yes", false, "do not ask") |
| + allowBelowRootfsFloor := fs.Bool(release.RootfsFloorOverrideFlag, false, release.RootfsFloorOverrideUsage) |
| fs.Usage = flagUsage(fs, "") |
| fs.Parse(args) |
| if *channel == "" { |
| @@ -587,7 +588,11 @@ func runSystemRollback(args []string) { |
| return |
| } |
| } |
| - st, body, err := sess.postJSON(context.Background(), "/api/cli/system/rollback", map[string]string{"channel": *channel}) |
| + in := map[string]any{"channel": *channel} |
| + if *allowBelowRootfsFloor { |
| + in["allow_below_rootfs_floor"] = true |
| + } |
| + st, body, err := sess.postJSON(context.Background(), "/api/cli/system/rollback", in) |
| if err != nil { |
| log.Fatalf("carlos system rollback: %v", err) |
| } |