Spec: provisioning — assign a connected device its role & services and keep the fleet current (P4 + P4b) #17
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#17
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 — provisioning's definition was locked on ticket #9 (2026-07-21). This child spec inherits the map's cross-feature constraints (clan substrate behind the
clanseam; kanidm/OIDC; thebrandkittheming seam; the seeded-cache supply chain; the cross-cutting UX rulings — advice never veto, logging with drill-in, hardware minima + spec gate) and links back to it as the parent artifact. Grilled 2026-07-23 (/grill-ux-with-docs), both journeys: P4 setup/change (ADRs 0058–0064, both gates passed) and P4b updates (ADRs 0065–0068, auto-accept session signed off 2026-07-24).Flows:
docs/ux/flows/p4-provisioning.mermaid,docs/ux/flows/p4b-updates.mermaid.Wireframes:
docs/ux/wireframes/p4-provisioning/,docs/ux/wireframes/p4b-updates/.Problem Statement
An operator has connected a device to their community's fleet (device-add left it
connected — not set upand, for a full install,takeover-ready— its disk not yet touched). It is doing nothing. The operator — low-skill, low-time — now has to decide what job the machine should do, make it do that job safely over the connection already established, and then keep it and the rest of the fleet current with security patches and feature updates for the fleet's whole life. Left to raw tools this means: judging which services a machine can run against its specs, network and uptime; knowing which of the community's data has no second copy and no backup; triggering an irreversible disk wipe with full knowledge of what is lost; watching a deploy that can half-succeed; and, forever after, applying updates without breaking the services members depend on — with a real way to roll back and a real way to opt out. None of that should require systems expertise, and none of it should let the system quietly claim a safety (a backup, a second copy) the community does not actually have.Solution
Provisioning is two operator journeys on the web dashboard, both driven by the community's own control plane over the established connection, so a closed browser never interrupts anything.
P4 — assign a device its role and services, and deploy them. The system assesses what the device offers (specs, reachability, uptime pattern) against what the community needs (HA gaps, backup gaps) and recommends the set that fills those gaps first; the operator accepts or adjusts freely (advice, never veto). It reviews the impact — what moves, what replicates, the new load — before anything runs. When the impact destroys something (a full-install device's disk is erased, or a removal drops the last copy of data), Review impact becomes a deliberate confirm that names the destruction and, for an erase, attributes the consent the device owner already gave at the machine. Deploy runs over the connection: a full-install device takes over to NixOS and joins the clan, a VM-mode device gets services only. Health checks run per service; the device goes active for the jobs that work, and any service that failed is named, retryable, and claims no coverage anywhere. P4 is also the standing surface for changing an active node later.
P4b — keep the fleet current. The control plane watches the pinned channel; security patches apply automatically in a community-chosen maintenance window while feature updates queue for one-click approval with plain-language release notes shipped signed with the release. Every update is a health-gated staged rollout — a canary chosen by rule (never the gateway, a quorum node, or the sole home of data), the gateway last — with automatic rollback at the matching scope on failure. A release that fails twice is quarantined and handed to the operator. The policy slider spans fully-automatic down to everything-manual; turning auto-security off is allowed and starts a standing, evidence-based indicator. Pin-or-fork the channel is the sovereignty exit.
User Stories
Acceptance criteria are Given/When/Then, sourced from the flow nodes and edges of
p4-provisioning.mermaidandp4b-updates.mermaid, including the error, empty and partial branches.P4 · Assess and recommend (P4-S1, P4-S1x)
As an operator, I want the system to assess a newly connected device before I choose anything, so that my choices start from what the machine can actually do.
connected — not set updevice, When I open its setup, Then P4-S1 shows what the device offers — resources (a VM-mode device counts its allocated resources), network and public reachability, and uptime pattern — and what the community needs, as named HA and backup gaps.As an operator, I want the recommended role and services to fill my gaps first, so that the machine does the most useful thing without me working it out.
As an operator whose device can run nothing useful, I want to be told plainly rather than dropped into a dead end, so that I am never stuck staring at a wiped or donated machine that can do nothing.
As an operator whose community already has no gaps, I want the recommendation to say so calmly, so that a fully-covered fleet does not look broken.
P4 · Select role and services (P4-S2)
As an operator, I want to accept the recommendation or adjust it freely, so that I stay in control while the system advises.
As an operator, I want to assign the device a fleet role, so that the machine takes a defined place in the fleet.
P4 · Review impact and the destructive confirm (P4-S3, P4-S3x)
As an operator, I want to see the impact of my choices before anything runs, so that I am never surprised by what a deploy does.
As an operator provisioning a full-install device, I want the erase named and confirmed deliberately, so that I never trigger an irreversible disk wipe without it being in front of me.
takeover-ready, When I reach review, Then P4-S3x is shown with an ⚠ ERASES row stating the disk is erased and replaced with NixOS, and the action reads "Erase & deploy", not "Deploy".As an operator removing something that destroys data, I want the loss named and confirmed deliberately, so that I do not tear down a community's only copy on an ordinary-looking click.
P4 · Deploy and health checks (P4-S4)
As an operator, I want the deploy to run over the connection already established, so that I do not repeat any enrollment step.
As an operator deploying a full-install device, I want the NixOS takeover to happen here, so that the machine becomes a real node.
takeover-readydevice, When deploy runs, Then it takes the device over to NixOS, joins the clan, then deploys services — in that order.As an operator deploying a VM-mode device, I want only the services deployed, so that a machine already running the right OS is not needlessly rebuilt.
As an operator, I want a failed deploy to fail safely with a plain error, so that a broken deploy never strands the machine.
P4 · Active, and partial success (P4-S5, P4-S5x)
As an operator, I want a device to count as active only when its services are healthy, so that "active" means working.
As an operator, I want a device whose deploy succeeded but one service failed to still do the jobs that work, so that one bad service does not throw away a successful takeover and a working service.
As a community, I want a failed service to claim no coverage, so that we are never told we have a backup or a second copy we do not have.
As an operator, I want the failed service carried into monitoring, so that it is not silently forgotten after setup.
P4 · Changing an active node (P4-S5 → P4-S1)
As an operator, I want to change an active node's role or services later, so that the fleet can grow and adapt without removing and re-adding machines.
As an operator changing a node, I want the impact shown as a delta, so that I see exactly what is added and removed.
clan.Deploywith no erase (the node is already NixOS).As an operator changing a node, I want a destructive removal to get the same deliberate confirm as an erase, so that removing the last copy of data is never a casual click.
P4b · Seeing update state (P4b-U1, P4b-U1x)
As an operator, I want one surface that tells me the whole update story, so that I always know what is waiting on me, what is happening without me, and what the fleet is running.
As an operator, I want an "up to date" resting state, so that a quiet fleet reads as working rather than empty.
As an operator, I want to drill into update history, so that "what changed just before this broke?" is always answerable.
P4b · Reviewing and approving (P4b-U2)
As an operator, I want feature and major updates to wait for my approval, so that a change my members will notice does not apply itself.
As an operator, I want plain-language release notes, so that I can decide without reading a changelog.
As an operator, I want to approve an update for the maintenance window, so that it applies when members are least affected.
As an operator, I want to skip an update and have it stay skipped, so that I am neither nagged nor overridden.
P4b · Automatic security (P4b-U1 → P4b-U3)
P4b · Rolling out (P4b-U3)
As an operator, I want every update staged and health-gated the same way, so that whether I approved it or it applied itself, it is equally protected.
As a community, I want the canary chosen by rule, so that a bad revision is proved on the node whose loss costs least.
As an operator, I want a retry to reuse the proven closure, so that a retry never rebuilds into something different.
P4b · Applied, rolled back, quarantine (P4b-U4, P4b-U4x)
As an operator, I want "applied" to mean converged and healthy, so that a finished update is genuinely done.
As an operator, I want a failed update rolled back automatically, so that the fleet is never left on a bad revision.
As an operator, I want a rolled-back update retried once, so that a transient failure does not need my attention.
As an operator, I want a repeatedly-failing update quarantined and handed to me, so that it does not re-break a node every window forever.
P4b · Policy and channel (P4b-U5, P4b-U5x)
As an operator, I want to set update policy across the full range, so that the community decides how much is automatic.
As an operator, I want turning auto-security off to be allowed but visible, so that the choice stays informed rather than forgotten.
As a community, I want pin-or-fork the channel to be a real setting, so that our sovereignty exit does not need a support ticket.
Implementation Decisions
provision(ADR 0058) drives the P4 journey;update(ADR 0065) drives P4b. They are siblings, not one package — the journeys differ in object (one device vs one release), trigger (an operator clicking vs a scheduled channel poll), scope (one node vs the fleet in stages) and cadence. Both run server-side, so a closed browser interrupts neither. The Vue dashboard is thin UI over both; it renders states, it does not decide them.clanhot paths; the two "enroll"s are different (ADR 0059). A full-install device's first deploy drivesclan.Enrollment(theinstall --phasesNixOS takeover that device-add only staged astakeover-ready); a VM-mode device or an already-active node drivesclan.Deploy. Device-add drives neither — its enrollment is the separateenroll(agent↔control-plane) seam.provisionreads thetakeover-readystate to choose Enrollment vs Deploy and to read the already-captured install-mode consent; it never re-asks consent.HealthCheck— the additive amendment to the confirmedclanseam (Config.AttachServiceadmits all three; aHealthChecktype added).provisionandupdateboth gate on it per service and know nothing about what a service does. Binding invariant: a service that has not passed its check contributes no coverage anywhere.provisionmust know whether a selection erases a disk (full-installtakeover-ready) or whether a removal drops a last copy of data or a dataset's last backup, because that decision routes the operator to P4-S3 (plain) or P4-S3x (deliberate confirm). Impact is computed as a diff against current state; a first setup is the special case where current state is empty.git revertof a non-tip.provisionandupdateshare one fleet-state reader (specs, reachability, uptime, roles, quorum membership, dataset homes, coverage/HA gaps) and the same per-serviceHealthCheckmachinery.Supply.Seedis a precondition of every deploy and every rollout — a drifted unfed node cannot deploy offline (S13 Q4/Q9).brandkitapplies to the service surfaces provisioning stands up.Testing Decisions
provision(P4) — THE seam for the setup/change journey (ADR 0058). Driven headless in-process against a fakeclan.Clanexercising both hot paths (Enrollmentfor the takeover,Deployfor services-only, including blocked/resume/remedy and generation rollback), a fake fleet-state reader, per-serviceHealthCheckfakes that pass/fail independently, a fake portal-link updater, and realbrandkit(pure — faking it would be waste). Every P4 acceptance criterion executes here: assess/recommend with gated-service reasons; both empty states (nothing available; no gaps to fill); impact for a first setup and a change; the destructive confirm's two triggers (ERASES/LOSES); full-install takeover vs VM-mode services-only; all-healthy → active; partial failure → active-for-what-works with no coverage claimed; the deploy-itself failures classified by the clan seam with the VM clean-retry / generation-rollback / rescue branches; and re-provisioning including destructive removals.update(P4b) — THE seam for the updates journey (ADR 0065). Driven headless against a fake channel (signed release metadata + notes), a fake clock (maintenance windows; the indicator's "oldest 12 days" evidence), a fakeclan.Clan(Deployplus the three rollback scopes), per-serviceHealthCheckfakes that fail on command, and a fakeSupplyreporting unfed nodes. Every P4b acceptance criterion executes here: the policy split (auto-security applies unattended in-window; features queue); skip-and-stay-skipped; canary-by-rule and the tiny-fleet fallback; gateway-last; health-gated automatic rollback at each scope; the two-attempt retry budget → quarantine (fail→retry→succeed, fail→retry→fail→quarantine, quarantine overriding auto-apply, a later release applying cleanly over a quarantined one); the evidence the indicator counts; and pin-or-fork.enrollledger + clock, ADR 0052), device-add's both-ends seam driving (ADR 0057), and the S13 prototype's clan fakes (spikes/S13-clan-orchestration/).Out of Scope
docs/architecture/11-update-supply-chain.md; this spec consumes them, it does not redesign them.Further Notes
needs_human_decisioncarried, not re-derived: multi-arch fleet support (aarch64 nodes change every service build and the cache) — inherited from device-add's spec and the map's §12 leftovers; decide at or before the slice-map.HealthCheckis defined once and reused by monitoring for steady-state watching.filesand member-orbitnextcloudstop naming the same software twice #222Closed in the 2026-08-27
other-state sweep (Ben's ruling) — child spec complete: 16/16 provisioning slices done, all 27 derived tickets closed. #353 (move-off-gateway) stands alone as a later DDR 0145 slice.