updates: set-release-channel --apply needs eight env exports the operator must know by heart — it should build the gateway's clan environment itself (#1569's runbook step) #1665

Closed
opened 2026-09-20 15:08:41 +00:00 by ben · 2 comments
Owner

The gap

set-release-channel --apply (#1661) is meant to be the ONE command an operator types in an SSH session on a kept gateway to move it onto a release channel (#1569 — first on Whakatōhea Demo). It is not one command yet. The #1614 proof drive only gets through it by prefixing eight environment variables on the SSH wire (5134fbb3, app/tests/e2e/fixtures/updatesJourney.ts realRailLandStep):

HOME=/root IDSS_CONFIG_REPO=/srv/idss/config IDSS_STATE_DIR=/var/lib/idss
SOPS_AGE_KEY_FILE=/var/lib/sops-nix/key.txt
GIT_AUTHOR_NAME=… GIT_AUTHOR_EMAIL=… GIT_COMMITTER_NAME=… GIT_COMMITTER_EMAIL=…
/srv/idss/bin/control-plane set-release-channel --apply gateway <feed> <key>

Those are the exports the control-plane UNIT's start script builds for its own clan runner (internal/clan/vmguest.go ~:823-867). The drive found them one red at a time (#1661's three layers, #1664). A human following a runbook will find them the same way — on a kept community, with the pin committed but not live each time it fails.

docs/architecture/11-update-supply-chain.md §"Landing the channel…" currently documents the one-liner WITHOUT them.

Fix

  1. --apply builds its own environment. One shared source for "the environment the gateway's clan runner needs" — a Go helper the subcommand calls, or an env file the render emits (e.g. /etc/idss/control-plane.env) that BOTH the unit's start script and --apply load — so the two cannot drift. Explicit env from the caller still wins (the drive, tests).
  2. Sensible defaults for the two IDSS paths on a gateway (/srv/idss/config, /var/lib/idss) when unset and present, so the operator's command is literally control-plane set-release-channel --apply <node> <feed> <key>. Refuse loud if they are absent (ADR 0100), naming what was looked for.
  3. The drive then DROPS the wire exports in realRailLandStep — it should type what the operator types. That is the proof.
  4. Runbook: the §"Landing the channel" text shows the bare command, and says where the binary lives on a gateway (/srv/idss/bin/control-plane) — or the render puts an idss-control-plane wrapper on root's PATH.

Acceptance

  • Seam test: with an EMPTY caller environment, --apply's clan invocation carries HOME, SOPS_AGE_KEY_FILE, the git identity and the config/state dirs.
  • A test pins that the unit's start script and --apply draw from the same source (no second hand-written list).
  • realRailLandStep carries no env prefix; fixture tests updated.
  • Runbook + GOTCHAS + STATUS in the same commit.

Live proof: the #1614 drive's real-rail leg. Blocks #1569 (do not run the re-tune on Whakatōhea Demo before this), not #1614.

## The gap `set-release-channel --apply` (#1661) is meant to be the ONE command an operator types in an SSH session on a kept gateway to move it onto a release channel (#1569 — first on Whakatōhea Demo). It is not one command yet. The #1614 proof drive only gets through it by prefixing **eight environment variables on the SSH wire** (`5134fbb3`, `app/tests/e2e/fixtures/updatesJourney.ts` `realRailLandStep`): ``` HOME=/root IDSS_CONFIG_REPO=/srv/idss/config IDSS_STATE_DIR=/var/lib/idss SOPS_AGE_KEY_FILE=/var/lib/sops-nix/key.txt GIT_AUTHOR_NAME=… GIT_AUTHOR_EMAIL=… GIT_COMMITTER_NAME=… GIT_COMMITTER_EMAIL=… /srv/idss/bin/control-plane set-release-channel --apply gateway <feed> <key> ``` Those are the exports the control-plane UNIT's start script builds for its own clan runner (`internal/clan/vmguest.go` ~:823-867). The drive found them one red at a time (#1661's three layers, #1664). A human following a runbook will find them the same way — on a kept community, with the pin committed but not live each time it fails. `docs/architecture/11-update-supply-chain.md` §"Landing the channel…" currently documents the one-liner WITHOUT them. ## Fix 1. **`--apply` builds its own environment.** One shared source for "the environment the gateway's clan runner needs" — a Go helper the subcommand calls, or an env file the render emits (e.g. `/etc/idss/control-plane.env`) that BOTH the unit's start script and `--apply` load — so the two cannot drift. Explicit env from the caller still wins (the drive, tests). 2. **Sensible defaults for the two IDSS paths on a gateway** (`/srv/idss/config`, `/var/lib/idss`) when unset and present, so the operator's command is literally `control-plane set-release-channel --apply <node> <feed> <key>`. Refuse loud if they are absent (ADR 0100), naming what was looked for. 3. **The drive then DROPS the wire exports** in `realRailLandStep` — it should type what the operator types. That is the proof. 4. **Runbook:** the §"Landing the channel" text shows the bare command, and says where the binary lives on a gateway (`/srv/idss/bin/control-plane`) — or the render puts an `idss-control-plane` wrapper on root's PATH. ## Acceptance - [ ] Seam test: with an EMPTY caller environment, `--apply`'s clan invocation carries `HOME`, `SOPS_AGE_KEY_FILE`, the git identity and the config/state dirs. - [ ] A test pins that the unit's start script and `--apply` draw from the same source (no second hand-written list). - [ ] `realRailLandStep` carries no env prefix; fixture tests updated. - [ ] Runbook + GOTCHAS + STATUS in the same commit. Live proof: the #1614 drive's `real-rail` leg. **Blocks #1569** (do not run the re-tune on Whakatōhea Demo before this), not #1614.

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

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

close-report for #1665 — status success

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

envelope
{
  "issue": 1665,
  "status": "success",
  "commits": [
    "9c956b335ed14f1820d9a90f6b6c7b5832531b34"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/updatesJourney.test.ts",
    "app/tests/e2e/fixtures/updatesJourney.ts",
    "app/tests/e2e/journey.updates.spec.ts",
    "control-plane/cmd/control-plane/channel_env.go",
    "control-plane/cmd/control-plane/main.go",
    "docs/GOTCHAS.md",
    "docs/architecture/11-update-supply-chain.md",
    "internal/clan/gatewayclanenv.go",
    "internal/clan/gatewayclanenv_test.go",
    "internal/clan/testdata/drvpath-baseline.txt",
    "internal/clan/vmguest.go",
    "internal/clan/vmguest_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan/ ./control-plane/cmd/control-plane/ -count=1",
      "exit_code": 0
    },
    {
      "command": "IDSS_EVAL_SMOKE=1 IDSS_EVAL_SMOKE_UPDATE=1 nix develop .#go-ci -c go test ./internal/clan/ -run TestSeedCommunity_EvalSmoke -count=1",
      "exit_code": 0
    },
    {
      "command": "nix develop ..#e2e -c pnpm vitest run tests/e2e/fixtures/updatesJourney.test.ts",
      "exit_code": 0
    },
    {
      "command": "nix develop ..#e2e -c pnpm exec eslint tests/e2e/fixtures/updatesJourney.ts tests/e2e/journey.updates.spec.ts tests/e2e/fixtures/updatesJourney.test.ts",
      "exit_code": 0
    },
    {
      "command": "git push origin HEAD:refs/heads/main (pre-push gate: go build/vet/test + eslint)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Seam test: with an EMPTY caller environment, --apply's clan invocation carries HOME, SOPS_AGE_KEY_FILE, the git identity and the config/state dirs": "internal/clan/gatewayclanenv_test.go TestResolveGatewayClanEnv_FillsTheWholeEnvFromAnEmptyCallerEnv — asserts an empty caller env fills HOME, SOPS_AGE_KEY_FILE, GIT_AUTHOR/COMMITTER_{NAME,EMAIL}, IDSS_CONFIG_REPO and IDSS_STATE_DIR; ResolveGatewayClanEnv is what ensureGatewayClanEnv (channel_env.go) sets into os.Environ() before --apply shells the ExecCLI clan runner",
    "A test pins that the unit's start script and --apply draw from the same source (no second hand-written list)": "internal/clan/gatewayclanenv_test.go TestGatewayClanEnv_UnitScriptAndApplyAgree + TestGatewayClanEnvExports_RenderEveryVarFromTheSharedSource — the unit's start script renders from clan.GatewayClanEnv via gatewayClanEnvExports (vmguest.go now embeds %[11]s), and ResolveGatewayClanEnv reads the same list; both tests prove every var agrees",
    "realRailLandStep carries no env prefix; fixture tests updated": "app/tests/e2e/fixtures/updatesJourney.ts realRailLandStep() now returns the bare `<bin> set-release-channel --apply <node> <feed> <key>`; updatesJourney.test.ts rewritten to assert NO env prefix (no HOME=/IDSS_*=/SOPS_/GIT_ and no cd); fixture vitest 20/20 green",
    "Runbook + GOTCHAS + STATUS in the same commit": "docs/architecture/11-update-supply-chain.md §Landing the channel shows the bare command and names /srv/idss/bin/control-plane; docs/GOTCHAS.md #291 added; STATUS.md header + milestone entry — all in commit 9c956b33",
    "--apply builds its own environment from one shared source; explicit caller env wins": "internal/clan/gatewayclanenv.go GatewayClanEnv (single source) + ResolveGatewayClanEnv (explicit lookup wins, proven by TestResolveGatewayClanEnv_CallerEnvWins); control-plane/cmd/control-plane/channel_env.go ensureGatewayClanEnv wired into main.go --apply branch before pin + exec apply read the env",
    "Sensible defaults for the two IDSS paths when unset and present; refuse loud if absent (ADR 0100), naming what was looked for": "ResolveGatewayClanEnv defaults IDSS_CONFIG_REPO=/srv/idss/config and IDSS_STATE_DIR=/var/lib/idss (GatewayEnvDir) only when present, and returns an error naming the var and path when absent — TestResolveGatewayClanEnv_RefusesLoudWhenARequiredPathIsAbsent"
  },
  "summary": "set-release-channel --apply builds the gateway's clan-runner environment itself from one shared source (clan.GatewayClanEnv) the unit's start script also renders, so the land-step is the bare command an operator types with no eight-var SSH prefix (#1665).",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1665 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1665, "status": "success", "commits": [ "9c956b335ed14f1820d9a90f6b6c7b5832531b34" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/updatesJourney.test.ts", "app/tests/e2e/fixtures/updatesJourney.ts", "app/tests/e2e/journey.updates.spec.ts", "control-plane/cmd/control-plane/channel_env.go", "control-plane/cmd/control-plane/main.go", "docs/GOTCHAS.md", "docs/architecture/11-update-supply-chain.md", "internal/clan/gatewayclanenv.go", "internal/clan/gatewayclanenv_test.go", "internal/clan/testdata/drvpath-baseline.txt", "internal/clan/vmguest.go", "internal/clan/vmguest_test.go" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan/ ./control-plane/cmd/control-plane/ -count=1", "exit_code": 0 }, { "command": "IDSS_EVAL_SMOKE=1 IDSS_EVAL_SMOKE_UPDATE=1 nix develop .#go-ci -c go test ./internal/clan/ -run TestSeedCommunity_EvalSmoke -count=1", "exit_code": 0 }, { "command": "nix develop ..#e2e -c pnpm vitest run tests/e2e/fixtures/updatesJourney.test.ts", "exit_code": 0 }, { "command": "nix develop ..#e2e -c pnpm exec eslint tests/e2e/fixtures/updatesJourney.ts tests/e2e/journey.updates.spec.ts tests/e2e/fixtures/updatesJourney.test.ts", "exit_code": 0 }, { "command": "git push origin HEAD:refs/heads/main (pre-push gate: go build/vet/test + eslint)", "exit_code": 0 } ], "criteria": { "Seam test: with an EMPTY caller environment, --apply's clan invocation carries HOME, SOPS_AGE_KEY_FILE, the git identity and the config/state dirs": "internal/clan/gatewayclanenv_test.go TestResolveGatewayClanEnv_FillsTheWholeEnvFromAnEmptyCallerEnv — asserts an empty caller env fills HOME, SOPS_AGE_KEY_FILE, GIT_AUTHOR/COMMITTER_{NAME,EMAIL}, IDSS_CONFIG_REPO and IDSS_STATE_DIR; ResolveGatewayClanEnv is what ensureGatewayClanEnv (channel_env.go) sets into os.Environ() before --apply shells the ExecCLI clan runner", "A test pins that the unit's start script and --apply draw from the same source (no second hand-written list)": "internal/clan/gatewayclanenv_test.go TestGatewayClanEnv_UnitScriptAndApplyAgree + TestGatewayClanEnvExports_RenderEveryVarFromTheSharedSource — the unit's start script renders from clan.GatewayClanEnv via gatewayClanEnvExports (vmguest.go now embeds %[11]s), and ResolveGatewayClanEnv reads the same list; both tests prove every var agrees", "realRailLandStep carries no env prefix; fixture tests updated": "app/tests/e2e/fixtures/updatesJourney.ts realRailLandStep() now returns the bare `<bin> set-release-channel --apply <node> <feed> <key>`; updatesJourney.test.ts rewritten to assert NO env prefix (no HOME=/IDSS_*=/SOPS_/GIT_ and no cd); fixture vitest 20/20 green", "Runbook + GOTCHAS + STATUS in the same commit": "docs/architecture/11-update-supply-chain.md §Landing the channel shows the bare command and names /srv/idss/bin/control-plane; docs/GOTCHAS.md #291 added; STATUS.md header + milestone entry — all in commit 9c956b33", "--apply builds its own environment from one shared source; explicit caller env wins": "internal/clan/gatewayclanenv.go GatewayClanEnv (single source) + ResolveGatewayClanEnv (explicit lookup wins, proven by TestResolveGatewayClanEnv_CallerEnvWins); control-plane/cmd/control-plane/channel_env.go ensureGatewayClanEnv wired into main.go --apply branch before pin + exec apply read the env", "Sensible defaults for the two IDSS paths when unset and present; refuse loud if absent (ADR 0100), naming what was looked for": "ResolveGatewayClanEnv defaults IDSS_CONFIG_REPO=/srv/idss/config and IDSS_STATE_DIR=/var/lib/idss (GatewayEnvDir) only when present, and returns an error naming the var and path when absent — TestResolveGatewayClanEnv_RefusesLoudWhenARequiredPathIsAbsent" }, "summary": "set-release-channel --apply builds the gateway's clan-runner environment itself from one shared source (clan.GatewayClanEnv) the unit's start script also renders, so the land-step is the bare command an operator types with no eight-var SSH prefix (#1665).", "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#1665
No description provided.