Skip to content

feat: implement issue #549 — feat(ci-standards): adopt inline-NOSONAR S7637 exemption in caller-stub templates (org-wide; supersedes per-file approach) — spike-validated - #551

Merged
don-petry merged 5 commits into
mainfrom
dev-lead/issue-549-20260627-1722
Jun 27, 2026
Merged

feat: implement issue #549 — feat(ci-standards): adopt inline-NOSONAR S7637 exemption in caller-stub templates (org-wide; supersedes per-file approach) — spike-validated#551
don-petry merged 5 commits into
mainfrom
dev-lead/issue-549-20260627-1722

Conversation

@don-petry

@don-petry don-petry commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Closes #549

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • New Features

    • Added inline SonarCloud exemption support for first-party reusable workflow calls.
    • Updated workflow templates so the exemption is handled directly on the uses: line.
  • Bug Fixes

    • Improved compliance checks to recognize inline exemption markers and distinguish them from legacy file-based exemptions.
    • Refined warning and error messages for clearer guidance on valid exemption formats.
  • Documentation

    • Revised CI guidance to reflect the new inline marker approach and updated template instructions.

… S7637 exemption in caller-stub templates (org-wide; supersedes per-file approach) — spike-validated
@don-petry
don-petry requested a review from a team as a code owner June 27, 2026 17:30
@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.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

More reviews will be available in 44 minutes and 4 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 745000f1-7b8e-480c-a7ba-d58adb1cf378

📥 Commits

Reviewing files that changed from the base of the PR and between 0d04734 and a68bc08.

📒 Files selected for processing (3)
  • scripts/compliance-audit.sh
  • scripts/deploy-standard-workflows.sh
  • test/scripts/compliance-audit/sonar-s7637-exemption.bats
📝 Walkthrough

Walkthrough

Adds inline # NOSONAR(githubactions:S7637) markers to all first-party channel-pinned uses: lines across caller-stub templates in standards/workflows/. Introduces classify_inline_s7637_marker() in compliance-audit.sh and reworks check_sonar_s7637_exemption() to prefer inline markers over legacy sonar-project.properties. Updates ci-standards.md and adds bats tests.

Changes

Inline NOSONAR S7637 exemption

