In-built self-update: archied update replaces the update scripts #1648

Open
opened 2026-10-27 13:41:14 +00:00 by sam · 1 comment
Owner

Updates run in Go inside the existing binaries instead of the bash scripts archie-update-check, archie-update-install and archie-update-watchdog. Done when the scripts and the code that runs commands and parses ARCHIE_UPDATE_RESULT are deleted, and Install on Settings > Status, chat /update and automatic installs all call one Go path. The --from-source build mode is dropped.


Imported from beads archie-core-wmvy · GitHub #1528 · type epic · priority P1 · created 2026-10-06

Updates run in Go inside the existing binaries instead of the bash scripts archie-update-check, archie-update-install and archie-update-watchdog. Done when the scripts and the code that runs commands and parses ARCHIE_UPDATE_RESULT are deleted, and Install on Settings > Status, chat /update and automatic installs all call one Go path. The --from-source build mode is dropped. --- _Imported from beads `archie-core-wmvy` · GitHub #1528 · type epic · priority P1 · created 2026-10-06_
sam added the highepic labels 2026-10-27 13:41:14 +00:00
sam self-assigned this 2026-10-27 13:41:14 +00:00
Author
Owner

archie's PRD is ready -- awaiting your go/no-go.

PRD: in-built self-update (#1648)

Recommendation: green-light the small parts, and settle one decision first. Three of the epic's four done-criteria already hold in this tree. What remains is (a) deleting the subprocess between releaseupdate and the daemon's host transaction, (b) dropping --from-source, and (c) the chat /update install, which is new behaviour rather than consolidation. (b) and (c) are cheap. (a) is the whole PRD, because it forces a choice of where the daemon's host wiring lives. My recommendation is a new DaemonService.InstallRelease streaming RPC.

1. Restating the epic against the tree

Verified on feat/1648-… at 1.61.3, empty [Unreleased]:

Criterion State
Bash scripts deleted Already done. No scripts/ directory. archie-update-check|install|watchdog appears only in CHANGELOG.md:296,1225 and docs/news/releases.json — history, which is not rewritten. Nothing in Taskfile.yml, .woodpecker/, install.sh or internal/releaseupdate references them.
Updates run in Go Already done. archied update check|install|watchdog|agent-image (internal/app/archied/update.go:39-57); transaction, journal, watchdog, DB backup/restore, topology plan and rollback in internal/releaseupdate (20 files); releaseupdate.WatchdogBinary = "archied" (transaction.go:39) — the watchdog is a frozen copy of the daemon.
One path from every entry point Already done, up to one hop. Settings → Status Install posts /api/chat/update/install (ui/src/lib/api.ts:349 → internal/webui/chat.go:598-641); the release canary posts to the same endpoint (releaseupdate/canary_dashboard.go:259, driven by .woodpecker/canary.yaml → archied release canary check -dashboard); both end in releaseupdate.Service.Install (service.go:207). There is no other automatic install path in the tree — no scheduler and no alert-driven install (alerts only check: internal/app/archied/alerts.go:275).
Delete the code that runs commands and parses ARCHIE_UPDATE_RESULT Not done. ArchiedInstaller execs the sibling archied (installer.go:60-70), scans stdout for ResultSentinel (installer.go:79-84, const at :21), and runUpdateInstall prints that line (update.go:148).
Drop --from-source Not done. install.sh:35,53,73,171,190; README.md:119.

So the epic's wording hides the work: the only real technical item is the subprocess, and the only real product item is chat /update.

2. The decision this PRD exists to settle

Service.Install reaches the host transaction by spawning the daemon because the wiring is unexported in package archied: hostTransaction (update.go:196), systemdUnits/dockerImages/stateDatabase/daemonHealth (update_host.go, ~113 lines, which imports internal/app/statestore), imagePolicy (update_image.go, ~78 lines), spawnWatchdog (update.go:207-238).

  • (a) archie-ui/archie-gateway import the daemon's wiring. Violates cmd → app → {domain, infrastructure} and drags internal/app/statestore across an app boundary.
  • (b) move ~250 lines of host wiring into a shared internal/infrastructure package. Not just a move: stateDatabase composes statestore.RunRecovery, whose own doc comment says it depends on openStateStoreControlPlane — the state store's app root (internal/app/statestore/recovery.go:11-16). Only cmd/archie-state-store and internal/app/archied import that package today. Moving the wiring as-is makes two more binaries import another service's app package, so (b) also means relocating or splitting the state store's recovery code — larger than the 250 lines it looks like.
  • (c) add a streaming install RPC to the Daemon contract. proto/daemon/v1/daemon.proto has only CheckRepository. Rule-consistent ("services own contracts", "a new binary exists only for a new service or a real process boundary"), and the client side already exists: the UI dials the daemon's listener for CheckRepository (internal/app/archieui/run.go:146, internal/infrastructure/daemonrpc/client.go:31). Cost: proto + generated code + a streaming progress channel. AGENTS.md says a new mechanism gets stopped and assessed — this is that assessment.
  • (d) fallback if the maintainer rejects a new RPC: keep the exec, delete only the sentinel. Pass -result FILE; the child writes the Result JSON there and the parent reads it after cmd.Wait(). ~20 lines changed, no new mechanism — but it does not meet the epic's "delete the code that runs commands".

Recommendation: (c). It deletes the hop rather than relocating it, keeps the daemon the single owner of the host transaction (it is the only binary that ever ran systemdUnits, dockerHealth, the DB backup and the image policy), and removes the odd shape where the caller computes the distribution source and passes it to a child via flags.

Two facts found while checking make (c) cheaper than it looks, and one risk it does not remove:

  • Concurrency is already solved in the transaction. Transaction.Prepare takes the state lock non-waiting and returns ErrInstallInProgress (prepare.go:66-75), and refuses if a journal exists. No new daemon-side guard is needed; the webui's own updateInProgress mutex (chat.go:618) stays as a UX gate.
  • The daemon can read the update settings itself. It already does: controlplanerpc.UpdateService(reader, "").Catalog at alerts.go:275 over b.controlPlaneRPC. So the RPC request carries the version and the report meta, not -source/-key/-channel.
  • Risk, and its mitigation: the watchdog stops units in reverse release.json order, so archied is stopped first, and an RPC running inside archied could be cut off before it returns. Prepare finishes before spawnWatchdog is called, so the window is small, and the harness listener already drains in-flight RPCs with a 10s capped GracefulStop (harness.go:227-231). The handler must return immediately after spawning, and the web-ui handler must treat a dropped stream after the request was sent as "install started, outcome arrives via the phase-2 report" — the same rule the canary already applies (canary_dashboard.go:243-249). This must be exercised on a real systemd host before the change is called done; I have not run it.
  • Consequence to accept: a host whose daemon will not start can no longer be updated from the dashboard. The CLI stays (archied update install, documented in deployments/systemd-user-service.md:38 and deployments/INSTRUCTIONS.md:81), so that host still has a path.

3. Proposed solution

3.1 Daemon contract. In proto/daemon/v1/daemon.proto:

rpc InstallRelease(InstallReleaseRequest) returns (stream InstallReleaseEvent);
message InstallReleaseRequest {
  string version = 1;            // the version the operator approved
  string report_path = 2;        // phase-2 report file, as InstallMeta today
  string channel = 3; int64 chat_id = 4; int32 thread_id = 5;
}
message InstallReleaseEvent {
  oneof event { string progress = 1; InstallReleaseResult result = 2; }
}
message InstallReleaseResult {
  map<string,string> previous = 1; map<string,string> installed = 2;
  bool restart_requested = 3;
}

Progress lines are the Transaction.Progress callback (update.go:207 already routes it to stdout).

3.2 One Go path, in archied. Extract the body of runUpdateInstall into installRelease(ctx, configPath, binDir, version, source, meta, progress) (releaseupdate.Result, error) doing hostTransaction → Prepare → spawnWatchdog. Two callers:

  • the existing CLI archied update install (unchanged flags, unchanged operator use), which prints the result as human lines instead of the ARCHIE_UPDATE_RESULT sentinel;
  • a new handler in repositoryServer (or a sibling installServer) that streams progress then the result, reads update-settings from the control plane for the source, and returns Result mapped into InstallReleaseResult.

Authorization follows the existing CheckRepository pattern (repository_check.go:31-48): require a signed-in principal and Access.Authorize(principal, access.ActionUpdate, …), because rpcidentity.Callers does no method-level gating and the install runs with the daemon's credentials. The dashboard already requires the same action at /api/chat/update/install (internal/webui/authorize.go:412), so this is a re-check, not a new policy.

3.3 Client and deletion. Replace ArchiedInstaller with a DaemonInstaller in internal/releaseupdate implementing Installer and Installable: stream events, forward progress, build the Result. Delete ArchiedInstaller, ResultSentinel and the exec/scanner entirely. ErrNotConfigured (declared in installer.go:25, referenced by internal/webui/chat.go:533) moves to service.go or goes away with its one caller. Wire it in internal/infrastructure/controlplanerpc/vocabulary.go:132-145, where UI (archieui/run.go:92) and gateway (archiegateway/chat_setup.go:105) both build their releaseupdate.Service. CanInstall becomes "a daemon target is configured": today it probes for an executable beside the caller (installer.go:34-44), and with no cheap RPC to probe there is no honest second answer. A stale or unreachable daemon then surfaces as an install error, which the dashboard already renders (VersionsCard.vue:150-155).

3.4 Chat /update install — recommend splitting out. /update only reports today (gateway.go:365-389 → handleUpdateCheck), and gateway.UpdateService declares Defer and Install that nothing calls (gateway.go:83-84; the only Updates.Install/Updates.Defer call sites are internal/webui/chat.go:587,633 on webui's own interface). So the epic's "chat /update … call one Go path" is new behaviour: a command to trigger an install from chat, plus the gateway dialling the daemon (it does not today — internal/app/archiegateway has no daemon client). Authorization is already settled: /update is admin-only (internal/gateway/slash_access.go:50). Two sub-items belong here regardless: delete the two dead interface methods, and file the chat-triggered install as its own issue with its own confirmation UX. If the maintainer wants it in this change, it is +~40 lines (path args, a confirm step, gateway daemon dial) on top of the above.

3.5 Drop --from-source. Remove the flag, its usage lines, the git clone + go build block and the git go jq prerequisite branch from install.sh; rewrite the x86_64 error at :174 (it currently tells the user to "use --from-source") to say what is actually supported; drop the sentence at README.md:119. Say the consequence out loud in the changelog: releases are linux-amd64 only (prepare.go:113 refuses other GOOS/GOARCH, release.json names linux-amd64), so a non-x86_64 host has task build and an operator running archied update install by hand, and nothing else. README.md:102 already requires x86_64, so this deletes an escape hatch the product never supported. install.sh:14-15 MODULE/SOURCE_GIT and the LDFLAGS dev-stamp line go with it.

3.6 Docs. deployments/INSTRUCTIONS.md:81-100 documents the subprocess form ("runs archied update install -version X", "hands the transaction to archied update watchdog") and must describe the dashboard asking the daemon, with the watchdog step unchanged. deployments/systemd-user-service.md:38,177 describe the CLI path and stay valid. CHANGELOG entry under [Unreleased], sequenced as a change to the install path and the installer flag, not a fix.

4. Files and components affected

  • proto/daemon/v1/daemon.proto; internal/contracts/daemon/v1/* (regenerated, committed — task proto:generate)
  • internal/app/archied/update.go (extract installRelease, drop the sentinel print), new update_install_rpc.go (handler), internal/app/archied/harness.go:214 (register)
  • internal/infrastructure/daemonrpc/client.go (streaming client)
  • internal/releaseupdate/installer.go (deleted) → internal/releaseupdate/daemon_installer.go; service.go (ErrNotConfigured, if it survives)
  • internal/infrastructure/controlplanerpc/vocabulary.go:128-147
  • internal/app/archieui/run.go:92, internal/app/archiegateway/chat_setup.go:105 (installer argument; gateway only if chat install is in scope)
  • internal/gateway/gateway.go:81-85 (delete dead methods)
  • internal/webui/chat.go:598-641 (dropped-stream handling; progress/result shape unchanged — VersionsCard.vue:143-150 reads progress[] and result.installed)
  • install.sh, README.md:119, deployments/INSTRUCTIONS.md:79-100, CHANGELOG.md
  • Unaffected: internal/releaseupdate/{transaction,prepare,topology,promote,canary,journal} internals and transaction_test.go, topology_test.go, promote_test.go, canary_test.go, release_test.go. No installer_test.go exists, so nothing is orphaned.

5. Acceptance criteria

  1. internal/releaseupdate/installer.go is gone, ResultSentinel/ARCHIE_UPDATE_RESULT appear nowhere in the tree, and no package outside internal/app/archied spawns archied to install.
  2. Settings → Status → Install installs a release end to end on a systemd host: progress appears, result.installed shows archied and archie-agent, the watchdog restarts the units, and the outcome panel fills from the phase-2 report. Verified by hand on a host, not by unit test.
  3. A second install request while one is preparing is refused with an explicit message, not a second journal (via Prepare's lock and the webui mutex).
  4. archied update install -version X from a shell still installs, still refuses an unmanaged host's missing unit with the printed migration plan (checkUpdateTopology), and prints the outcome without a sentinel line. archied update install -version X on a host with a pending journal still says so.
  5. The daemon's install RPC refuses an unauthenticated caller and one without ActionUpdate, and the refusal is covered by a test at the seam (security boundary — the one place AGENTS.md wants a test).
  6. install.sh --from-source is rejected as an unknown option; install.sh on a non-x86_64 host fails with a message that names the real alternatives; a normal x86_64 install is unchanged.
  7. gateway.UpdateService declares only Check (or Check + whatever the chat-install issue wires), and go build ./... proves nothing referenced the removed methods.
  8. task check is green on the tree that ships it, including task proto:generate producing no diff.

6. Non-goals

  • Rewriting Transaction, the journal, the watchdog, topology migration or rollback. Unchanged.
  • Changing the --from-source removal into a supported arm64/other-arch release path. If that is wanted it is its own issue, and prepare.go's runtime.GOARCH != amd64 refusal plus the signed statement's platform field are the real work.
  • Kit/dev-time installs (task build, deployments/dev.toml) — untouched by --from-source.
  • Editing history: CHANGELOG.md pre-1.61 entries and docs/news/releases.json keep their archie-update-* mentions.
  • An "update now" button on the canary or alert surfaces. Alerts stay read-only.

7. Estimated diff size

Hand-written: ≈ +120 / −150.

  • Deletions: installer.go −85; update.go sentinel/marshal −10; gateway.go −3; install.sh −~35; README.md −1.
  • Additions: daemon handler + extracted install function ~+70; daemon_installer.go ~+55; daemonrpc client ~+25; vocabulary.go ±10; docs/changelog ~+10.
  • Generated: ~+200 in internal/contracts/daemon/v1/ from task proto:generate, committed with the change.

For comparison: option (b) is ≈ +250/−250 of moved code plus a decision about internal/app/statestore's recovery code being imported by two more binaries; option (d) is ≈ +20/−40 and leaves the epic's fourth criterion unmet. Chat-triggered /update install, if included, adds ~+40.

8. Open questions for the maintainer

  1. Removal path — (c) streaming RPC (recommended), (b) shared infrastructure package, or (d) keep the exec and delete only the sentinel? If the answer is (b), the state store's recovery code has to move; that is a second PRD.
  2. Is chat /update install in this change or its own issue? Recommended: its own issue. It is the only genuinely new behaviour in the epic, it needs the gateway to dial the daemon, and it needs a confirmation step before an install runs from chat.
  3. Is "dashboard install requires a running daemon" acceptable? Recommended: yes, with the CLI kept as the recovery path; today's dashboard install only works because it spawns a sibling binary, so it is not a capability the daemon-down case actually had end to end.

Nothing in this PRD was executed against a live systemd host; the two things that need a real host to confirm are the RPC response surviving the watchdog's stop and the progress stream reaching the dashboard across the restart.

Decide in chat or on the dashboard.

**archie's PRD is ready -- awaiting your go/no-go.** # PRD: in-built self-update (#1648) **Recommendation: green-light the small parts, and settle one decision first.** Three of the epic's four done-criteria already hold in this tree. What remains is (a) deleting the subprocess between `releaseupdate` and the daemon's host transaction, (b) dropping `--from-source`, and (c) the chat `/update` install, which is new behaviour rather than consolidation. (b) and (c) are cheap. (a) is the whole PRD, because it forces a choice of where the daemon's host wiring lives. My recommendation is a new `DaemonService.InstallRelease` streaming RPC. ## 1. Restating the epic against the tree Verified on `feat/1648-…` at 1.61.3, empty `[Unreleased]`: | Criterion | State | | --- | --- | | Bash scripts deleted | **Already done.** No `scripts/` directory. `archie-update-check\|install\|watchdog` appears only in `CHANGELOG.md:296,1225` and `docs/news/releases.json` — history, which is not rewritten. Nothing in `Taskfile.yml`, `.woodpecker/`, `install.sh` or `internal/releaseupdate` references them. | | Updates run in Go | **Already done.** `archied update check\|install\|watchdog\|agent-image` (`internal/app/archied/update.go:39-57`); transaction, journal, watchdog, DB backup/restore, topology plan and rollback in `internal/releaseupdate` (20 files); `releaseupdate.WatchdogBinary = "archied"` (`transaction.go:39`) — the watchdog is a frozen copy of the daemon. | | One path from every entry point | **Already done, up to one hop.** Settings → Status Install posts `/api/chat/update/install` (`ui/src/lib/api.ts:349` → `internal/webui/chat.go:598-641`); the release canary posts to the same endpoint (`releaseupdate/canary_dashboard.go:259`, driven by `.woodpecker/canary.yaml` → `archied release canary check -dashboard`); both end in `releaseupdate.Service.Install` (`service.go:207`). There is no other automatic install path in the tree — no scheduler and no alert-driven install (alerts only *check*: `internal/app/archied/alerts.go:275`). | | Delete the code that runs commands and parses `ARCHIE_UPDATE_RESULT` | **Not done.** `ArchiedInstaller` execs the sibling archied (`installer.go:60-70`), scans stdout for `ResultSentinel` (`installer.go:79-84`, const at `:21`), and `runUpdateInstall` prints that line (`update.go:148`). | | Drop `--from-source` | **Not done.** `install.sh:35,53,73,171,190`; `README.md:119`. | So the epic's wording hides the work: the only real technical item is the subprocess, and the only real product item is chat `/update`. ## 2. The decision this PRD exists to settle `Service.Install` reaches the host transaction by spawning the daemon because the wiring is unexported in `package archied`: `hostTransaction` (`update.go:196`), `systemdUnits`/`dockerImages`/`stateDatabase`/`daemonHealth` (`update_host.go`, ~113 lines, which imports `internal/app/statestore`), `imagePolicy` (`update_image.go`, ~78 lines), `spawnWatchdog` (`update.go:207-238`). - **(a) archie-ui/archie-gateway import the daemon's wiring.** Violates `cmd → app → {domain, infrastructure}` and drags `internal/app/statestore` across an app boundary. - **(b) move ~250 lines of host wiring into a shared `internal/infrastructure` package.** Not just a move: `stateDatabase` composes `statestore.RunRecovery`, whose own doc comment says it depends on `openStateStoreControlPlane` — the state store's app root (`internal/app/statestore/recovery.go:11-16`). Only `cmd/archie-state-store` and `internal/app/archied` import that package today. Moving the wiring as-is makes two more binaries import another service's app package, so (b) also means relocating or splitting the state store's recovery code — larger than the 250 lines it looks like. - **(c) add a streaming install RPC to the Daemon contract.** `proto/daemon/v1/daemon.proto` has only `CheckRepository`. Rule-consistent ("services own contracts", "a new binary exists only for a new service or a real process boundary"), and the client side already exists: the UI dials the daemon's listener for `CheckRepository` (`internal/app/archieui/run.go:146`, `internal/infrastructure/daemonrpc/client.go:31`). Cost: proto + generated code + a streaming progress channel. `AGENTS.md` says a new mechanism gets stopped and assessed — this is that assessment. - **(d) fallback if the maintainer rejects a new RPC: keep the exec, delete only the sentinel.** Pass `-result FILE`; the child writes the `Result` JSON there and the parent reads it after `cmd.Wait()`. ~20 lines changed, no new mechanism — but it does not meet the epic's "delete the code that runs commands". **Recommendation: (c).** It deletes the hop rather than relocating it, keeps the daemon the single owner of the host transaction (it is the only binary that ever ran `systemdUnits`, `dockerHealth`, the DB backup and the image policy), and removes the odd shape where the caller computes the distribution source and passes it to a child via flags. Two facts found while checking make (c) cheaper than it looks, and one risk it does not remove: - **Concurrency is already solved in the transaction.** `Transaction.Prepare` takes the state lock non-waiting and returns `ErrInstallInProgress` (`prepare.go:66-75`), and refuses if a journal exists. No new daemon-side guard is needed; the webui's own `updateInProgress` mutex (`chat.go:618`) stays as a UX gate. - **The daemon can read the update settings itself.** It already does: `controlplanerpc.UpdateService(reader, "").Catalog` at `alerts.go:275` over `b.controlPlaneRPC`. So the RPC request carries the version and the report meta, not `-source`/`-key`/`-channel`. - **Risk, and its mitigation:** the watchdog stops units in reverse `release.json` order, so `archied` is stopped first, and an RPC running *inside* archied could be cut off before it returns. `Prepare` finishes before `spawnWatchdog` is called, so the window is small, and the harness listener already drains in-flight RPCs with a 10s capped `GracefulStop` (`harness.go:227-231`). The handler must return immediately after spawning, and the web-ui handler must treat a dropped stream after the request was sent as "install started, outcome arrives via the phase-2 report" — the same rule the canary already applies (`canary_dashboard.go:243-249`). This must be exercised on a real systemd host before the change is called done; I have not run it. - **Consequence to accept:** a host whose daemon will not start can no longer be updated from the dashboard. The CLI stays (`archied update install`, documented in `deployments/systemd-user-service.md:38` and `deployments/INSTRUCTIONS.md:81`), so that host still has a path. ## 3. Proposed solution **3.1 Daemon contract.** In `proto/daemon/v1/daemon.proto`: ``` rpc InstallRelease(InstallReleaseRequest) returns (stream InstallReleaseEvent); message InstallReleaseRequest { string version = 1; // the version the operator approved string report_path = 2; // phase-2 report file, as InstallMeta today string channel = 3; int64 chat_id = 4; int32 thread_id = 5; } message InstallReleaseEvent { oneof event { string progress = 1; InstallReleaseResult result = 2; } } message InstallReleaseResult { map<string,string> previous = 1; map<string,string> installed = 2; bool restart_requested = 3; } ``` Progress lines are the `Transaction.Progress` callback (`update.go:207` already routes it to stdout). **3.2 One Go path, in archied.** Extract the body of `runUpdateInstall` into `installRelease(ctx, configPath, binDir, version, source, meta, progress) (releaseupdate.Result, error)` doing `hostTransaction` → `Prepare` → `spawnWatchdog`. Two callers: - the existing CLI `archied update install` (unchanged flags, unchanged operator use), which prints the result as human lines instead of the `ARCHIE_UPDATE_RESULT` sentinel; - a new handler in `repositoryServer` (or a sibling `installServer`) that streams progress then the result, reads update-settings from the control plane for the source, and returns `Result` mapped into `InstallReleaseResult`. Authorization follows the existing `CheckRepository` pattern (`repository_check.go:31-48`): require a signed-in principal and `Access.Authorize(principal, access.ActionUpdate, …)`, because `rpcidentity.Callers` does no method-level gating and the install runs with the daemon's credentials. The dashboard already requires the same action at `/api/chat/update/install` (`internal/webui/authorize.go:412`), so this is a re-check, not a new policy. **3.3 Client and deletion.** Replace `ArchiedInstaller` with a `DaemonInstaller` in `internal/releaseupdate` implementing `Installer` and `Installable`: stream events, forward progress, build the `Result`. Delete `ArchiedInstaller`, `ResultSentinel` and the exec/scanner entirely. `ErrNotConfigured` (declared in `installer.go:25`, referenced by `internal/webui/chat.go:533`) moves to `service.go` or goes away with its one caller. Wire it in `internal/infrastructure/controlplanerpc/vocabulary.go:132-145`, where UI (`archieui/run.go:92`) and gateway (`archiegateway/chat_setup.go:105`) both build their `releaseupdate.Service`. `CanInstall` becomes "a daemon target is configured": today it probes for an executable beside the caller (`installer.go:34-44`), and with no cheap RPC to probe there is no honest second answer. A stale or unreachable daemon then surfaces as an install error, which the dashboard already renders (`VersionsCard.vue:150-155`). **3.4 Chat `/update` install — recommend splitting out.** `/update` only reports today (`gateway.go:365-389` → `handleUpdateCheck`), and `gateway.UpdateService` declares `Defer` and `Install` that nothing calls (`gateway.go:83-84`; the only `Updates.Install`/`Updates.Defer` call sites are `internal/webui/chat.go:587,633` on webui's own interface). So the epic's "chat /update … call one Go path" is new behaviour: a command to trigger an install from chat, plus the gateway dialling the daemon (it does not today — `internal/app/archiegateway` has no daemon client). Authorization is already settled: `/update` is admin-only (`internal/gateway/slash_access.go:50`). Two sub-items belong here regardless: delete the two dead interface methods, and file the chat-triggered install as its own issue with its own confirmation UX. If the maintainer wants it in this change, it is +~40 lines (path args, a confirm step, gateway daemon dial) on top of the above. **3.5 Drop `--from-source`.** Remove the flag, its usage lines, the `git clone` + `go build` block and the `git go jq` prerequisite branch from `install.sh`; rewrite the x86_64 error at `:174` (it currently tells the user to "use --from-source") to say what is actually supported; drop the sentence at `README.md:119`. Say the consequence out loud in the changelog: releases are linux-amd64 only (`prepare.go:113` refuses other `GOOS/GOARCH`, `release.json` names linux-amd64), so a non-x86_64 host has `task build` and an operator running `archied update install` by hand, and nothing else. `README.md:102` already requires x86_64, so this deletes an escape hatch the product never supported. `install.sh:14-15` `MODULE`/`SOURCE_GIT` and the `LDFLAGS` dev-stamp line go with it. **3.6 Docs.** `deployments/INSTRUCTIONS.md:81-100` documents the subprocess form ("runs `archied update install -version X`", "hands the transaction to `archied update watchdog`") and must describe the dashboard asking the daemon, with the watchdog step unchanged. `deployments/systemd-user-service.md:38,177` describe the CLI path and stay valid. CHANGELOG entry under `[Unreleased]`, sequenced as a change to the install path and the installer flag, not a fix. ## 4. Files and components affected - `proto/daemon/v1/daemon.proto`; `internal/contracts/daemon/v1/*` (regenerated, committed — `task proto:generate`) - `internal/app/archied/update.go` (extract `installRelease`, drop the sentinel print), new `update_install_rpc.go` (handler), `internal/app/archied/harness.go:214` (register) - `internal/infrastructure/daemonrpc/client.go` (streaming client) - `internal/releaseupdate/installer.go` (deleted) → `internal/releaseupdate/daemon_installer.go`; `service.go` (`ErrNotConfigured`, if it survives) - `internal/infrastructure/controlplanerpc/vocabulary.go:128-147` - `internal/app/archieui/run.go:92`, `internal/app/archiegateway/chat_setup.go:105` (installer argument; gateway only if chat install is in scope) - `internal/gateway/gateway.go:81-85` (delete dead methods) - `internal/webui/chat.go:598-641` (dropped-stream handling; progress/result shape unchanged — `VersionsCard.vue:143-150` reads `progress[]` and `result.installed`) - `install.sh`, `README.md:119`, `deployments/INSTRUCTIONS.md:79-100`, `CHANGELOG.md` - Unaffected: `internal/releaseupdate/{transaction,prepare,topology,promote,canary,journal}` internals and `transaction_test.go`, `topology_test.go`, `promote_test.go`, `canary_test.go`, `release_test.go`. No `installer_test.go` exists, so nothing is orphaned. ## 5. Acceptance criteria 1. `internal/releaseupdate/installer.go` is gone, `ResultSentinel`/`ARCHIE_UPDATE_RESULT` appear nowhere in the tree, and no package outside `internal/app/archied` spawns `archied` to install. 2. Settings → Status → Install installs a release end to end on a systemd host: progress appears, `result.installed` shows `archied` and `archie-agent`, the watchdog restarts the units, and the outcome panel fills from the phase-2 report. Verified by hand on a host, not by unit test. 3. A second install request while one is preparing is refused with an explicit message, not a second journal (via `Prepare`'s lock and the webui mutex). 4. `archied update install -version X` from a shell still installs, still refuses an unmanaged host's missing unit with the printed migration plan (`checkUpdateTopology`), and prints the outcome without a sentinel line. `archied update install -version X` on a host with a pending journal still says so. 5. The daemon's install RPC refuses an unauthenticated caller and one without `ActionUpdate`, and the refusal is covered by a test at the seam (security boundary — the one place `AGENTS.md` wants a test). 6. `install.sh --from-source` is rejected as an unknown option; `install.sh` on a non-x86_64 host fails with a message that names the real alternatives; a normal x86_64 install is unchanged. 7. `gateway.UpdateService` declares only `Check` (or `Check` + whatever the chat-install issue wires), and `go build ./...` proves nothing referenced the removed methods. 8. `task check` is green on the tree that ships it, including `task proto:generate` producing no diff. ## 6. Non-goals - Rewriting `Transaction`, the journal, the watchdog, topology migration or rollback. Unchanged. - Changing the `--from-source` removal into a supported arm64/other-arch release path. If that is wanted it is its own issue, and `prepare.go`'s `runtime.GOARCH != amd64` refusal plus the signed statement's platform field are the real work. - Kit/dev-time installs (`task build`, `deployments/dev.toml`) — untouched by `--from-source`. - Editing history: `CHANGELOG.md` pre-1.61 entries and `docs/news/releases.json` keep their `archie-update-*` mentions. - An "update now" button on the canary or alert surfaces. Alerts stay read-only. ## 7. Estimated diff size Hand-written: **≈ +120 / −150**. - Deletions: `installer.go` −85; `update.go` sentinel/marshal −10; `gateway.go` −3; `install.sh` −~35; `README.md` −1. - Additions: daemon handler + extracted install function ~+70; `daemon_installer.go` ~+55; `daemonrpc` client ~+25; `vocabulary.go` ±10; docs/changelog ~+10. - Generated: ~+200 in `internal/contracts/daemon/v1/` from `task proto:generate`, committed with the change. For comparison: option (b) is ≈ +250/−250 of moved code plus a decision about `internal/app/statestore`'s recovery code being imported by two more binaries; option (d) is ≈ +20/−40 and leaves the epic's fourth criterion unmet. Chat-triggered `/update` install, if included, adds ~+40. ## 8. Open questions for the maintainer 1. **Removal path — (c) streaming RPC (recommended), (b) shared infrastructure package, or (d) keep the exec and delete only the sentinel?** If the answer is (b), the state store's recovery code has to move; that is a second PRD. 2. **Is chat `/update` install in this change or its own issue?** Recommended: its own issue. It is the only genuinely new behaviour in the epic, it needs the gateway to dial the daemon, and it needs a confirmation step before an install runs from chat. 3. **Is "dashboard install requires a running daemon" acceptable?** Recommended: yes, with the CLI kept as the recovery path; today's dashboard install only works because it spawns a sibling binary, so it is not a capability the daemon-down case actually had end to end. Nothing in this PRD was executed against a live systemd host; the two things that need a real host to confirm are the RPC response surviving the watchdog's stop and the progress stream reaching the dashboard across the restart. _Decide in chat or on the dashboard._
sam added a new dependency 2026-11-14 14:45:15 +00:00
sam added a new dependency 2026-11-14 14:45:15 +00:00
sam added a new dependency 2026-11-14 14:45:15 +00:00
sam added the deferred label 2026-11-15 17:26:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1648