Skip to content

[plugin-approvals] 审批 {type:'role'} 审批人只查 sys_member.role,解析不到权限集业务角色且静默回退字面量 #2702

Closed as not planned

Description

@baozhoutao

概述

审批 Flow 节点 approvers: [{ type: 'role', value: '<业务角色>' }] 静默路由到无人:Flow 正常触发,但目标审批人「审批中心」显示「暂无待审批事项」。

根因

  • packages/plugins/plugin-approvals/src/approval-service.ts:380-389 —— expandRoleUsers() 解析 role 审批人时查 sys_member.role = <value>,而 sys_member.role 是 better-auth 组织角色(仅 owner|admin|member),不认权限集实现的业务角色。
  • :306-316 —— 解析为空时引擎静默回退成把字面量 role:<value> 存进审批人(pending_approvers / sys_approval_approver),没有任何会话身份能匹配 → 落不到人。

影响

{type:'role'} 对权限集业务角色形同失效,且静默无报错(最难排查)。

期望(任一)

  • role 审批人也解析权限集角色(sys_user_permission_set / sys_permission_set.name);或
  • 至少解析为空时报错/告警,不要回退成永不匹配的字面量;
  • 文档明确 {type:'role'} 仅指组织角色。

已知规避

改用 { type: 'team', value: '...' }(expandTeamUsers() 走 sys_team_member 解析真实 user id)。


来源(项目 dogfood):steedos-labs/os-tianshun-mtc#35

Activity

  1. os-zhuang commented on Jul 9, 2026

    @os-zhuang
    Contributor

    按照新的权限设计,已经没有 role 了,改成 岗位 了

  2. os-zhuang commented on Jul 10, 2026

    @os-zhuang
    Contributor

    role 已作废,相关功能要重新设计和测试

  3. os-justin commented on Sep 1, 2026

    @os-justin
    Collaborator

    state_reason corrected completed → not_planned (close date and history untouched). Provenance, three parts: (1) the census on #14081 confirmed this close as concept-scrapped-not-fixed — the closing comment reads 「role 已作废,相关功能要重新设计和测试」, i.e. it itself says work remains; (2) the seat review of record on #14081 (comment 5490049186, 2026-09-01) adjudicated the 4 confirmed cases as normal single-write dispositions; (3) executed by the skills-lane PM seat, session session_01Whev4BkZ4BRcgiXYo4muWP, performing the vacant triage seat's mechanical disposition. The defect this card measured (approvers routing to nobody) was never delivered — the close reason now says so.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions