refactor(shell): use [[ ]] for conditional tests in .github/scripts/** (S7688, part of #1462)

Merged
DO
7d ago
+210-143

User description

What

Split E of 5 of #1463, split by directory at the Maintainer's direction: .github/scripts/** (19 files). It is part of #1462, SonarCloud shell:S7688: use [[ instead of [.

The files are taken unchanged from #1463 head 3c6d334, which was level with main. 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.

SplitScope
Ascripts/canary-rollout.sh + tests/canary_rollout.bats
Bscripts/compliance-audit.sh
Cother top-level scripts/*.sh + their tests
Dscripts/lib/*.sh + their tests
E.github/scripts/**

#1462 stays open until all five merge.

Review focus

Inside [[ ]], -eq/-ne/-lt/-le/-gt/-ge evaluate both operands as arithmetic, which [ ] does not:

  • an empty or non-numeric operand now compares as 0 instead of failing the test;
  • a leading-zero value is read as octal (08 is an error, 010 is 8). #1463 added $((10#…)) normalisation and tests where it found config values;
  • a value from outside (API JSON, issue text, env input) that reaches such a comparison unvalidated is evaluated, and a string like a[$(cmd)] would run cmd.

Please check each numeric comparison in this diff whose operand is not a local counter or exit status.

Checks

  • Every changed file passes bash -n (bash 5) and is not a #!/bin/sh script.
  • shellcheck -x -S warning reports no new findings compared with main.
  • Related bats suites, run locally on this branch (GNU date, bash 5), with any failure re-run on main: add-to-project, feature-ideation, pr-auto-review and dependency-audit workflow suites β€” 483 ok, 10 failed; the same 10 (feature-ideation/collect-signals.bats 1, signals-schema.bats 9) fail identically on main locally, a macOS environment difference. CI on Linux is authoritative.

πŸ€– 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.


CodeAnt-AI Description

Handle zero-padded limits and retry settings in review sweeps

What Changed

  • PR sweep limits with leading zeros are now treated as decimal values, so values like 08 and 09 no longer fail or get misread.
  • Review dispatch accepts positive retry counts with leading zeros while still rejecting zero.

Impact

βœ… Zero-padded PR sweep limits work as intended
βœ… Padded retry counts no longer block review dispatch

πŸ’‘ 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.