Skip to content

docs(distribution): recipe for restricting skills to some members (role gating pitfall + enforced-rule adoption) - #1096

Merged
jeff-r2026 merged 2 commits into
Tencent:mainfrom
pcm1991:docs/role-scoped-distribution-recipe
Oct 14, 2026
Merged

jeff-r2026 merged 2 commits into
Tencent:mainfrom
pcm1991:docs/role-scoped-distribution-recipe

Conversation

@pcm1991

@pcm1991 pcm1991 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a "Restricting skills to some members" recipe to the distribution guide (EN + zh-CN, mirrored). It documents behavior that is easy to get wrong when a team starts gating skills by namespace:

  • Namespace gating only applies to members who have set a role. A member with no primaryRole gets an unfiltered sync (every namespace reaches them) — manifest/roles.yaml alone restricts no one.
  • teamai init already forces the role choice (auto-select for one role, picker for several, hard failure non-interactively without --role), but members initialized before the manifest existed stay unfiltered until they run teamai roles set.
  • What the first pull after a role switch withdraws (teamai-delivered copies outside the new namespaces; modified copies kept and named).
  • A gap-closing pattern using an enforced rule (sharing.rules.enforced, which members cannot delete) that makes agents check teamai roles list and prompt the member to pick a role.
  • A clarifying note that tags never restrict — subscription is an additive opt-in channel; restriction belongs to namespaces + roles.

All statements were verified against a live team repo running teamai-cli 0.27.0 (fail-open behavior for role-less members, withdrawal on role switch, enforced-rule delivery).

Type of Change

  • Documentation only

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run passes
  • Added/updated tests for the change

N/A — docs only, no code touched.

Related Issues

None.

Notes for Reviewers

Two files, one section each, inserted between "Roles and projects" and "Tags" (zh-CN mirrors EN at the same position). Happy to reword, shorten, or relocate (e.g. split between distribution.md and member-guide.md) if maintainers prefer. If there is appetite for making this first-class (e.g. a sharing.roles.required: true that makes pull warn/refuse for role-less members instead of failing open), I can follow up with a feature issue.

Document that namespace gating only applies once a member sets a role
(no-role members get an unfiltered, backward-compatible sync), how init
forces the role choice, what pull withdraws after a role switch, and the
enforced-rule pattern that prompts legacy members to pick a role. Also
clarify that tags are an additive opt-in channel and never restrict.

EN + zh-CN mirrored.
@jeff-r2026 jeff-r2026 self-assigned this Oct 13, 2026
@github-actions

Copy link
Copy Markdown

No findings confidently supported by the current diff.

  • Changes are limited to the distribution guide, with matching English and Chinese sections.
  • Testing documentation is sufficient under the trusted review rules: this docs-only PR requires no build, unit-test, or real-CLI verification record.
  • No earlier findings were supplied to mark resolved.

Reviewed only the specified diff; did not run, build, or install anything from the PR.

@hsuchifeng

Copy link
Copy Markdown
Collaborator

Thanks for the contribution. We'd like to keep the documentation simple and easy to follow. Could you simplify this section and mirror the change in the zh-CN version?

@pcm1991

pcm1991 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @hsuchifeng — simplified in 5d40437..latest: the section is now ~16 lines per language (was 32). Dropped the full rule-body example and the init picker mechanics; kept the fail-open pitfall, the one-time roles set fix + withdrawal behavior, the enforced-rule pointer, and the tags clarification.

The zh-CN mirror has been included since the first commit (docs/guide/zh-CN/distribution.md, same position between 角色和项目 and 标签) and is updated in sync here.

For reference, the mechanism claims in the section were verified against v0.27.0 source and a live team repo:

  • Fail-open for role-less members: resolveResourceNamespaces() returns null when no primaryRole/projects are set, so pull falls back to the unfiltered scanTeamForPull() scan (root + every namespace dir).
  • Gating + withdrawal once a role is set: buildRolePullContext() computes active/inactive namespaces; only active ones are scanned, and pull removes teamai-delivered copies outside them — matched against delivery records (hash), so locally modified copies are kept and named.
  • Init enforcement: promptForRoleProfile() auto-selects a single role, shows a picker for several, and hard-fails non-interactive runs without --role.
  • Tags are additive only: filterByTags() is a no-op with an empty subscription list, and matched tags only add skills to the desired set — never subtract.

Happy to trim further or relocate if you'd prefer.

@github-actions

Copy link
Copy Markdown

No findings confidently supported by the current diff.

  • Changes are documentation-only, with matching English and Chinese sections.
  • Testing documentation is sufficient: under the trusted review rules, this docs-only PR requires no end-to-end / real-CLI record.
  • The earlier review reported no findings, so none require resolution.

Reviewed only the specified diff; did not run, build, or install anything from the PR.

@jeff-r2026
jeff-r2026 merged commit d3309a6 into Tencent:main Oct 14, 2026
13 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
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.

3 participants