Repository navigation
Description
Summary
scripts/cut-standards-release.sh aborts mid-write on bash 3.2 (the macOS system bash), leaving the release channel in a partially-cut state: the immutable release tag is created, the moving channel tag is not.
Hit on the very first real use of the script — cutting standards/v1.0.0 on 2026-09-13.
Reproduction
$ bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin25)
$ bash scripts/cut-standards-release.sh cut v1.0.0 --commit 782e005f8359...
repo: petry-projects/.github
release: standards/v1.0.0 -> 782e005f8359
channel: standards/v1-stable -> 782e005f8359
decision: CREATE
creating immutable release standards/v1.0.0 at 782e005f8359...
moving channel standards/v1-stable onto 782e005f8359...
scripts/cut-standards-release.sh: line 275: ${out,,}: bad substitution
Cause
_gh_move_tag() (line ~275) lowercases the API error with ${out,,}:
out="$(gh api -X PATCH "repos/$repo/git/refs/tags/$tag" -f sha="$sha" -F force=true 2>&1)" && return 0
low="${out,,}" # <-- bash 4+ only${var,,} is a bash 4.0 case-modification expansion. On bash 3.2 it is a syntax error, and under set -euo pipefail the script dies immediately.
The expansion is only used for case-insensitive matching of a "not found" / 404 message to decide PATCH-vs-POST — so the failure happens on the create path, which is exactly the path a first-ever cut takes.
Why the partial state is the real problem
The script's stated contract is that cutting is "a scripted, idempotent, clobber-refusing operation instead of a one-off hand action". On bash 3.2 it is not atomic: it created standards/v1.0.0 and then died before creating standards/v1-stable. Observed state afterwards:
standards/v1.0.0 -> annotated tag -> 782e005f8359... (created)
standards/v1-stable -> 404 (missing)
An immutable release that consumers cannot reach through the channel they pin. And because the release tag is clobber-refusing by design, a naive re-run does not repair it — it correctly reports NOOP on the release while the channel stays absent.
In this instance the channel was completed manually via the same POST /git/refs call the script's own fallback performs, and the result verifies:
$ bash scripts/cut-standards-release.sh resolve
current: standards/v1.0.0 (channel standards/v1-stable)
Acceptance criteria
- Runs on bash 3.2. Replace
${out,,}with a portable lowercase (tr '[:upper:]' '[:lower:]') or a case-insensitive match, and sweep the file for other bash 4+ constructs (${x^^},declare -A,mapfile/readarray,&>>). - A failed channel move does not leave a published release stranded. Either the cut is ordered/recoverable so a re-run completes the channel (the current
NOOPpath should still ensure the channel is aligned, which the dry-run text already claims it does), or the failure is reported loudly enough that the operator knows a manual step remains. Silent partial success is the defect. - A regression test runs the script under bash 3.2 semantics, or CI lints for bash 4+ constructs in
scripts/**. This script is operator-run from a workstation, so "CI uses newer bash" is not sufficient coverage — macOS is the likely execution environment. - The existing published state is left intact.
standards/v1.0.0andstandards/v1-stableboth resolve to782e005f8359...today and must not be clobbered or re-pointed by the fix. - Idempotency is preserved and proven: re-running the cut at the same commit stays
NOOPon the release and still converges the channel.
Out of scope
- Changing the release/channel naming or the N-1 policy (fix(ci): fail the Agent Security Scan job at high severity #1448).
- Automating when a cut happens — a human still decides that.
Dev Notes
- Same portability class as the
sed -ianddate -u -dfindings raised on #1742 and elsewhere: GNU-only constructs in scripts that are actually run on macOS. Worth checking whetherscripts/lib/standards-release.sh(the pure core) has the same issue — the failure here was in the thin I/O glue, which is less well covered bytests/standards_release.bats. canary-rollout.shhas a sibling_gh_move_tag; check whether it carries the same construct, since it is the pattern this script mirrored.
Observed 2026-09-13 cutting the first standards release (#1091 / PR #1094).
Activity
don-petry commentedon Sep 13, 2026
Dev-Lead Implementation Plan
Issue: #1119 — [bug] cut-standards-release.sh dies on bash 3.2 (${out,,}) mid-cut — leaves release published with no channel tag
Scope
Make
scripts/cut-standards-release.shrun on bash 3.2 (the macOS system bash) by replacing the bash-4-only${out,,}case-modification expansion with a portable lowercase, and make a failed channel move surface loudly with a recovery hint so a first-ever cut can never silently strand a published release with no channel tag.Root cause
_gh_move_tag()lowercases the API error withlow="${out,,}"(bash 4.0 case-modification). On bash 3.2 this is a fatal "bad substitution"; underset -euo pipefailthe script dies after creating the immutablestandards/vX.Y.Zrelease but before movingstandards/v<major>-stable— a partial, non-atomic cut.Implementation Checklist
scripts/cut-standards-release.sh_gh_move_tag: replace${out,,}with a portable lowercase (tr '[:upper:]' '[:lower:]'); keep the same 404/not-found matching semantics (AC Addressing PR comments #1)scripts/cut-standards-release.sh_cmd_cut: on a failed channel move, emit a loud::error::naming the stranded release + channel and pointing to the NOOP-safe re-run that converges the channel; exit non-zero (AC Add multi-agent isolation strategy using git worktrees #2)scripts/cut-standards-release.shandscripts/lib/standards-release.shfor other bash 4+ constructs (${x^^},declare -A,mapfile/readarray,&>>) — none other than${out,,}found; confirm via the new regression testscripts/canary-rollout.shhas a sibling_gh_move_tagwith${out,,}, but that script already requires bash 4+ (extensivedeclare -A/mapfile) and is CI-run, not operator-run on macOS — out of scope for a bash 3.2 fix; documented in the reportTests to Write (tests/standards_release.bats)
cut-standards-release.sh+standards-release.shcontain no bash 4+ constructs (${,,}/${^^},declare -A,mapfile/readarray,&>>) — this is the red test (currently fails on${out,,}) and gives macOS/bash-3.2 coverage that "CI uses newer bash" cannot (AC Add coding standards & principles section to AGENTS.md #3)Existing state preserved
No git tags are created or re-pointed by this change (AC #4) — the fix is script portability + tests only;
standards/v1.0.0andstandards/v1-stableare untouched.Test Command
GH_TOKEN=dummy-token bats --print-output-on-failure tests/standards_release.batsandbash .dev-lead/scripts/dev-lead-lint.shdon-petry commentedon Sep 13, 2026
Dev-Lead: Progress (in progress — not yet durable)
Plan Execution (intended)
_gh_move_taglowercase expansion with a POSIXtrlowercase inscripts/cut-standards-release.sh, preserving the case-insensitive 404/not-found → POST-fallback semantics._cmd_cutfail loudly: it names the now-stranded release + channel and points to the NOOP-safe re-run that converges the channel (never re-creating/clobbering the release).scripts/cut-standards-release.shandscripts/lib/standards-release.shfor other bash 4+ constructs (${x^^}/${x,,},declare -A/local -A,mapfile/readarray,&>>) — the only one present was the reported${out,,}; the pure core was already clean.Notes on scope
scripts/canary-rollout.shhas a sibling_gh_move_tagwith the same${out,,}construct (per the issue Dev Notes). Left unchanged intentionally: that script already requires bash 4+ (extensivedeclare -Aandmapfile) and is CI-run, not operator-run on macOS — a one-line${out,,}fix would not make it bash-3.2-safe and a full port is out of scope for [bug] cut-standards-release.sh dies on bash 3.2 (${out,,}) mid-cut — leaves release published with no channel tag #1119.standards/v1.0.0andstandards/v1-stableare untouched; the change is script portability + tests only.Local check output (provisional — NOT the pushed run)
The durable record (PR + head SHA) follows the push.
don-petry commentedon Sep 13, 2026
Dev-Lead: Implementation Complete — PR #1127
The implementation for issue #1119 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.
8d10a07ba797e5a255c1be46aef1e8868bd91ec2Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.
feat: implement issue #1119 — [bug] cut-standards-release.sh dies on …