engine-adapters: clan-adapter-core — the real clan.Clan drives the pinned CLI; single-writer config repo #162

Closed
opened 2026-07-29 05:09:22 +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 production clan.Clan core (ADR 0102): a Go adapter driving the pinned clan CLI headlessly — Deploy / Rollback / Readiness — with the control plane as the community config repo's single writer. Commit-then-apply-exact-revision; a tree with conflict markers is refused before commit; the layered outcome classifier is contract (connectivity before secrets, signal-kills by exit code, disk tokens only once disko runs — S13 + Q2.2). Nothing outside the adapter knows CLI shapes (DDR 0010).

Acceptance criteria

  • Given a committed revision and a reachable node, When Deploy runs, Then that exact revision is applied headlessly (no TTY hang) and the outcome is a structured verdict
  • Given a config that does not evaluate / a missing var / an unreachable node, When the deploy runs, Then the failure is classified config_eval / missing_var / connectivity with a legible operator-facing message, never a masked success
  • Given revision N bad and N−1 known good, When Rollback runs, Then N−1 is applied as an exact revision (no git-revert of a non-tip)
  • Given two concurrent mutations, When both land, Then they serialise into clean commits through the one writer

Blocked by

  • bootstrap:clan-seam — #25 (closed; satisfied)

Task manifest

task: engine-adapters:clan-adapter-core
implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)"
interface: "clan.Clan (Deploy/Rollback/Readiness) per docs/seams/clan.md — contract unchanged"
seam: "internal/clan seam tests (existing fakes stay) + adapter contract tests over a scripted clan-CLI double"
acceptance:
  - given: a scripted CLI double replaying S13's verdict corpus; when: each failure class is driven; then: classification matches the S13/Q2.2 taxonomy
  - given: exact-revision deploys; when: rollback; then: earlier revision applied, no revert
depends_on: [bootstrap:clan-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 production `clan.Clan` core (ADR 0102): a Go adapter driving the pinned clan CLI headlessly — Deploy / Rollback / Readiness — with the control plane as the community config repo's single writer. Commit-then-apply-exact-revision; a tree with conflict markers is refused before commit; the layered outcome classifier is contract (connectivity before secrets, signal-kills by exit code, disk tokens only once disko runs — S13 + Q2.2). Nothing outside the adapter knows CLI shapes (DDR 0010). ## Acceptance criteria - [ ] Given a committed revision and a reachable node, When Deploy runs, Then that exact revision is applied headlessly (no TTY hang) and the outcome is a structured verdict - [ ] Given a config that does not evaluate / a missing var / an unreachable node, When the deploy runs, Then the failure is classified config_eval / missing_var / connectivity with a legible operator-facing message, never a masked success - [ ] Given revision N bad and N−1 known good, When Rollback runs, Then N−1 is applied as an exact revision (no git-revert of a non-tip) - [ ] Given two concurrent mutations, When both land, Then they serialise into clean commits through the one writer ## Blocked by - bootstrap:clan-seam — #25 (closed; satisfied) ## Task manifest ```yaml task: engine-adapters:clan-adapter-core implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)" interface: "clan.Clan (Deploy/Rollback/Readiness) per docs/seams/clan.md — contract unchanged" seam: "internal/clan seam tests (existing fakes stay) + adapter contract tests over a scripted clan-CLI double" acceptance: - given: a scripted CLI double replaying S13's verdict corpus; when: each failure class is driven; then: classification matches the S13/Q2.2 taxonomy - given: exact-revision deploys; when: rollback; then: earlier revision applied, no revert depends_on: [bootstrap:clan-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

Done in 2781757 (on origin/main).

ADR 0102's production clan.Clan adapter lands as internal/clan's Adapter (New(repo, cli, log) over cli.go / configrepo.go / adapter.go): the real clan-seam driving the pinned CLI headlessly through a CLI port (ExecCLI never inherits stdin/TTY; signal-kills carried as rc 128+signal), with ConfigRepo as the community config repo's single writer.

  • Deploy applies an exact committed revision as a git+file://<dir>?rev=<rev> flake ref (commit-then-apply-exact-revision), per-node eval preflight (exclude-and-report, or fail under Strict), then a layered classification into *DeployResult/*DeployError. (AC1)
  • Failures classified per the S13/Q2.2 taxonomy — config_eval / missing_var / connectivity (connectivity before secrets), disk, and a zero exit over a failing log as masked_exit — legible, never a masked success. (AC2)
  • Rollback revision scope redeploys an earlier exact revision, no git-revert of a non-tip (S13 Q5); generation/container scopes need the per-op SSH target resolver (ADR 0039) and fail loud until #163. (AC3)
  • ConfigRepo.Mutate serialises concurrent mutations into clean sequential commits behind a mutex and refuses a tree with conflict markers before committing. (AC4)
  • Readiness is the headless nix eval …drvPath gate.

Enrollment (#163) and Config/Vars/Supply (#164) are later arc slices and fail loud here (ADR 0100). Seam: adapter contract tests over a scripted clan-CLI double + a real single-writer git repo (internal/clan/adapter_test.go) — S13 verdict corpus per class incl. masked-exit, exact-revision rollback with no revert, 8 concurrent mutations → 8 clean commits. The adapter's real-hardware proof is the family-1 clan-lab smoke (#166). go build / go vet / golangci-lint / clan tests (incl. -race) clean.

Unblocks #163 (enroll) and #164 (config/vars/supply).

Done in `2781757` (on `origin/main`). ADR 0102's production `clan.Clan` adapter lands as `internal/clan`'s `Adapter` (`New(repo, cli, log)` over `cli.go` / `configrepo.go` / `adapter.go`): the real clan-seam driving the pinned CLI **headlessly** through a `CLI` port (`ExecCLI` never inherits stdin/TTY; signal-kills carried as rc 128+signal), with `ConfigRepo` as the community config repo's **single writer**. - **Deploy** applies an *exact committed revision* as a `git+file://<dir>?rev=<rev>` flake ref (commit-then-apply-exact-revision), per-node eval preflight (exclude-and-report, or fail under `Strict`), then a layered classification into `*DeployResult`/`*DeployError`. **(AC1)** - Failures classified per the S13/Q2.2 taxonomy — `config_eval` / `missing_var` / `connectivity` (connectivity **before** secrets), `disk`, and a zero exit over a failing log as `masked_exit` — legible, **never a masked success**. **(AC2)** - **Rollback** revision scope redeploys an earlier *exact* revision, **no git-revert of a non-tip** (S13 Q5); generation/container scopes need the per-op SSH target resolver (ADR 0039) and fail loud until #163. **(AC3)** - **ConfigRepo.Mutate** serialises concurrent mutations into clean sequential commits behind a mutex and refuses a tree with conflict markers before committing. **(AC4)** - **Readiness** is the headless `nix eval …drvPath` gate. Enrollment (#163) and Config/Vars/Supply (#164) are later arc slices and fail loud here (ADR 0100). Seam: adapter contract tests over a scripted clan-CLI double + a real single-writer git repo (`internal/clan/adapter_test.go`) — S13 verdict corpus per class incl. masked-exit, exact-revision rollback with no revert, 8 concurrent mutations → 8 clean commits. The adapter's real-hardware proof is the family-1 clan-lab smoke (#166). `go build` / `go vet` / `golangci-lint` / clan tests (incl. `-race`) clean. Unblocks #163 (enroll) and #164 (config/vars/supply).
ben closed this issue 2026-07-29 19:12:03 +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#162
No description provided.