Skip to content

feat(v2): add and remove squad members - #233

Merged
EricWvi merged 4 commits into
ora-space:mainfrom
Zpc001:feat/797-squad-members
Oct 30, 2026
Merged

EricWvi merged 4 commits into
ora-space:mainfrom
Zpc001:feat/797-squad-members

Conversation

@Zpc001

@Zpc001 Zpc001 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

v2,不涉及 specs。

运行 issue:ora-space/circus#797(父 issue ora-space/circus#789 的 R3)

做了什么

详情页现在能加人和移除成员;候选只来自正式契约里的工作区成员接口,不另造目录。

  • v2-server:实现 GET /api/v1/tenants/{tid}/members 的子集——调用者所在工作区的有效账号,一页返回、按显示名排序;非成员 403 forbidden,非法租户 id 404 not_found。v2 的 memberships 没有成员 id、版本和加入来源,所以 id 用 user id、version 恒为 1,joinMethod/joinedAt/actorDisplayName 恒为空,这条差异写进了 v2-server/README.md。HTTP 测试用 api/openapi.json 校验响应,契约路由不会和文档漂移。
  • frontend-v2:「添加成员」打开选择器,候选是本工作区里还没加入本队的有效成员,可按姓名筛选、填职责后加入;成员行加「移除」,二次确认,移除后进入「已退出」历史。文案写明移出小队不影响工作区成员资格、也不授予运行时权限。写操作带 version。
  • e2e:开发者登录永远只有一个账号,所以测试先通过 v2-server 用的那个库插入一个工作区成员(新增 devDependency pg),再在浏览器里走完 加人 → 刷新仍在 → 移除 → 已退出 历史 → 归档。

顺带处理 R2 的两条非阻塞意见

  • 编辑入口改为与后端同口径:工作区 owner/admin 可以编辑任何小队,其他人必须是本队有效人类维护者。
  • 409 区分 squad_archived 和版本冲突,前者提示「这个小队已归档,不能再修改」。

验证(head 7f7daf00)

gofmt -l . && go vet ./... && go test -race -count=1 ./...   # v2-server 全部通过
npm run check                                                 # 471 个单测 + 类型 + lint + build
npm run e2e                                                   # 18 个 spec 全部通过

截图(head 7f7daf00,来自同一 head 的 e2e)

添加成员面板:

添加成员

加入后详情(人类 2、职责「外部协作」):

加入后详情

移除后(人类 1、已退出 1):

移除后

未包含

  • 添加 Space Agent:需要 v2-server 先有空间与插件读取。owner 已在决策 circus#802 定了做法(按正式契约实现,Agent 只用真实安装的 OpenCode),由另一个运行承接。
  • 修改成员职责与维护者标记:接口已支持,本期面板只做加入与移除。

Refs ora-space/circus#797

🤖 Generated with Claude Code

Zpc001 and others added 4 commits October 30, 2026 20:24
The picker needs to offer existing workspace members, and v2-server served no
way to list them. Implement the contract's members route as a subset: every
live account in the caller's workspace, one page, sorted by display name.
v2's memberships table has no membership identity of its own, so the row
repeats the user id with version 1 and empty provenance; the README records
that difference. A caller outside the workspace gets 403 rather than an empty
roster, so the route cannot be used to probe a workspace.

Co-Authored-By: Claude Code <noreply@anthropic.com>
A maintainer can now open 添加成员, filter the workspace roster by name, add
one existing member with an optional role, and remove a live member after a
confirmation. Ends only the squad membership: the workspace membership and the
member's history are untouched, and the UI says so. Candidates come from the
contract's workspace members route, so nothing outside the workspace can be
offered. Agent members stay unavailable because v2-server has no Space Agent
directory; the picker states that instead of inventing agents.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The development login always signs in as the same account, so the browser
flow needs a second human. The e2e seeds one workspace member through the
database the v2-server uses (with `pg`, a dev dependency), withdraws older
runs' seeded members so the picker stays readable, then drives add, reload
and remove in the real frontend and snapshots each state.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Workspace owners and administrators may edit any squad, so the page now reads
the caller's workspace role instead of only squad maintainers. A 409 from an
archived squad now says so, leaving the version-conflict wording for the case
where another change really landed first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants