Skip to content

fix(workflows): address CodeRabbit suggestions deferred from #87#93

Merged
don-petry merged 2 commits intomainfrom
fix/coderabbit-followups-from-87
Apr 8, 2026
Merged

fix(workflows): address CodeRabbit suggestions deferred from #87#93
don-petry merged 2 commits intomainfrom
fix/coderabbit-followups-from-87

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

Closes #90.

Four small behavioral fixes to the centralized reusable workflows that CodeRabbit raised on #87 and I deferred to avoid expanding scope. Each is independent.

1. agent-shield-reusable.yml — SKILL.md frontmatter regex

Allow optional leading whitespace so indented YAML keys (e.g. under a metadata: parent) are recognised. Was: ^name: / ^description:. Now: ^[[:space:]]*name: / ^[[:space:]]*description:.

2. dependabot-rebase-reusable.yml — vacuous-truth merge gate

The previous jq | all(...) returned true on an empty status-check rollup, so a PR with no checks at all would be treated as "all green" and auto-merged. New gate also requires at least one COMPLETED check. Also collapsed three gh pr view calls into one round-trip.

3. dependency-audit-reusable.yml — cargo workspace dedup

Find workspace roots (Cargo.toml containing [workspace]) and audit each once, then audit standalone crates whose directory is not under any workspace root. For a workspace with N members, this is 1 audit instead of N+1.

4. dependency-audit-reusable.yml — pip-audit pyproject + requirements

Audit both pyproject.toml and requirements.txt when both exist in a directory. Previous elif made the requirements.txt branch unreachable when pyproject was present, but some projects ship pyproject for tooling and requirements.txt for pinned runtime deps.

Test plan

  • actionlint clean
  • CI on this branch
  • After merge: bump v1 tag

🤖 Generated with Claude Code

Closes #90.

1) agent-shield-reusable.yml — SKILL.md frontmatter regex now allows
   optional leading whitespace (`^[[:space:]]*name:` /
   `^[[:space:]]*description:`), so indented YAML keys (e.g. under a
   `metadata:` parent) are recognised as present. Previously the strict
   column-zero anchor missed them.

2) dependabot-rebase-reusable.yml — fix vacuous-truth merge gate.
   `[].statusCheckRollup[]? | ... | all(...)` returns true on an empty
   list (logical convention), which made a PR with no status checks
   appear "all green" and trigger an auto-merge. New gate also requires
   at least one COMPLETED check before merging, in addition to the
   existing all-pass and zero-pending requirements. Also collapses the
   three `gh pr view` calls into one round-trip via a shared $ROLLUP.

3) dependency-audit-reusable.yml — cargo audit no longer re-runs per
   workspace member. The new logic finds workspace roots (Cargo.toml
   files containing `[workspace]`) and audits them once each, then
   audits standalone crates whose dir is not under any workspace root.
   For a workspace with N members, that's 1 audit instead of N+1.

4) dependency-audit-reusable.yml — pip-audit now audits both
   pyproject.toml AND requirements.txt when both exist in the same
   directory (some projects ship pyproject for tooling and
   requirements.txt for pinned runtime deps). Previously the elif
   branch made requirements.txt unreachable.

All four were originally raised by CodeRabbit on #87
and intentionally deferred to keep that PR no-behavior-change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 8, 2026 16:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies four deferred behavioral fixes to the org’s centralized reusable workflows to improve correctness and reduce unnecessary work in downstream repos.

Changes:

  • Improve SKILL.md frontmatter validation to recognize indented YAML keys in agent-shield-reusable.yml.
  • Fix Dependabot “merge-ready” gating to avoid vacuous-truth on empty status checks and reduce gh pr view calls.
  • Optimize dependency-audit-reusable.yml by deduplicating Cargo workspace audits and auditing both pyproject.toml and requirements.txt when both exist.

Reviewed changes

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

File Description
.github/workflows/dependency-audit-reusable.yml Dedup Cargo audits at workspace roots; audit both pyproject and requirements when present.
.github/workflows/dependabot-rebase-reusable.yml Require at least one completed check before treating rollup as passing; consolidate gh pr view calls.
.github/workflows/agent-shield-reusable.yml Relax frontmatter key matching to allow leading whitespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


