rehearsal-5 task 5/13: Files render grows the member-device shape #846

Closed
opened 2026-08-25 20:14:34 +00:00 by ben · 4 comments
Owner

Part of the #183 phase-5 rehearsal arc (device-add + Nextcloud-on-device on a standing rented community).

  • Spec: docs/superpowers/specs/2026-08-25-183-phase-5-device-nextcloud-rehearsal-design.md
  • Plan: docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md — this ticket is Task 5, carried verbatim below. The plan's Global Constraints apply to every step.

Task 5: Files render grows the member-device shape

Files:

  • Modify: internal/clan/files.go (standalone wt0 listen + firewall; OIDC device form), files_test.go
  • Modify: internal/clan/files_attach.go (device-shape FilesLiveSet), files_attach_test.go
  • Create: internal/clan/member_attach.go + member_attach_test.go (ComposeMemberModules)
  • Create: internal/clan/files_idp_gateway.go + test (the gateway-side kanidm client oneshot + shared secret var)
  • Modify: STATUS.md

Interfaces:

  • Consumes: RenderFiles(FilesConfig) (files.go:232), AttachFiles(ctx, FilesLiveSet) (files_attach.go:119), ComposeGatewayCohost/presentModules as the composition pattern (gateway_attach.go:326,414), the sibling wt0 firewall pattern (code.go:302).

  • Produces:

    // FilesConfig gains: MeshListen bool (standalone: nginx listens on the wt0
    // interface port 80 and the firewall opens it), OIDCDiscoveryURL string,
    // OIDCSecretVar string (the shared clan var path both machines read).
    func (a *Adapter) ComposeMemberModules(ctx context.Context, node NodeID, present []string) (Commit, error)
    // files_idp_gateway.go: RenderFilesIdPClient(cfg FilesIdPConfig) string —
    // the kanidm OAuth2 client oneshot + shared secret generator, rendered into
    // machines/<gateway>/files-idp.nix when files is placed OFF-gateway.
    

    Render facts under test: standalone files.nix contains networking.firewall.interfaces."wt0".allowedTCPPorts = [ 80 ];, an explicit nginx listen, NO services.kanidm reference, NO localhost:8443, discovery URL = https://id.<apex>/oauth2/openid/<client>/.well-known/openid-configuration; the member configuration.nix imports the four base modules + files.nix.

  • Step 1: Write the failing render tests — TestRenderFiles_MemberDeviceListensOnWt0AndOpensFirewall (replaces the pinned absence in TestRenderFiles_StandaloneLeavesNginxDefault — retire that test WITH a comment naming this task), TestRenderFiles_MemberOIDCUsesPublicDiscoveryAndSharedSecret, TestRenderFilesIdPClient_GatewayOneshotOwnsKanidmAndSharesSecret, TestComposeMemberModules_ImportsBaseAndPresentModules (+ idempotence, mirroring gateway_attach_test.go:164).

  • Step 2: Run go test ./internal/clan -run 'Member|FilesIdP|RenderFiles' -v → FAIL.

  • Step 3: Implement — smallest render changes that pass; keep every existing co-host test green untouched.

  • Step 4: Run the whole package + requireNixParse smokes → PASS.

  • Step 5: Commit — git commit -m "rehearsal-5: files grows the member-device shape — wt0 listen, OIDC split, member composition (ADR 0209) (task 5 of #<ticket>)".


