data-collections: the operator is Grist's install admin and members are editors — set GRIST_DEFAULT_EMAIL to the operator's community identity (not owner@data-collections.local) and seed the org's default access; repair the demo #1536

Closed
opened 2026-09-16 18:54:48 +00:00 by ben · 3 comments
Owner

Spec

#1535 — Ben's ruling (2026-09-16): adding a member in the control panel grants them access to every member service the control panel deployed; adding a member as an operator gives them admin access to all services. One community sign-in, every door, no second login, no hidden per-app credential.

Symptom (Ben, Whakatōhea demo, 2026-09-16)

Signed in at the community door as the founding operator, Data collections lets you in (the header path works) but you land as a fresh non-admin user named after your person id; the install admin is the placeholder owner@data-collections.local, which nobody is.

Cause

  • internal/clan/portroute.go:70 attaches Grist with DataCollectionsLiveSet{Node, Apex} only → cfg.OwnerEmail == "" → DefaultDataCollectionsOwner = "owner@data-collections.local" (datacollections.go:128, 238-240) becomes GRIST_DEFAULT_EMAIL.
  • The header Grist trusts (GRIST_FORWARD_AUTH_HEADER=X-Idss-Identity, datacollections.go:360) carries the person id (preferred_username, internal/controlapi/oidcprovider.go:236) — operator for the founding operator (clan.OperatorAccount, vmguest.go:110). Grist treats that string as the account's email key; it never equals the placeholder, so the operator is never the owner.

