Skip to content

chore: rename compliance workflow to "Org Standards Compliance Audit" - #264

Closed
don-petry wants to merge 3 commits into
mainfrom
rename/compliance-audit-workflow-name
Closed

chore: rename compliance workflow to "Org Standards Compliance Audit"#264
don-petry wants to merge 3 commits into
mainfrom
rename/compliance-audit-workflow-name

Conversation

@don-petry

Copy link
Copy Markdown
Contributor

Summary

  • Renames the workflow display name from Weekly Compliance & Health Audit to Org Standards Compliance Audit.
  • Filename and all internal job/step names are unchanged.

Test plan

  • CI passes

🤖 Generated with Claude Code

don-petry and others added 3 commits May 12, 2026 13:20
Passing a growing JSON array via `jq --argjson` exceeds the Linux kernel's
ARG_MAX limit (~2-3 MB) once enough PR data accumulates. The daily run hit
this at 252 PRs across 8 repos (exit code 126, "Argument list too long").

Switch both the PR and issues accumulation loops to the NDJSON pattern already
used in the Behind-Base Detection section: emit one compact JSON line per item
into a string variable, then slurp into an array once at the end with
`jq -cs '.'`. No PR/issue data ever passes through a command-line argument.

Regression test (8 repos × 35 PRs = 280 synthetic PRs):
- Old pattern: Argument list too long at repo 7/8
- New pattern: 280 PRs accumulated successfully

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…< style

Address Gemini review on PR #258:

- collect_classify_prs: replace --argjson page accumulation (all_nodes) with
  NDJSON pattern; protects against repos with many PR pages, not just large
  org totals.  Also switch echo | jq to <<< throughout the function.

- Merge activity: write ORG_MERGES/PERSONAL_MERGES to DATA_DIR/merges.json via
  printf (bash builtin, no exec, no ARG_MAX) so MERGE_DAILY and
  MERGE_BY_REPO_DAY read from a file descriptor instead of --argjson args.

- All remaining echo "$x" | jq and printf | jq replaced with <<< herestrings
  as suggested (more idiomatic, avoids echo flag interpretation edge case).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@don-petry
don-petry requested a review from a team as a code owner May 12, 2026 19:17
Copilot AI review requested due to automatic review settings May 12, 2026 19:17
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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: 42756718-7a4b-434a-a179-8378df824bd7

📥 Commits

Reviewing files that changed from the base of the PR and between 8558fa5 and 98ff8a7.

📒 Files selected for processing (2)
  • .github/workflows/compliance-audit-and-improvement.yml
  • scripts/org_status.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rename/compliance-audit-workflow-name

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 and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Contributor Author

Closing — branch was cut from the wrong base (included org_status.sh commits already merged via #258). Will reopen from main.

@don-petry don-petry closed this May 12, 2026
@don-petry
don-petry deleted the rename/compliance-audit-workflow-name branch May 12, 2026 19:18

@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 refactors scripts/org_status.sh to mitigate ARG_MAX limitations when processing large volumes of pull requests and issues. It replaces iterative JSON array concatenation with NDJSON accumulation and utilizes temporary files for merge data. Review feedback highlights potential $O(N^2)$ performance bottlenecks when appending to large shell variables and suggests redirecting command outputs directly to files to further reduce memory overhead and improve scalability.

Comment thread scripts/org_status.sh
Comment on lines +62 to +63
all_nodes_ndjson+=$(jq -c '.[]' <<< "$nodes")
all_nodes_ndjson+=$'\n'

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.

medium

Appending to a shell variable in a loop (e.g., all_nodes_ndjson+=$'\n') leads to $O(N^2)$ performance issues in Bash because strings are re-allocated as they grow. For an organization with hundreds or thousands of PRs, this will cause noticeable slowdowns and high memory consumption. Since a temporary directory is already initialized in $DATA_DIR, a more scalable approach is to append the NDJSON output directly to a file (e.g., >> "$DATA_DIR/nodes.ndjson") and then have the final jq command read from that file.

Comment thread scripts/org_status.sh
--argjson org "$ORG_MERGES" --argjson personal "$PERSONAL_MERGES" '
# Write merges to a temp file so subsequent jq calls read from a file descriptor
# rather than shell arguments — avoids the same ARG_MAX risk at high merge volumes.
printf '{"org":%s,"personal":%s}\n' "$ORG_MERGES" "$PERSONAL_MERGES" > "$DATA_DIR/merges.json"

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.

medium

While using printf to write to a file avoids the ARG_MAX limit for external commands, passing very large strings as arguments to the printf builtin still consumes significant memory and may hit shell-specific limits. A more robust approach for handling large datasets is to redirect the output of the gh commands directly to files (e.g., gh search ... > "$DATA_DIR/org_merges.json") and then use jq --slurpfile to process them, avoiding the use of large shell variables entirely.

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

Pull request overview

Updates org automation by renaming the compliance workflow’s display name, and refactors org_status.sh to avoid ARG_MAX failures by switching several JSON accumulations from “growing array in a shell variable” to NDJSON + jq -s (and using a temp JSON file for merge stats).

Changes:

  • Renamed workflow display name to Org Standards Compliance Audit.
  • Refactored PR/issue aggregation in scripts/org_status.sh to accumulate NDJSON and slurp with jq -s to avoid ARG_MAX.
  • Wrote merge search results to a temp JSON file and updated downstream jq calls to read from that file.

Reviewed changes

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

File Description
scripts/org_status.sh Refactors JSON aggregation strategy (NDJSON + slurp; temp file for merges) to avoid command-line size limits.
.github/workflows/compliance-audit-and-improvement.yml Renames the workflow display name shown in GitHub Actions UI.

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

Comment thread scripts/org_status.sh
Comment on lines +99 to +101
# Accumulate as NDJSON then slurp — avoids passing a growing $ALL_PRS as a
# shell argument to jq, which hits ARG_MAX once the org accumulates ~200+ PRs.
ALL_PR_NDJSON=""
Comment thread scripts/org_status.sh
# rather than shell arguments — avoids the same ARG_MAX risk at high merge volumes.
printf '{"org":%s,"personal":%s}\n' "$ORG_MERGES" "$PERSONAL_MERGES" > "$DATA_DIR/merges.json"

MERGE_DAILY=$(jq --arg since "$SINCE" --arg today "$TODAY" '
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.

2 participants