Repository navigation
refactor(shell): use [[ ]] for conditional tests in scripts/compliance-audit.sh (S7688, part of #1462) - #1502
Conversation
This comment has been minimized.
This comment has been minimized.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #1502 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required check |
|
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-11-10T18:10:06Z. |
|
Acknowledged: the Codex review status table reports a failed run (usage limit) and lists no actual findings. No action needed. |
|
Acknowledged: Codex usage-limit notice, no finding and no code action required. |
|
Acknowledged: CodeRabbit reports no actionable comments, Merge Risk Minimal, and all 5 pre-merge checks passed. No finding-bearing section is present. |
|
Acknowledged: SonarCloud Quality Gate passed. No action needed. |
Dev-Lead — fix-reviews (no-changes)Agent reasoning |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 3e0536b34cba6ec1de8f179bb277130152215bd7
Review mode: triage-approved (single reviewer)
Summary
This PR changes [ ... ] to [[ ... ]] throughout scripts/compliance-audit.sh, with 194 lines added and 194 removed, as split B of 5 of the closed #1463 (SonarCloud shell:S7688). I read the whole diff. Every hunk is a bracket swap with the same operands and operators, and no logic, control flow or output text changes. I agree with the triage verdict: LOW risk, style-only.
Linked issue analysis
No closing issue is linked, and that is deliberate. The PR refers to #1462 ("#1462 stays open until all five merge"), so it should not auto-close it. Its scope matches its row in the description's split table: one file. I did not read #1462 itself because it was not in the pre-fed context.
Findings
No blocking findings.
What I checked: the risk the description asks reviewers to look at. Inside [[ ]], -eq/-ne/-lt/-gt evaluate both operands as arithmetic. I traced the operand of every numeric comparison in the diff:
- Exit codes and
PIPESTATUS:rc,list_rc,persona_rc,api_ok,match_rc,lint_rc. These are always integers. - Loop counters and local flags:
i/attempt(fromfor … in 1 2 3),broad,channel_seen,missing,inline_seen,inline_missing,$#,${#ECOSYSTEMS[@]}. - Counts from
grep -corjq length:total_findingsandcat_countcome fromjqover the script's own$FINDINGS_FILE. Inclose_resolved_issues, the empty case is checked before the numeric test. Thegrep -vx … | grep -c .count incheck_reusable_workflows_disabledis also always an integer.
No value from an API, an issue or the environment reaches an arithmetic comparison without first going through grep -c or jq length. The one operand I could not trace is $retries in gh_api, because its definition is outside the diff context. It is almost certainly a local constant, but I could not confirm that.
String comparisons: every right-hand side of = / != is either quoted or a bare literal with no glob characters (false, true). The newly pattern-matched right side of [[ == ]] therefore cannot change any result, including "**" and "$(ring_canonical_ref …)", which are quoted and so compared literally.
Non-blocking, existing before this PR: in check_workflow_permissions, job_count and has_job_perms use grep -cE … || echo "0". When nothing matches, grep -c prints 0 and exits 1, so the variable becomes 0\n0. Before this PR, [ "0\n0" -eq 0 ] errored and counted as false. Now [[ ]] reports an arithmetic syntax error and returns false. The result is the same, so this PR introduces no regression. The underlying bug is that a single-job workflow with no job-level permissions: is never flagged as missing permissions. Consider fixing it in a follow-up with $(grep -cE … || true).
Context I could not access: I had no MCP secret-scanning tool and no shell, so I did not run shellcheck or bats myself. I relied on the CI results below and the author's reported run (361 bats ok, no new shellcheck findings).
CI status
All checks completed, with no failures and no pending checks. These passed: Lint, ShellCheck, Compliance Audit Tests (Lint and bats), CodeQL (actions, python), SonarCloud and SonarCloud Code Analysis (Quality Gate passed, 0 new issues, 0 hotspots), Secret scan (gitleaks), Agent Security Scan, AgentShield, duplicate-decl-gate, dependency audit gate, CodeRabbit and Graphite. The remaining checks were skipped because they did not apply.
CodeRabbit approved at this SHA with no actionable comments. Codex failed because it hit its usage limit, so it produced no findings. There are no unresolved review threads and no unanswered questions from human reviewers. The merge state is BLOCKED only because the required org-leads review is still outstanding.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.
|
pr-review approved on PARTIAL advisory evidence: 2/5 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |
|
No description provided. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |



What
Split B of 5 of #1463, split by directory at the Maintainer's direction:
scripts/compliance-audit.sh(1 files). It is part of #1462, SonarCloudshell:S7688: use[[instead of[.The files are taken unchanged from #1463 head
3c6d334, which was level withmain. That PR's review rounds (CodeRabbit, Codex, pr-review) are already folded in. #1463 is closed in favour of these five smaller PRs, because a 68-file mechanical change kept drawing review rounds and never converged.scripts/canary-rollout.sh+tests/canary_rollout.batsscripts/compliance-audit.shscripts/*.sh+ their testsscripts/lib/*.sh+ their tests.github/scripts/**#1462 stays open until all five merge.
Review focus
Inside
[[ ]],-eq/-ne/-lt/-le/-gt/-geevaluate both operands as arithmetic, which[ ]does not:0instead of failing the test;08is an error,010is 8). feat: implement issue #1462 — SonarCloud: miscellaneous findings #1463 added$((10#…))normalisation and tests where it found config values;a[$(cmd)]would runcmd.Please check each numeric comparison in this diff whose operand is not a local counter or exit status.
Checks
bash -n(bash 5) and is not a#!/bin/shscript.shellcheck -x -S warningreports no new findings compared withmain.date, bash 5), with any failure re-run onmain: compliance-audit suites (27 files) — 361 ok, 0 failed.🤖 Generated with Claude Code
Problem
See the linked issue.
Risk
Low — changes automation shell logic under scripts/, covered by shellcheck (--severity=warning) and the bats suite.
Test plan
No test files were added or updated. Verification:
bash scripts/dev-lead-lint.sh(shellcheck --severity=warning) ran pre-commit; the existing CI (bats + lint) guards the change.Rollback
Revert this PR. No non-revertible side effects (no tags, migrations, or external state).
Monitoring
This PR's Lint (shellcheck) and bats checks show pass/fail; watch subsequent dev-lead / pr-review runs for behavioral regressions.