rehearsal-5 task 4/13: The gateway serves the one-liner — install script + seeded agent cache #845

Closed
opened 2026-08-25 20:14:32 +00:00 by ben · 4 comments
Owner

Part of the #183 phase-5 rehearsal arc (device-add + Nextcloud-on-device on a standing rented community).

  • Spec: docs/superpowers/specs/2026-08-25-183-phase-5-device-nextcloud-rehearsal-design.md
  • Plan: docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md — this ticket is Task 4, carried verbatim below. The plan's Global Constraints apply to every step.

Task 4: The gateway serves the one-liner — install script + seeded agent cache

Files:

  • Modify: internal/controlapi/install_doorway.go (+ its test) — bare GET /get (no arch) serves the POSIX install script
  • Create: internal/controlapi/installscript.go + installscript_test.go
  • Modify: internal/clan/* gateway facts (export IDSS_AGENT_CACHE=/var/lib/idss/agent-cache beside the existing gateway env exports — find them where IDSS_CLAIM_SECRET is exported) + the founding/provisioning supply step seeds the payload's pinned agent into that dir (follow Supply.Seed's existing pattern)
  • Modify: STATUS.md

Interfaces:

  • Consumes: install.NewCacheSource (exists), AgentSource (exists), the payload's agent-x86_64 artifact.

  • Produces: curl -sSf https://<apex>/get | sh -s -- <code> works verbatim on a stock Ubuntu box: the script detects arch (uname -m → x86_64), fetches /get?arch=x86_64 honoring X-IDSS-Release, installs to /usr/local/bin/idss-agent, then IDSS_COMMUNITY_ORIGIN=<apex> idss-agent install "$1". A gateway with nothing seeded still 503s loud on the arch fetch (ADR 0100).

  • Step 1: Write the failing doorway test — no-arch GET returns text/x-shellscript containing idss-agent install "$1" and the community origin; arch GET unchanged (regression assertions from the existing test kept).

  • Step 2: Run → FAIL; implement (script rendered from the request's Host); → PASS.

  • Step 3: Write the failing seed test (clan side): the gateway env file carries IDSS_AGENT_CACHE; the supply step's plan includes the agent artifact copy.

  • Step 4: Run → FAIL; implement; → PASS; go test ./... → PASS.

  • Step 5: Commit — git commit -m "rehearsal-5: the community gateway serves the install one-liner — /get script + seeded agent cache (ADR 0208/0051) (task 4 of #<ticket>)".


Global Constraints (from the plan)

  • Nothing fabricated (ADR 0100): every landed fact is read from the box; a
    failure is a named error, never a masked success. No sandbox-green claim (#377).
  • The wipe consent is given at the machine (ADR 0024) and shown-not-re-asked
    at P4-S3x; the takeover runs at provisioning's first deploy, never at join.
  • One placement deploy = device closure + gateway route in one config-repo
    commit, then two single-node clan.Deploy calls, device first (ruling: a
    route to a dead service is the honest failure, a service with no route is
    invisible).
  • Standing community: home test-results/standing-rented/; staleness gate =
    oc_bootstrap_staleness pattern over agent/ go.mod go.sum internal/; the
    reaper stays honest — renewal, not exemption (idss-rental-hold is for
    humans, the executor never sets it).
  • Do not destabilize live drives: #720 (rented confirm loop, elitebook) and
    #721/#722 (workstation) keep running; the prefix extraction (Task 10) is
    behavior-preserving and #720 must stay green across it. Never touch the
    executors' env files from a ticket.
  • Tracker gotcha: labels via POST/DELETE /issues/<n>/labels, never in an
    issue PATCH. "closes #NNN" in commit messages auto-closes — say "task N of
    #NNN" instead.
  • ADR numbers: 0207/0208/0209 assumed — re-check git ls-tree origin/main docs/adr/
    at mint (IDIP + observability swarm lanes are minting concurrently).
  • STATUS.md updated in the same commit as any project-state change;
    git pull --rebase immediately before a STATUS commit (shared checkout).
  • Go: gofmt, go vet ./..., go test ./... green; TS: pnpm -r typecheck +
    unit suites green, pre-land.
Part of the **#183 phase-5 rehearsal arc** (device-add + Nextcloud-on-device on a standing rented community). - Spec: `docs/superpowers/specs/2026-08-25-183-phase-5-device-nextcloud-rehearsal-design.md` - Plan: `docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md` — this ticket is **Task 4**, carried verbatim below. The plan's Global Constraints apply to every step. --- ### Task 4: The gateway serves the one-liner — install script + seeded agent cache **Files:** - Modify: `internal/controlapi/install_doorway.go` (+ its test) — bare `GET /get` (no `arch`) serves the POSIX install script - Create: `internal/controlapi/installscript.go` + `installscript_test.go` - Modify: `internal/clan/*` gateway facts (export `IDSS_AGENT_CACHE=/var/lib/idss/agent-cache` beside the existing gateway env exports — find them where `IDSS_CLAIM_SECRET` is exported) + the founding/provisioning supply step seeds the payload's pinned agent into that dir (follow `Supply.Seed`'s existing pattern) - Modify: `STATUS.md` **Interfaces:** - Consumes: `install.NewCacheSource` (exists), `AgentSource` (exists), the payload's `agent-x86_64` artifact. - Produces: `curl -sSf https://<apex>/get | sh -s -- <code>` works verbatim on a stock Ubuntu box: the script detects arch (`uname -m` → `x86_64`), fetches `/get?arch=x86_64` honoring `X-IDSS-Release`, installs to `/usr/local/bin/idss-agent`, then `IDSS_COMMUNITY_ORIGIN=<apex> idss-agent install "$1"`. A gateway with nothing seeded still 503s loud on the arch fetch (ADR 0100). - [ ] **Step 1: Write the failing doorway test** — no-arch GET returns `text/x-shellscript` containing `idss-agent install "$1"` and the community origin; arch GET unchanged (regression assertions from the existing test kept). - [ ] **Step 2: Run** → FAIL; **implement** (script rendered from the request's Host); → PASS. - [ ] **Step 3: Write the failing seed test** (clan side): the gateway env file carries `IDSS_AGENT_CACHE`; the supply step's plan includes the agent artifact copy. - [ ] **Step 4: Run** → FAIL; **implement**; → PASS; `go test ./...` → PASS. - [ ] **Step 5: Commit** — `git commit -m "rehearsal-5: the community gateway serves the install one-liner — /get script + seeded agent cache (ADR 0208/0051) (task 4 of #<ticket>)"`. --- ## Global Constraints (from the plan) - **Nothing fabricated (ADR 0100):** every landed fact is read from the box; a failure is a named error, never a masked success. No sandbox-green claim (#377). - **The wipe consent is given at the machine (ADR 0024)** and shown-not-re-asked at P4-S3x; the takeover runs at provisioning's first deploy, never at join. - **One placement deploy = device closure + gateway route** in one config-repo commit, then two single-node `clan.Deploy` calls, device first (ruling: a route to a dead service is the honest failure, a service with no route is invisible). - **Standing community:** home `test-results/standing-rented/`; staleness gate = `oc_bootstrap_staleness` pattern over `agent/ go.mod go.sum internal/`; the reaper stays honest — renewal, not exemption (`idss-rental-hold` is for humans, the executor never sets it). - **Do not destabilize live drives:** #720 (rented confirm loop, elitebook) and #721/#722 (workstation) keep running; the prefix extraction (Task 10) is behavior-preserving and #720 must stay green across it. Never touch the executors' env files from a ticket. - **Tracker gotcha:** labels via `POST/DELETE /issues/<n>/labels`, never in an issue PATCH. "closes #NNN" in commit messages auto-closes — say "task N of #NNN" instead. - **ADR numbers:** 0207/0208/0209 assumed — re-check `git ls-tree origin/main docs/adr/` at mint (IDIP + observability swarm lanes are minting concurrently). - **STATUS.md** updated in the same commit as any project-state change; `git pull --rebase` immediately before a STATUS commit (shared checkout). - Go: `gofmt`, `go vet ./...`, `go test ./...` green; TS: `pnpm -r typecheck` + unit suites green, pre-land.

ADR numbers ruled at mint — read 0207 → 0208, 0208 → 0209, 0209 → 0210

Task 1 (#842) has landed the phase-5 design tier. This ticket's body carries the
plan's assumed ADR numbers; they shifted by one at mint, exactly as the
Global Constraints line in your body told you to re-check.

assumed ruled ADR
0207 0208 the standing rehearsal community — staleness-gated re-found
0208 0209 device-add's landing goes live — mesh fact, fleet admission, /get
0209 0210 files on a member device — composition, OIDC split, mesh route

Why: docs/adr/0207-design-keri-stack-version-pins.md (#771, the concurrent
IDIP lane) had taken 0207 on origin/main before this arc minted.

Use the ruled numbers in your commit messages and code comments. The plan
(docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md)
is updated and records the mapping; commit 70a3bce6.

Ruled by agent under ADR 0174 — veto anytime.

## ADR numbers ruled at mint — read 0207 → 0208, 0208 → 0209, 0209 → 0210 Task 1 (#842) has landed the phase-5 design tier. This ticket's body carries the plan's **assumed** ADR numbers; they shifted by one at mint, exactly as the Global Constraints line in your body told you to re-check. | assumed | **ruled** | ADR | |---|---|---| | 0207 | **0208** | the standing rehearsal community — staleness-gated re-found | | 0208 | **0209** | device-add's landing goes live — mesh fact, fleet admission, `/get` | | 0209 | **0210** | files on a member device — composition, OIDC split, mesh route | Why: `docs/adr/0207-design-keri-stack-version-pins.md` (#771, the concurrent IDIP lane) had taken 0207 on `origin/main` before this arc minted. Use the **ruled** numbers in your commit messages and code comments. The plan (`docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md`) is updated and records the mapping; commit `70a3bce6`. Ruled by agent under ADR 0174 — veto anytime.

swarm-claim host=elitebook-distributed-server-03 run=10099
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10099 (automated multi-host claim — lowest live claim id works this ticket)

Ruled by agent under ADR 0174 — veto anytime (three two-way doors)

Building task 4/13, three under-specified choices were ruled in-flight. Each is
revertible by a later commit and proven by an existing seam test, none touches a
one-way door (no credentials, no security widening, no member trust, no data
loss, no spend):

  1. Bare /get script is opt-in, not the shared default. The /get doorway
    handler is REUSED by the get.idss.nz bootstrap (bootstrap/cmd/bootstrap),
    whose own founding one-liner lives at / and stops at install (no enroll,
    #582). Making bare /get serve the community device-add script unconditionally
    broke bootstrap's TestServeGet_FailsLoud and would have served a nonsense
    IDSS_COMMUNITY_ORIGIN=get.idss.nz idss-agent install there. So the community
    gateway wires a new WithInstallOneLiner (bare /get → script) while
    WithInstallDoorway stays arch-only (bare /get → 400). Proof:
    install_doorway_test.go (both faces) + bootstrap stays green.

  2. The payload's agent artifact is the cache source. The interface named
    "the payload's agent-x86_64 artifact"; the payload actually stages it as
    agent (assemble-payload.sh). fleetwire.Supply.Seed copies that into
    <cache>/x86_64/idss-agent. Proof: TestSupplySeed_SeedsAgentCache.

  3. RELEASE marker from a build-stampable fleetwire.Release var (defaults
    unknown, mirroring the agent's own version discipline — nothing stamps it
    yet across the repo). The cache needs a non-empty RELEASE for
    install.CacheSource/X-IDSS-Release; the supply step writes it LAST so a
    crash mid-copy never points a release at an absent binary (ADR 0100).

Residue named, not swept: nothing stamps fleetwire.Release at build yet (same
as agent/cmd/agent version), so a real deploy serves X-IDSS-Release: unknown
until a build stamps it — a follow-up, not a blocker for this slice.

## Ruled by agent under ADR 0174 — veto anytime (three two-way doors) Building task 4/13, three under-specified choices were ruled in-flight. Each is revertible by a later commit and proven by an existing seam test, none touches a one-way door (no credentials, no security widening, no member trust, no data loss, no spend): 1. **Bare `/get` script is opt-in, not the shared default.** The `/get` doorway handler is REUSED by the get.idss.nz bootstrap (`bootstrap/cmd/bootstrap`), whose own founding one-liner lives at `/` and stops at install (no enroll, #582). Making bare `/get` serve the community device-add script unconditionally broke `bootstrap`'s `TestServeGet_FailsLoud` and would have served a nonsense `IDSS_COMMUNITY_ORIGIN=get.idss.nz idss-agent install` there. So the community gateway wires a new `WithInstallOneLiner` (bare `/get` → script) while `WithInstallDoorway` stays arch-only (bare `/get` → 400). Proof: `install_doorway_test.go` (both faces) + `bootstrap` stays green. 2. **The payload's `agent` artifact is the cache source.** The interface named "the payload's `agent-x86_64` artifact"; the payload actually stages it as `agent` (`assemble-payload.sh`). `fleetwire.Supply.Seed` copies that into `<cache>/x86_64/idss-agent`. Proof: `TestSupplySeed_SeedsAgentCache`. 3. **RELEASE marker from a build-stampable `fleetwire.Release` var** (defaults `unknown`, mirroring the agent's own `version` discipline — nothing stamps it yet across the repo). The cache needs a non-empty `RELEASE` for `install.CacheSource`/`X-IDSS-Release`; the supply step writes it LAST so a crash mid-copy never points a release at an absent binary (ADR 0100). Residue named, not swept: nothing stamps `fleetwire.Release` at build yet (same as `agent/cmd/agent` `version`), so a real deploy serves `X-IDSS-Release: unknown` until a build stamps it — a follow-up, not a blocker for this slice.

close-report for #845 — status success

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

envelope
{
  "issue": 845,
  "status": "success",
  "commits": [
    "39ac606ad8a755af98adbacf2886e4aa282bf73f"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "internal/clan/agentcache_test.go",
    "internal/clan/vmguest.go",
    "internal/controlapi/install_doorway.go",
    "internal/controlapi/install_doorway_test.go",
    "internal/controlapi/installscript.go",
    "internal/fleetwire/supply.go",
    "internal/fleetwire/supply_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/fleetwire/",
      "exit_code": 0
    },
    {
      "command": "go test ./bootstrap/...",
      "exit_code": 0
    },
    {
      "command": "go test ./control-plane/...",
      "exit_code": 0
    },
    {
      "command": "go build ./... && go vet ./... && go test ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Bare GET /get serves a text/x-shellscript install script rendered from the request Host, containing idss-agent install \"$1\" and the community origin": "internal/controlapi/installscript.go (renderInstallScript) + install_doorway.go (WithInstallOneLiner bare-/get branch); TestInstallDoorway_BareGetServesInstallScript + TestInstallDoorway_BareGetRendersRequestHost",
    "GET /get?arch= unchanged (pinned binary, X-IDSS-Release header, 503 when nothing seeded)": "install_doorway.go arch branch unchanged; TestInstallDoorway_ArchGetServesPinnedAgent + TestInstallDoorway_ArchGetUnseededFailsLoud; bootstrap TestServeGet_FailsLoud stays green (arch-only WithInstallDoorway keeps 400)",
    "Gateway env file exports IDSS_AGENT_CACHE beside IDSS_CLAIM_SECRET": "internal/clan/vmguest.go gatewayEnvExports + AgentCacheDir const; TestGatewayEnvExports_CarriesAgentCache pins both gateway surfaces",
    "The founding/provisioning supply step seeds the payload's pinned agent into that dir (follow Supply.Seed pattern)": "internal/fleetwire/supply.go Seed plan gains staged agent copy to <cache>/x86_64/idss-agent + RELEASE marker; TestSupplySeed_SeedsAgentCache",
    "go test ./... green": "final tests entry exit_code 0"
  },
  "summary": "The community gateway's bare /get serves the POSIX install one-liner and its agent cache is exported by the gateway render and seeded by the supply step at deploy.",
  "blockers": []
}
**close-report** for #845 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 845, "status": "success", "commits": [ "39ac606ad8a755af98adbacf2886e4aa282bf73f" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "internal/clan/agentcache_test.go", "internal/clan/vmguest.go", "internal/controlapi/install_doorway.go", "internal/controlapi/install_doorway_test.go", "internal/controlapi/installscript.go", "internal/fleetwire/supply.go", "internal/fleetwire/supply_test.go" ], "tests": [ { "command": "go test ./internal/controlapi/", "exit_code": 0 }, { "command": "go test ./internal/clan/", "exit_code": 0 }, { "command": "go test ./internal/fleetwire/", "exit_code": 0 }, { "command": "go test ./bootstrap/...", "exit_code": 0 }, { "command": "go test ./control-plane/...", "exit_code": 0 }, { "command": "go build ./... && go vet ./... && go test ./...", "exit_code": 0 } ], "criteria": { "Bare GET /get serves a text/x-shellscript install script rendered from the request Host, containing idss-agent install \"$1\" and the community origin": "internal/controlapi/installscript.go (renderInstallScript) + install_doorway.go (WithInstallOneLiner bare-/get branch); TestInstallDoorway_BareGetServesInstallScript + TestInstallDoorway_BareGetRendersRequestHost", "GET /get?arch= unchanged (pinned binary, X-IDSS-Release header, 503 when nothing seeded)": "install_doorway.go arch branch unchanged; TestInstallDoorway_ArchGetServesPinnedAgent + TestInstallDoorway_ArchGetUnseededFailsLoud; bootstrap TestServeGet_FailsLoud stays green (arch-only WithInstallDoorway keeps 400)", "Gateway env file exports IDSS_AGENT_CACHE beside IDSS_CLAIM_SECRET": "internal/clan/vmguest.go gatewayEnvExports + AgentCacheDir const; TestGatewayEnvExports_CarriesAgentCache pins both gateway surfaces", "The founding/provisioning supply step seeds the payload's pinned agent into that dir (follow Supply.Seed pattern)": "internal/fleetwire/supply.go Seed plan gains staged agent copy to <cache>/x86_64/idss-agent + RELEASE marker; TestSupplySeed_SeedsAgentCache", "go test ./... green": "final tests entry exit_code 0" }, "summary": "The community gateway's bare /get serves the POSIX install one-liner and its agent cache is exported by the gateway render and seeded by the supply step at deploy.", "blockers": [] } ``` </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#845
No description provided.