Skip to content

docs(adr): ADR-0057 addendum — finish D4's reverse role→users path (sys_member.role → sys_user_role)#2326

Merged
os-zhuang merged 1 commit into
mainfrom
claude/romantic-dirac-1c2346
Jun 25, 2026
Merged

docs(adr): ADR-0057 addendum — finish D4's reverse role→users path (sys_member.role → sys_user_role)#2326
os-zhuang merged 1 commit into
mainfrom
claude/romantic-dirac-1c2346

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

What

Appends an addendum to ADR-0057 recording a follow-up gap found while adjudicating an approval-routing question.

D4 made sys_user_role the source of truth for RBAC role assignment and migrated the forward direction (given a user → which roles, into ctx.roles = sys_user_role ∪ sys_member.role). The reverse direction (given a role → which users) was not migrated:

  • plugin-approvals expandRoleUsers (approval-service.ts:380-389) → find('sys_member', { filter: { role } })
  • plugin-sharing teamGraph.expandRoleUsers (team-graph.ts:70-80) → find('sys_member', …)

Neither unions sys_user_role.

Why this framing

  • Not intentional design (no recorded decision that approval/sharing roles == org-membership roles).
  • Not an approvals-only bug — the in-scope sibling plugin-sharing behaves identically.
  • Accurate: an incomplete / phased migration — forward path shipped under the transition-window union, reverse-lookup consumers left on the legacy table.

Consequence

A user holding a role only via sys_user_role (never written to sys_member.role) is invisible to approval routing and sharing-rule role expansion.

Follow-up decision (documented, does not revise D4)

  1. Read sys_user_role ∪ sys_member.role on the reverse path, in both plugins, scoped by organization_id.
  2. Retire sys_member.role from forward and reverse paths together when the transition window closes.
  3. Until (1) lands, multi-plant 岗位/职务 approval chains use type:'field' approvers fed by a submit-time 岗位→人 mapping.

Doc-only change. Implementation + regression test (a sys_user_role-only assignee must resolve) tracked as follow-up.

… sys_member.role

The role→users expansion (approvals expandRoleUsers, sharing
teamGraph.expandRoleUsers) terminates in sys_member.role and never unions
sys_user_role, contradicting D4's source-of-truth model on the reverse
direction. Document it as an incomplete/phased migration (not intentional
design, not an approvals-only bug — plugin-sharing, an in-scope consumer,
behaves identically), with the follow-up decision to finish the union in
both plugins and the type:'field'+mapping workaround until then.
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 25, 2026 12:00pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation size/s labels Jun 25, 2026
@os-zhuang
os-zhuang merged commit ca54449 into main Jun 25, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the claude/romantic-dirac-1c2346 branch June 25, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants