bootstrap: enroll-seam — the shared enroll package + in-memory fake #26
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.
Blocks
Depends on
#47 founding: spec-gate-and-reachability — spec gate pass/fail, reachability before name-wire
Matou/idss
Reference
Matou/idss#26
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: #7 — the engineering foundation (PROCESS.md Phase 2½, emitted as DAG root slices).
What to build
The shared
enrollGo package — the protocol between the device-side agent and the control plane (the seam contract indocs/seams/agent-control-plane.md, carrying ADR 0028's one enrollment mechanism and ADR 0037's shared types). One package holds the wire types and the service interfaces: the connection request as a single resource with a typed, monotonic state machine (Redeemed → Pending → Approved → Enrolled, plus Declined/Expired) whose states map 1:1 to the P2/P3 flow nodes. The boundary's security job is a one-way conversion — a weak, human-carried enrollment code becomes a strong, individually revocable device identity — so the seam splits into two faces: the pre-mesh Enrollment face and the over-mesh fleet-reporting face.Three service interfaces exist with their full verb sets:
ControlPlane(Redeem, Pair, Poll, ConfirmEnrolled — the agent's whole enrollment view, signed by the device key),Operator(List, Approve, Decline, plus the amendments MintCode/RevokeCode from the device-add grill and ListCodes +CodeView.CreatedByfrom the shell grill), andFleetReporting(Report — the standing NodeCert-mTLS heartbeat). TheIdentityGrantships the full community CA at v1 (spike #5's Q6 verdictworkable): a 90-day NodeCert, SSH host cert, and ClanTrust — the wiring that makes the clan seam's "established connection" credential-first. The error taxonomy has one error per device-end screen.Notes: the control-plane face must be an embeddable, first-class build target — founding's bundled helper embeds it behind an in-process ledger and the seeded control plane inherits the resulting request record and grant (ADR 0043), so this is not merely a test fake. The seam-test fake is an in-memory ledger plus a clock.
Acceptance criteria
enrollpackage is built, then the connection-request resource carries a monotonic, typed state machine (Redeemed/Pending/Approved/Enrolled/Declined/Expired) matching the P2/P3 flow nodes, with terminal states that never change.ControlPlane(Redeem/Pair/Poll/ConfirmEnrolled),Operator(List/Approve/Decline + MintCode/RevokeCode/ListCodes withCodeView.CreatedBy), andFleetReporting(Report) all exist with their listed verbs.ErrCodeInUse; the full taxonomy (ErrCodeUnknown/Expired/Revoked/Consumed/InUse,ErrSpecGate,ErrVirtUnavailable,ErrGone) exists, each mapping to a distinct device-end screen.IdentityGrantdelivers the full community-CA-signed NodeCert (90-day validity), SSH host cert, mesh admission, and ClanTrust; nothing in it is re-derivable from the code.Blocked by
Task manifest
Done in commit
250e68b(internal/enroll/).The shared
enrollGo package — the agent↔control-plane boundary as one shared module (ADR 0037: the types ARE the schema).What landed:
Redeemed→Pending→Approved→Enrolledplus theDeclined/Expiredoff-ramps — states mapping 1:1 to the P2/P3 flow nodes; the three terminal states never change.ControlPlane(Redeem/Pair/Poll/ConfirmEnrolled),Operator(List/Approve/Decline + MintCode/RevokeCode/ListCodes withCodeView.CreatedBy),FleetReporting(Report). Static interface checks bind all three to theLedger.ErrCodeInUse. Spec-gate failure is a typed*SpecGateErrorthat STAYS Redeemed so the code survives. The full taxonomy (ErrCodeUnknown/Expired/Revoked/Consumed/InUse,ErrSpecGate,ErrVirtUnavailable,ErrGone) each maps to a distinct device-end screen viaDeviceScreenFor.IdentityGrant: approval mints a full-community-CA 90-day NodeCert, SSH host cert, mesh admission, and ClanTrust via a pluggableGranter(StubGranter= the pinned-key fallback shape); random material, nothing re-derivable from the code. The real CA ceremony plugs in behind the same types (founding's).Ledger(in-memory maps + injectableClock) is both the seam-test fake and founding's in-process control-plane target.Export/NewLedgerFromStateare the state handover (founding's request record + grant move into the seeded control plane); the on-disk form is the sameStatethrough JSON.Evidence: 15 seam tests in
internal/enroll/enroll_test.go(happy path, non-consuming/idempotent redeem, spec-gate stays-redeemed, VM-virt loop, decline/expiry/revoke off-ramps, blocking poll, grant shape + per-node freshness, taxonomy→distinct-screens, ADR-0043 state handover, crash-resend).go build/go vet ./...,go test -race ./internal/enroll/, andgolangci-lint runall clean.Out of scope (untouched): the founding/device-add flow UIs, the CA key ceremony, and the clan install/deploy
enroll(clan-seam's — the two "enroll"s are different things). Sibling root slice #25 (clan-seam) remains.clanpackage + fake adapter behind DDR 0010 #25/is 100% full (0 bytes free) because /etc/cron.d/swarm-prune still points at the rootless docker socket — every task landing on its runner dies in 1-3s at Set up job, includingswarm-pool triage/resume-asks #2076