Layer / File(s) Summary
classify_inline_s7637_marker() and reworked check_sonar_s7637_exemption()
scripts/compliance-audit.sh
Adds classify_inline_s7637_marker() returning present/missing/n/a based on inline marker presence on channel-pinned first-party uses: lines. Reworks check_sonar_s7637_exemption() to run the inline classifier first across all .github/workflows files, falling back to legacy sonar-project.properties only when markers are missing. Updates legacy-verdict message strings.
Inline NOSONAR markers on all caller-stub templates
standards/workflows/dev-lead.yml, standards/workflows/add-to-project.yml, standards/workflows/agent-shield.yml, standards/workflows/auto-rebase.yml, standards/workflows/dependabot-*.yml, standards/workflows/dependency-audit.yml, standards/workflows/idea-*.yml, standards/workflows/initiative-planner.yml, standards/workflows/pr-*.yml
Appends # NOSONAR(githubactions:S7637) to the channel-pinned uses: line in each caller-stub template. dev-lead.yml header comment is also updated to remove the sonar-project.properties instruction.
ci-standards.md: inline marker as canonical S7637 suppression
standards/ci-standards.md
Makes inline # NOSONAR(githubactions:S7637) in the stub file the canonical mechanism; retains legacy per-file sonar-project.properties as transitional. Updates Dev-Lead adoption section to remove the s7637_devlead requirement.
bats tests for classify_inline_s7637_marker()
test/scripts/compliance-audit/sonar-s7637-exemption.bats
Adds classify_inline helper and test cases for present/missing/n/a outcomes; adds a loop test asserting every standards/workflows/*.yml template classifies as present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • petry-projects/.github#11: Introduced standards/ci-standards.md with the original SonarCloud S7637 exemption guidance now being updated.
  • petry-projects/.github#12: Introduced scripts/compliance-audit.sh with the SonarCloud checking logic reworked by this PR.
  • petry-projects/.github#491: Switched caller-stub templates from SHA pins to /<name>/stable channel pins — the same lines now receiving inline NOSONAR markers.

Suggested labels

needs-human-review

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is long, but it clearly describes the main change: adopting inline NOSONAR S7637 exemptions for caller-stub templates.
Linked Issues check ✅ Passed The PR updates the audit, docs, and listed caller-stub templates to use inline NOSONAR markers while preserving legacy fallback during migration.
Out of Scope Changes check ✅ Passed The changes appear limited to the S7637 exemption workflow, documentation, and tests, with no unrelated scope added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-549-20260627-1722

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
Contributor

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 canonical inline # NOSONAR(githubactions:S7637) marker mechanism for first-party channel-pinned reusable-ref workflows, removing the need for per-repo sonar-project.properties files. It updates the compliance audit script, documentation, standard workflow templates, and adds corresponding BATS tests. The review feedback suggests avoiding a false positive in the compliance script when no channel-pinned stubs are present, and recommends using explicit return 0 instead of bare return statements in Bash functions to ensure robust exit code handling.

Comment thread scripts/compliance-audit.sh
Comment thread scripts/compliance-audit.sh Outdated
Comment thread scripts/compliance-audit.sh Outdated
Comment thread scripts/compliance-audit.sh Outdated
@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) June 27, 2026 17:35
@don-petry
don-petry disabled auto-merge June 27, 2026 17:35

@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: 2

🤖 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 `@test/scripts/compliance-audit/sonar-s7637-exemption.bats`:
- Around line 168-180: The drift-guard test currently uses a hardcoded template
list, so new shipped caller-stub workflows can slip through without coverage.
Update the `inline: every shipped channel-pinned caller-stub template is
present` test to iterate over `standards/workflows/*.yml` instead of enumerating
names manually, and keep using `classify_inline` to assert the result is never
`missing` while allowing `present` and `n/a` for non-stub workflows. This change
should be made in the Bats test around `classify_inline` so the guard
self-maintains as templates are added.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ca46aa93-9cb6-4be8-99c5-1c7389649e00

📥 Commits

Reviewing files that changed from the base of the PR and between 5aab2c2 and 0d04734.

📒 Files selected for processing (15)
  • scripts/compliance-audit.sh
  • standards/ci-standards.md
  • standards/workflows/add-to-project.yml
  • standards/workflows/agent-shield.yml
  • standards/workflows/auto-rebase.yml
  • standards/workflows/dependabot-automerge.yml
  • standards/workflows/dependabot-rebase.yml
  • standards/workflows/dependency-audit.yml
  • standards/workflows/dev-lead.yml
  • standards/workflows/idea-enhancer.yml
  • standards/workflows/idea-triage.yml
  • standards/workflows/initiative-planner.yml
  • standards/workflows/pr-auto-review.yml
  • standards/workflows/pr-review-mention.yml
  • test/scripts/compliance-audit/sonar-s7637-exemption.bats

Comment thread scripts/compliance-audit.sh
Comment thread test/scripts/compliance-audit/sonar-s7637-exemption.bats
@don-petry

Copy link
Copy Markdown
Contributor Author

@coderabbitai resolve

@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) June 27, 2026 17:39
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@don-petry
don-petry disabled auto-merge June 27, 2026 17:40
@don-petry

Copy link
Copy Markdown
Contributor Author

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

Changes committed and pushed.

…dling

Replace all bare `return` statements in compliance-audit.sh with explicit
`return 0` to ensure consistent and clear exit code handling across functions.
This is particularly important for check_sonar_s7637_exemption's early exit
when sonarcloud.yml is not present — now it correctly returns success (0)
instead of propagating the gh_api failure code.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 27, 2026
@don-petry

Copy link
Copy Markdown
Contributor Author

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

Changes committed and pushed.

@sonarqubecloud

Copy link
Copy Markdown

@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) June 27, 2026 17:50

@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: a68bc087ed3ffa12992ecb53a002cda9107262b7
Cascade: triage → deep (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5)

Summary

PR #549 adds an inline # NOSONAR(githubactions:S7637) exemption mechanism for first-party channel-pinned reusable-workflow caller stubs, reworking check_sonar_s7637_exemption in compliance-audit.sh, updating ci-standards.md, marking all caller-stub templates, and adding bats coverage. The triage escalation (Gemini's false-positive logic bug) is RESOLVED in the final commit: both missing finding sites are guarded by [ "$inline_missing" -eq 1 ], and since classify_inline_s7637_marker only sets inline_missing together with inline_seen, that guard is equivalent to Gemini's suggested inline_seen check at the legacy branch — a repo with no channel-pinned stubs is no longer flagged. No downstream consumers were reported (DOWNSTREAM_IMPACT=none).

Findings

  • INFO [correctness]: Verified RESOLVED: Gemini's flagged false positive (flagging repos with no channel-pinned first-party stubs as S7637-missing) does not occur in the final code. The legacy missing) and no-properties branches both gate add_finding on [ "$inline_missing" -eq 1 ]; classify_inline_s7637_marker only emits missing (setting inline_missing=1) alongside inline_seen=1, and the inline_seen=1/inline_missing=0 case returns early as exempt. So at the legacy branch inline_missing==inline_seen, making this guard equivalent to the suggested inline_seen guard. (scripts/compliance-audit.sh:948)
  • INFO [security]: The NOSONAR markers are narrowly scoped to first-party channel-pinned reusable-ref uses: lines only (regex anchored to petry-projects/.github(-private)?/.github/workflows/...@). SHA-pinned and third-party actions get no marker and remain S7637-enforced, consistent with the documented AGENTS.md mutable-ref exception. Not a new security regression; mirrors the prior sonar-project.properties exemption. SonarCloud, CodeQL, gitleaks, and ShellCheck all passed. (scripts/compliance-audit.sh)
  • INFO [tooling]: run_secret_scanning MCP tool was not available in this environment; skipped per instructions. The gitleaks CI secret-scan check passed (SUCCESS) on the head SHA.
  • MINOR [robustness]: In check_sonar_s7637_exemption, for wf in $workflows relies on unquoted word-splitting over gh_api-returned filenames. Workflow filenames don't contain whitespace in practice, so this is benign, but a while-read loop would be marginally more robust. Non-blocking. (scripts/compliance-audit.sh)

Reviewed by the PR-review cascade (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5). Reply if you need a human review.

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.

feat(ci-standards): adopt inline-NOSONAR S7637 exemption in caller-stub templates (org-wide; supersedes per-file approach) — spike-validated

2 participants