#945: founding reads the community CA before it mints it — the rented and own-VPS gateways render no idss-community-ca-* vars, so Approve refuses with ErrNoCA #949

Closed
opened 2026-08-28 18:42:47 +00:00 by matou-build-agent · 1 comment

Failure

Drive 20260828T174113Z (target device, commit fa0d297c) red at the approve leg after 23 green legs — artifacts/legs.json:24, artifacts/verdict.json (firstRedLeg: approve, 814 ms). The control plane refused to mint the device grant:

enroll: no community CA configured — approval fails loud (ADR 0100/0111); mint one at founding

Surfaced by app/tests/e2e/fixtures/deviceAdd.ts:214 (the #945 refusal race added at ed4499f5 — that leg self-explained correctly and reds in 814 ms instead of burning the 5-min ceiling; it is working as designed).

Diagnosis: an ordering inversion, not a missing wire

bb80306d wired the gateway's device-grant signer to two persisted-prompt clan vars fed by founding. On the rented and own-VPS carrier paths the feed is read one leg too early:

  • internal/founding/rentedpath.go:289 — installRented (the enroll-configure leg) calls communityCAAnswers(ctx, o.trustRoot).
  • internal/founding/standup.go:706-714 — applyPaired is the only caller of trustRoot.Ensure, i.e. the only thing that mints the root. It runs at the pair leg.
  • internal/founding/rentedpath.go:254 then :268 — install returns before pair is entered. Same shape on own-VPS: internal/founding/ownvpspath.go:430 (install) before :482 (pair), feed at :609.

On a fresh community the app's community-ca dir (app/helper/cmd/helper/wiring_prod.go:116) is empty, so trustRootAdapter.Material → enroll.Material (internal/enroll/community_ca_store.go:187-190) returns a wrapped os.ErrNotExist. communityCAAnswers (internal/founding/ownvpspath.go:544-552) deliberately swallows that into ok=false, so the miss is silent:

  • GatewayFacts.CommunityCA stays false → gatewayCommunityCAGenerators (internal/clan/vmguest.go:1884-1889) emits no generator;
  • gatewayEnvExports (internal/clan/vmguest.go:1657-1663) exports no IDSS_COMMUNITY_CA_KEY_FILE/_CERT_FILE;
  • productionCommunityCA (control-plane/cmd/control-plane/main.go:192-207) returns nil and the enroll ledger's Granter rests.

Both run records confirm it

  • state/clan-config-snapshot/tree.txt — the gateway's vars carry idss-claim-secret, gate-oidc, kanidm-admins, kanidm-tls, state-version, and zero idss-community-ca-* entries. The generators were never declared.
  • logs/gateway-journal.txt:1322 (17:54, first control-plane start after enroll-activate), and again at :1718 / :1808 (18:36, after the deploy leg): community CA resting: no IDSS_COMMUNITY_CA_KEY_FILE/_CERT_FILE — device approval refuses (ErrNoCA) until founding feeds the root into the gateway's vars (ADR 0111, #945).
  • logs/founding-state.log — the seed leg placed root-ca among the 5 crown jewels, so the root does exist by then; it simply did not exist at enroll-configure, three legs earlier.

Why the seam tests stayed green

Two independent blind spots:

  1. The only whole-path feed test covers the one path whose ordering is correct. internal/founding/selfhostedpath_test.go:476 (TestSelfHosted_DeployFeedsTheCommunityCA) exercises composeSelfHostedGateway, whose feed at internal/founding/selfhostedpath.go:210 sits inside runDeploy — after applyPaired mints. Self-hosted is genuinely fine. Rented and own-VPS have no equivalent test.
  2. FakeTrustRoot.Material is not keyed on Ensure. internal/founding/testing/fakes.go answers from KeyPEM/CertPEM set at construction, so a fake handed material reports it minted even if Ensure was never called. The real adapter's material only appears on disk once Ensure runs. TestCommunityCAAnswers (internal/founding/ownvpspath_internal_test.go:303) pins the unminted→ok=false behaviour of the helper in isolation, which is correct — nothing pins when the helper is called relative to the mint.

Suspected layer

internal/founding — carrier-path leg ordering. Not clan render, not control-plane composition, not enroll: those three all behave correctly given a fed var. The commit message on bb80306d says the feed rides "the seed leg"; the code puts it on the install leg, and on two of three carriers that is ahead of the mint.

What plugging it needs

A ruling on where ADR 0111's mint moment sits, since bb80306d landed one commit ago as an ADR 0111 amendment on Ben's ruling and the fix amends it again. The options are not equivalent:

  1. Mint before the install leg. Hoist trustRoot.Ensure so it runs ahead of installRented/installOwnVPS (the community name is known from the create leg — s.Draft.Details.Name is populated well before), keeping the idempotent Ensure at standup.go:706 as the convergence point for every path. Smallest change; moves ADR 0111's "created when the community is founded, immediately ahead of the first grant" wording earlier in the same ceremony.
  2. Feed at the seed leg as the commit message describes. Does not work as-is: the generator must be declared in the machine config the enroll-configure render bakes, so a seed-leg feed needs a second render + redeploy after seeding — a new leg, and slower.
  3. Gateway mints its own root, founding hands only the cert. Largest change; breaks the "one root, two homes" property the amendment was written to get.

Whichever lands, two test gaps should close in the same commit:

  • make FakeTrustRoot.Material honest — return the os.ErrNotExist wrap until Ensure has been called, so the fake models the real adapter's disk;
  • add the rented and own-VPS twins of TestSelfHosted_DeployFeedsTheCommunityCA, asserting req.Gateway.CommunityCA is true and both answers are fed on those paths. With the fake made honest, those two tests fail against today's main and pass after the fix.

Targeted check: go test ./internal/founding/... ./internal/clan/....

Notes

  • Self-hosted needs no ordering change — only the added guard tests.
  • The approve leg's own refusal handling is correct and should not be touched.
  • No infra state is implicated: the droplet, DNS and the standing community all behaved; this is a config-render omission decided on the operator's machine.

drive 20260828T174113Z red at approve: the control plane refused to approve the device — the Approve verb landed but minting the grant failed: "enroll: no community CA configured — approval fails loud (ADR 0100/0111); mint one at found
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T174113Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure Drive `20260828T174113Z` (target `device`, commit `fa0d297c`) red at the `approve` leg after 23 green legs — `artifacts/legs.json:24`, `artifacts/verdict.json` (`firstRedLeg: approve`, 814 ms). The control plane refused to mint the device grant: > `enroll: no community CA configured — approval fails loud (ADR 0100/0111); mint one at founding` Surfaced by `app/tests/e2e/fixtures/deviceAdd.ts:214` (the #945 refusal race added at `ed4499f5` — that leg self-explained correctly and reds in 814 ms instead of burning the 5-min ceiling; it is working as designed). ## Diagnosis: an ordering inversion, not a missing wire `bb80306d` wired the gateway's device-grant signer to two persisted-prompt clan vars fed by founding. On the **rented** and **own-VPS** carrier paths the feed is read one leg too early: - `internal/founding/rentedpath.go:289` — `installRented` (the `enroll-configure` leg) calls `communityCAAnswers(ctx, o.trustRoot)`. - `internal/founding/standup.go:706-714` — `applyPaired` is the only caller of `trustRoot.Ensure`, i.e. the only thing that mints the root. It runs at the **pair** leg. - `internal/founding/rentedpath.go:254` then `:268` — install returns *before* pair is entered. Same shape on own-VPS: `internal/founding/ownvpspath.go:430` (install) before `:482` (pair), feed at `:609`. On a fresh community the app's `community-ca` dir (`app/helper/cmd/helper/wiring_prod.go:116`) is empty, so `trustRootAdapter.Material` → `enroll.Material` (`internal/enroll/community_ca_store.go:187-190`) returns a wrapped `os.ErrNotExist`. `communityCAAnswers` (`internal/founding/ownvpspath.go:544-552`) deliberately swallows that into `ok=false`, so the miss is silent: - `GatewayFacts.CommunityCA` stays false → `gatewayCommunityCAGenerators` (`internal/clan/vmguest.go:1884-1889`) emits no generator; - `gatewayEnvExports` (`internal/clan/vmguest.go:1657-1663`) exports no `IDSS_COMMUNITY_CA_KEY_FILE`/`_CERT_FILE`; - `productionCommunityCA` (`control-plane/cmd/control-plane/main.go:192-207`) returns nil and the enroll ledger's Granter rests. ### Both run records confirm it - `state/clan-config-snapshot/tree.txt` — the gateway's vars carry `idss-claim-secret`, `gate-oidc`, `kanidm-admins`, `kanidm-tls`, `state-version`, and **zero** `idss-community-ca-*` entries. The generators were never declared. - `logs/gateway-journal.txt:1322` (17:54, first control-plane start after enroll-activate), and again at `:1718` / `:1808` (18:36, after the deploy leg): `community CA resting: no IDSS_COMMUNITY_CA_KEY_FILE/_CERT_FILE — device approval refuses (ErrNoCA) until founding feeds the root into the gateway's vars (ADR 0111, #945)`. - `logs/founding-state.log` — the seed leg placed `root-ca` among the 5 crown jewels, so the root *does* exist by then; it simply did not exist at `enroll-configure`, three legs earlier. ## Why the seam tests stayed green Two independent blind spots: 1. **The only whole-path feed test covers the one path whose ordering is correct.** `internal/founding/selfhostedpath_test.go:476` (`TestSelfHosted_DeployFeedsTheCommunityCA`) exercises `composeSelfHostedGateway`, whose feed at `internal/founding/selfhostedpath.go:210` sits inside `runDeploy` — *after* `applyPaired` mints. Self-hosted is genuinely fine. Rented and own-VPS have no equivalent test. 2. **`FakeTrustRoot.Material` is not keyed on `Ensure`.** `internal/founding/testing/fakes.go` answers from `KeyPEM`/`CertPEM` set at construction, so a fake handed material reports it minted even if `Ensure` was never called. The real adapter's material only appears on disk once `Ensure` runs. `TestCommunityCAAnswers` (`internal/founding/ownvpspath_internal_test.go:303`) pins the unminted→`ok=false` behaviour of the helper in isolation, which is correct — nothing pins *when* the helper is called relative to the mint. ## Suspected layer `internal/founding` — carrier-path leg ordering. Not clan render, not control-plane composition, not enroll: those three all behave correctly given a fed var. The commit message on `bb80306d` says the feed rides "the seed leg"; the code puts it on the install leg, and on two of three carriers that is ahead of the mint. ## What plugging it needs A ruling on where ADR 0111's mint moment sits, since `bb80306d` landed one commit ago as an ADR 0111 amendment on Ben's ruling and the fix amends it again. The options are not equivalent: 1. **Mint before the install leg.** Hoist `trustRoot.Ensure` so it runs ahead of `installRented`/`installOwnVPS` (the community name is known from the create leg — `s.Draft.Details.Name` is populated well before), keeping the idempotent `Ensure` at `standup.go:706` as the convergence point for every path. Smallest change; moves ADR 0111's "created when the community is founded, immediately ahead of the first grant" wording earlier in the same ceremony. 2. **Feed at the seed leg as the commit message describes.** Does not work as-is: the generator must be *declared* in the machine config the `enroll-configure` render bakes, so a seed-leg feed needs a second render + redeploy after seeding — a new leg, and slower. 3. **Gateway mints its own root**, founding hands only the cert. Largest change; breaks the "one root, two homes" property the amendment was written to get. Whichever lands, two test gaps should close in the same commit: - make `FakeTrustRoot.Material` honest — return the `os.ErrNotExist` wrap until `Ensure` has been called, so the fake models the real adapter's disk; - add the rented and own-VPS twins of `TestSelfHosted_DeployFeedsTheCommunityCA`, asserting `req.Gateway.CommunityCA` is true and both answers are fed on those paths. With the fake made honest, those two tests fail against today's `main` and pass after the fix. Targeted check: `go test ./internal/founding/... ./internal/clan/...`. ## Notes - Self-hosted needs no ordering change — only the added guard tests. - The `approve` leg's own refusal handling is correct and should not be touched. - No infra state is implicated: the droplet, DNS and the standing community all behaved; this is a config-render omission decided on the operator's machine. drive `20260828T174113Z` red at `approve`: `the control plane refused to approve the device — the Approve verb landed but minting the grant failed: "enroll: no community CA configured — approval fails loud (ADR 0100/0111); mint one at found` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T174113Z` 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 -->
Owner

Correct diagnosis — and already landed as 81bfee95 (pushed 18:39, minutes before this was filed): communityCAAnswers now Ensures (idempotently, for the draft's community name) at the seed leg before reading Material, on all three carrier paths; applyPaired's mint stays as the net. FakeTrustRoot.MintOnEnsure models the real adapter so TestSelfHosted_DeployFeedsTheCommunityCA proves the ordering end to end; TestCommunityCAAnswers asserts the mint precedes the read. Closing so the next #854 drive is the live proof — a worker picking this up would double-land it (#237).

Correct diagnosis — and already landed as `81bfee95` (pushed 18:39, minutes before this was filed): `communityCAAnswers` now `Ensure`s (idempotently, for the draft's community name) at the seed leg before reading `Material`, on all three carrier paths; `applyPaired`'s mint stays as the net. `FakeTrustRoot.MintOnEnsure` models the real adapter so `TestSelfHosted_DeployFeedsTheCommunityCA` proves the ordering end to end; `TestCommunityCAAnswers` asserts the mint precedes the read. Closing so the next #854 drive is the live proof — a worker picking this up would double-land it (#237).
ben closed this issue 2026-08-28 18:43:29 +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#949
No description provided.