Skip to content

feat: implement issue #323 — Compliance: ruleset-drift-pr-quality-require_code_owner_review - #332

Closed
don-petry wants to merge 2 commits into
mainfrom
dev-lead/issue-323-20260717-1358
Closed

feat: implement issue #323 — Compliance: ruleset-drift-pr-quality-require_code_owner_review#332
don-petry wants to merge 2 commits into
mainfrom
dev-lead/issue-323-20260717-1358

Conversation

@don-petry

Copy link
Copy Markdown
Contributor

Closes #323

Implemented by dev-lead agent. Please review.

Copilot AI review requested due to automatic review settings July 17, 2026 14:03
@don-petry
don-petry requested a review from a team as a code owner July 17, 2026 14:03
@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.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fff10293-1cb3-49f0-b720-29c67ee30196

📥 Commits

Reviewing files that changed from the base of the PR and between 8e2a986 and 2d01027.

📒 Files selected for processing (2)
  • .github/scripts/apply-pr-quality-ruleset.sh
  • .github/scripts/tests/apply-pr-quality-ruleset.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-323-20260717-1358

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.

@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 introduces a bash script (apply-pr-quality-ruleset.sh) and associated BATS tests to idempotently manage the pr-quality branch protection ruleset for the petry-projects/markets repository. The review feedback identifies a critical issue where the allowed_merge_methods parameter is invalid for the pull_request ruleset API and will cause a 422 error, recommending its removal from both the JSON payload and the script's documentation header. Additionally, the feedback suggests removing error silencing (2>/dev/null || true) when querying existing rulesets to ensure the script fails fast on actual API or authentication errors.

Comment thread .github/scripts/apply-pr-quality-ruleset.sh Outdated
Comment thread .github/scripts/apply-pr-quality-ruleset.sh Outdated
Comment thread .github/scripts/apply-pr-quality-ruleset.sh Outdated

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a repo-local, idempotent script to enforce the pr-quality GitHub repository ruleset for petry-projects/markets, plus Bats tests that validate the script’s static contents without making live API calls.

Changes:

  • Introduce .github/scripts/apply-pr-quality-ruleset.sh to create/update the pr-quality ruleset via gh api and a jq-built payload.
  • Add .github/scripts/tests/apply-pr-quality-ruleset.bats to assert key configuration and idempotent behavior patterns.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
.github/scripts/apply-pr-quality-ruleset.sh New automation to create/update the pr-quality ruleset with codified PR review requirements.
.github/scripts/tests/apply-pr-quality-ruleset.bats New Bats tests verifying the script contains required settings and uses create/update API calls.

Comment on lines +31 to +33
@test "script sets require_code_owner_review to true (issue #323)" {
grep -qE 'require_code_owner_review["[:space:]:]+true' "$SCRIPT"
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in .github/scripts/tests/apply-pr-quality-ruleset.bats line 32: updated the ERE pattern from require_code_owner_review["[:space:]:]+true to require_code_owner_review"?:[[:space:]]+true. The new pattern unambiguously matches the jq output format (require_code_owner_review: true) while optionally allowing a surrounding double-quote.

Comment thread .github/scripts/apply-pr-quality-ruleset.sh Outdated
Comment on lines +44 to +45
PAYLOAD=$(jq -n '{
name: "pr-quality",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in .github/scripts/apply-pr-quality-ruleset.sh: the PAYLOAD jq call now uses --arg name "$RULESET_NAME" and references $name in the JSON instead of the hardcoded string "pr-quality". RULESET_NAME is now the single source of truth for the ruleset name throughout the script.

@@ -0,0 +1,89 @@
#!/usr/bin/env bash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added explicit dependency checks immediately after set -euo pipefailcommand -v gh and command -v jq each emit a clear ERROR: message to stderr and exit 1 if the tool is absent, before any other logic runs. New bats assertions in .github/scripts/tests/apply-pr-quality-ruleset.bats verify both checks are present.

# canonical tool for managing rulesets across all repos. This script exists as a
# repo-local reference and fallback for the markets repository specifically.

set -euo pipefail

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added explicit dependency checks immediately after set -euo pipefailcommand -v gh and command -v jq each emit a clear ERROR: message to stderr and exit 1 if the tool is absent, before any other logic runs. New bats assertions in .github/scripts/tests/apply-pr-quality-ruleset.bats verify both checks are present.

Comment on lines +41 to +44
EXISTING_ID=$(gh api "repos/$REPO/rulesets" \
--jq ".[] | select(.name == \"$RULESET_NAME\") | .id" 2>/dev/null || true)

PAYLOAD=$(jq -n '{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added explicit dependency checks immediately after set -euo pipefailcommand -v gh and command -v jq each emit a clear ERROR: message to stderr and exit 1 if the tool is absent, before any other logic runs. New bats assertions in .github/scripts/tests/apply-pr-quality-ruleset.bats verify both checks are present.

Comment on lines +48 to +58
bypass_actors: [
{
actor_type: "OrganizationAdmin",
bypass_mode: "always"
},
{
actor_id: 3167543,
actor_type: "Integration",
bypass_mode: "always"
}
],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added an inline comment identifying integration 3167543 as the donpetry-bot GitHub App and introduced a BYPASS_INTEGRATION_ID env var (defaulting to 3167543) so the value can be overridden without editing the script. The jq payload now uses --argjson bypass_id "$BYPASS_INTEGRATION_ID" and references $bypass_id in the JSON.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) July 17, 2026 14:48
@don-petry
don-petry disabled auto-merge July 17, 2026 14:50
@sonarqubecloud

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Contributor Author

Closing as part of the 50-PR cap drain. The dev-lead fix-loop repairs #1340 (self-cancellation), #1290 (comment-inertness) and #806 (thread-resolution) have all landed, so this deadlocked PR can be regenerated cleanly through the repaired loop. The driving issue stays open and its dev-lead label is re-fired — no work is lost.

@don-petry don-petry closed this Jul 21, 2026
auto-merge was automatically disabled July 21, 2026 19:20

Pull request was closed

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.

Compliance: ruleset-drift-pr-quality-require_code_owner_review

3 participants