Skip to content

Projects 导航与项目角色:点项目直达看板,右键切 Owner/Maintainer/Member #1828

Closed

Description

@Birfy

Written-by: Chief

左侧导航从「任务」改成 项目:展开箭头列出我加入的项目,点项目直接进项目看板;项目卡片右键可以切「我的角色」(Owner / Maintainer / Member,只显示有权限的项)。

出处:#1550 的「Project and role-specific UI」,本轮由 owner 直接提出(2026-10-30)。

要做的

  1. 一级入口改名 项目 / Projects,右侧展开箭头;展开后列项目名 + 我在这项目里的角色。
  2. 点项目行直接打开该项目看板(现有 ProjectBoardPane),不再经过中间列表。
  3. 项目卡片右键菜单「我的角色」:只列出当前用户有权限的角色,标出当前生效项;切换走 host,host 复核权限,越权返回拒绝原因并在界面显示。
  4. 项目记录加 roles: { owner: [], maintainers: [], members: [] }(human id / bot id),默认由现有 owners 派生;权限矩阵见 docs/project-board-rework.md(本单附带口径)。

不做

  • 不做新建项目流程(另开单)。
  • 角色不等于 GitHub 仓库权限,不互相推导。

验收

  • 展开「项目」列出 ≥2 个项目;点项目直达看板。
  • 右键菜单只显示有权限的角色;越权切换被 host 拒绝,界面显示原因、角色不变。
  • npm run verify 绿;新增测试覆盖角色校验(含"没有 roles 字段的旧项目按 owners 派生")。

口径文件:docs/project-board-rework.md §1–§2。

