Skip to content

docs(config): org rulesets are writable with admin scope — matrix correction + what was applied tonight - #883

Merged
hyperpolymath merged 1 commit into
mainfrom
docs/ruleset-capabilities
Sep 21, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
docs/ruleset-capabilities

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Why

config/rulesets/README.adoc (added in #878) records that PATCH /orgs/ORG/rulesets/ID is a 404 and that the metadatastician EstateBranching repair must be an owner session. Both were properties of the token I had, not of the API.

What happened, factually

PUT /orgs/metadatastician/rulesets/18225024 (EstateBranching, active, ~DEFAULT_BRANCH x ~ALL) returned 200 after ?dry-run=true returned 200. Removed: rules code_coverage, code_quality; bypass actors 827041 (gitar-bot) and 1658531 (Linear Code). Preserved verbatim: conditions, enforcement, target, every other rule and every other actor (2 always, 5 pull_request, 12526, 29110, 1236702, 262318, Team 18237148, OrganizationAdmin, RepositoryMigration). Re-read confirms it.

Because that ruleset is inherited, one write removed gitar-bot's default-branch bypass from all 43 metadatastician repos — all 43 grants in the last full sweep were this org ruleset (source_type: Organization x43), and no sampled repo-level ruleset grants it.

The two durable rules

  1. PUT bodies must be read back from the live ruleset, never reconstructed from a snapshot. My first attempt sent a body whose conditions came from my own sweep summary: 422 Invalid property /conditions: data matches no possible input. The live object carries repository_name alongside ref_name; the snapshot had dropped it. Any summariser that flattens conditions yields bodies that either fail or silently rewrite policy.
  2. A 422 naming a bypass actor is a dangling-grant detector. Actor Linear Code integration must be part of the ruleset source or owner organization proves the app is not installed — no read endpoint says that. It cuts the other way too: actors that validate cleanly are installed, which is why 946600 and 262318 were left alone. Stripping a working bypass from a live-but-unnamed app is a decision, not a cleanup.

Not included

copilot_code_review (enforced on 152 repos) awaits your ruling. Repo-level PUT .../rulesets/ID is 403 for the token that made the org write, so the 96 per-repo entries in the repair plan stay owner-run — and ruleset-repair/apply-ruleset-repair.sh now derives bodies from live state and dry-runs each write, because with the frozen bodies it would have 422'd on all 97. Docs-only PR.

… matrix correction

`config/rulesets/README.adoc` recorded `PATCH /orgs/ORG/rulesets/ID` as a 404 and the
metadatastician EstateBranching fix as owner-session-only. Both were true of one token, not of the
API. With org admin, `PUT /orgs/ORG/rulesets/ID` works; `?dry-run=true` validates without writing;
per-repo `PUT .../rulesets/ID` is still 403 for that same token.

Applied today on that basis: EstateBranching lost `code_coverage` + `code_quality` and the bypass
grants to `827041` (gitar-bot) and `1658531` (Linear Code, which GitHub reported as not installed).
Inherited by every metadatastician repo, so gitar's default-branch bypass is gone across all 43 in
one write — closing the half of the estate cleanup that could not be done by PR.

Two durable rules came out of being rejected:
* PUT bodies must be read back from the live ruleset, not reconstructed — a snapshot that dropped
  `repository_name` from `conditions` produced `422 Invalid property /conditions`.
* a `422` naming a bypass actor is a dangling-grant detector: it means that app is not installed on
  the target, which no read endpoint tells you. Actors that validate cleanly are installed even when
  unnamed, so `946600` and `262318` were left alone rather than removed for convenience.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 32603089-683e-48a0-bfdf-2ff77b4f5e24

📥 Commits

Reviewing files that changed from the base of the PR and between 08f77c1 and 2212d19.

📒 Files selected for processing (1)
  • config/rulesets/README.adoc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hyperpolymath
hyperpolymath merged commit d1ca0e8 into main Sep 21, 2026
15 of 22 checks passed
@hyperpolymath
hyperpolymath deleted the docs/ruleset-capabilities branch September 21, 2026 00:24
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant