Dashboard operator is a person owning org-sys, not the system identity #317

Closed
opened 2026-10-27 13:35:49 +00:00 by sam · 0 comments
Owner

Goal

The dashboard operator acts as a person who owns org-sys, not as the system identity, without requiring an OIDC provider.

Context

  • internal/webui/authorize.go:58 requestPrincipal: with no acting identity (shared token) it returns access.SharedTokenOwner() (internal/domain/access/request.go), a synthetic system owner with no membership row.
  • Consequences today: personal tokens fail ("personal tokens belong to a signed-in person", internal/infrastructure/staterpc/personal_tokens.go:24), audit rows name system (internal/webui/api_identities.go:88-93 webAudit hardcodes identity.SystemID), and the org has no person owner, so enabling OIDC later orphans it.
  • The default org upgrade lives in queries/orgupgrade.sql + internal/infrastructure/postgres/orgs.go UpgradeDefaultOrg.
  • Identity kinds: person, bot, service_account, system (internal/domain/identity).

Steps

  1. In the default-org upgrade add an idempotent phase: if org-sys has no person member with role owner, create a person identity operator (display name "Operator") and give it an owner membership in org-sys. (Use a new org_upgrades phase name; extend the CHECK constraint in a migration.)
  2. Make the shared-token principal that person: requestPrincipal resolves the org-sys owner person via the Principals source instead of SharedTokenOwner() when one exists; fall back to SharedTokenOwner only if none. Keep machine callers (service tokens, run credentials) unchanged.
  3. webAudit: use the request's principal identity, falling back to system only when there is none.
  4. Personal tokens now work for the shared-token session; verify with curl that POST /api/tokens succeeds and the token authenticates.

Out of scope

OIDC configuration UI, subject binding, instance admin, renaming the operator (the Identities page already renames).

Stop when

  • Fresh and existing installs end with exactly one person operator, owner of org-sys (run the upgrade twice: still one).
  • With the shared token, GET /api/identities shows operator, POST /api/tokens works, and a settings change's history row names operator.
  • task check passes.
  • Commit feat(access): the dashboard operator is a person owning org-sys, close. Stop.

Rules for this ticket

  • Read CLAUDE.md first. Follow it: smallest change, no new binaries, no compatibility shims, comments say why briefly.
  • Do ONLY the steps below. Anything else you notice: file it with bd create (one line of why) and carry on. Do not fix it.
  • Do not refactor, rename or reformat code outside the listed files.
  • No new tests unless a step says so.
  • Run task check once at the end. If it fails twice on the same problem, stop and write what failed in a bead comment (bd comments add <id> "...") instead of looping.
  • Timebox: if you have not reached "Stop when" after the steps, stop, comment what is left, and leave the bead open.

Close reason

Closed


Imported from beads archie-core-kgxw.4 · GitHub #1276 · type feature · priority P1 · created 2026-10-05 · closed 2026-10-05

## Goal The dashboard operator acts as a **person** who owns org-sys, not as the `system` identity, without requiring an OIDC provider. ## Context - `internal/webui/authorize.go:58` `requestPrincipal`: with no acting identity (shared token) it returns `access.SharedTokenOwner()` (`internal/domain/access/request.go`), a synthetic system owner with no membership row. - Consequences today: personal tokens fail ("personal tokens belong to a signed-in person", `internal/infrastructure/staterpc/personal_tokens.go:24`), audit rows name system (`internal/webui/api_identities.go:88-93` `webAudit` hardcodes `identity.SystemID`), and the org has no person owner, so enabling OIDC later orphans it. - The default org upgrade lives in `queries/orgupgrade.sql` + `internal/infrastructure/postgres/orgs.go` `UpgradeDefaultOrg`. - Identity kinds: person, bot, service_account, system (`internal/domain/identity`). ## Steps 1. In the default-org upgrade add an idempotent phase: if org-sys has no person member with role owner, create a person identity `operator` (display name "Operator") and give it an `owner` membership in org-sys. (Use a new org_upgrades phase name; extend the CHECK constraint in a migration.) 2. Make the shared-token principal that person: `requestPrincipal` resolves the org-sys owner person via the Principals source instead of `SharedTokenOwner()` when one exists; fall back to SharedTokenOwner only if none. Keep machine callers (service tokens, run credentials) unchanged. 3. `webAudit`: use the request's principal identity, falling back to system only when there is none. 4. Personal tokens now work for the shared-token session; verify with curl that POST /api/tokens succeeds and the token authenticates. ## Out of scope OIDC configuration UI, subject binding, instance admin, renaming the operator (the Identities page already renames). ## Stop when - [ ] Fresh and existing installs end with exactly one person `operator`, owner of org-sys (run the upgrade twice: still one). - [ ] With the shared token, GET /api/identities shows operator, POST /api/tokens works, and a settings change's history row names operator. - [ ] `task check` passes. - [ ] Commit `feat(access): the dashboard operator is a person owning org-sys`, close. Stop. ## Rules for this ticket - Read CLAUDE.md first. Follow it: smallest change, no new binaries, no compatibility shims, comments say why briefly. - Do ONLY the steps below. Anything else you notice: file it with `bd create` (one line of why) and carry on. Do not fix it. - Do not refactor, rename or reformat code outside the listed files. - No new tests unless a step says so. - Run `task check` once at the end. If it fails twice on the same problem, stop and write what failed in a bead comment (`bd comments add <id> "..."`) instead of looping. - Timebox: if you have not reached "Stop when" after the steps, stop, comment what is left, and leave the bead open. ### Close reason Closed --- _Imported from beads `archie-core-kgxw.4` · GitHub #1276 · type feature · priority P1 · created 2026-10-05 · closed 2026-10-05_
sam added the highfeature labels 2026-10-27 13:35:50 +00:00
sam self-assigned this 2026-10-27 13:35:50 +00:00
sam closed this issue 2026-10-27 13:35:50 +00:00
sam added a new dependency 2026-10-27 13:41:53 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#317