Skip to content

feat(cycle): membership & roles reconcile cycle (#6)#24

Merged
lex00 merged 1 commit into
mainfrom
feat/membership-cycle
Jun 19, 2026
Merged

feat(cycle): membership & roles reconcile cycle (#6)#24
lex00 merged 1 commit into
mainfrom
feat/membership-cycle

Conversation

@lex00

@lex00 lex00 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Closes #6.

Adds the membership cycle — org members and roles (admins/members), third of the npm-gate set (#5#9).

What it does

  • GET /orgs/{org}/members?role=admin|member — paginated live listing, role-tagged
  • PUT /orgs/{org}/memberships/{user} — add a member / set role (create + update)
  • DELETE /orgs/{org}/memberships/{user} — remove from org (delete)

Safety (the crux of this issue)

  • Deletes are ownership-gated. diffMembers only emits a delete when the caller supplies DiffOptions.isOwned. With the default runner wiring this cycle only adds/re-roles declared members — it never removes anyone.
  • When removals are enabled, the member-aware guardrails gate the apply. Tests prove two trip via the runner / guardrail engine:
    • adminFloor blocks an apply that would drop below 2 admins (asserted through runReconcile in apply mode — guardrailBlocked, zero mutating calls).
    • removalDeltaCap trips when >25% of members would be removed.

Scope note

Outside collaborators are a distinct per-repo concept not modelled by MemberConfig; intentionally out of scope here and left as future inventory work.

Verification

  • npx tsc --noEmit clean
  • npm test green (286 tests; +14 in membership.test.ts)
  • Action bundle rebuilt for the CI freshness check

🤖 Generated with Claude Code

Reconciles org membership/roles: lists admins+members (paginated),
PUT /orgs/{org}/memberships/{user} to add/re-role, DELETE to remove.
Deletes stay ownership-gated (safe default: add/re-role only). Tests
prove adminFloor and removalDeltaCap trip via the runner.

Registered, exported, action bundle rebuilt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00 lex00 merged commit 53f046f into main Jun 19, 2026
2 checks passed
@lex00 lex00 mentioned this pull request Jun 19, 2026
1 task
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.

cycle: membership & roles

1 participant