feat(cycle): teams reconcile cycle (#7) - #25
Merged
Merged
Conversation
Reconciles teams, team membership/roles, and team→repo permissions (team / team-member / team-repo resource types). Create resolves parentTeamSlug→parent_team_id and attaches members/repos embedded in the new-team diff entry. Adds TeamConfig.previously so resolveRenames collapses a rename, sparing removalDeltaCap (apply-time atomic rename is a documented runner follow-up). Registered, exported, action bundle rebuilt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7.
Adds the teams cycle — team tree, membership/roles, and team→repo permissions. Fourth of the npm-gate set (#5–#9).
What it does
Dispatches across the three team resource types the diff already emits (
team,team-member,team-repo):POST/PATCH/DELETE /orgs/{org}/teams/{slug}— create/update/delete; create resolvesparentTeamSlug→parent_team_idPUT/DELETE …/memberships/{user}— member add/role/removePUT/DELETE …/repos/{owner}/{repo}— team repo permission set/removeTeam-repo permission live-mapping prefers
role_name, falling back to the highestpermissionsboolean.New-team handling
diffTeamsembeds members/repos inside the team create entry (it doesn't emit separate child entries for a brand-new team), soapplyTeamattaches the embedded members and repos after the POST. Existing teams reconcile members/repos as their own entries.Rename-without-loss
Adds
TeamConfig.previously. Its effect is at the guardrail layer:resolveRenamescollapsesdelete(previously)+create(slug)into one update so a rename doesn't tripremovalDeltaCap. With the safe default (no ownership predicate) a rename is emitted purely as a create — the old team is left in place, nothing deleted.previouslyis never written to GitHub. Atomic apply-time rename is noted as a runner-level follow-up (the runner applies the raw, not rename-resolved, change set).Verification
npx tsc --noEmitcleannpm testgreen (308 tests; +22 inteams.test.ts)🤖 Generated with Claude Code