komiti: backfill the files ocgroups claim-map on deploy for komiti created before files (the #1406 silent half) #1409

Closed
opened 2026-09-12 04:15:47 +00:00 by matou-build-agent · 13 comments

What

Follow-up from #1406/#1407. Those tickets fixed the loud half — creating a komiti before files is co-hosted no longer 400s (the runtime claim-map write now reads a 404 as "files not deployed, nothing to map"), and the non-atomic-create retry hole is closed (the claim-map is reconciled on every CreateKomiti, not only on first create). See commit(s) on #1406.

This is the remaining silent half: a komiti created before files is deployed lands with no ocgroups claim-map entry. When files is later co-hosted, nothing writes those entries, so members of a pre-deploy komiti do not reach Nextcloud as a group (basic files access via the all-persons scope is unaffected; group-scoped behaviour is).

Where it belongs

The reconcile-on-deploy point is the files render's nextcloud-oidc oneshot (internal/clan/files.go, renderNextcloudOIDC) — the same oneshot that already writes the files-admin -> admin ocgroups claim-map (create-or-update, idempotent, runs on every deploy). It should, after creating the OAuth2 client, backfill an ocgroups claim-map for every existing komiti_* group, mapping each to its bare name — exactly what member.FilesKomitiClaimMapPort.AddFilesKomitiClaimMap writes at runtime.

Why it was NOT shipped with #1406

It is deploy-critical shell against a real kanidm CLI (kanidm group list output shape / JSON support in the pinned version) that I could not live-prove in the sandcastle sandbox. Shipping unproven parsing into the &&-chained oneshot risks reding every files deploy — a far worse regression than the silent gap. This needs a clan-lab spike to prove the enumeration + backfill against real kanidm before it lands.

Note also: the existing safety test TestRenderFiles_OIDCProvisionsMemberByClaimAlone asserts strings.Count(out, "update-claim-map nextcloud ocgroups ") == 1. The backfill adds more ocgroups claim-map writes (to non-admin values), so that test must be tightened to its true intent — exactly ONE map to the admin value (the files-admin group), any number to komiti's own bare names.

Acceptance

  • On a community that created komiti before deploying files, after deploy-files every such komiti has its ocgroups claim-map entry (proven on a live box or the droplet drive).
  • The files deploy never reds when there are zero komiti (empty loop) or when the CLI enumeration finds nothing.
  • The story-4 safety invariant holds: only files-admin maps to the admin value.

Found while fixing #1406 (rehearsal-183, drive 20260912T034016Z, leg portal-s1e).

## What Follow-up from #1406/#1407. Those tickets fixed the loud half — creating a komiti before files is co-hosted no longer 400s (the runtime claim-map write now reads a 404 as "files not deployed, nothing to map"), and the non-atomic-create retry hole is closed (the claim-map is reconciled on every `CreateKomiti`, not only on first create). See commit(s) on #1406. This is the **remaining silent half**: a komiti created **before** files is deployed lands with **no ocgroups claim-map entry**. When files is later co-hosted, nothing writes those entries, so members of a pre-deploy komiti do not reach Nextcloud **as a group** (basic files access via the all-persons scope is unaffected; group-scoped behaviour is). ## Where it belongs The reconcile-on-deploy point is the files render's `nextcloud-oidc` oneshot (`internal/clan/files.go`, `renderNextcloudOIDC`) — the same oneshot that already writes the files-admin -> `admin` ocgroups claim-map (create-or-update, idempotent, runs on every deploy). It should, after creating the OAuth2 client, **backfill** an ocgroups claim-map for every existing `komiti_*` group, mapping each to its bare name — exactly what `member.FilesKomitiClaimMapPort.AddFilesKomitiClaimMap` writes at runtime. ## Why it was NOT shipped with #1406 It is **deploy-critical shell** against a real kanidm CLI (`kanidm group list` output shape / JSON support in the pinned version) that I could not live-prove in the sandcastle sandbox. Shipping unproven parsing into the `&&`-chained oneshot risks reding **every files deploy** — a far worse regression than the silent gap. This needs a `clan-lab` spike to prove the enumeration + backfill against real kanidm before it lands. Note also: the existing safety test `TestRenderFiles_OIDCProvisionsMemberByClaimAlone` asserts `strings.Count(out, "update-claim-map nextcloud ocgroups ") == 1`. The backfill adds more ocgroups claim-map writes (to **non-admin** values), so that test must be tightened to its true intent — exactly ONE map to the **`admin` value** (the files-admin group), any number to komiti's own bare names. ## Acceptance - On a community that created komiti before deploying files, after `deploy-files` every such komiti has its ocgroups claim-map entry (proven on a live box or the droplet drive). - The files deploy never reds when there are zero komiti (empty loop) or when the CLI enumeration finds nothing. - The story-4 safety invariant holds: only files-admin maps to the `admin` value. Found while fixing #1406 (rehearsal-183, drive `20260912T034016Z`, leg `portal-s1e`).
Author
Member

swarm-claim host=matou-dev-server-01 run=22235
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=22235 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

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

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

swarm-claim host=bens-mac-04 run=22240
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=22240 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=22240
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=22240 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=22240
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=22240 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=22249
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=22249 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=22262
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=22262 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=22297
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=22297 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=22305
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=22305 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=22305
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=22305 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=22323
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=22323 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=8ab5a5d16aad run=22323
(sandcastle agent claim)

swarm-claim host=8ab5a5d16aad run=22323 (sandcastle agent claim)
Author
Member

close-report for #1409 — status success

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

envelope
{
  "issue": 1409,
  "status": "success",
  "commits": [
    "4b30dbf68a55db3178424c2177300ebd7f41a070"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/spike-findings/komiti-backfill-1409.md",
    "internal/clan/files.go",
    "internal/clan/files_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c golangci-lint run ./internal/clan/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On a community that created komiti before deploying files, after deploy-files every such komiti has its ocgroups claim-map entry (proven on a live box or the droplet drive)": "renderNextcloudOIDC's new backfill_komiti_ocgroups reconciler (internal/clan/files.go) enumerates komiti_* groups and writes each komiti_<slug>->bare <slug> ocgroups claim-map on every deploy. Proven live against real kanidm 1.10.3 (clan-lab-komiti-backfill-1409): the VERBATIM rendered function reinstated a deleted komiti_gardening map and a never-mapped komiti_hauora — read-back showed ocgroups:komiti_gardening:;:\"gardening\" etc. See docs/spike-findings/komiti-backfill-1409.md.",
    "The files deploy never reds when there are zero komiti (empty loop) or when the CLI enumeration finds nothing": "The loop guards enumeration with `|| return 1` (retries via the 60x settle budget) and `grep '^komiti_' || true` so an empty result yields zero iterations and rc=0. Proven live: an empty enumeration `[] | jq | grep '^komiti_'` matches nothing and the function returns rc=0 (spike-findings).",
    "The story-4 safety invariant holds: only files-admin maps to the `admin` value": "The static files-admin->admin map is unchanged; the backfill maps komiti to their own bare names, never `admin`. Test TestRenderFiles_OIDCProvisionsMemberByClaimAlone retightened to assert exactly one map to the `admin` VALUE. Proven live: after backfill, nextcloud_admins was the ONLY group mapping to `admin`."
  },
  "summary": "The files deploy now backfills every pre-existing komiti's ocgroups claim-map, closing the #1406 silent half so a komiti created before files was co-hosted reaches Nextcloud as a group.",
  "reason": "",
  "blockers": []
}
**close-report** for #1409 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1409, "status": "success", "commits": [ "4b30dbf68a55db3178424c2177300ebd7f41a070" ], "changed_files": [ "STATUS.md", "docs/spike-findings/komiti-backfill-1409.md", "internal/clan/files.go", "internal/clan/files_test.go" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c golangci-lint run ./internal/clan/", "exit_code": 0 } ], "criteria": { "On a community that created komiti before deploying files, after deploy-files every such komiti has its ocgroups claim-map entry (proven on a live box or the droplet drive)": "renderNextcloudOIDC's new backfill_komiti_ocgroups reconciler (internal/clan/files.go) enumerates komiti_* groups and writes each komiti_<slug>->bare <slug> ocgroups claim-map on every deploy. Proven live against real kanidm 1.10.3 (clan-lab-komiti-backfill-1409): the VERBATIM rendered function reinstated a deleted komiti_gardening map and a never-mapped komiti_hauora — read-back showed ocgroups:komiti_gardening:;:\"gardening\" etc. See docs/spike-findings/komiti-backfill-1409.md.", "The files deploy never reds when there are zero komiti (empty loop) or when the CLI enumeration finds nothing": "The loop guards enumeration with `|| return 1` (retries via the 60x settle budget) and `grep '^komiti_' || true` so an empty result yields zero iterations and rc=0. Proven live: an empty enumeration `[] | jq | grep '^komiti_'` matches nothing and the function returns rc=0 (spike-findings).", "The story-4 safety invariant holds: only files-admin maps to the `admin` value": "The static files-admin->admin map is unchanged; the backfill maps komiti to their own bare names, never `admin`. Test TestRenderFiles_OIDCProvisionsMemberByClaimAlone retightened to assert exactly one map to the `admin` VALUE. Proven live: after backfill, nextcloud_admins was the ONLY group mapping to `admin`." }, "summary": "The files deploy now backfills every pre-existing komiti's ocgroups claim-map, closing the #1406 silent half so a komiti created before files was co-hosted reaches Nextcloud as a group.", "reason": "", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1409
No description provided.