Spec: device-add — enrol a device into an existing fleet (P2+P3) #13
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Wayfinder map: Matou/ourcloud#7 — device-add's definition was locked on ticket #9 (2026-07-21); this spec inherits the map's cross-feature constraints (clan substrate behind the
clanseam, one enrollment mechanism with full community CA at v1, Netbird mesh with no relay, hardware minima + spec gate at pairing, advice never veto, seeded-cache supply chain).Design contract:
docs/ux/flows/p2-device-add-cli.mermaid+docs/ux/flows/p3-device-add-app.mermaid+docs/ux/wireframes/p2-device-add-cli/(5 screens) +docs/ux/wireframes/p3-device-add-app/(7 screens). Engineering tree: ADRs 0053–0057 plus theenrollseam's additive MintCode/RevokeCode amendment (device-add grill, 2026-07-23). Carried residual — resolved: spike #12 (S13 Q2.2 fresh-host takeover) was executed 2026-07-24, verdict CONFIRMED-WITH-WORKAROUND (docs/spike-findings/q22-fresh-host-takeover.md); its §6 inputs are folded into the takeover-ready acceptance below and the clan seam's Enrollment notes.Problem Statement
A community's fleet has to grow beyond its first node, and the machines it grows with are whatever the community has: a member's spare PC in a cupboard, an old laptop, a second-hand server. The people at those machines are not sysadmins, and the operator is not standing next to them. Today there is no safe way for an operator to say "add that machine" and for the person holding it to make it happen — without install media to burn and verify, without granting anyone standing access, and without the machine's owner losing the ability to consent to what happens to their hardware (especially a full wipe).
The join also has to be honest about time and failure: approval can take days, machines get rebooted mid-join, codes get mistyped, hardware turns out too weak, and an operator must be able to change their mind — decline — and know the device ends up clean, not half-joined.
Solution
Device-add enrols a device into an existing fleet through the one enrollment mechanism, over two doorways that converge immediately.
The operator starts at Fleet → Add device (P2-S1), picks an intended-role hint (default helper — advice for the device end, never an assignment), and gets a generated enrollment code: short, human-typeable, single-use, expiring (7 days by default), revocable.
On the CLI path (P2, Linux machines and servers), the device owner copy-pastes one install command — served by the community's own gateway — which installs the agent as a persistent service and starts the join. On the app path (P3, Windows/Mac/Linux with no terminal), the owner downloads the operator app, enters the code, and the app's first real act is installing that same standing agent; the join screens are thin UI over it.
Either way the owner consents to an install mode on the device end — full install (Linux only; wipe at first deploy) or VM mode (a local NixOS VM on the agent's bundled QEMU, sized by the hint) — then the agent probes hardware, passes the spec gate, and sends the connection request. The operator sees the pending card (the echoed probe), and approves or declines. Approval converts the weak code into strong, individually revocable device identity; the agent joins the mesh, brings up the clan connection, and the device lands at Connected — not yet set up (full-install devices takeover-ready), heartbeating, waiting for provisioning's Assess. Decline tears the device down clean — VM removed or agent self-removed.
User Stories
Acceptance criteria are Given/When/Then, sourced from the P2/P3 flow nodes and edges (including failure branches), the
enrollseam's state machine and error taxonomy, and the ADRs noted.Minting (operator, dashboard)
As an operator, I want to start every device add from Fleet → Add device (P2-S1), so that both paths begin at one place with one code discipline.
As an operator, I want to give the code an intended-role hint, defaulting to helper (ADR 0055), so that the device end can check specs and size a VM without me committing to anything.
As an operator, I want to revoke an unspent code (seam amendment: RevokeCode), so that a code that leaked or went stale stops working.
As an operator, I want the code screen (P2-S2) to show the code, its expiry, a revoke affordance, and the one install command, so that handing the join to a device owner is one copy-paste.
https://<community-domain>/get) with the code as its argument (ADR 0054) — no Matou-hosted URL.CLI path (device owner, device end)
As a device owner, I want one copy-pasted install command on my stock Linux OS, so that joining needs no install media and leaves no operator-driveable tool behind.
As a device owner on the CLI path, I want the install-mode choice and consent in my terminal (P2-S3), so that only the person at the machine authorises what happens to it (ADR 0024).
App path (device owner, operator app)
As an operator, I want to send the device owner a download link or QR plus the code (P3-S1), so that a non-technical owner can join with no terminal.
As a device owner, I want to enter the code in the app (P3-S2) and see what I'm joining, so that I can trust the request before giving consent.
As a device owner, I want the app's first real act to be installing the standing agent (ADR 0053), so that the join — and my machine's membership — never depends on the app staying open.
As a device owner on Windows or Mac (P3-S3), I want VM mode presented as the way my machine joins, so that my existing OS is kept.
As a device owner whose machine has virtualisation disabled, I want per-OS enable steps (P3-S3 self-loop), so that a fixable machine gets fixed rather than rejected.
As a device owner on Linux in the app (P3-S3L), I want the mode choice, so that I decide between reversibility and reliability.
As a device owner in VM mode, I want the agent to create and keep the local NixOS VM (ADR 0056), so that my contribution survives reboots without my attention.
As a device owner consenting to full install, I want the wipe deferred to first deploy, so that nothing destructive happens before the operator has approved and set the device up.
Pairing and the spec gate (both paths)
As a device owner, I want pairing to happen in one shot after consent, so that the probe, my consented mode, and the machine's SSH host key travel together.
As a device owner with a too-weak machine, I want the spec gate to fail early with a remedy (ADR 0030/0026), so that I'm not stranded mid-deploy later.
Approval, decline, and waiting (operator + device owner)
As an operator, I want a pending-device card (P2-S4 / P3-S4) showing the probed specs and label, so that I approve real hardware, not a guess.
As a device owner, I want the joining screen to wait honestly for days if needed (P3-S4), so that approval on someone else's schedule doesn't fail my join.
As an operator, I want approval to convert the code into strong device identity, so that the community holds every key and can revoke any device individually.
As an operator, I want the dashboard to show a device as joined only when it truly is, so that the Fleet surface never lies.
As an operator, I want decline to end the request cleanly (P2-S4 decline / P3-S4x), so that a device I turned away holds nothing of the community.
As a device owner whose join was declined mid-wait, I want the decline to reach me as an outcome, not an error, so that the screen tells me what happened and what was removed.
Codes, errors, and resumability (both paths)
As a device owner, I want expired, revoked, consumed, and in-use codes each to say what they are, so that the fix is obvious.
As a device owner whose machine crashed or rebooted mid-join, I want the join to resume, not duplicate, so that the operator never sees two pending cards for one machine.
As an operator, I want the pending list to be a live query over connection requests, so that pending devices appear and resolve without me refreshing.
Landing (both paths)
As an operator, I want a newly enrolled device to land at Connected — not yet set up (P2-S5 / P3-S5), so that joining and setting up stay two decisions.
As an operator, I want heartbeats from the moment a device is enrolled, so that staleness is visible from day one.
As a device owner on the app path, I want the app to rest at Device home after joining (P3-S5 → shell), so that my machine's membership is visible where I'd look for it.
Implementation Decisions
enrollseam's connection-request resource exactly as confirmed: Redeemed → Pending → Approved → Enrolled, with Declined/Expired terminal; monotonic states; non-consuming Redeem; codes spent only on terminal outcomes. The seam doc's state ↔ flow-node mapping is the design contract's spine.joinorchestrator is a Go package in the agent, running as a persistent OS service. On P3 the app (via its bundled helper) first installs the agent, then renders the agent's states over its local Unix socket — the same carrier founding's relayed paths use. The helper holds no standing duty; the app can close without consequence./get); the install command curls the community's own domain; the operator app ships and self-updates on Matou's release channel (ADR 0033). The enrollment code carries no URL.ext4-single-disktemplate) so the overwritten host boots regardless of firmware. The community-signed SSH host cert is what carries the gateway's trust across the re-image withoutknown_hostschurn (observed live). None of this reverses ADR 0024/0028 — it is the concrete shape of takeover-ready for a real host; see the clan seam's "Spike Q2.2 reconciliation" section.enrollseam's Operator face — additive verbs over the code ledger the seam already hides. Shell's standing codes ledger later consumes the same verbs.Testing Decisions
enrollstate machine.joinorchestrator wired in-process against the realenrollcontrol-plane service backed by its in-memory ledger + clock (a first-class build target per ADR 0043). Fakes below: VM manager (ADR 0056's interface), mesh admission, takeover-ready stager, artifact serving. Acceptance tests drive both ends — MintCode/Approve/Decline/RevokeCode and mode consent — and assert flow-node states, IdentityGrant contents, teardown residue, and idempotent resume. Every Given/When/Then above executes at this seam.enrollledger + clock, fake-driven orchestrator — ADR 0052) and the S13 prototype's clan fakes./get, approve, assert Connected/takeover-ready with heartbeats flowing. Fake-drift insurance for the VM-manager and artifact-serving fakes; explicitly not an acceptance gate. The full-install takeover itself is spike #12's, not the smoke's.depends_on#12 edge is already closed whento-ticketsruns.Out of Scope
Further Notes
needs_human_decision(carried, not re-derived): multi-arch fleet support — Apple Silicon VM-mode helpers make the fleet mixed x86_64 + aarch64, which every service build and the binary cache must then serve (flagged in ADRs 0030/0056; a migration-spec §12 leftover). Decide before (or at) the slice-map if aarch64 devices are admitted at v1 or steered away at the spec gate.Note from the Sandcastle swarm (leaving open, not relabeling/closing — that is a human triage call):
This issue is the Phase-1 device-add spec deliverable, not an implementable vertical slice, so the swarm has nothing to build against yet:
interface/seam/acceptance/depends_on);sjoinorchestrator wired to the realenroll` service — does not exist; the ADR 0040 repo skeleton is still unbuilt (STATUS "Now" checklist);needs_human_decision(multi-arch fleet / aarch64 admission at v1), to be resolved at or before the slice-map.Implementable slices for this feature come from Phase 2 (
/slice-map) →/to-tickets, which emit tickets with manifests anddepends_onedges (the deploy-touching slice will takedepends_on #12). Because it is labeledready-for-agent, the swarm re-selects it every iteration with no actionable work — suggest retriaging the label until its tickets exist.Sandcastle note (not implementable yet — leaving open): this is a
to-specoutput (a feature spec), not a vertical slice. It carries user stories/acceptance but no implementation task manifest (interface/seam/depends_on), and the spec itself states it "waits on the Phase-2 slice-map (needs all eight feature specs)". Phase 2 is not started (docs/slices/holds only the README; 2 of 8 features specced) and the slice-map +to-ticketssteps — which are what emit the implementable, DAG-ordered tickets — are human-gated (Ben confirms the graph). Until those run there is no seam for the swarm to build/test against, so I'm not implementing this here. Also note the carried residual: the deploy-touching device-add slice takes adepends_onon spike #12, which is currently blocked on missing DigitalOcean credentials (see #12).Sandcastle: not yet implementable as a code slice — leaving open.
This is a published spec artifact, not a
to-ticketstask manifest. There is no code target to build against yet: no repo skeleton (ADR 0040 / Phase 2½ not built — the repo holds no Go module), and no slice-map (docs/slices/holds only its README; Phase 2 has not started, and the slice-map needs all eight feature specs — only 2 of 8 exist). The spec itself states it waits on the Phase-2 slice-map. Implementing device-add code now would violate the dependency and scope rules.This will become swarm-ready after: 6 remaining grills+specs → slice-map (Phase 2) →
to-ticketsemits code tickets withinterface/seam/acceptancemanifests. (Founding spec #11 is in the identical state.) Consider droppingready-for-agentfrom the spec issues until their code tickets exist, so the swarm stops surfacing them as ready.Not an executable slice for the swarm yet — this is the published feature spec, not an implementation ticket.
The swarm implements the per-slice tickets that
to-ticketsemits after the Phase-2 slice-map, not the feature specs directly. As of this iteration that pipeline stage has not run: nodocs/slices/*.yamlexists (this spec's own Sequencing note: it 'waits on the Phase-2 slice-map'), there is no repo skeleton /enroll·clanseam packages to build thejoinorchestrator against (Phase 2.5 incomplete, ADR 0040), and this feature's deploy-touching slice nativelydepends_onspike #12 (still open/blocked — see #12).Building the whole feature now would violate one-vertical-slice-per-iteration, stay-in-scope, and honour-dependencies. Consider dropping
ready-for-agentfrom the spec issues so the ready-list surfaces implementation tickets rather than design artifacts. Leaving open; no code changed.Amended by the provisioning grill (2026-07-23) — ADR 0064.
Provisioning's grill surfaced a gap between this spec's spec gate and provisioning's available-service list: the gate checks a device against the hint's declared minimum, while P4-S1 assesses it against every service in the catalogue. A device could therefore pass the gate — and, on the full-install path, be wiped on the strength of that pass — and then land on a setup screen that says there is nothing it can do.
ADR 0064 pins the gate's floor for a role to the floor of the cheapest service that role can actually run, with the catalogue's per-service minima as the single source. Two edits applied to the spec body above:
The residual case — fleet state moving between pairing and setup — is handled on provisioning's side by the new
P4-S1xempty state, which names why each service is out of reach and always offers a next step (lowest-floor job, or removal). No user story here is invalidated; theenrollseam is unchanged.Spec amended for spike #12 findings (Q2.2,
docs/spike-findings/q22-fresh-host-takeover.md, 2026-07-24). Four changes: (1) the header's carried residual is marked resolved — #12 executed, CONFIRMED-WITH-WORKAROUND; (2) story 14 gained an acceptance criterion: the spec-gate/facter probe also captures the host's network facts (public IP/CIDR, gateway, DNS, public NIC MAC) and they ride the takeover-ready contract; (3) the constraints gained a §6 block: takeover-ready includes the captured network facts (→ MAC-matched systemd-networkd node config) and a hybrid BIOS+UEFI disko layout, with the community-signed host cert carrying trust across the re-image; (4) the #12 blocking-edge note now records the edge as satisfied. Mirrored in the clan seam:docs/seams/clan.md§ Spike Q2.2 reconciliation (additive; nothing confirmed retracted).Closed in the 2026-08-27
other-state sweep (Ben's ruling) — child spec complete: all derived tickets closed; the remaining device-add work was re-specced as rehearsal phase 5 (spec129efa32, #842–#854).GET /enroll/places,GET /enroll/server-offer,POST /enroll/rent(the broker rents, the box enrols itself with a code minted for it) #1397placeOptions/serverOffer/rentServerto the new enroll ops so the real panel opens the dialog on the place screen #1398dialogstate, the Overview's device/System/service/members rows, the sidebar chrome — unit debt from Ben's 2026-09-10/11 UI pass #1399journey.rented-device.spec.tson the standing rented community: Overview → Add a device → place → rent → the box calls in → the device card → remove → reap; GREEN is the only close #1400kindprop (#2065 × #2164 merge collision) #2168