engine-adapters: clan-adapter-enroll — install takeover + update join, resumable (Q2.2 contract) #163

Closed
opened 2026-07-29 05:09:26 +00:00 by ben · 1 comment
Owner

Parent

Engine-adapters child spec: #161 (ADRs 0102–0107; scoped on wayfinder #160 — Ben ruled live: per-family clan-lab smokes gate each family, the arc closes on a real-hardware end-to-end, tickets arm the swarm). Everything else agent-decided, post-hoc review pending.

What to build

The enrollment verbs real (ADR 0102): install (full-install takeover — kexec → disko → install → reboot, --phases resumable) and update (VM-mode join), carrying the Q2.2 takeover-ready reconciliations: captured network facts baked as a MAC-matched networkd config, hybrid BIOS+UEFI disko layout, and the interruption classes (severed control → resume; vanished host → timeout, classify, durable Enrollment blocks on a Remedy — never spins forever).

Acceptance criteria

  • Given a takeover-ready device, When the takeover is driven, Then the host is overwritten to NixOS and comes back a clan member over the established trust
  • Given a severed control connection mid-run, When the takeover is re-driven, Then it resumes idempotently to a reachable member
  • Given a host that vanished mid-write, When the install hangs, Then the adapter times out, classifies interrupted/connectivity, and the Enrollment blocks on a Remedy

Blocked by

  • engine-adapters:clan-adapter-core
  • bootstrap:enroll-seam — #26 (closed; satisfied)

Task manifest

task: engine-adapters:clan-adapter-enroll
implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)"
interface: "clan.Clan Enroll/Resume per docs/seams/clan.md — contract unchanged"
seam: "internal/clan + internal/enroll seam tests with fakes; contract tests over the scripted CLI double's install phases"
acceptance:
  - given: the Q2.2 phase log corpus; when: each interruption class replays; then: classification and resume match the spike findings
