enroll: the gateway control plane wires no Granter — device-add approve fails loud (ErrNoCA) and reds the #854 drive's approve leg #945

Closed
opened 2026-08-28 15:49:58 +00:00 by matou-build-agent · 2 comments

Failure

The #854 standing device drive (test-results/drive-device/20260828T152314Z) ran 23 legs green and red at approve after the full 300 s ceiling (artifacts/legs.json, artifacts/verdict.json — firstRedLeg: approve, commit e453b8f4). Playwright reports only locator('[data-field="connected-device"]') never appearing, but that is the symptom. The accessibility snapshot taken at the moment of failure shows the real answer already on screen:

- alert:
  - paragraph: "enroll: no community CA configured — approval fails loud (ADR 0100/0111); mint one at founding"
  - button "Try again"

(artifacts/journey.device-device-add--809eb-e-standing-rented-community/error-context.md:58.) The pending card was correct and scoped — code UZPR-NDUS-LTFJ-V2QS-XLTN, the probe table carrying the member droplet's real facts — and the operator's Approve click landed. The control plane refused to mint the grant.

Diagnosis

The rendered sentence is enroll.ErrNoCA verbatim and unwrapped (internal/enroll/community_ca.go:32). That matters: the production DirGranter wraps it as "%w (no root at %s)" (internal/enroll/community_ca_store.go:138) and Approve further wraps a granter error as "mint grant: %w" (internal/enroll/ledger.go:614). An unadorned sentence can come from exactly one place — the nil-Granter branch:

  • internal/enroll/ledger.go:602-604 — if l.cfg.Granter == nil { return rec.View, ErrNoCA }
  • internal/controlapi/enroll.go:248-249 — maps it to a 503 no_community_ca Problem whose detail is err.Error(), which the dashboard renders as the alert above.

The device journey drives the gateway's public dashboard, not the operator app's own surface: app/tests/e2e/journey.device.spec.ts sets dash = cb.page (the ceremony browser), signs in at https://id.<apex>, and dash.goto(portalAddress); every later leg — mint, decline-resume, join, approve — drives dash. So the ledger in play is the gateway control plane's, served by control-plane (pid 2909 on :8080, logs/gateway-units.txt).

That composition never wires a Granter:

  • control-plane/cmd/control-plane/whole_composition.go:160-167 — var enrollCfg enroll.Config sets only CommunitySource and (when a clan adapter exists) OnEnrolled, then openEnrollLedger(deps.stateDir, enrollCfg). No Granter field is ever assigned, and composeDeps carries no CA home.
  • The code says so in as many words: control-plane/cmd/control-plane/compose.go:599-600 — "Where the ledger carries no community CA, Approve honestly fails loud (ErrNoCA, ADR 0111) — the transport lands the act, the CA wiring is #210's separate slice"; same note at whole_composition.go:477-481.
  • It is pinned by an existing test: control-plane/cmd/control-plane/compose_enroll_test.go:196-224 (TestComposeEnroll_WholeActsOverRealLedger) asserts approve returns 503. Verified on e453b8f4: CGO_ENABLED=0 go test ./cmd/control-plane/ -run TestComposeEnroll_WholeActsOverRealLedger → PASS.

This is therefore an unbuilt slice, not a regression. #210 landed the CA seam and wired it on the app-helper side only (app/helper/cmd/helper/wiring_prod.go:261-263 — Granter: enroll.DirGranter{Dir: communityCADir()}, mint at wiring_prod.go:184 via the founding trust-root port, internal/founding/standup.go:706-713). The founding-side root exists for this drive — logs/founding-state.log shows founded: true and the gateway approved wizard-implicitly — but it lives in the workstation helper's state dir (<state>/community-ca, wiring_prod.go:116). Nothing puts it, or any signer, on the gateway.

