skillhub/docs/skillhub/guide/namespace.md
小妍儿 ✨ 62219af2fb
feat(publish): opt-in trusted TEAM publisher approval after safe scans (#1069)
* feat(publish): gate trusted TEAM member auto-approval on safe scans

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs: design team-only automatic publication

Replace the draft two-switch policy with member grant identities, scan-bound system decisions and irreversible manual-review fallback. Document scope, locking, API/UI and acceptance boundaries before implementation.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* feat(namespace): manage team-only automatic publication grants

Rewrite unreleased V123 around per-member grant identities and review-task eligibility snapshots. Remove the namespace switch, review-exempt flag and old policy endpoints. Grants are session-only member-management writes; every API token is rejected. Revocation, role change, removal and account merge clear the identity, hand pending eligible tasks to normal review and are audited with before/after values. Automatic approval stays inert until the scan-bound approval path lands.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* feat(publish): capture team-only automatic eligibility on submission

Add TeamAutoPublicationPolicy as the single scope owner. Ordinary submissions capture the active member grant only for a new NAMESPACE_ONLY Skill or a new version of an already NAMESPACE_ONLY Skill owned by the submitter in an ACTIVE TEAM namespace. Uploads that change visibility, PUBLIC, PRIVATE, non-MEMBER roles, GitHub sync and Bundle paths never capture it; rerelease reapplies the same policy. Eligible tasks defer the reviewer notification until fallback.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* feat(review): approve team-only publication after current SAFE scan

Add TeamAutoPublicationService, invoked only by the callback that completes a version's current scan round. It locks namespace, Skill and version, refreshes state, and approves only when the captured grant equals the member's current grant, the account, namespace, Skill and version are still eligible, the task is not superseded and the recorded round is an explicit SAFE verdict. Any other outcome irreversibly hands the task to normal review and emits ReviewSubmittedEvent exactly once.

System decisions record decision_method SYSTEM_AUTOMATIC with the scan task id and no human reviewer; human decisions record HUMAN. Review projections, ReviewApprovedEvent, notifications and business logs expose the method. Replayed or late callbacks are ignored before any state change.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* test(auth): pin team-only publication token matrix to current scopes

Express the maintainer combination matrix with today's skill:read/skill:publish scopes in one place so #1078 can swap the submit capability name. Read-only tokens cannot upload, submit-capable tokens reach the same upload policy as browser sessions, and no scope can grant the permission.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* feat(web): manage team-only automatic publication on member page

Show the per-member grant state on the existing TEAM namespace member page, let owners and admins grant or revoke it through a confirmation dialog, and explain that it covers the member's browser submissions in this namespace and every token with submit capability.

Review list, detail and attempt history label system automatic approvals and their scan basis without naming the submitter as reviewer. Add copy to en, zh, ko and ru, regenerate the OpenAPI schema from a running backend and refresh the analytics manifest.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs: document team-only automatic publication

Add Chinese and English user guides for team-only automatic publication, link them from the namespace and review guides and the documentation sidebar, and document the session-only grant endpoint, review decision fields, lifecycle transition and business event attributes. Remove the unreleased trusted TEAM publishers draft guide and mark completed OpenSpec tasks.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* test(app): pin site presentation upgrade check to V122

The upgrade test asserts that exactly one migration runs after V121. Pin the upgrade target to V122 so the new V123 team-only automatic publication migration does not change what this V122 upgrade step proves.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* test(app): cover withdrawal racing team-only automatic approval

Run a submitter withdrawal concurrently with the SAFE scan completion on real PostgreSQL. Withdrawal is rejected while the version is scanning or already settled, and the system decision publishes exactly once without losing its review task.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs(openspec): mark team-only automatic publication gates complete

Record that backend, web, OpenAPI drift and strict OpenSpec gates ran, failures were classified against 683decad, and the controlled-scan journey environment was cleaned up.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(namespace): revoke team-only publication on platform admin member changes

Platform admin role changes, member removal and ownership transfer changed namespace_member rows directly, so a granted member promoted to ADMIN and demoted back kept the same grant identity and an in-flight task was approved automatically. These paths now call the shared NamespaceMemberService revocation: clear the grant, hand pending eligible tasks to normal review with one notification each, and audit the platform admin with the before value.

Covered on real PostgreSQL for the role round trip, removal and ownership transfer.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(scan): hand undispatchable scans to normal review

A permanent scan outbox dispatch failure set the version to SCAN_FAILED directly. The scan attempt stayed open, team-only eligibility was not cancelled, reviewers were never notified, and a later SAFE retry published automatically. The dispatcher now settles the attempt through the same SecurityScanService failure path as a scanner failure callback, which cancels eligibility irreversibly and emits ReviewSubmittedEvent once. Outbox rows without a scan attempt keep the previous handling.

Covered on real PostgreSQL: SCAN_FAILED, cancelled, notified once, and a SAFE retry stays in manual review.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(auth): audit team-only publication revocation on account merge

Account merge cleared the merged membership's grant silently; pending tasks only fell back at scan time. Merge now uses the shared NamespaceMemberService revocation for the merged membership and for a surviving membership promoted out of MEMBER, so tasks are handed to normal review immediately and the confirming account is audited.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* chore(db): renumber team-only publication migration to V124

#1078 merges first with its own V123 (suite bundle authorization
snapshot), so this unreleased migration moves to V124. No released
migration is changed.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* test(auth): derive the submit scope in the token matrix from the registry

TeamAutoPublicationTokenMatrixTest hard-coded skill:publish as the scope
that means "may submit". After #1078 splits token capabilities, every
upload route requires skill:submit instead, so the two route-policy rows
of the matrix failed on the integrated tree although the policy itself
is correct (read-only tokens are still rejected; submit tokens are still
admitted on every upload route).

Read the required upload scope from RouteSecurityPolicyRegistry and accept
only the known submit scopes (skill:publish before #1078, skill:submit
after), so the matrix keeps proving the same contract on either base.
Test-only change; no production code is touched.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* chore(db): renumber team-only publication migration to V125

Main now ships V123 (homepage recommendations) and #1078 moved its
suite bundle authorization snapshot to V124, so this unreleased
migration moves to V125. No released migration is changed.

Refs #1068

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(publish): capture submit authority for team auto publication

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* docs(publish): record maintainer runtime validation

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* docs(publish): clarify upgrade and rollback compatibility

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-11-16 14:08:28 +08:00

10 KiB
Raw Permalink Blame History

管理命名空间

本页说明团队命名空间的创建、成员维护和生命周期治理,适用于有相应权限的操作者。技能所有权、平台角色和命名空间角色分别管理;创建或管理命名空间不代表取得平台权限。GLOBAL 等非团队类型不适用本页的生命周期操作。

前置条件与职责

命名空间确定技能坐标中的归属,例如 @team/example-skill;该坐标仅为示例,不保证存在。命名空间 slug 创建后不可修改,显示名称可以在具备编辑权限时调整。

操作 所需身份 入口与判断依据
创建团队命名空间 平台技能管理员(SKILL_ADMIN)或超级管理员(SUPER_ADMIN) /dashboard/namespaces 的创建入口;普通成员不可创建
维护成员与资料 所有者(Owner)或空间管理员(Admin) 命名空间处于 ACTIVE,详情页显示相应操作
发布技能 成员(Member)及具备发布权限的操作者 在发布页选择命名空间;仍受扫描、审核和技能维护权限约束
查看成员 已加入的成员 详情页“成员”页签;查看权限不包含成员修改权限

权限依据:创建服务与命名空间策略。

创建并组织协作

  1. 由有权创建者进入创建入口,填写显示名称、稳定 slug 和职责说明。创建成功后,创建者成为该命名空间所有者;此操作不新增平台角色。
  2. 打开详情页“成员”,为已有账号添加成员或生成邀请。添加时选择 MEMBER 或 ADMIN;命名空间所有权通过独立转让入口处理,不使用普通角色选择框授予 OWNER。
  3. 成员在发布页选择目标命名空间。面向成员共享时选择空间成员可见(NAMESPACE_ONLY);私有(PRIVATE)不会对全体成员开放,公开(PUBLIC)也不要求读者先加入该命名空间。
  4. 提交后,由有权审核人在命名空间审核入口处理,作者在“我的审核进度”跟踪结果。成员身份不能替代发布和审核完成状态。

创建命名空间、加入成员并进入发布审核的职责顺序

图:创建、成员加入和发布是三个独立动作;邀请只授予成员资格,不直接发布技能。

创建与添加成员的请求示例如下,名称、slug 和用户标识均为占位值;程序化调用还须满足实例认证与防跨站请求规则。

POST /api/v1/namespaces
Content-Type: application/json

{"displayName":"Example Team","slug":"example-team","description":"Shared authoring"}
POST /api/v1/namespaces/{slug}/members
Content-Type: application/json

{"userId":"example-user","role":"MEMBER"}

邀请、角色调整与记录

在 ACTIVE 团队命名空间的“成员 → 邀请成员”创建链接,通过受控渠道分享。持链接者须先完成登录和现有准入,再核对目标、当前账号及 MEMBER 角色并确认加入;打开链接本身不建立成员关系。链接不限定邮箱或账号,不得在公开渠道发布。

项目 当前规则 生效与边界
有效期与使用次数 创建后24小时,一名新成员使用一次 固定规则;到期或使用后不能再次加入
替换与作废 操作者确认后,旧链接立即失效 已加入成员保留成员资格
网页邀请记录 每页5条,可分页查询 网页固定展示;完整用户标识可通过悬停查看
历史查询分页 每页1–50条 请求参数控制,不返回邀请码或哈希
历史保留 命名空间存在期间保留 彻底删除命名空间时删除邀请业务记录;操作审计按原规则保留