depends_on: [engine-adapters:clan-adapter-core, bootstrap:enroll-seam]
out_of_scope: [screen changes (no UI surface in this arc), the release source / rollout mechanics (out of arc, wayfinder #160)]
needs_human_decision: []
## Parent Engine-adapters child spec: #161 (ADRs 0102–0107; scoped on wayfinder #160 — Ben ruled live: per-family clan-lab smokes gate each family, the arc closes on a real-hardware end-to-end, tickets arm the swarm). Everything else agent-decided, post-hoc review pending. ## What to build The enrollment verbs real (ADR 0102): `install` (full-install takeover — kexec → disko → install → reboot, `--phases` resumable) and `update` (VM-mode join), carrying the Q2.2 takeover-ready reconciliations: captured network facts baked as a MAC-matched networkd config, hybrid BIOS+UEFI disko layout, and the interruption classes (severed control → resume; vanished host → timeout, classify, durable Enrollment blocks on a Remedy — never spins forever). ## Acceptance criteria - [ ] Given a takeover-ready device, When the takeover is driven, Then the host is overwritten to NixOS and comes back a clan member over the established trust - [ ] Given a severed control connection mid-run, When the takeover is re-driven, Then it resumes idempotently to a reachable member - [ ] Given a host that vanished mid-write, When the install hangs, Then the adapter times out, classifies interrupted/connectivity, and the Enrollment blocks on a Remedy ## Blocked by - engine-adapters:clan-adapter-core - bootstrap:enroll-seam — #26 (closed; satisfied) ## Task manifest ```yaml task: engine-adapters:clan-adapter-enroll implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)" interface: "clan.Clan Enroll/Resume per docs/seams/clan.md — contract unchanged" seam: "internal/clan + internal/enroll seam tests with fakes; contract tests over the scripted CLI double's install phases" acceptance: - given: the Q2.2 phase log corpus; when: each interruption class replays; then: classification and resume match the spike findings depends_on: [engine-adapters:clan-adapter-core, bootstrap:enroll-seam] out_of_scope: [screen changes (no UI surface in this arc), the release source / rollout mechanics (out of arc, wayfinder #160)] needs_human_decision: [] ```
Author
Owner

Landed in 77315f4 on origin/main.

ADR 0102 clan.Clan Enroll/Resume are now the real forward-only, snapshot-resumable state machine (internal/clan/enrollment.go): configure → preflight → install → verify → done, driving the pinned clan CLI headlessly.

  • Full-install runs the four takeover phases (kexec/disko/install/reboot) as separate clan machines install --phases <p> invocations; phase bookkeeping (DonePhases) makes a resume run only the derived retry subset and never re-run destructive disk work. VM-mode joins with a single update.
  • Q2.2 takeover-ready bake at configure: captured network facts → MAC-matched systemd-networkd config (with the explicit defaultGateway interface the spike assertion needs) + hybrid BIOS+UEFI disko, committed as ONE commit through the single writer (BuildNodeConfig → per-machine Nix under machines/<node>/), alongside the fresh deploy.targetHost (#162 deferred this per-operation SSH target to #163).
  • Interruption classes (Q2.2 §4): a severed control connection (ctx cancelled or CLI signal-killed) and a vanished host (install hangs → the seams own phase timeout fires → signal-kill) both TIME OUT rather than spin, classify interrupted/connectivity, and block the durable Enrollment on a resumable Remedy; a disko/ESP corruption blocks on a manual remedy, then the resume runs install,reboot only.
  • Classify absorbs two Q2.2 §4 findings: a signal-kill (rc 137/143) reads interrupted from the exit code first; a failed assertions eval failure classifies config_eval before the disk class.
  • Verify = deploy-over-established-connection (clan machines update, ADR 0028) over the community-signed host trust.

Acceptance — proven by contract tests over a scripted install-CLI double + a real single-writer git repo (internal/clan/enrollment_test.go):

  • AC1 (takeover-ready device → NixOS clan member): TestEnroll_FullInstallTakeoverBecomesMember — the bake (MAC networkd + EF02/EF00 disko), all four phases in order, then the verify update.
  • AC2 (severed control → resumes idempotently): TestEnroll_SeveredControlResumesIdempotently — the block is resumable, Resume drives to Done, and the whole install ran exactly once across the two objects.
  • AC3 (vanished host → times out, classifies, blocks on a Remedy): TestEnroll_VanishedHostTimesOutAndBlocks — a genuinely-hung CLI; the adapters phase timeout fires (never spins), classifies interrupted, blocks on a resumable Remedy.
  • Plus the disko-remedy→install,reboot-only path, the VM-mode join, and snapshot refuse-or-migrate.

Agent-decided (post-hoc review pending): per-phase --phases invocations (vs one multi-phase call) for testable phase bookkeeping; per-machine Nix rendering of the networkd/disko config.

go build ./... / vet / gofmt / the full Go suite (incl. -race) clean. The engine-adapters arc is complete — every child #162–#183 landed.

Landed in `77315f4` on `origin/main`. ADR 0102 `clan.Clan` `Enroll`/`Resume` are now the real forward-only, snapshot-resumable state machine (`internal/clan/enrollment.go`): configure → preflight → install → verify → done, driving the pinned clan CLI headlessly. - **Full-install** runs the four takeover phases (kexec/disko/install/reboot) as separate `clan machines install --phases <p>` invocations; phase bookkeeping (`DonePhases`) makes a resume run only the derived retry subset and never re-run destructive disk work. **VM-mode** joins with a single `update`. - **Q2.2 takeover-ready bake at configure**: captured network facts → MAC-matched systemd-networkd config (with the explicit `defaultGateway` interface the spike assertion needs) + hybrid BIOS+UEFI disko, committed as ONE commit through the single writer (`BuildNodeConfig` → per-machine Nix under `machines/<node>/`), alongside the fresh `deploy.targetHost` (#162 deferred this per-operation SSH target to #163). - **Interruption classes (Q2.2 §4)**: a severed control connection (ctx cancelled or CLI signal-killed) and a vanished host (install hangs → the seams own phase timeout fires → signal-kill) both TIME OUT rather than spin, classify interrupted/connectivity, and block the durable Enrollment on a **resumable** Remedy; a disko/ESP corruption blocks on a **manual** remedy, then the resume runs install,reboot only. - `Classify` absorbs two Q2.2 §4 findings: a signal-kill (rc 137/143) reads interrupted **from the exit code first**; a `failed assertions` eval failure classifies config_eval **before** the disk class. - **Verify** = deploy-over-established-connection (`clan machines update`, ADR 0028) over the community-signed host trust. **Acceptance** — proven by contract tests over a scripted install-CLI double + a real single-writer git repo (`internal/clan/enrollment_test.go`): - **AC1** (takeover-ready device → NixOS clan member): `TestEnroll_FullInstallTakeoverBecomesMember` — the bake (MAC networkd + EF02/EF00 disko), all four phases in order, then the verify update. - **AC2** (severed control → resumes idempotently): `TestEnroll_SeveredControlResumesIdempotently` — the block is resumable, Resume drives to Done, and the whole install ran exactly once across the two objects. - **AC3** (vanished host → times out, classifies, blocks on a Remedy): `TestEnroll_VanishedHostTimesOutAndBlocks` — a genuinely-hung CLI; the adapters phase timeout fires (never spins), classifies interrupted, blocks on a resumable Remedy. - Plus the disko-remedy→install,reboot-only path, the VM-mode join, and snapshot refuse-or-migrate. Agent-decided (post-hoc review pending): per-phase `--phases` invocations (vs one multi-phase call) for testable phase bookkeeping; per-machine Nix rendering of the networkd/disko config. `go build ./...` / `vet` / `gofmt` / the full Go suite (incl. `-race`) clean. **The engine-adapters arc is complete** — every child #162–#183 landed.
ben closed this issue 2026-07-30 01:44:16 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#163
No description provided.