Fix

  1. PortPlacement gains Operator string (the operator's person id as the header carries it); provision/deploy.go:1039 fills it from the ledger's operator (member seam — the founding operator today; the reconciler ticket generalises to all operators). AttachDataCollections passes it as OwnerEmail. Keep DefaultDataCollectionsOwner only as the empty-operator fallback and make the render REFUSE (not fabricate) when the placement has no operator on a public route.
  2. Members must be able to create documents: after the health check, set the single org's default access so every signed-in member is an editor and the operator an owner (PATCH /api/orgs/{orgId}/access, over the same admin session the health check drives — datacollectionshealth.go). This is what makes Ben's sentence 1 true for Grist; the reconciler ticket takes over ownership of role CHANGES later.
  3. Existing installs (the demo): GRIST_DEFAULT_EMAIL only seeds on first boot, so the repair is the same PATCH …/access call: add operator as owner, then optionally remove the placeholder. Document the one-liner in the ticket close-out; a session runs it on whakatohea-demo.idss.nz (root over the run's rent-operator key).

Acceptance

  • RenderDataCollections test: GRIST_DEFAULT_EMAIL equals the placement's operator id; empty operator on a routed placement is refused with an operator-legible error.
  • Health check (or a following step) asserts GET /api/orgs/{id}/access lists the operator as owners and default member role editors.
  • Demo repaired by a session and confirmed by Ben opening Data collections as an owner.
  • Security invariant (every header-trusting port, #1167): a port that trusts X-Idss-Identity lands header_up -X-Idss-Identity on its client-protocol exempt paths in the SAME commit (the gated handle overwrites the header from the gate's answer; the exempt handle has no such vouch — `internal/clan/frontdoor. (Already present for data-collections; do not regress it.)

Files

internal/clan/portroute.go, internal/clan/datacollections.go, internal/clan/datacollections_attach.go, internal/clan/datacollectionshealth.go, internal/provision/deploy.go, tests alongside.

## Spec #1535 — Ben's ruling (2026-09-16): **adding a member in the control panel grants them access to every member service the control panel deployed; adding a member as an operator gives them admin access to all services.** One community sign-in, every door, no second login, no hidden per-app credential. ## Symptom (Ben, Whakatōhea demo, 2026-09-16) Signed in at the community door as the founding operator, Data collections lets you in (the header path works) but you land as a **fresh non-admin user** named after your person id; the install admin is the placeholder `owner@data-collections.local`, which nobody is. ## Cause - `internal/clan/portroute.go:70` attaches Grist with `DataCollectionsLiveSet{Node, Apex}` only → `cfg.OwnerEmail == ""` → `DefaultDataCollectionsOwner = "owner@data-collections.local"` (`datacollections.go:128, 238-240`) becomes `GRIST_DEFAULT_EMAIL`. - The header Grist trusts (`GRIST_FORWARD_AUTH_HEADER=X-Idss-Identity`, `datacollections.go:360`) carries the **person id** (`preferred_username`, `internal/controlapi/oidcprovider.go:236`) — `operator` for the founding operator (`clan.OperatorAccount`, `vmguest.go:110`). Grist treats that string as the account's email key; it never equals the placeholder, so the operator is never the owner. ## Fix 1. `PortPlacement` gains `Operator string` (the operator's person id as the header carries it); `provision/deploy.go:1039` fills it from the ledger's operator (`member` seam — the founding operator today; the reconciler ticket generalises to all operators). `AttachDataCollections` passes it as `OwnerEmail`. Keep `DefaultDataCollectionsOwner` only as the empty-operator fallback and make the render REFUSE (not fabricate) when the placement has no operator on a public route. 2. Members must be able to create documents: after the health check, set the single org's default access so every signed-in member is an **editor** and the operator an **owner** (`PATCH /api/orgs/{orgId}/access`, over the same admin session the health check drives — `datacollectionshealth.go`). This is what makes Ben's sentence 1 true for Grist; the reconciler ticket takes over ownership of role CHANGES later. 3. **Existing installs** (the demo): `GRIST_DEFAULT_EMAIL` only seeds on first boot, so the repair is the same `PATCH …/access` call: add `operator` as owner, then optionally remove the placeholder. Document the one-liner in the ticket close-out; a session runs it on `whakatohea-demo.idss.nz` (root over the run's rent-operator key). ## Acceptance - `RenderDataCollections` test: `GRIST_DEFAULT_EMAIL` equals the placement's operator id; empty operator on a routed placement is refused with an operator-legible error. - Health check (or a following step) asserts `GET /api/orgs/{id}/access` lists the operator as `owners` and default member role `editors`. - Demo repaired by a session and confirmed by Ben opening Data collections as an owner. - **Security invariant (every header-trusting port, #1167):** a port that trusts `X-Idss-Identity` lands `header_up -X-Idss-Identity` on its client-protocol exempt paths in the SAME commit (the gated handle overwrites the header from the gate's answer; the exempt handle has no such vouch — `internal/clan/frontdoor. (Already present for data-collections; do not regress it.) ## Files `internal/clan/portroute.go`, `internal/clan/datacollections.go`, `internal/clan/datacollections_attach.go`, `internal/clan/datacollectionshealth.go`, `internal/provision/deploy.go`, tests alongside.
ben closed this issue 2026-09-16 18:56:53 +00:00
Author
Owner

REOPENED — closed by accident, no work landed. Commit 3b4b5169 (a STATUS.md entry) carried the words "Grist fix #1536 first" in its message and Forgejo read fix #1536 as a close keyword. Nothing under this ticket has been built: portroute.go still attaches Grist with no owner and GRIST_DEFAULT_EMAIL is still the placeholder. Labels unchanged (bug, priority, ready-for-agent) — swarm, please pick it up.

**REOPENED — closed by accident, no work landed.** Commit 3b4b5169 (a STATUS.md entry) carried the words "Grist fix #1536 first" in its message and Forgejo read `fix #1536` as a close keyword. Nothing under this ticket has been built: `portroute.go` still attaches Grist with no owner and `GRIST_DEFAULT_EMAIL` is still the placeholder. Labels unchanged (bug, priority, ready-for-agent) — swarm, please pick it up.
ben reopened this issue 2026-09-16 20:03:03 +00:00

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

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

close-report for #1536 — status success

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

envelope
{
  "issue": 1536,
  "status": "success",
  "commits": [
    "1f24e88c454ef394bb0703fe55633906254643f6"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/datacollectionshealth.go",
    "control-plane/cmd/control-plane/main.go",
    "control-plane/cmd/control-plane/provision_datacollections_health_test.go",
    "internal/clan/archive.go",
    "internal/clan/datacollections.go",
    "internal/clan/datacollections_attach.go",
    "internal/clan/datacollections_attach_test.go",
    "internal/clan/portroute.go",
    "internal/clan/portroute_test.go",
    "internal/provision/deploy.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go build ./...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go test ./internal/clan/ ./internal/provision/ ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command gofmt -l internal/clan/ internal/provision/ control-plane/cmd/control-plane/ (clean)",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go vet ./internal/clan/... ./internal/provision/... ./control-plane/cmd/control-plane/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "RenderDataCollections test: GRIST_DEFAULT_EMAIL equals the placement's operator id": "PortPlacement gains Operator (clan.OperatorAccount = the header's preferred_username), deploy.go fills it, the dispatch carries it into AttachDataCollections as OwnerEmail, the render writes GRIST_DEFAULT_EMAIL. Proved by TestAttachDataCollections_OperatorIsTheInstallAdmin and TestAttachPort_OperatorRidesIntoDataCollections (internal/clan/datacollections_attach_test.go, portroute_test.go).",
    "empty operator on a routed placement is refused with an operator-legible error": "AttachDataCollections refuses an empty operator on a routed placement (a public route always derives a host) with a named error; DefaultDataCollectionsOwner stays only the pure render's fallback. Proved by TestAttachDataCollections_EmptyOperatorOnRoutedPlacementRefused and TestAttachPort_DataCollectionsRefusesNoOperator.",
    "Health check asserts GET /api/orgs/{id}/access lists the operator as owners and default member role editors": "dataCollectionsEnsureOrgAccess PATCHes /api/orgs/data-collections/access (operator->owners, everyone@getgrist.com->editors) then GETs and asserts, run as the final step of the deploy-time check over the same admin session. Proved by TestDataCollectionsHealth_SeedsOrgDefaultAccess (both the seed and a dropped-member-reds subtest). productionDataCollectionsAdmin's owner follows the operator so the sides cannot drift (TestDataCollectionsHealthWiring_ProductionDerivesURLAndOwner).",
    "Demo repaired by a session and confirmed by Ben opening Data collections as an owner": "DELEGATED to the session lab leg already tracked in #1546 (ready-for-session: 'repair + prove Grist on the Whakatohea demo'). GRIST_DEFAULT_EMAIL only seeds on first boot, so the demo's placeholder owner stands until a re-deploy; the health check now runs the same org-access PATCH every deploy, so re-deploying #1536 to whakatohea-demo.idss.nz repairs it (or a one-off PATCH /api/orgs/data-collections/access {\"delta\":{\"users\":{\"operator\":\"owners\",\"everyone@getgrist.com\":\"editors\"}}} over the owner's minted key). This leg needs lab + Ben and is not the agent's to run in-sandbox.",
    "Security invariant #1167: header_up -X-Idss-Identity on exempt paths in the same commit (already present, do not regress)": "Unregressed — no change to data-collections' exempt-path front-door handling; DataCollectionsExemptPaths and the front-door strip are untouched by this commit."
  },
  "summary": "The founding operator's person id is Grist's install admin (GRIST_DEFAULT_EMAIL) and the deploy-time health check seeds+asserts the org's default access (operator owner, members editors); a routed placement with no operator is refused, not fabricated.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1536 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1536, "status": "success", "commits": [ "1f24e88c454ef394bb0703fe55633906254643f6" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/datacollectionshealth.go", "control-plane/cmd/control-plane/main.go", "control-plane/cmd/control-plane/provision_datacollections_health_test.go", "internal/clan/archive.go", "internal/clan/datacollections.go", "internal/clan/datacollections_attach.go", "internal/clan/datacollections_attach_test.go", "internal/clan/portroute.go", "internal/clan/portroute_test.go", "internal/provision/deploy.go" ], "tests": [ { "command": "nix develop .#go-ci --command go build ./...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go test ./internal/clan/ ./internal/provision/ ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command gofmt -l internal/clan/ internal/provision/ control-plane/cmd/control-plane/ (clean)", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go vet ./internal/clan/... ./internal/provision/... ./control-plane/cmd/control-plane/...", "exit_code": 0 } ], "criteria": { "RenderDataCollections test: GRIST_DEFAULT_EMAIL equals the placement's operator id": "PortPlacement gains Operator (clan.OperatorAccount = the header's preferred_username), deploy.go fills it, the dispatch carries it into AttachDataCollections as OwnerEmail, the render writes GRIST_DEFAULT_EMAIL. Proved by TestAttachDataCollections_OperatorIsTheInstallAdmin and TestAttachPort_OperatorRidesIntoDataCollections (internal/clan/datacollections_attach_test.go, portroute_test.go).", "empty operator on a routed placement is refused with an operator-legible error": "AttachDataCollections refuses an empty operator on a routed placement (a public route always derives a host) with a named error; DefaultDataCollectionsOwner stays only the pure render's fallback. Proved by TestAttachDataCollections_EmptyOperatorOnRoutedPlacementRefused and TestAttachPort_DataCollectionsRefusesNoOperator.", "Health check asserts GET /api/orgs/{id}/access lists the operator as owners and default member role editors": "dataCollectionsEnsureOrgAccess PATCHes /api/orgs/data-collections/access (operator->owners, everyone@getgrist.com->editors) then GETs and asserts, run as the final step of the deploy-time check over the same admin session. Proved by TestDataCollectionsHealth_SeedsOrgDefaultAccess (both the seed and a dropped-member-reds subtest). productionDataCollectionsAdmin's owner follows the operator so the sides cannot drift (TestDataCollectionsHealthWiring_ProductionDerivesURLAndOwner).", "Demo repaired by a session and confirmed by Ben opening Data collections as an owner": "DELEGATED to the session lab leg already tracked in #1546 (ready-for-session: 'repair + prove Grist on the Whakatohea demo'). GRIST_DEFAULT_EMAIL only seeds on first boot, so the demo's placeholder owner stands until a re-deploy; the health check now runs the same org-access PATCH every deploy, so re-deploying #1536 to whakatohea-demo.idss.nz repairs it (or a one-off PATCH /api/orgs/data-collections/access {\"delta\":{\"users\":{\"operator\":\"owners\",\"everyone@getgrist.com\":\"editors\"}}} over the owner's minted key). This leg needs lab + Ben and is not the agent's to run in-sandbox.", "Security invariant #1167: header_up -X-Idss-Identity on exempt paths in the same commit (already present, do not regress)": "Unregressed — no change to data-collections' exempt-path front-door handling; DataCollectionsExemptPaths and the front-door strip are untouched by this commit." }, "summary": "The founding operator's person id is Grist's install admin (GRIST_DEFAULT_EMAIL) and the deploy-time health check seeds+asserts the org's default access (operator owner, members editors); a routed placement with no operator is refused, not fabricated.", "reason": "", "blockers": [], "no_code_change": "" } ``` </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#1536
No description provided.