链接采用 /join#invite=邀请码。创建人的同一账号、同一浏览器标签页暂存链接,刷新后重新打开弹窗,校验仍有效即可复制;换账号、标签页或设备不能依靠该暂存恢复。历史记录不提供原邀请码;原链接遗失时,须确认替换后创建新邀请。登录回跳不携带邀请 Token。

邀请历史显示创建人、时间、到期时间、状态和实际加入账号。改名或成员离开不改写当时加入事实;历史不代表当前成员资格。仅命名空间所有者及空间管理员可查看,冻结或归档时为只读。升级仅迁入可确认的当前邀请并标注旧记录,不推测更早历史。

TEAM 命名空间的成员表还显示“团队内自动发布”授权状态;所有者或空间管理员可在网页会话中为普通成员授权或撤销,API Token 不能操作。范围、撤销效果和排障见团队内自动发布。

角色调整时,在成员行选择修改角色,再使用操作栏保存;保存后重新核对角色。移除成员和转让命名空间所有权须分别确认,后者不转让其技能。邀请实现见邀请服务及历史展示。

生命周期治理

以下矩阵适用于 TEAM。服务端权限和依赖检查优先于角色名称。

命名空间状态 命名空间角色 可用操作 限制
ACTIVE 所有者 编辑、成员管理、所有权转让、冻结、归档、删除 删除还须无依赖
ACTIVE 空间管理员 编辑、成员管理、冻结 不可归档、删除或转让所有权
ACTIVE 成员 无上述治理操作 技能所有者身份不增加治理权限
FROZEN 所有者 解冻、归档、删除 成员管理只读;删除还须无依赖
FROZEN 空间管理员 解冻 不可归档或删除
FROZEN 成员 无上述治理操作 不可写入
ARCHIVED 所有者 恢复至 ACTIVE、删除 删除还须无依赖
ARCHIVED 空间管理员或成员 无上述治理操作 原编辑权限不包含恢复
命名空间状态 平台身份 平台专用治理入口 限制
ACTIVE 超级管理员 冻结、归档 不要求成员身份,无永久删除入口
FROZEN 超级管理员 解冻、归档 不要求成员身份
ARCHIVED 超级管理员 恢复至 ACTIVE 不要求成员身份
任意状态 技能管理员或用户管理员 单靠平台角色无上述专用权限 另有成员角色时,按上一表判断

冻结用于暂停写入,不撤回客户端已安装文件;已有版本仍按访问规则读取。归档使命名空间退出搜索,并保留已有技能访问。永久删除仅由所有者发起,须没有技能、审核任务、指向该命名空间的提升申请及创作草稿;归档不会清除依赖。

依据:命名空间服务与平台治理入口。

完成标准与失败处理

创建后,列表应显示目标 slug、ACTIVE 和创建者的所有者角色;邀请接受后,成员列表应包含实际账号及 MEMBER。治理动作结束后重新读取详情,核对目标状态,例如解冻后为 ACTIVE。邀请记录显示已使用,不代表该账号当前仍为成员。

现象 最可能原因 定位手段 处置
无创建入口 缺少平台创建角色 核对账号的平台角色及页面身份 联系有权创建者;不要反复注册账号
邀请无法加入 过期、已使用、作废或命名空间不可写 邀请弹窗核对状态;设置页核对命名空间状态 原操作者按需创建新邀请;不要重复使用旧链接
刷新后无法复制链接 标签页暂存不可用或链接已失效 原账号原标签页重开弹窗,读取有效性结果 先重试校验;原码不可恢复时确认替换,不要将历史记录当作邀请码
成员操作不可用 非所有者/空间管理员,或已冻结/归档 核对成员角色、状态及只读提示 由有权操作者恢复后再处理;不要修改浏览器请求绕过权限
永久删除被拒绝 存在四类依赖之一 按响应指出的对象,检查技能、审核、提升和草稿列表 先按各对象流程处理;不要直接删数据库记录

成员移除与维护边界

移除成员不会删除、迁移或转让其技能,已发布内容继续按原可见范围提供。账号正常的当前技能所有者仍可在“我的技能”查看和下载自己的内容,包括私有内容、未发布版本和历史版本;页面显示只读提示。仅凭该所有者身份不能上传、重新发布、改头像或可见范围、撤回、归档或删除;其他成员的受限内容不因该例外开放。

重新加入且仍为所有者时,按原规则恢复维护;停用账号不可操作,重新启用不恢复已移除的成员关系。已提交申请继续正常审核,不自动批准或撤回;移除成员会撤销其团队内自动发布授权,待自动批准的任务转入普通审核。空间及平台治理权限保持原规则,本版不提供技能转让、自助退出或永久注销功能;所有者访问策略不替代其他管理权限。

延伸阅读