Skip to content

feat: implement issue #399 — Compliance: ruleset-bypass-orgadmin-code-quality - #405

Merged
don-petry merged 4 commits into
mainfrom
dev-lead/issue-399-20260807-1325
Aug 7, 2026
Merged

don-petry merged 4 commits into
mainfrom
dev-lead/issue-399-20260807-1325

Conversation

@don-petry

@don-petry don-petry commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

User description

Closes #399

Implemented by dev-lead agent. Please review.


CodeAnt-AI Description

Allow organization administrators to bypass the code-quality ruleset in emergencies

What Changed

  • Code-quality rulesets now grant organization administrators an always-available bypass for the required checks
  • Added automated coverage to verify the bypass actor and its behavior are included when the ruleset is created

Impact

✅ Emergency admin overrides for protected branches
✅ Required checks remain enforced for regular changes
✅ Fewer configuration regressions

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features

    • Updated code-quality rulesets to support OrganizationAdmin and automated dependency-update bypass actors with always-enabled bypass access.
    • Existing bypass actors are now preserved when rulesets are updated.
  • Tests

    • Added automated coverage for ruleset creation and updates, including verification of required bypass actors and preservation of existing configuration.
    • Added isolated test environment setup and cleanup.

@don-petry
don-petry requested a review from a team as a code owner August 7, 2026 13:28
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codeant-ai

codeant-ai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 7018c33 Aug 07, 2026 · 13:28 13:30

@codeant-ai

codeant-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f353330a-d00f-481f-826a-d7af00da263a

📥 Commits

Reviewing files that changed from the base of the PR and between 7018c33 and 29b1508.

📒 Files selected for processing (2)
  • .github/scripts/apply-code-quality-ruleset.sh
  • .github/scripts/tests/apply-code-quality-ruleset.bats

📝 Walkthrough

Walkthrough

The ruleset application script now configures required bypass actors, preserves other existing actors during updates, and sends the merged list in the payload. BATS tests cover ruleset creation and update payloads.

Changes

Ruleset bypass configuration

Layer / File(s) Summary
Configure and preserve bypass actors
.github/scripts/apply-code-quality-ruleset.sh
The script defines required bypass actors, preserves unrelated existing actors during updates, and uses the computed list in the ruleset payload.
Validate creation and update payloads
.github/scripts/tests/apply-code-quality-ruleset.bats
Mocked gh calls verify required actors, always bypass modes, and preservation of an existing RepositoryRole actor.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: donpetry-bot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the compliance implementation for issue #399 and matches the primary ruleset change.
Linked Issues check ✅ Passed The changes add the required OrganizationAdmin bypass actor with always mode for the code-quality ruleset targeting main.
Out of Scope Changes check ✅ Passed The changes are limited to the ruleset script and its test, with no unrelated modifications identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-399-20260807-1325

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.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Aug 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the GitHub ruleset script to include OrganizationAdmin as a bypass actor with always bypass mode, and adds a corresponding BATS test to verify the payload structure. The review feedback suggests improving the test suite by leveraging BATS's built-in $BATS_TEST_TMPDIR instead of manually managing a temporary directory in setup and teardown, defining GH_TOKEN locally, and using a single semantic jq assertion to validate the bypass_actors array.

Comment thread .github/scripts/tests/apply-code-quality-ruleset.bats Outdated
Comment thread .github/scripts/tests/apply-code-quality-ruleset.bats
Comment thread .github/scripts/apply-code-quality-ruleset.sh Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/scripts/tests/apply-code-quality-ruleset.bats (1)

57-74: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Cover the existing-ruleset update path.

This test forces the lookup to return no existing ruleset, so it only exercises POST. Verify that another test covers the PUT path. If none exists, capture the update payload and assert the bypass actor contract there too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/tests/apply-code-quality-ruleset.bats around lines 57 - 74,
The test currently covers only the create path because the mocked ruleset lookup
returns no existing ruleset. Add coverage for the existing-ruleset update path
in the tests around the apply-code-quality-ruleset script: mock a returned
ruleset, capture the PUT payload, and assert it includes the OrganizationAdmin
bypass actor with bypass_mode always, while preserving the existing POST
assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/apply-code-quality-ruleset.sh:
- Around line 14-19: Update the ruleset payload’s bypass_actors configuration to
include both OrganizationAdmin and the Integration actor
dependabot-automerge-petry, using its required actor_id, so the PUT update
preserves both bypasses. Revise the nearby comments to document both required
actors.

---

Nitpick comments:
In @.github/scripts/tests/apply-code-quality-ruleset.bats:
- Around line 57-74: The test currently covers only the create path because the
mocked ruleset lookup returns no existing ruleset. Add coverage for the
existing-ruleset update path in the tests around the apply-code-quality-ruleset
script: mock a returned ruleset, capture the PUT payload, and assert it includes
the OrganizationAdmin bypass actor with bypass_mode always, while preserving the
existing POST assertions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 853b4cb2-88a1-4115-82c4-e7428ce85b1d

📥 Commits

Reviewing files that changed from the base of the PR and between 93726a6 and 7018c33.

📒 Files selected for processing (2)
  • .github/scripts/apply-code-quality-ruleset.sh
  • .github/scripts/tests/apply-code-quality-ruleset.bats

Comment thread .github/scripts/apply-code-quality-ruleset.sh
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 7, 2026 13:37
@don-petry
don-petry disabled auto-merge August 7, 2026 13:45
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 7, 2026 13:49
@don-petry
don-petry disabled auto-merge August 7, 2026 13:54
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — waiting on PR blockers (intent: fix-reviews)

PR: #405
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-08-07T14:25:43Z

@don-petry
don-petry enabled auto-merge (squash) August 7, 2026 13:55

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: e3e884d538af101c73871f0c58065d2765b288c1
Review mode: triage-approved (single reviewer)

Summary

Adds the two org-mandated bypass actors (OrganizationAdmin and the dependabot-automerge-petry GitHub App, both bypass_mode: always) to the code-quality ruleset payload in .github/scripts/apply-code-quality-ruleset.sh, with a merge path that preserves any other existing bypass actors when updating an existing ruleset. Two new bats tests cover both the create (POST) and update (PUT) payloads. The change exactly matches the codified org standard (standards/github-settings.md and standards/rulesets/code-quality.json in petry-projects/.github), including the hardcoded Integration actor_id 3167543, which was verified against the canonical ruleset JSON.

Linked issue analysis

Closes #399 (Compliance: ruleset-bypass-orgadmin-code-quality). The issue requires the OrganizationAdmin bypass actor with bypass_mode: always on the code-quality ruleset; the PR adds it. It additionally adds the dependabot-automerge-petry Integration bypass actor, which the same referenced standard section explicitly requires on every ruleset targeting main — in-scope per the standard, not scope creep. The issue is substantively addressed.

Findings

  • Merge logic on update filters out any pre-existing OrganizationAdmin / Integration-3167543 entries before appending the required actors, so it is idempotent and does not clobber other legitimate bypass actors — this addresses the earlier CodeAnt finding (thread resolved).
  • bypass_mode: always for the Dependabot app is justified by the standard (pull_request mode does not work for PRs the actor opens; the automerge workflow verifies CI + MERGEABLE before merging).
  • All 4 bot review threads (gemini-code-assist x2, codeant-ai, coderabbitai) are resolved; no human reviewer questions are outstanding.
  • Secret scan MCP tool was not available in this session; the gitleaks CI check passed and the diff contains no secret-like content.
  • Triage assessment confirmed: change is a focused, standards-driven config-script update with test coverage. Risk rated MEDIUM (touches branch-protection/bypass configuration) rather than LOW, but it converges the repo to the codified org standard rather than deviating from it.

CI status

All code-relevant checks green: agent-shield, CodeQL, SonarCloud (quality gate passed), Secret scan (gitleaks), dependency-audit, Graphite AI review, CodeRabbit. Remaining SKIPPED entries are ecosystem-specific audits and CI not applicable to this diff; CANCELLED entries are superseded dev-lead/review orchestration runs, not code CI failures. No failing checks.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@don-petry
don-petry merged commit ed2286b into main Aug 7, 2026
20 of 22 checks passed
@don-petry
don-petry deleted the dev-lead/issue-399-20260807-1325 branch August 7, 2026 14:37
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-08-07T15:38:40Z.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compliance: ruleset-bypass-orgadmin-code-quality

2 participants