updates (#1562-2c): the production lander — land the signed fleet software on the gateway, keep the previous copy so rollback can restore it, and wire it into the composition #1576

Closed
opened 2026-09-18 13:35:58 +00:00 by ben · 3 comments
Owner

Parent: #1562 — carrying contract: ADR 0248 (decision 1)

Split out of #1571 by Ben's ruling (2026-09-18): #1571 was parked needs-design as a whole, but only its third part — the control panel's render of the land stage and the refusal state — needs design. This ticket is the build half and needs no design. #1571 keeps the screen.

What's true today (verified on main @ f541461c)

#1564 built the land step's core: update.FleetLander downloads every manifest artifact, verifies each sha256, refuses loud on a mismatch, and hands the verified bytes to an injected update.NodeLander. The rollout calls it as StageLand between seed and canary (internal/update/rollout.go). But on a real gateway it cannot run:

  1. No production NodeLander exists. Only the seam test's recorder implements it. Nothing scps or renames anything.
  2. The composition never wires a lander. whole_composition.go calls .WithRollout(...) and stops; there is no .WithLander(...). So the first real release that carries artifacts fails every rollout with ErrLanderNotWired — the lane refuses loudly rather than landing nothing quietly, but it refuses every release.
  3. The control-panel artifact has no defined shape. cmd/release-cut reads --control-panel with os.ReadFile, so a built tree (dashboard/dist) cannot be passed at all today, and nothing says what the single file is or how it becomes /srv/idss/dashboard.
  4. The land targets every node, but the fleet software lives on the gateway. Land is handed seed.Nodes (the whole fleet). The control-plane binary, the built control panel and the agent cache exist only on the gateway (internal/fleetwire/supply.go, internal/clan/vmguest.go); a member device has no /srv/idss.
  5. Rollback promises a restore nothing can perform. internal/update/resume.go says a failed post-swap health check "restores the previous binary + control panel", but the rollback only deploys the earlier config-repo revision through clan. The scp-landed files are outside that closure and no code keeps or restores the previous copies — after a failed self-swap the gateway would keep running the BAD binary under the OLD revision.
  6. No reader exposes a node's deploy target. loadInventory / Deploy.TargetHost are unexported and clan.ReadPlacement drops the target host, so the lander cannot learn where to land.

What to build

  • Rule the control-panel artifact shape (two-way door, ADR 0174 — proposed default): one gzip tarball of the built control panel tree's contents (incl. the idip/ member bundle), entries sorted with fixed mtime/uid/gid so the same tree cuts the same digest. release-cut --control-panel accepts a directory and packs it (a ready tarball still passes through). Record the shape as an amendment to ADR 0248.
  • A small clan-seam reader for a node's deploy target (host + port + the identity posture), so nobody outside internal/clan parses the inventory. Mind #1504: the carried ?IdentityFile=… query must not ride onto a loopback target.
  • The production NodeLander, reusing fleetwire's shape rather than re-deriving it:
    • lands only on nodes that carry the fleet software (the gateway); every other node is an honest recorded skip, never a fabricated success (ADR 0100);
    • binary and agent: stage beside the destination, then mv -f (ETXTBSY on a running binary — the reasoning already written in fleetwire/supply.go);
    • control panel: clear the staging dir first (scp -r/cp -r nest into a leftover dir), unpack there, then swap the directory;
    • unpacking is hostile-input handling even after the digest passes: refuse absolute paths, .. traversal, symlinks/hardlinks that escape the staging root, and device nodes; cap entry count and unpacked size;
    • idempotent — Resume re-runs the land stage after the control plane's own restart (#1567, GOTCHAS #241).
  • Keep the previous software and make rollback restore it. Before each swap, retain the outgoing binary, control panel and agent (*.previous, one generation). Give the rollback path a restore act so a failed post-swap health check really does put the previous binary + control panel back before the restart — making resume.go's sentence true. A restore with nothing retained says so loudly.
  • Wire it: whole_composition.go .WithLander(update.NewFleetLander(update.NewHTTPArtifactFetcher(nil), <the node lander>)), fact-gated the way the release source is — only when a signed source is wired. The resting composition stays byte-identical.
  • Do not touch the dashboard. The control panel's StageKind does not know 'land' yet; that and the refusal state are #1571. Confirm the existing U3 screen does not throw on an unknown stage kind (a blank page = a thrown render, GOTCHAS #225) and, if it does, make the minimum defensive change and say so on #1571.

Acceptance criteria

Seam (scripted runner, as fleetwire's own tests do):

  • Given a verified bundle and a fleet of a gateway plus two devices, Then the gateway receives binary, control panel and agent by staging + atomic rename, and the devices are recorded as skipped
  • Given a leftover staging directory from a crashed land, Then a re-run lands the control panel at the right depth, never nested one directory too deep
  • Given a tarball carrying ../ paths, an absolute path, or a symlink out of the staging root, Then nothing is unpacked outside staging, nothing is swapped, and the land names the refusal
  • Given a landed release whose gateway fails its post-swap health check, Then the previous binary and control panel are back on disk before the control plane restarts, and the rollout records rolled-back
  • Given the same tree cut twice, Then the control-panel artifact's sha256 is identical
  • Given no signed release source, Then the composition wires no lander and the resting build is unchanged
  • go build ./... && go vet ./... && go test ./... + golangci-lint + the -tags dev build green

Live proof rides the parent, not this ticket. Like #1563–#1568, this closes on the seam. The two live checks — a real gateway serving control panel A takes cut release B through the real land step with no hand copy, and a B whose control plane fails its health check ends back on A's binary and A's control panel — are added to #1562's live acceptance.

Notes

  • Read docs/GOTCHAS.md first — #221, #225, #241 and the #1504 entry all bear on this.
  • Seam-only on purpose, so a swarm worker can take it now. Do not claim the live behaviour in the close report — say "seam-proven, live unproven (#1562)".
  • STATUS.md updates in the same commit (CLAUDE.md).

Filed from Ben's 2026-09-18 ruling to split #1571 so the build half can start while the screen is designed.

## Parent: #1562 — carrying contract: ADR 0248 (decision 1) Split out of #1571 by Ben's ruling (2026-09-18): #1571 was parked `needs-design` as a whole, but only its third part — the control panel's render of the land stage and the refusal state — needs design. **This ticket is the build half and needs no design.** #1571 keeps the screen. ## What's true today (verified on `main` @ `f541461c`) #1564 built the land step's core: `update.FleetLander` downloads every manifest artifact, verifies each `sha256`, refuses loud on a mismatch, and hands the verified bytes to an injected `update.NodeLander`. The rollout calls it as `StageLand` between seed and canary (`internal/update/rollout.go`). But on a real gateway it cannot run: 1. **No production `NodeLander` exists.** Only the seam test's recorder implements it. Nothing scps or renames anything. 2. **The composition never wires a lander.** `whole_composition.go` calls `.WithRollout(...)` and stops; there is no `.WithLander(...)`. So the first real release that carries artifacts fails every rollout with `ErrLanderNotWired` — the lane refuses loudly rather than landing nothing quietly, but it refuses *every* release. 3. **The control-panel artifact has no defined shape.** `cmd/release-cut` reads `--control-panel` with `os.ReadFile`, so a built tree (`dashboard/dist`) cannot be passed at all today, and nothing says what the single file is or how it becomes `/srv/idss/dashboard`. 4. **The land targets every node, but the fleet software lives on the gateway.** `Land` is handed `seed.Nodes` (the whole fleet). The control-plane binary, the built control panel and the agent cache exist only on the gateway (`internal/fleetwire/supply.go`, `internal/clan/vmguest.go`); a member device has no `/srv/idss`. 5. **Rollback promises a restore nothing can perform.** `internal/update/resume.go` says a failed post-swap health check "restores the previous binary + control panel", but the rollback only deploys the earlier config-repo revision through clan. The scp-landed files are outside that closure and no code keeps or restores the previous copies — after a failed self-swap the gateway would keep running the BAD binary under the OLD revision. 6. **No reader exposes a node's deploy target.** `loadInventory` / `Deploy.TargetHost` are unexported and `clan.ReadPlacement` drops the target host, so the lander cannot learn where to land. ## What to build - **Rule the control-panel artifact shape (two-way door, ADR 0174 — proposed default):** one gzip tarball of the built control panel tree's *contents* (incl. the `idip/` member bundle), entries sorted with fixed mtime/uid/gid so the same tree cuts the same digest. `release-cut --control-panel` accepts a directory and packs it (a ready tarball still passes through). Record the shape as an amendment to ADR 0248. - **A small clan-seam reader** for a node's deploy target (host + port + the identity posture), so nobody outside `internal/clan` parses the inventory. Mind #1504: the carried `?IdentityFile=…` query must not ride onto a loopback target. - **The production `NodeLander`**, reusing `fleetwire`'s shape rather than re-deriving it: - lands **only on nodes that carry the fleet software** (the gateway); every other node is an honest recorded skip, never a fabricated success (ADR 0100); - binary and agent: stage beside the destination, then `mv -f` (ETXTBSY on a running binary — the reasoning already written in `fleetwire/supply.go`); - control panel: clear the staging dir first (`scp -r`/`cp -r` nest into a leftover dir), unpack there, then swap the directory; - **unpacking is hostile-input handling even after the digest passes**: refuse absolute paths, `..` traversal, symlinks/hardlinks that escape the staging root, and device nodes; cap entry count and unpacked size; - idempotent — `Resume` re-runs the land stage after the control plane's own restart (#1567, GOTCHAS #241). - **Keep the previous software and make rollback restore it.** Before each swap, retain the outgoing binary, control panel and agent (`*.previous`, one generation). Give the rollback path a restore act so a failed post-swap health check really does put the previous binary + control panel back before the restart — making `resume.go`'s sentence true. A restore with nothing retained says so loudly. - **Wire it:** `whole_composition.go` `.WithLander(update.NewFleetLander(update.NewHTTPArtifactFetcher(nil), <the node lander>))`, fact-gated the way the release source is — only when a signed source is wired. The resting composition stays byte-identical. - **Do not touch the dashboard.** The control panel's `StageKind` does not know `'land'` yet; that and the refusal state are #1571. Confirm the existing U3 screen does not throw on an unknown stage kind (a blank page = a thrown render, GOTCHAS #225) and, if it does, make the *minimum* defensive change and say so on #1571. ## Acceptance criteria Seam (scripted runner, as `fleetwire`'s own tests do): - [ ] Given a verified bundle and a fleet of a gateway plus two devices, Then the gateway receives binary, control panel and agent by staging + atomic rename, and the devices are recorded as skipped - [ ] Given a leftover staging directory from a crashed land, Then a re-run lands the control panel at the right depth, never nested one directory too deep - [ ] Given a tarball carrying `../` paths, an absolute path, or a symlink out of the staging root, Then nothing is unpacked outside staging, nothing is swapped, and the land names the refusal - [ ] Given a landed release whose gateway fails its post-swap health check, Then the previous binary and control panel are back on disk before the control plane restarts, and the rollout records rolled-back - [ ] Given the same tree cut twice, Then the control-panel artifact's `sha256` is identical - [ ] Given no signed release source, Then the composition wires no lander and the resting build is unchanged - [ ] `go build ./... && go vet ./... && go test ./...` + `golangci-lint` + the `-tags dev` build green **Live proof rides the parent, not this ticket.** Like #1563–#1568, this closes on the seam. The two live checks — a real gateway serving control panel A takes cut release B through the real land step with no hand copy, and a B whose control plane fails its health check ends back on A's binary and A's control panel — are added to #1562's live acceptance. ## Notes - Read `docs/GOTCHAS.md` first — #221, #225, #241 and the #1504 entry all bear on this. - Seam-only on purpose, so a swarm worker can take it now. Do not claim the live behaviour in the close report — say "seam-proven, live unproven (#1562)". - STATUS.md updates in the same commit (CLAUDE.md). --- *Filed from Ben's 2026-09-18 ruling to split #1571 so the build half can start while the screen is designed.*

swarm-claim host=bens-mac-04 run=26614
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=26614 (automated multi-host claim — lowest live claim id works this ticket)

Ruled by agent under ADR 0174 — veto anytime.

The ticket asked me to rule the control-panel artifact shape (two-way door, proposed default). Ruling:

The control-panel artifact is ONE gzip tarball of the built tree's CONTENTS (entries relative to the tree root, so the land step unpacks directly at /srv/idss/dashboard, never nested under a tree-name dir). The pack is deterministic — entries walked + sorted by path, fixed epoch mtime, uid/gid 0, mode normalised (only the exec bit preserved), bare gzip frame (no name/modtime) — so the same built tree cuts the same sha256 every time. release-cut --control-panel accepts the directory and packs it; a ready tarball still passes through. (matourelease.PackControlPanel.)

Why a two-way door: it is a producer-side encoding, reverted by editing PackControlPanel and re-cutting, and proven by TestPackControlPanel_SameTreeSameDigest (identical bytes, order-independent) + the fleetland land seam (contents land at the right depth). It is not on the one-way-door list.

Two smaller calls ride the same ruling, both revertible + test-proven: (a) the unpacker refuses all symlinks/hardlinks (not only escaping ones) plus device nodes, and the packer refuses the same at the cut — a control-panel tree needs none, and refusing broadly is the safe default (ADR 0100); (b) a rollback Restore that finds nothing retained fails loud rather than silently claim the previous software is back.

Recorded as an amendment to ADR 0248 decision 1 in this commit.

**Ruled by agent under ADR 0174 — veto anytime.** The ticket asked me to *rule the control-panel artifact shape* (two-way door, proposed default). Ruling: **The control-panel artifact is ONE gzip tarball of the built tree's CONTENTS** (entries relative to the tree root, so the land step unpacks directly at `/srv/idss/dashboard`, never nested under a tree-name dir). The pack is **deterministic** — entries walked + sorted by path, fixed epoch mtime, uid/gid 0, mode normalised (only the exec bit preserved), bare gzip frame (no name/modtime) — so the same built tree cuts the same `sha256` every time. `release-cut --control-panel` accepts the directory and packs it; a ready tarball still passes through. (`matourelease.PackControlPanel`.) **Why a two-way door:** it is a producer-side encoding, reverted by editing `PackControlPanel` and re-cutting, and proven by `TestPackControlPanel_SameTreeSameDigest` (identical bytes, order-independent) + the fleetland land seam (contents land at the right depth). It is not on the one-way-door list. Two smaller calls ride the same ruling, both revertible + test-proven: (a) the unpacker refuses **all** symlinks/hardlinks (not only escaping ones) plus device nodes, and the packer refuses the same at the cut — a control-panel tree needs none, and refusing broadly is the safe default (ADR 0100); (b) a rollback `Restore` that finds **nothing retained** fails loud rather than silently claim the previous software is back. Recorded as an amendment to ADR 0248 decision 1 in this commit.

close-report for #1576 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1576,
  "status": "success",
  "commits": [
    "103ac3afb61145fff7e97121d815063cb0e11e34"
  ],
  "changed_files": [
    "STATUS.md",
    "cmd/release-cut/main.go",
    "control-plane/cmd/control-plane/whole_composition.go",
    "docs/adr/0248-design-fleet-auto-update-lands-a-signed-release-on-a-running-community.md",
    "internal/clan/deploytarget.go",
    "internal/clan/deploytarget_test.go",
    "internal/fleetland/fleetland.go",
    "internal/fleetland/fleetland_test.go",
    "internal/matourelease/pack.go",
    "internal/matourelease/pack_test.go",
    "internal/update/land.go",
    "internal/update/rollback.go",
    "internal/update/rollout_land_test.go",
    "internal/update/rollout_test.go"
  ],
  "tests": [
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./...",
      "exit_code": 0
    },
    {
      "command": "go build -tags dev ./...",
      "exit_code": 0
    },
    {
      "command": "go test ./...",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./internal/fleetland/... ./internal/matourelease/... ./internal/clan/... ./internal/update/... ./cmd/release-cut/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Given a verified bundle and a fleet of a gateway plus two devices, Then the gateway receives binary, control panel and agent by staging + atomic rename, and the devices are recorded as skipped": "internal/fleetland/fleetland_test.go TestLand_GatewayGetsSoftwareDevicesSkipped (asserts the gateway's on-disk binary/panel/agent + Landed()==[gateway], Skipped()==2 devices); landFile stages then rename(2), landPanel unpacks-then-swaps (internal/fleetland/fleetland.go)",
    "Given a leftover staging directory from a crashed land, Then a re-run lands the control panel at the right depth, never nested one directory too deep": "internal/fleetland/fleetland_test.go TestLand_LeftoverStagingDirDoesNotNest (asserts dashboard/index.html, not dashboard/dashboard/...); landPanel RemoveAll(staging) before unpack (fleetland.go)",
    "Given a tarball carrying `../` paths, an absolute path, or a symlink out of the staging root, Then nothing is unpacked outside staging, nothing is swapped, and the land names the refusal": "internal/fleetland/fleetland_test.go TestLand_HostileTarballRefusedNothingSwapped (dotdot/absolute/symlink/hardlink/device cases; asserts panel A survives, no escape file, error names 'refusing'); untar() hostile-input guards (fleetland.go)",
    "Given a landed release whose gateway fails its post-swap health check, Then the previous binary and control panel are back on disk before the control plane restarts, and the rollout records rolled-back": "internal/update/rollout_land_test.go TestRollout_LandedGatewayFailureRestoresPreviousBeforeRollback (restore op precedes first config rollback op; res.RolledBack) + internal/fleetland TestRestore_PutsPreviousBinaryAndPanelBack (previous bytes back on disk); rollback.go restores before the config rollback loop",
    "Given the same tree cut twice, Then the control-panel artifact's sha256 is identical": "internal/matourelease/pack_test.go TestPackControlPanel_SameTreeSameDigest (identical bytes + identical sha256, order-independent); PackControlPanel deterministic pack (internal/matourelease/pack.go)",
    "Given no signed release source, Then the composition wires no lander and the resting build is unchanged": "control-plane/cmd/control-plane/whole_composition.go: the WithLander wiring is guarded by `if deps.releaseSource != nil` (the same fact-gate as the release source), so a resting community wires no lander and the resting path is untouched",
    "go build ./... && go vet ./... && go test ./... + golangci-lint + the -tags dev build green": "all five ran exit 0 in nix develop .#go-ci (see tests[])"
  },
  "summary": "Built the production fleet-software lander (internal/fleetland) that lands a verified release on the gateway with staging+atomic-rename, retains and restores the previous copy on rollback, defined the deterministic control-panel tarball shape, added the clan deploy-target reader, and wired it fact-gated — all seam-proven.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1576 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1576, "status": "success", "commits": [ "103ac3afb61145fff7e97121d815063cb0e11e34" ], "changed_files": [ "STATUS.md", "cmd/release-cut/main.go", "control-plane/cmd/control-plane/whole_composition.go", "docs/adr/0248-design-fleet-auto-update-lands-a-signed-release-on-a-running-community.md", "internal/clan/deploytarget.go", "internal/clan/deploytarget_test.go", "internal/fleetland/fleetland.go", "internal/fleetland/fleetland_test.go", "internal/matourelease/pack.go", "internal/matourelease/pack_test.go", "internal/update/land.go", "internal/update/rollback.go", "internal/update/rollout_land_test.go", "internal/update/rollout_test.go" ], "tests": [ { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./...", "exit_code": 0 }, { "command": "go build -tags dev ./...", "exit_code": 0 }, { "command": "go test ./...", "exit_code": 0 }, { "command": "golangci-lint run ./internal/fleetland/... ./internal/matourelease/... ./internal/clan/... ./internal/update/... ./cmd/release-cut/...", "exit_code": 0 } ], "criteria": { "Given a verified bundle and a fleet of a gateway plus two devices, Then the gateway receives binary, control panel and agent by staging + atomic rename, and the devices are recorded as skipped": "internal/fleetland/fleetland_test.go TestLand_GatewayGetsSoftwareDevicesSkipped (asserts the gateway's on-disk binary/panel/agent + Landed()==[gateway], Skipped()==2 devices); landFile stages then rename(2), landPanel unpacks-then-swaps (internal/fleetland/fleetland.go)", "Given a leftover staging directory from a crashed land, Then a re-run lands the control panel at the right depth, never nested one directory too deep": "internal/fleetland/fleetland_test.go TestLand_LeftoverStagingDirDoesNotNest (asserts dashboard/index.html, not dashboard/dashboard/...); landPanel RemoveAll(staging) before unpack (fleetland.go)", "Given a tarball carrying `../` paths, an absolute path, or a symlink out of the staging root, Then nothing is unpacked outside staging, nothing is swapped, and the land names the refusal": "internal/fleetland/fleetland_test.go TestLand_HostileTarballRefusedNothingSwapped (dotdot/absolute/symlink/hardlink/device cases; asserts panel A survives, no escape file, error names 'refusing'); untar() hostile-input guards (fleetland.go)", "Given a landed release whose gateway fails its post-swap health check, Then the previous binary and control panel are back on disk before the control plane restarts, and the rollout records rolled-back": "internal/update/rollout_land_test.go TestRollout_LandedGatewayFailureRestoresPreviousBeforeRollback (restore op precedes first config rollback op; res.RolledBack) + internal/fleetland TestRestore_PutsPreviousBinaryAndPanelBack (previous bytes back on disk); rollback.go restores before the config rollback loop", "Given the same tree cut twice, Then the control-panel artifact's sha256 is identical": "internal/matourelease/pack_test.go TestPackControlPanel_SameTreeSameDigest (identical bytes + identical sha256, order-independent); PackControlPanel deterministic pack (internal/matourelease/pack.go)", "Given no signed release source, Then the composition wires no lander and the resting build is unchanged": "control-plane/cmd/control-plane/whole_composition.go: the WithLander wiring is guarded by `if deps.releaseSource != nil` (the same fact-gate as the release source), so a resting community wires no lander and the resting path is untouched", "go build ./... && go vet ./... && go test ./... + golangci-lint + the -tags dev build green": "all five ran exit 0 in nix develop .#go-ci (see tests[])" }, "summary": "Built the production fleet-software lander (internal/fleetland) that lands a verified release on the gateway with staging+atomic-rename, retains and restores the previous copy on rollback, defined the deterministic control-panel tarball shape, added the clan deploy-target reader, and wired it fact-gated — all seam-proven.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1576
No description provided.