feat(cycle): rulesets reconcile cycle, repo + org (#9)#26
Merged
Conversation
Adds the rulesets API (separate from classic branch protection): new RulesetConfig on OrgConfig/RepoConfig, LiveRuleset + diffRulesets in the diff (org-ruleset/repo-ruleset resource types, ownership-gated deletes, id captured-not-diffed), and the cycle. fetchLive lists + GETs detail per ruleset; apply POSTs creates and addresses updates/deletes by live id. Completes the npm-publish gate (#5-#9). 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 #9. Completes the npm-publish gate (#5–#9).
Adds the rulesets cycle — repository and organization rulesets, a separate REST API from classic branch protection (which the branch-protection cycle already covers).
New types (rulesets weren't modeled before)
RulesetConfig(+RulesetTarget/RulesetEnforcement) onOrgConfig.rulesetsandRepoConfig.rulesets.bypassActors/conditions/rulesare GitHub-native pass-through JSON so the cycle forwards them verbatim.LiveRuleset(carries the GitHubid, captured-not-diffed),diffRulesetsfor bothorg-rulesetandrepo-rulesetresource types, added toRESOURCE_TYPE_ORDER. Deletes are ownership-gated like every managed collection.Cycle
fetchLive: lists rulesets (paginated) then GETs each ruleset's detail sorules/conditions/bypassActorsare populated for an accurate diff. Org rulesets viaorgLogin; repo rulesets forscope.reposthat declare them. 404 → empty (rulesets unsupported / repo missing).apply:POSTfor creates;PUT/DELETEaddress the ruleset by its live id (read from the change-setbefore), with a clear error if the id is missing.RMW note
A ruleset is authored as a unit — the declared
rules/conditions/bypassActorsare the source of truth for that ruleset; we don't merge individual rules from live. Selective-by-omission protects undeclared rulesets, which are never touched.Verification
npx tsc --noEmitcleannpm testgreen (328 tests; +20 inrulesets.test.ts; existing diff tests unaffected)With this merged, all five access/repo cycles in the roadmap's npm-publish gate (#5 org-settings, #6 membership, #7 teams, #8 repo-settings, #9 rulesets) are landed.
🤖 Generated with Claude Code