The crown-jewel root-ca var is declaration-only and cannot currently serve as the transport: internal/founding/seed.go:344 lists it in crownJewelKeys and placeCrownJewels (seed.go:350-366) calls Config().SetVarSpec, which records generator + recipients into the inventory and nothing else (internal/clan/config.go:169-191; clan.VarSpec has no value field, internal/clan/clan.go:738-744). The founding-minted PEM pair is never handed into it. founding-state.log's crown_jewels entry for root-ca (recipients machine:gateway, recovery:rehearsal-d) is that spec, not sealed key material.

Suspected layer

Composition + founding hand-off, not the enroll seam. internal/enroll is correct and fails loud exactly as ADR 0100/0111 ask. The gap is that post-founding device-add is operated from the gateway's dashboard while the only wired signer lives in the operator app.

What plugging it needs

A ruling first, then wiring — this is why the report is not marked confident:

  1. Who signs a post-founding device grant? The gateway control plane (the surface the operator actually approves on, and the one ADR 0111's machine:gateway recipient implies), or the operator app's helper with the gateway's ledger delegating to it? Founding's own S9 grant is signed app-side today; device-add cannot be, because the approve click never reaches the helper.
  2. If the gateway signs — how does the root get there, and may it hold the private half at all? ADR 0111 rules the key is a crown jewel sealed at rest under ADR 0104's rescue posture but does not settle transport, and putting a community root's private key on the public-facing gateway is a security posture decision. The obvious candidate is giving root-ca a real value at seeding (the recipient set is already right) and reading it back through clan.Vars — compare backup.NewCrownJewelKeyReader(deps.clan.Vars(), node) at whole_composition.go:~197, which is the same shape for the backup-root jewel. A re-mint on the gateway must be ruled out: it would orphan every grant the founding-side root already signed (internal/enroll/community_ca_store.go:28-33).
  3. Once ruled: assign enrollCfg.Granter in whole_composition.go:160-167, and flip compose_enroll_test.go's 503 pin to the new posture (the resting composition should keep failing loud).

Secondary, same evidence — the drive burns 5 minutes blind

app/tests/e2e/journey.device.spec.ts (fixture approvePending, the expect(...).toBeVisible({ timeout: 5 * 60_000 }) at line 193) waits only on the success locator. The refusal alert is on the page within milliseconds, so the leg spends the entire 300 s ceiling (legs.json: approve ms: 300357) and then reports element(s) not found — hiding a sentence the control plane stated plainly. Racing the connected-device card against the approve-refusal alert would make this class of red self-explaining and cheap. Worth folding in, but it is presentation only: the leg stays red until the Granter is wired.

drive 20260828T152314Z red at approve: expect(locator).toBeVisible() failed Locator: locator('[data-field="connected-device"]') Expected: visible Timeout: 300000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 3
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T152314Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure The #854 standing device drive (`test-results/drive-device/20260828T152314Z`) ran 23 legs green and red at `approve` after the full 300 s ceiling (`artifacts/legs.json`, `artifacts/verdict.json` — `firstRedLeg: approve`, commit `e453b8f4`). Playwright reports only `locator('[data-field="connected-device"]')` never appearing, but that is the symptom. The accessibility snapshot taken at the moment of failure shows the real answer already on screen: ``` - alert: - paragraph: "enroll: no community CA configured — approval fails loud (ADR 0100/0111); mint one at founding" - button "Try again" ``` (`artifacts/journey.device-device-add--809eb-e-standing-rented-community/error-context.md:58`.) The pending card was correct and scoped — code `UZPR-NDUS-LTFJ-V2QS-XLTN`, the probe table carrying the member droplet's real facts — and the operator's Approve click landed. The control plane refused to mint the grant. ## Diagnosis The rendered sentence is `enroll.ErrNoCA` **verbatim and unwrapped** (`internal/enroll/community_ca.go:32`). That matters: the production `DirGranter` wraps it as `"%w (no root at %s)"` (`internal/enroll/community_ca_store.go:138`) and `Approve` further wraps a granter error as `"mint grant: %w"` (`internal/enroll/ledger.go:614`). An unadorned sentence can come from exactly one place — the nil-Granter branch: - `internal/enroll/ledger.go:602-604` — `if l.cfg.Granter == nil { return rec.View, ErrNoCA }` - `internal/controlapi/enroll.go:248-249` — maps it to a 503 `no_community_ca` Problem whose detail is `err.Error()`, which the dashboard renders as the alert above. The device journey drives the **gateway's public dashboard**, not the operator app's own surface: `app/tests/e2e/journey.device.spec.ts` sets `dash = cb.page` (the ceremony browser), signs in at `https://id.<apex>`, and `dash.goto(portalAddress)`; every later leg — `mint`, `decline-resume`, `join`, `approve` — drives `dash`. So the ledger in play is the gateway control plane's, served by `control-plane` (pid 2909 on `:8080`, `logs/gateway-units.txt`). That composition never wires a `Granter`: - `control-plane/cmd/control-plane/whole_composition.go:160-167` — `var enrollCfg enroll.Config` sets only `CommunitySource` and (when a clan adapter exists) `OnEnrolled`, then `openEnrollLedger(deps.stateDir, enrollCfg)`. No `Granter` field is ever assigned, and `composeDeps` carries no CA home. - The code says so in as many words: `control-plane/cmd/control-plane/compose.go:599-600` — "Where the ledger carries no community CA, Approve honestly fails loud (ErrNoCA, ADR 0111) — the transport lands the act, the CA wiring is #210's separate slice"; same note at `whole_composition.go:477-481`. - It is **pinned by an existing test**: `control-plane/cmd/control-plane/compose_enroll_test.go:196-224` (`TestComposeEnroll_WholeActsOverRealLedger`) asserts approve returns `503`. Verified on `e453b8f4`: `CGO_ENABLED=0 go test ./cmd/control-plane/ -run TestComposeEnroll_WholeActsOverRealLedger` → PASS. This is therefore an **unbuilt slice, not a regression**. #210 landed the CA seam and wired it on the app-helper side only (`app/helper/cmd/helper/wiring_prod.go:261-263` — `Granter: enroll.DirGranter{Dir: communityCADir()}`, mint at `wiring_prod.go:184` via the founding `trust-root` port, `internal/founding/standup.go:706-713`). The founding-side root exists for this drive — `logs/founding-state.log` shows `founded: true` and the gateway approved wizard-implicitly — but it lives in the **workstation helper's** state dir (`<state>/community-ca`, `wiring_prod.go:116`). Nothing puts it, or any signer, on the gateway. The crown-jewel `root-ca` var is **declaration-only** and cannot currently serve as the transport: `internal/founding/seed.go:344` lists it in `crownJewelKeys` and `placeCrownJewels` (`seed.go:350-366`) calls `Config().SetVarSpec`, which records generator + recipients into the inventory and nothing else (`internal/clan/config.go:169-191`; `clan.VarSpec` has no value field, `internal/clan/clan.go:738-744`). The founding-minted PEM pair is never handed into it. `founding-state.log`'s `crown_jewels` entry for `root-ca` (recipients `machine:gateway`, `recovery:rehearsal-d`) is that spec, not sealed key material. ## Suspected layer Composition + founding hand-off, not the enroll seam. `internal/enroll` is correct and fails loud exactly as ADR 0100/0111 ask. The gap is that post-founding device-add is operated from the gateway's dashboard while the only wired signer lives in the operator app. ## What plugging it needs A ruling first, then wiring — this is why the report is not marked confident: 1. **Who signs a post-founding device grant?** The gateway control plane (the surface the operator actually approves on, and the one ADR 0111's `machine:gateway` recipient implies), or the operator app's helper with the gateway's ledger delegating to it? Founding's own S9 grant is signed app-side today; device-add cannot be, because the approve click never reaches the helper. 2. **If the gateway signs — how does the root get there, and may it hold the private half at all?** ADR 0111 rules the key is a crown jewel sealed at rest under ADR 0104's rescue posture but does not settle transport, and putting a community root's private key on the public-facing gateway is a security posture decision. The obvious candidate is giving `root-ca` a real value at seeding (the recipient set is already right) and reading it back through `clan.Vars` — compare `backup.NewCrownJewelKeyReader(deps.clan.Vars(), node)` at `whole_composition.go:~197`, which is the same shape for the `backup-root` jewel. A re-mint on the gateway must be ruled **out**: it would orphan every grant the founding-side root already signed (`internal/enroll/community_ca_store.go:28-33`). 3. Once ruled: assign `enrollCfg.Granter` in `whole_composition.go:160-167`, and flip `compose_enroll_test.go`'s 503 pin to the new posture (the resting composition should keep failing loud). ## Secondary, same evidence — the drive burns 5 minutes blind `app/tests/e2e/journey.device.spec.ts` (fixture `approvePending`, the `expect(...).toBeVisible({ timeout: 5 * 60_000 })` at line 193) waits only on the success locator. The refusal alert is on the page within milliseconds, so the leg spends the entire 300 s ceiling (`legs.json`: `approve` `ms: 300357`) and then reports `element(s) not found` — hiding a sentence the control plane stated plainly. Racing the `connected-device` card against the approve-refusal alert would make this class of red self-explaining and cheap. Worth folding in, but it is presentation only: the leg stays red until the Granter is wired. drive `20260828T152314Z` red at `approve`: `expect(locator).toBeVisible() failed Locator: locator('[data-field="connected-device"]') Expected: visible Timeout: 300000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 3` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T152314Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: c1ac37bc5a0d -->
Author
Member

Routed ready-for-human — the Granter wiring is a one-way door (ADR 0174)

Ruled by agent under ADR 0174 — veto anytime.

I confirmed the diagnosis end-to-end on ed4499f5 and it holds exactly as filed:

  • internal/enroll/ledger.go:602-604 — the nil-Granter branch returns the bare
    ErrNoCA sentence, unwrapped; that is why the dashboard's refusal alert reads
    enroll: no community CA configured … verbatim (only the nil branch skips the
    DirGranter/mint grant: wrappers).
  • control-plane/cmd/control-plane/whole_composition.go:162-167 — enrollCfg sets
    only CommunitySource (+ OnEnrolled when a clan adapter exists); no Granter
    is ever assigned
    , so the gateway ledger the device journey approves on refuses
    the mint. The composition note at :479-481 and compose.go:599-600 say so in as
    many words, and compose_enroll_test.go's TestComposeEnroll_WholeActsOverRealLedger
    pins the 503 (PASS on this checkout). This is an unbuilt slice (#210's CA seam was
    wired app-side only), not a regression.

Why human

This ticket asks for a ruling, and the ruling it needs is a one-way door — so
under ADR 0174 rule 2 I stop that part rather than self-authorize. Wiring the Granter
is not a config flip; it forces a security-posture decision that is on ADR 0174's
one-way-door list ("security-posture widenings: a new deliberately-public surface …"):

  1. Who signs a post-founding device grant — the gateway control plane, or the
    operator app's helper with the gateway's ledger delegating to it?
    Founding's own
    S9 grant is signed app-side; device-add cannot be, because the approve click never
    reaches the helper (the journey drives the gateway's public dashboard).
  2. If the gateway signs — may the public-facing gateway hold the community root's
    private half at all, and how does the root get there?
    ADR 0111 rules the root key
    is a crown jewel sealed at rest under ADR 0104's rescue posture but does not
    settle transport. Placing a community root's private signing key onto the
    deliberately-public gateway is a security-posture widening — not revertible by a
    commit once the exposure decision is made — and so belongs to the human.
    (A re-mint on the gateway must be ruled out either way: it would orphan every
    grant the founding-side root already signed — community_ca_store.go:28-33.)

The ticket carries no proposed default ruling (ADR 0174 rule 4), so there is
nothing for a session to adopt under rule 1. The obvious candidate wiring is sketched
in the report (give root-ca a real value at seeding — the machine:gateway recipient
set is already right — and read it back through clan.Vars, the same shape as
backup.NewCrownJewelKeyReader at whole_composition.go:199), but choosing it is the
human's call because of (2). Once ruled: assign enrollCfg.Granter at
whole_composition.go:162-167 and flip compose_enroll_test.go's 503 pin to the new
posture (the resting composition should keep failing loud).

## Why human: a one-way-door ruling — the signing-authority + private-key-transport
posture for post-founding device grants on the public gateway.

The two-way part landed this session (ed4499f5)

The secondary finding — the drive burns the full 300 s ceiling blind — was revertible
and provable, so I fixed it. app/tests/e2e/fixtures/deviceAdd.ts approvePending now
races the connected-device success card against the strip's refusal alert
(PendingDevicesSurface's OcErrorState, status="pending-device-error") with
locator.or(): a mint refusal now loses the race in milliseconds and reds the leg with
the control plane's own error-message text as the reason, instead of a bare
element(s) not found after 5 minutes. Presentation only — the approve leg stays
correctly red until the Granter is wired; it just fails fast and self-explaining.
Proof: vue-tsc clean, prettier --check clean, vitest tests/e2e/fixtures/deviceAdd.test.ts
10/10 green. STATUS.md unchanged (no phase/gate/feature moved — the drive leg is still red).

Leaving the ticket open and relabelled ready-for-session → ready-for-human; the
Granter wiring is the human residue.

## Routed `ready-for-human` — the Granter wiring is a one-way door (ADR 0174) Ruled by agent under ADR 0174 — veto anytime. I confirmed the diagnosis end-to-end on `ed4499f5` and it holds exactly as filed: - `internal/enroll/ledger.go:602-604` — the nil-`Granter` branch returns the bare `ErrNoCA` sentence, unwrapped; that is why the dashboard's refusal alert reads `enroll: no community CA configured …` verbatim (only the nil branch skips the `DirGranter`/`mint grant:` wrappers). - `control-plane/cmd/control-plane/whole_composition.go:162-167` — `enrollCfg` sets only `CommunitySource` (+ `OnEnrolled` when a clan adapter exists); **no `Granter` is ever assigned**, so the gateway ledger the device journey approves on refuses the mint. The composition note at `:479-481` and `compose.go:599-600` say so in as many words, and `compose_enroll_test.go`'s `TestComposeEnroll_WholeActsOverRealLedger` pins the 503 (PASS on this checkout). This is an **unbuilt slice (#210's CA seam was wired app-side only), not a regression.** ### Why human This ticket asks for a **ruling**, and the ruling it needs is a **one-way door** — so under ADR 0174 rule 2 I stop that part rather than self-authorize. Wiring the Granter is not a config flip; it forces a **security-posture** decision that is on ADR 0174's one-way-door list ("security-posture widenings: a new deliberately-public surface …"): 1. **Who signs a post-founding device grant — the gateway control plane, or the operator app's helper with the gateway's ledger delegating to it?** Founding's own S9 grant is signed app-side; device-add cannot be, because the approve click never reaches the helper (the journey drives the gateway's public dashboard). 2. **If the gateway signs — may the public-facing gateway hold the community root's private half at all, and how does the root get there?** ADR 0111 rules the root key is a **crown jewel sealed at rest** under ADR 0104's rescue posture but does **not** settle transport. Placing a community root's private signing key onto the deliberately-public gateway is a security-posture widening — not revertible by a commit once the exposure decision is made — and so belongs to the human. (A re-mint on the gateway must be ruled **out** either way: it would orphan every grant the founding-side root already signed — `community_ca_store.go:28-33`.) The ticket carries **no proposed default ruling** (ADR 0174 rule 4), so there is nothing for a session to adopt under rule 1. The obvious candidate wiring is sketched in the report (give `root-ca` a real value at seeding — the `machine:gateway` recipient set is already right — and read it back through `clan.Vars`, the same shape as `backup.NewCrownJewelKeyReader` at `whole_composition.go:199`), but choosing it is the human's call because of (2). Once ruled: assign `enrollCfg.Granter` at `whole_composition.go:162-167` and flip `compose_enroll_test.go`'s 503 pin to the new posture (the *resting* composition should keep failing loud). **`## Why human`: a one-way-door ruling** — the signing-authority + private-key-transport posture for post-founding device grants on the public gateway. ### The two-way part landed this session (`ed4499f5`) The secondary finding — the drive burns the full 300 s ceiling blind — was revertible and provable, so I fixed it. `app/tests/e2e/fixtures/deviceAdd.ts` `approvePending` now races the `connected-device` success card against the strip's refusal alert (`PendingDevicesSurface`'s `OcErrorState`, `status="pending-device-error"`) with `locator.or()`: a mint refusal now loses the race in milliseconds and reds the leg with the control plane's **own** `error-message` text as the reason, instead of a bare `element(s) not found` after 5 minutes. Presentation only — the `approve` leg stays **correctly red** until the Granter is wired; it just fails fast and self-explaining. Proof: `vue-tsc` clean, `prettier --check` clean, `vitest tests/e2e/fixtures/deviceAdd.test.ts` 10/10 green. STATUS.md unchanged (no phase/gate/feature moved — the drive leg is still red). Leaving the ticket **open** and relabelled `ready-for-session` → `ready-for-human`; the Granter wiring is the human residue.
Owner

RULED by Ben (2026-08-28): the gateway signs, from the root-ca clan vars — landed bb80306d (ADR 0111 amendment)

Who signs: the gateway control plane. How the root gets there: founding feeds the minted root's two PEM halves into two persisted-prompt clan vars on the gateway node — idss-community-ca-key / idss-community-ca-cert — at the seed leg, beside the claim secret (communityCAAnswers, all three carrier paths). The control-plane unit exports their .paths as IDSS_COMMUNITY_CA_KEY_FILE / _CERT_FILE (file paths, never $(cat)); the whole composition wires enroll.FilesGranter over them. One root, two homes — the gateway-signed grant verifies against the operator-minted root. May it hold the private half: yes — the gateway already holds ssh-ca, gateway-vars, backup-root under the same recipient set (machine key + recovery, operator keys excluded). Rejected: delegating each grant to the operator's laptop (approval would need it online).

Tests: FilesGranter; all four gateway renders declare + export, gated on GatewayFacts.CommunityCA (dual-render, GOTCHAS #12); TestSelfHosted_DeployFeedsTheCommunityCA; TestComposeEnroll_WholeApprovesWithTheCommunityCA (204, grant verifies) beside the standing ErrNoCA pin for the resting composition. Secondary (fixture self-explains the refusal) landed earlier as ed4499f5.

The next #854 drive re-founds the standing community (agent-affecting change) with the vars fed, so approve is its live proof. Closing.

## RULED by Ben (2026-08-28): the gateway signs, from the `root-ca` clan vars — landed `bb80306d` (ADR 0111 amendment) **Who signs:** the gateway control plane. **How the root gets there:** founding feeds the minted root's two PEM halves into two persisted-prompt clan vars on the gateway node — `idss-community-ca-key` / `idss-community-ca-cert` — at the seed leg, beside the claim secret (`communityCAAnswers`, all three carrier paths). The control-plane unit exports their `.path`s as `IDSS_COMMUNITY_CA_KEY_FILE` / `_CERT_FILE` (file paths, never `$(cat)`); the whole composition wires `enroll.FilesGranter` over them. One root, two homes — the gateway-signed grant verifies against the operator-minted root. **May it hold the private half:** yes — the gateway already holds `ssh-ca`, `gateway-vars`, `backup-root` under the same recipient set (machine key + recovery, operator keys excluded). Rejected: delegating each grant to the operator's laptop (approval would need it online). Tests: `FilesGranter`; all four gateway renders declare + export, gated on `GatewayFacts.CommunityCA` (dual-render, GOTCHAS #12); `TestSelfHosted_DeployFeedsTheCommunityCA`; `TestComposeEnroll_WholeApprovesWithTheCommunityCA` (204, grant verifies) beside the standing `ErrNoCA` pin for the resting composition. Secondary (fixture self-explains the refusal) landed earlier as `ed4499f5`. The next #854 drive re-founds the standing community (agent-affecting change) with the vars fed, so `approve` is its live proof. Closing.
ben closed this issue 2026-08-28 16:14:55 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#945
No description provided.