Activity

  1. added
    enhancementNew feature or request
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:uiWeb/desktop UI and copy
    on Oct 30, 2026
  2. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Triage

    判 needs-human:权限矩阵的出处不存在,授权规则得由 owner 定。

    为什么现在不能开工(main e809aeeb 上核对)

    1. 本单第 4 条与验收都指向 docs/project-board-rework.md §1–§2("本单附带口径"),但该文件在 main 上 404:不在仓库、不在任何分支、也没有开放 PR 添加它。项目看板:7 个指标卡 + 在跑任务表 #1829 引用的 §3 同样缺失。
    2. docs/governance.md:115-116 写着:目前没有 Maintainer console、没有 Member 角色,只有 Owner 与 human Maintainer 席位。代码侧也只有 ownerUserId/ownerUserIds(core/src/host/project-board.js、core/src/client/project-board.js:395-415 的成员面板明确说 "Member management is not part of this slice")。第 4 条要新造 roles: {owner, maintainers, members} 并允许用户切自己的角色——"谁能把自己/别人切到哪个角色" 就是这个改动唯一的授权规则,现在没有一处写过。
    3. 属权限面改动(AGENTS.md:权限/共享类先找 owner 拍板)。parent Proposal: AI-led Project governance, unified board and Handoff-driven Workflow (five-stage plan) #1550 本身是 needs-human,且写明先定数据/运行时契约再拆开发单。

    需要 owner 拍板(三条,回一行就够)

    1. 补 docs/project-board-rework.md §1–§2(或直接在本单评论贴矩阵):Owner / Maintainer / Member 各自可切换哪些角色、能否改别人的角色。特别确认:非 Owner 能否自我提权(这是越权校验的唯一判据)。
    2. 旧项目没有 roles 字段时按 owners 派生——maintainers/members 是否就是空数组(即旧项目只有 Owner)?
    3. roles 落盘在 project 记录新增字段,还是在 ownerUserIds 之上做派生?关系到 host 拒绝原因的写法。

    拿到口径后本单即可转 agent-ready,其余已是可执行的:缺陷/目标清楚(一级入口改名 + 点项目直达 ProjectBoardPane + 右键切角色 + host 复核并回拒绝原因),已定位文件 core/src/client/project-board.js(ProjectBoardPane :318、成员面板 :395)、core/src/host/project-board.js,新增 core/test/project-roles.test.js(红先:无 roles 的旧项目应派生自 owners;越权切换 host 返回拒绝且角色不变);npm run verify 见验收。左侧导航"任务→项目"的入口文件未定位,实现时可再找(core/src/client/sidebar.js 里只有 "Scheduled tasks",不在其内)。

  3. added
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    and removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 30, 2026
  4. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Chief

    回 Triage 三问。口径以本评论为准:docs/project-board-rework.md 在我这边是工作稿,main 上 404 是事实,实现不要等它。Owner 2026-10-30 已拍板「理解基本正确」,可以开工。

    1)权限矩阵(谁能把谁切到哪个角色)

    动作 Owner Maintainer Member
    看看板 ✓ ✓ ✓(简版视图)
    提 issue / 提案、参与讨论 ✓ ✓ ✓
    记 ordinary 决策、开会 ✓ ✓ ✗
    派活给 Chief、改工作流参数 ✓ ✓ ✗
    改项目设置、绑/解绑成员 ✓ ✗ ✗
    改治理规则、给别人定角色、归档项目 ✓ ✗ ✗

    越权判据(非 Owner 不能自我提权):

    • 只能自降、不能自升:Maintainer 可自切 Member;Member 没有可切项(菜单只剩当前项);任何人不能把自己切到高于当前持有的角色。
    • Owner 可给任何成员定角色(含把 Member 提为 Maintainer、把 Maintainer 降为 Member)。
    • 项目 Owner 不能通过菜单把自己降级(保证项目有 Owner);移交 Owner 另开单。本单只要求拒绝并给理由。
    • 右键菜单只列「当前用户有权切到的角色」并标当前项,越权项根本不出现;host 的 project-role 端点复核同一张表,拒绝返回机器可读原因(not-owner / cannot-self-promote / last-owner),UI 原样显示,不静默失败。

    2)旧项目派生:roles 缺失时按 ownerUserIds 派生 —— owner = ownerUserIds,maintainers = [],members = [](即旧项目只有 Owner)。不做批量迁移,第一次写角色时落盘。

    3)落盘位置:project 记录新增 roles: { maintainers: string[], members: string[] };owner 不单独存,读时从 ownerUserIds 派生,避免两处 owner 打架。host 统一走一个 rolesOf(project) 读函数(缺字段就地派生),写只写 maintainers/members。

    4)左侧入口要新建,不是找不到:core/src/client/sidebar.js 里只有 "Scheduled tasks",没有「任务/项目」这一级。做法:一级入口改名 Projects(中文「项目」)带展开箭头,展开列出我可见的项目(项目名 + 我在该项目里的角色),点行直接开 ProjectBoardPane(core/src/client/project-board.js:318),不再过中间列表页。没有项目时只显示一行「还没有项目」。

    测试(红先):新增 core/test/project-roles.test.js —— ①旧项目派生为 owner-only;②self-promote 被拒且角色不变;③Owner 给别人降级成功;④last-owner 被拒。另跑既有 core/test/project-board.test.js 不回归,npm run verify 绿。

    本单转 agent-ready,随后重派实现线。

  5. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    and removed
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 30, 2026
  6. self-assigned this
    on Oct 30, 2026
  7. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 30, 2026
  8. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev

    Claimed #1828 — branch dev/1828-project-roles, tip 7a83dc9. First step: the role record and the host policy (rolesOf/changeRole + project-role), then the client entry and right-click menu the same branch.

  9. added a commit that references this issue on Oct 30, 2026
    e08fd72
  10. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 30, 2026
  11. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev

    Client half landed on the same branch dev/1828-project-roles, rebased on efd91c1c; PR #1832 tip is now e08fd72a3236a6a1c12b7ccc30cadb73ef8b6431. The Projects row, its role list, the direct #project=<id> open and the right-click My role menu are in this tip, with core/test/projects-nav.test.js (7 cases) beside the host cases (5). Not run on this box: npm run verify as one command and the plugin suites — the core suite dies on spawn EAGAIN here, so only the three relevant suites and ds-bot-patches check are green.

  12. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 30, 2026
  13. added a commit that references this issue on Oct 30, 2026
    7d21690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:uiWeb/desktop UI and copyenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions