Skip to content

feat: implement issue #375 — Compliance: ruleset-drift-code-quality-required_status_checks - #379

Merged
don-petry merged 2 commits into
mainfrom
dev-lead/issue-375-20260724-1400
Jul 24, 2026
Merged

don-petry merged 2 commits into
mainfrom
dev-lead/issue-375-20260724-1400

Conversation

@don-petry

@don-petry don-petry commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

User description

Closes #375

Implemented by dev-lead agent. Please review.


CodeAnt-AI Description

Apply the code-quality ruleset when repository settings are updated

What Changed

  • Repository settings updates now also apply the code-quality required status checks ruleset
  • The repo settings workflow now reruns when the code-quality ruleset script changes
  • Test coverage was updated to confirm the new ruleset step is included

Impact

✅ Consistent code-quality checks on repo changes
✅ Fewer missed required status checks
✅ Safer repository settings updates

💡 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

  • Chores

    • Repository settings automation now applies the required code-quality checks ruleset.
    • Changes to code-quality ruleset configuration now trigger the repository settings workflow.
  • Tests

    • Added coverage verifying that code-quality ruleset application is included in repository settings automation.

@don-petry
don-petry requested a review from a team as a code owner July 24, 2026 14:05
@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 Jul 24, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 4ec9d8d Jul 24, 2026 · 14:05 14:06

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Repository settings automation now applies the code-quality required-status-checks ruleset. The workflow triggers when that ruleset script changes, and a static Bats test verifies the invocation wiring.

Changes

Repository settings automation

Layer / File(s) Summary
Code-quality ruleset application wiring
.github/scripts/apply-repo-settings.sh, .github/workflows/apply-repo-settings.yml, .github/scripts/tests/apply-repo-settings.bats
The settings script invokes apply-code-quality-ruleset.sh; the workflow watches that script for changes; and a Bats test checks the reference.

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

Possibly related PRs

  • petry-projects/markets#77: Wires repository settings to invoke the code-quality ruleset script and updates its workflow and test coverage.
🚥 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 and specifically matches the PR’s main change and linked compliance issue.
Linked Issues check ✅ Passed Applying the code-quality ruleset script aligns with the issue’s requirement to converge the required status checks.
Out of Scope Changes check ✅ Passed The workflow trigger and test update support the same ruleset change and do not appear unrelated.
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-375-20260724-1400

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:XS This PR changes 0-9 lines, ignoring generated files label Jul 24, 2026
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) July 24, 2026 14:06

@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 repository settings script to apply the code-quality required-status-checks ruleset by invoking apply-code-quality-ruleset.sh. It also adds a corresponding unit test in the BATS test suite to verify this integration. There are no review comments, and the changes look correct and well-tested, so I have no feedback to provide.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Wire code-quality ruleset application into repo settings automation

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Invoke the code-quality required-status-checks ruleset application from the repo settings script.
• Add a Bats test to prevent accidental removal of the ruleset wiring.
• Ensure the settings workflow re-runs when the code-quality ruleset script changes.
Diagram

graph TD
  W["apply-repo-settings.yml"] --> S["apply-repo-settings.sh"] --> SS["secret scanning script"] --> API[("GitHub API")] --> R[("Repo settings")]
  S --> CQ["apply-code-quality-ruleset.sh"] --> API
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Call org-level ruleset automation
  • ➕ Single canonical ruleset implementation across all repos
  • ➕ Avoids repo-local wiring drift over time
  • ➖ Requires access to and coordination with the org-level automation pipeline
  • ➖ Still needs a local trigger point or scheduled run per repo
2. Inline ruleset API call in apply-repo-settings.sh
  • ➕ Fewer moving parts (one script)
  • ➕ Simpler operationally for a one-off repo
  • ➖ Harder to reuse/test ruleset logic independently
  • ➖ Mixes concerns (general repo settings vs ruleset payload management)
3. Separate workflow to apply rulesets only
  • ➕ Clear separation of responsibilities
  • ➕ Allows ruleset updates without touching general settings
  • ➖ Adds another workflow to maintain/monitor
  • ➖ More entry points for “repo compliance” operations

Recommendation: Current approach (wiring the existing apply-code-quality-ruleset.sh into the existing apply-repo-settings.sh entry point) is the best trade-off: it keeps a single operational command/workflow for restoring compliance while preserving the ruleset logic as an independently testable unit.

Files changed (3) +9 / -0

Enhancement (1) +4 / -0
apply-repo-settings.shInvoke code-quality ruleset application during repo settings enforcement +4/-0

Invoke code-quality ruleset application during repo settings enforcement

• Adds a new step that calls apply-code-quality-ruleset.sh as part of the standard repository settings application sequence. This ensures required status checks ruleset compliance is enforced whenever repo settings are applied.

.github/scripts/apply-repo-settings.sh

Tests (1) +4 / -0
apply-repo-settings.batsAdd regression test for code-quality ruleset wiring +4/-0

Add regression test for code-quality ruleset wiring

• Adds a static Bats assertion that apply-repo-settings.sh references apply-code-quality-ruleset.sh. This guards against accidental removal of the ruleset enforcement step.

.github/scripts/tests/apply-repo-settings.bats

Other (1) +1 / -0
apply-repo-settings.ymlTrigger settings workflow when code-quality ruleset script changes +1/-0

Trigger settings workflow when code-quality ruleset script changes

• Extends the push path filter to include apply-code-quality-ruleset.sh. This ensures updates to the ruleset script automatically trigger re-application on main.

.github/workflows/apply-repo-settings.yml

@don-petry
don-petry disabled auto-merge July 24, 2026 14:06
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
Addressed 0 threads:
(no open threads)
Test verification: skipped — no code changes were made
Files changed: none
```

@don-petry
don-petry enabled auto-merge (squash) July 24, 2026 14:07
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@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: 4ec9d8d865ecffdbdc55a146e7c6a947668d7373
Review mode: triage-approved (single reviewer)

Summary

Wires the existing apply-code-quality-ruleset.sh into the repo-settings automation so the code-quality required-status-checks ruleset is re-applied whenever settings are enforced, with a bats regression test and a workflow path-filter addition. Verified the invoked script exists on the head branch and the workflow supplies GH_TOKEN_ADMIN with the administration:write scope the script requires. Confirms the triage low-risk assessment.

Linked issue analysis

Closes #375 (compliance: ruleset-drift-code-quality-required_status_checks). The issue reports the code-quality ruleset drifted (missing agent-shield / AgentShield and dependency-audit / Detect ecosystems required checks). Merging this PR modifies apply-repo-settings.sh, which is in the workflow's path filter, so the Apply repo settings workflow runs on main and applies the codified ruleset — converging the drift. The new path-filter entry for apply-code-quality-ruleset.sh also re-applies on future script changes, preventing recurrence. Substantively addressed.

Findings

No blocking findings.

  • apply-repo-settings.sh: adds one call to the pre-existing, idempotent apply-code-quality-ruleset.sh (set -euo pipefail; requires GH_TOKEN — provided by the workflow env). No injection surface; no new secrets handling.
  • apply-repo-settings.bats: static grep assertion guards the wiring, consistent with the existing test pattern (e.g. issue #227 test).
  • apply-repo-settings.yml: path-filter-only change; permissions: {} and SHA-pinned checkout unchanged.
  • Secret scan: gitleaks CI check passed; the run_secret_scanning MCP tool was not available in this environment, so the MCP-based scan was skipped (no secret-like content present in the diff).

CI status

All required checks green: CodeQL (SUCCESS), SonarCloud quality gate passed (0 new issues, 0 hotspots), agent-shield / AgentShield (SUCCESS), Secret scan gitleaks (SUCCESS), dependency-audit / Detect ecosystems (SUCCESS). Remaining checks SKIPPED (not applicable to this change) or SUCCESS. No failures.


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

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry merged commit b58fbb0 into main Jul 24, 2026
21 of 22 checks passed
@don-petry
don-petry deleted the dev-lead/issue-375-20260724-1400 branch July 24, 2026 14:10

@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

🤖 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/tests/apply-repo-settings.bats:
- Around line 33-35: Update the test “script wires in code-quality ruleset
application (issue `#375`)” to assert the actual executable invocation used by
apply-repo-settings.sh, including its command context and expected arguments,
rather than only matching the apply-code-quality-ruleset.sh filename. Keep the
assertion focused on detecting whether the script truly invokes the ruleset
command.
🪄 Autofix (Beta)

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: 4eb1b6ea-a7b6-4404-b508-97f06377d148

📥 Commits

Reviewing files that changed from the base of the PR and between 6b75228 and 8bf57b1.

📒 Files selected for processing (3)
  • .github/scripts/apply-repo-settings.sh
  • .github/scripts/tests/apply-repo-settings.bats
  • .github/workflows/apply-repo-settings.yml

Comment on lines +33 to +35
@test "script wires in code-quality ruleset application (issue #375)" {
grep -q 'apply-code-quality-ruleset.sh' "$SCRIPT"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the actual ruleset invocation, not just the filename.

This test would pass if apply-code-quality-ruleset.sh appeared in a comment or unrelated string. Match the executable command used by .github/scripts/apply-repo-settings.sh so the test detects broken wiring.

Suggested assertion
 `@test` "script wires in code-quality ruleset application (issue `#375`)" {
-  grep -q 'apply-code-quality-ruleset.sh' "$SCRIPT"
+  grep -qF '"$SCRIPT_DIR/apply-code-quality-ruleset.sh"' "$SCRIPT"
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@test "script wires in code-quality ruleset application (issue #375)" {
grep -q 'apply-code-quality-ruleset.sh' "$SCRIPT"
}
`@test` "script wires in code-quality ruleset application (issue `#375`)" {
grep -qF '"$SCRIPT_DIR/apply-code-quality-ruleset.sh"' "$SCRIPT"
}
🤖 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-repo-settings.bats around lines 33 - 35, Update
the test “script wires in code-quality ruleset application (issue `#375`)” to
assert the actual executable invocation used by apply-repo-settings.sh,
including its command context and expected arguments, rather than only matching
the apply-code-quality-ruleset.sh filename. Keep the assertion focused on
detecting whether the script truly invokes the ruleset command.

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

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compliance: ruleset-drift-code-quality-required_status_checks

2 participants