The role vocabulary is declared three times, one of them Cedar policy text #2049

Closed
opened 2026-11-18 23:10:12 +00:00 by sam · 1 comment
Owner

The four roles are declared in internal/domain/org/org.go and again in modules/governance/org.go, and the shipped policies (modules/governance/roles.go) spell the same four names inside Cedar source. Rows store role text, so the vocabulary reads as data while enforcement is code.

A fifth role means editing three files and re-seeding policies, and nothing catches the policy text drifting from the Go list.

Done when: the role names exist once, the shipped policies are built from that one list, and adding a role touches no policy text.

Whether an organisation can define its own roles is a product question, not part of this.

The four roles are declared in internal/domain/org/org.go and again in modules/governance/org.go, and the shipped policies (modules/governance/roles.go) spell the same four names inside Cedar source. Rows store `role text`, so the vocabulary reads as data while enforcement is code. A fifth role means editing three files and re-seeding policies, and nothing catches the policy text drifting from the Go list. Done when: the role names exist once, the shipped policies are built from that one list, and adding a role touches no policy text. Whether an organisation can define its own roles is a product question, not part of this.
sam added the featuremediumin-progress labels 2026-11-18 23:10:35 +00:00
Author
Owner

Verified against the tree; the filed premise was wrong, so closing.

The policy text is not a third copy: modules/governance/roles.go interpolates the Role constants (roleViewer = string(RoleViewer) and so on), so a renamed role changes the shipped policies with it. Nothing can drift there.

The real duplication is modules/governance's four names beside internal/domain/org's four. That package is imported by 28 packages across the old services, and moving it is the migration ledger's work (MIGRATION.md, #2024), not a bug.

Custom roles already work: governance.Role.Validate accepts any stable identifier and TestCustomRoleAndMemberStatePolicy pins that, so the four are starter names, not the whole vocabulary. The old dashboard still validates against the four, which dies with that service.

Reopen if the four starter names should become editable per organisation, which is a product question rather than duplication.

Verified against the tree; the filed premise was wrong, so closing. The policy text is not a third copy: modules/governance/roles.go interpolates the Role constants (roleViewer = string(RoleViewer) and so on), so a renamed role changes the shipped policies with it. Nothing can drift there. The real duplication is modules/governance's four names beside internal/domain/org's four. That package is imported by 28 packages across the old services, and moving it is the migration ledger's work (MIGRATION.md, #2024), not a bug. Custom roles already work: governance.Role.Validate accepts any stable identifier and TestCustomRoleAndMemberStatePolicy pins that, so the four are starter names, not the whole vocabulary. The old dashboard still validates against the four, which dies with that service. Reopen if the four starter names should become editable per organisation, which is a product question rather than duplication.
sam removed the in-progress label 2026-11-20 16:42:34 +00:00
sam closed this issue 2026-11-20 16:42:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#2049