for dir in "${WORKSPACES[@]}" "${STANDALONE[@]}"; do
echo "::group::cargo audit $dir"
if ! (cd "$dir" && cargo generate-lockfile 2>/dev/null; cargo audit); then
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

In the cargo audit subshell, cargo audit is separated by ; so it will run even if cd "$dir" fails (and also regardless of cargo generate-lockfile success). This can cause auditing the wrong directory. Chain commands so cargo audit only runs after a successful cd (and decide whether a lockfile generation failure should be fatal or explicitly ignored).

Suggested change
if ! (cd "$dir" && cargo generate-lockfile 2>/dev/null; cargo audit); then
if ! (cd "$dir" && { cargo generate-lockfile 2>/dev/null || true; } && cargo audit); then

Copilot uses AI. Check for mistakes.
Comment on lines +180 to +191
mapfile -t WORKSPACES < <(
find . -name Cargo.toml -not -path '*/target/*' -print0 \
| xargs -0 grep -l '^\[workspace\]' 2>/dev/null \
| xargs -n1 dirname 2>/dev/null \
| sort -u
)

mapfile -t NON_WORKSPACES < <(
find . -name Cargo.toml -not -path '*/target/*' -print0 \
| xargs -0 grep -L '^\[workspace\]' 2>/dev/null \
| xargs -n1 dirname 2>/dev/null \
| sort -u
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The workspace discovery pipelines convert NUL-delimited find -print0 output into newline/whitespace-delimited paths before dirname (via grep then xargs -n1 dirname). That will mis-handle Cargo.toml paths containing spaces/tabs/newlines. Consider keeping NUL delimiters end-to-end (e.g., grep -Z + xargs -0) or using find ... -exec sh -c ... to emit workspace/dir names without whitespace splitting.

Suggested change
mapfile -t WORKSPACES < <(
find . -name Cargo.toml -not -path '*/target/*' -print0 \
| xargs -0 grep -l '^\[workspace\]' 2>/dev/null \
| xargs -n1 dirname 2>/dev/null \
| sort -u
)
mapfile -t NON_WORKSPACES < <(
find . -name Cargo.toml -not -path '*/target/*' -print0 \
| xargs -0 grep -L '^\[workspace\]' 2>/dev/null \
| xargs -n1 dirname 2>/dev/null \
| sort -u
mapfile -d '' -t WORKSPACES < <(
find . -name Cargo.toml -not -path '*/target/*' -print0 \
| xargs -0 grep -Z -l '^\[workspace\]' 2>/dev/null \
| xargs -0 -n1 dirname -z 2>/dev/null \
| sort -zu
)
mapfile -d '' -t NON_WORKSPACES < <(
find . -name Cargo.toml -not -path '*/target/*' -print0 \
| xargs -0 grep -Z -L '^\[workspace\]' 2>/dev/null \
| xargs -0 -n1 dirname -z 2>/dev/null \
| sort -zu

Copilot uses AI. Check for mistakes.
…stub

The canonical stub had three spaces aligning the comment after the cron
expression. Repos that run prettier in their lint chain (e.g.
google-app-scripts) hit a `prettier --check` failure on every fresh
adoption — see petry-projects/google-app-scripts#151. Bringing the
template in line with prettier defaults so future adopters don't drift.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 43 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 43 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2ef4e7c4-748b-48d1-b691-da3190471e67

📥 Commits

Reviewing files that changed from the base of the PR and between 67cb057 and 5f457cd.

📒 Files selected for processing (4)
  • .github/workflows/agent-shield-reusable.yml
  • .github/workflows/dependabot-rebase-reusable.yml
  • .github/workflows/dependency-audit-reusable.yml
  • standards/workflows/feature-ideation.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/coderabbit-followups-from-87

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@don-petry don-petry merged commit 4964c4e into main Apr 8, 2026
18 checks passed
@don-petry don-petry deleted the fix/coderabbit-followups-from-87 branch April 8, 2026 17:08
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.

follow-up: address CodeRabbit suggestions deferred from #87

2 participants