Global Constraints (from the plan)

  • Nothing fabricated (ADR 0100): every landed fact is read from the box; a
    failure is a named error, never a masked success. No sandbox-green claim (#377).
  • The wipe consent is given at the machine (ADR 0024) and shown-not-re-asked
    at P4-S3x; the takeover runs at provisioning's first deploy, never at join.
  • One placement deploy = device closure + gateway route in one config-repo
    commit, then two single-node clan.Deploy calls, device first (ruling: a
    route to a dead service is the honest failure, a service with no route is
    invisible).
  • Standing community: home test-results/standing-rented/; staleness gate =
    oc_bootstrap_staleness pattern over agent/ go.mod go.sum internal/; the
    reaper stays honest — renewal, not exemption (idss-rental-hold is for
    humans, the executor never sets it).
  • Do not destabilize live drives: #720 (rented confirm loop, elitebook) and
    #721/#722 (workstation) keep running; the prefix extraction (Task 10) is
    behavior-preserving and #720 must stay green across it. Never touch the
    executors' env files from a ticket.
  • Tracker gotcha: labels via POST/DELETE /issues/<n>/labels, never in an
    issue PATCH. "closes #NNN" in commit messages auto-closes — say "task N of
    #NNN" instead.
  • ADR numbers: 0207/0208/0209 assumed — re-check git ls-tree origin/main docs/adr/
    at mint (IDIP + observability swarm lanes are minting concurrently).
  • STATUS.md updated in the same commit as any project-state change;
    git pull --rebase immediately before a STATUS commit (shared checkout).
  • Go: gofmt, go vet ./..., go test ./... green; TS: pnpm -r typecheck +
    unit suites green, pre-land.
Part of the **#183 phase-5 rehearsal arc** (device-add + Nextcloud-on-device on a standing rented community). - Spec: `docs/superpowers/specs/2026-08-25-183-phase-5-device-nextcloud-rehearsal-design.md` - Plan: `docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md` — this ticket is **Task 5**, carried verbatim below. The plan's Global Constraints apply to every step. --- ### Task 5: Files render grows the member-device shape **Files:** - Modify: `internal/clan/files.go` (standalone wt0 listen + firewall; OIDC device form), `files_test.go` - Modify: `internal/clan/files_attach.go` (device-shape `FilesLiveSet`), `files_attach_test.go` - Create: `internal/clan/member_attach.go` + `member_attach_test.go` (`ComposeMemberModules`) - Create: `internal/clan/files_idp_gateway.go` + test (the gateway-side kanidm client oneshot + shared secret var) - Modify: `STATUS.md` **Interfaces:** - Consumes: `RenderFiles(FilesConfig)` (`files.go:232`), `AttachFiles(ctx, FilesLiveSet)` (`files_attach.go:119`), `ComposeGatewayCohost`/`presentModules` as the composition pattern (`gateway_attach.go:326,414`), the sibling wt0 firewall pattern (`code.go:302`). - Produces: ```go // FilesConfig gains: MeshListen bool (standalone: nginx listens on the wt0 // interface port 80 and the firewall opens it), OIDCDiscoveryURL string, // OIDCSecretVar string (the shared clan var path both machines read). func (a *Adapter) ComposeMemberModules(ctx context.Context, node NodeID, present []string) (Commit, error) // files_idp_gateway.go: RenderFilesIdPClient(cfg FilesIdPConfig) string — // the kanidm OAuth2 client oneshot + shared secret generator, rendered into // machines/<gateway>/files-idp.nix when files is placed OFF-gateway. ``` Render facts under test: standalone `files.nix` contains `networking.firewall.interfaces."wt0".allowedTCPPorts = [ 80 ];`, an explicit nginx listen, NO `services.kanidm` reference, NO `localhost:8443`, discovery URL = `https://id.<apex>/oauth2/openid/<client>/.well-known/openid-configuration`; the member `configuration.nix` imports the four base modules + `files.nix`. - [ ] **Step 1: Write the failing render tests** — `TestRenderFiles_MemberDeviceListensOnWt0AndOpensFirewall` (replaces the pinned absence in `TestRenderFiles_StandaloneLeavesNginxDefault` — retire that test WITH a comment naming this task), `TestRenderFiles_MemberOIDCUsesPublicDiscoveryAndSharedSecret`, `TestRenderFilesIdPClient_GatewayOneshotOwnsKanidmAndSharesSecret`, `TestComposeMemberModules_ImportsBaseAndPresentModules` (+ idempotence, mirroring `gateway_attach_test.go:164`). - [ ] **Step 2: Run** `go test ./internal/clan -run 'Member|FilesIdP|RenderFiles' -v` → FAIL. - [ ] **Step 3: Implement** — smallest render changes that pass; keep every existing co-host test green untouched. - [ ] **Step 4: Run** the whole package + `requireNixParse` smokes → PASS. - [ ] **Step 5: Commit** — `git commit -m "rehearsal-5: files grows the member-device shape — wt0 listen, OIDC split, member composition (ADR 0209) (task 5 of #<ticket>)"`. --- ## Global Constraints (from the plan) - **Nothing fabricated (ADR 0100):** every landed fact is read from the box; a failure is a named error, never a masked success. No sandbox-green claim (#377). - **The wipe consent is given at the machine (ADR 0024)** and shown-not-re-asked at P4-S3x; the takeover runs at provisioning's first deploy, never at join. - **One placement deploy = device closure + gateway route** in one config-repo commit, then two single-node `clan.Deploy` calls, device first (ruling: a route to a dead service is the honest failure, a service with no route is invisible). - **Standing community:** home `test-results/standing-rented/`; staleness gate = `oc_bootstrap_staleness` pattern over `agent/ go.mod go.sum internal/`; the reaper stays honest — renewal, not exemption (`idss-rental-hold` is for humans, the executor never sets it). - **Do not destabilize live drives:** #720 (rented confirm loop, elitebook) and #721/#722 (workstation) keep running; the prefix extraction (Task 10) is behavior-preserving and #720 must stay green across it. Never touch the executors' env files from a ticket. - **Tracker gotcha:** labels via `POST/DELETE /issues/<n>/labels`, never in an issue PATCH. "closes #NNN" in commit messages auto-closes — say "task N of #NNN" instead. - **ADR numbers:** 0207/0208/0209 assumed — re-check `git ls-tree origin/main docs/adr/` at mint (IDIP + observability swarm lanes are minting concurrently). - **STATUS.md** updated in the same commit as any project-state change; `git pull --rebase` immediately before a STATUS commit (shared checkout). - Go: `gofmt`, `go vet ./...`, `go test ./...` green; TS: `pnpm -r typecheck` + unit suites green, pre-land.

ADR numbers ruled at mint — read 0207 → 0208, 0208 → 0209, 0209 → 0210

Task 1 (#842) has landed the phase-5 design tier. This ticket's body carries the
plan's assumed ADR numbers; they shifted by one at mint, exactly as the
Global Constraints line in your body told you to re-check.

assumed ruled ADR
0207 0208 the standing rehearsal community — staleness-gated re-found
0208 0209 device-add's landing goes live — mesh fact, fleet admission, /get
0209 0210 files on a member device — composition, OIDC split, mesh route

Why: docs/adr/0207-design-keri-stack-version-pins.md (#771, the concurrent
IDIP lane) had taken 0207 on origin/main before this arc minted.

Use the ruled numbers in your commit messages and code comments. The plan
(docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md)
is updated and records the mapping; commit 70a3bce6.

Ruled by agent under ADR 0174 — veto anytime.

## ADR numbers ruled at mint — read 0207 → 0208, 0208 → 0209, 0209 → 0210 Task 1 (#842) has landed the phase-5 design tier. This ticket's body carries the plan's **assumed** ADR numbers; they shifted by one at mint, exactly as the Global Constraints line in your body told you to re-check. | assumed | **ruled** | ADR | |---|---|---| | 0207 | **0208** | the standing rehearsal community — staleness-gated re-found | | 0208 | **0209** | device-add's landing goes live — mesh fact, fleet admission, `/get` | | 0209 | **0210** | files on a member device — composition, OIDC split, mesh route | Why: `docs/adr/0207-design-keri-stack-version-pins.md` (#771, the concurrent IDIP lane) had taken 0207 on `origin/main` before this arc minted. Use the **ruled** numbers in your commit messages and code comments. The plan (`docs/superpowers/plans/2026-08-25-183-phase-5-device-nextcloud-rehearsal.md`) is updated and records the mapping; commit `70a3bce6`. Ruled by agent under ADR 0174 — veto anytime.

swarm-claim host=elitebook-distributed-server-03 run=10099
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10099 (automated multi-host claim — lowest live claim id works this ticket)

Ruled by agent under ADR 0174 — veto anytime

Decision: how the SHARED client secret (ADR 0210 ruling 3) is imposed on the kanidm OAuth2 client in the gateway-side files-idp.nix oneshot (RenderFilesIDPClient).

The device-side user_oidc reads the client secret from a share = true clan var (files-oidc-secret, FilesOIDCSecretVar); for OAuth2 to succeed, kanidm must hold that SAME secret. The render therefore emits kanidm system oauth2 update-basic-secret nextcloud "$secret" --name idm_admin to set it from the shared var. The exact kanidm secret-set verb is not proven offline here (kanidm CLI exposes show-basic-secret/reset-secrets; a set-from-value verb is the drive's to confirm).

Why a two-way door: it is a pure render string, revertible by a later commit with no state to migrate, no security-posture change (the secret stays a sealed clan var, the crown-jewel idm_admin credential stays on the gateway — the split's whole point), and no spend. It is provable by the placement drive (a later task in the #183 phase-5 arc): if the verb is wrong the drive reds loud at deploy-files, and the fix is local to this one render line. Not on the one-way-door list.

What proves it: the offline render seam (files_idp_gateway_test.go, green) pins the ruled SHAPE — one secret, two readers; the two-node placement drive proves the live mechanism end-to-end.

## Ruled by agent under ADR 0174 — veto anytime **Decision:** how the SHARED client secret (ADR 0210 ruling 3) is imposed on the kanidm OAuth2 client in the gateway-side `files-idp.nix` oneshot (`RenderFilesIDPClient`). The device-side `user_oidc` reads the client secret from a `share = true` clan var (`files-oidc-secret`, `FilesOIDCSecretVar`); for OAuth2 to succeed, kanidm must hold that SAME secret. The render therefore emits `kanidm system oauth2 update-basic-secret nextcloud "$secret" --name idm_admin` to set it from the shared var. The exact kanidm secret-set verb is not proven offline here (kanidm CLI exposes `show-basic-secret`/`reset-secrets`; a set-from-value verb is the drive's to confirm). **Why a two-way door:** it is a pure render string, revertible by a later commit with no state to migrate, no security-posture change (the secret stays a sealed clan var, the crown-jewel idm_admin credential stays on the gateway — the split's whole point), and no spend. It is **provable by the placement drive** (a later task in the #183 phase-5 arc): if the verb is wrong the drive reds loud at `deploy-files`, and the fix is local to this one render line. Not on the one-way-door list. **What proves it:** the offline render seam (`files_idp_gateway_test.go`, green) pins the ruled SHAPE — one secret, two readers; the two-node placement drive proves the live mechanism end-to-end.

close-report for #846 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 846,
  "status": "success",
  "commits": [
    "673054329404681966599c873aca6c8539c226f2"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/clan/files.go",
    "internal/clan/files_idp_gateway.go",
    "internal/clan/files_idp_gateway_test.go",
    "internal/clan/files_test.go",
    "internal/clan/member_attach.go",
    "internal/clan/member_attach_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan -run 'Member|FilesIDP|RenderFiles'",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c golangci-lint run internal/clan/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/... ./control-plane/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Standalone files.nix contains networking.firewall.interfaces.\"wt0\".allowedTCPPorts = [ 80 ] + an explicit nginx listen": "files.go renderNextcloudMeshListen (FilesConfig.MeshListen); pinned by TestRenderFiles_MemberDeviceListensOnWt0AndOpensFirewall (files_test.go), which replaces the retired TestRenderFiles_StandaloneLeavesNginxDefault",
    "Standalone render has NO services.kanidm and NO localhost:8443": "renderNextcloudOIDCDevice emits only the occ half; TestRenderFiles_MemberOIDCUsesPublicDiscoveryAndSharedSecret asserts absence of services.kanidm/localhost:8443/KANIDM_URL/idm_admin",
    "Discovery URL = https://id.<apex>/oauth2/openid/<client>/.well-known/openid-configuration": "FilesConfig.OIDCDiscoveryURL rendered verbatim into --discoveryuri; asserted in TestRenderFiles_MemberOIDCUsesPublicDiscoveryAndSharedSecret",
    "Gateway files-idp.nix: kanidm client oneshot + shared secret var": "files_idp_gateway.go RenderFilesIDPClient (+ FilesOIDCSecret* shared clan var, share = true); TestRenderFilesIDPClient_GatewayOneshotOwnsKanidmAndSharesSecret",
    "Member configuration.nix imports the four base modules + files.nix": "member_attach.go ComposeMemberModules over baseMemberModules + present, presentModules-filtered; TestComposeMemberModules_ImportsBaseAndPresentModules (+ idempotence, + RefusesNoNode), requireNixParse over the rendered configuration.nix"
  },
  "summary": "internal/clan grows the member-device files shape — wt0 mesh listen, the gateway/device OIDC split over a shared clan var, and member configuration.nix composition (ADR 0210 rulings 1-3).",
  "blockers": []
}
**close-report** for #846 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 846, "status": "success", "commits": [ "673054329404681966599c873aca6c8539c226f2" ], "changed_files": [ "STATUS.md", "internal/clan/files.go", "internal/clan/files_idp_gateway.go", "internal/clan/files_idp_gateway_test.go", "internal/clan/files_test.go", "internal/clan/member_attach.go", "internal/clan/member_attach_test.go" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan -run 'Member|FilesIDP|RenderFiles'", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go test ./internal/clan", "exit_code": 0 }, { "command": "nix develop .#go-ci -c golangci-lint run internal/clan/...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/... ./control-plane/...", "exit_code": 0 } ], "criteria": { "Standalone files.nix contains networking.firewall.interfaces.\"wt0\".allowedTCPPorts = [ 80 ] + an explicit nginx listen": "files.go renderNextcloudMeshListen (FilesConfig.MeshListen); pinned by TestRenderFiles_MemberDeviceListensOnWt0AndOpensFirewall (files_test.go), which replaces the retired TestRenderFiles_StandaloneLeavesNginxDefault", "Standalone render has NO services.kanidm and NO localhost:8443": "renderNextcloudOIDCDevice emits only the occ half; TestRenderFiles_MemberOIDCUsesPublicDiscoveryAndSharedSecret asserts absence of services.kanidm/localhost:8443/KANIDM_URL/idm_admin", "Discovery URL = https://id.<apex>/oauth2/openid/<client>/.well-known/openid-configuration": "FilesConfig.OIDCDiscoveryURL rendered verbatim into --discoveryuri; asserted in TestRenderFiles_MemberOIDCUsesPublicDiscoveryAndSharedSecret", "Gateway files-idp.nix: kanidm client oneshot + shared secret var": "files_idp_gateway.go RenderFilesIDPClient (+ FilesOIDCSecret* shared clan var, share = true); TestRenderFilesIDPClient_GatewayOneshotOwnsKanidmAndSharesSecret", "Member configuration.nix imports the four base modules + files.nix": "member_attach.go ComposeMemberModules over baseMemberModules + present, presentModules-filtered; TestComposeMemberModules_ImportsBaseAndPresentModules (+ idempotence, + RefusesNoNode), requireNixParse over the rendered configuration.nix" }, "summary": "internal/clan grows the member-device files shape — wt0 mesh listen, the gateway/device OIDC split over a shared clan var, and member configuration.nix composition (ADR 0210 rulings 1-3).", "blockers": [] } ``` </details>
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#846
No description provided.