Skip to content

fix: restore macOS Bash 3.2 compatibility (12106) - #212

Merged
howonlee merged 1 commit into
mainfrom
bugfix/12106-1
Oct 28, 2026
Merged

howonlee merged 1 commit into
mainfrom
bugfix/12106-1

Conversation

@howonlee

@howonlee howonlee commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Description

Restore startup on macOS's system Bash 3.2. The generated trust-helper template contained a case pattern with an unmatched closing parenthesis inside a heredoc command substitution. Bash 3.2 rejects the source while loading command handlers, so even git gtr --version exits with a syntax error.

Add the optional opening parenthesis to balance the pattern without changing its matches. Add a macOS CI job that uses system Bash to exercise both CLI entrypoints, generate shell integration, check its syntax, and source it.

Motivation

Tracks issue 12106. Preserve the documented Bash 3.2+ compatibility contract for macOS installations using /bin/bash.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature
  • Breaking change
  • Documentation update
  • Code refactoring
  • Other

Testing

  • Full bats tests/ suite: 605/605 passed. Git configuration and Fish config/data/cache directories were isolated under a temporary directory.
  • ShellCheck across binaries, libraries, commands, and adapters: passed.
  • ./scripts/generate-completions.sh --check and git diff --check: passed.
  • /bin/bash -n across all shipped Bash files: passed.
  • New macOS CI smoke commands reproduced locally using system Bash 3.2.57: passed.
  • Existing multiline trust-snapshot and repository-identity checks run under system Bash: 2/2 passed.
  • Disposable repository lifecycle under system Bash: creation, slash branches, paths with spaces, porcelain output, file copying, hooks, navigation, command execution, rename, dirty-removal refusal, bare creation, and removal passed.

Manual Testing Checklist

Tested on:

  • macOS (system Bash 3.2.57 and Homebrew Bash 5.3.9)
  • Linux (covered by existing CI)
  • Windows (Git Bash)

Core functionality tested:

  • git gtr new <branch>
  • git gtr go <branch>
  • Editor integration (unaffected)
  • AI integration (unaffected)
  • git gtr rm <branch>
  • git gtr list
  • Configuration used for copy patterns and hooks
  • Other: startup, init bash, run, copy, and mv

Test Steps

  1. On macOS, run /bin/bash bin/git-gtr --version on main at f5f3939: it exits 2 with a syntax error at lib/commands/init.sh:189.
  2. Run the same command on this branch: it prints version 2.11.1 and exits 0.
  3. Run the new workflow's system-Bash smoke steps and the existing automated checks.

Expected and actual behavior after the fix: CLI startup and generated Bash integration work with Bash 3.2.

Breaking Changes

  • This PR introduces breaking changes

Checklist

  • Read CONTRIBUTING.md and followed the project style
  • Performed manual testing on macOS
  • Reviewed documentation needs; no user-facing commands or configuration changed
  • Preserved Bash and Zsh template behavior; Linux remains covered by existing CI
  • No completion changes needed
  • Tested both git gtr and ./bin/gtr
  • No new external dependencies

Additional Context

The new CI check protects against a real startup failure that Ubuntu's newer Bash does not reproduce. No BATS tests were added or removed; existing trust-helper tests protect the template's behavior.

Agent handoff

Agent Thread Context Handoff

  • User Request (Exact Intent): “fix the compatibility bug under issue 12106”.
  • Business/Technical Goal: Restore the documented Bash 3.2 minimum and detect future macOS startup regressions in CI.
  • Current State: Main at f5f3939 fails during command-handler loading under Bash 3.2; Bash 5.3 starts successfully.
  • What Changed: lib/commands/init.sh balances the template's case pattern; .github/workflows/lint.yml adds a system-Bash macOS smoke job.
  • Key Decisions + Rationale: Use the shell's existing optional opening parenthesis to preserve pattern semantics. Keep the macOS CI check small and dependency-free.
  • Service Boundaries / External I/O: No runtime network, credential, persistence, or service-boundary changes. CI adds a GitHub-hosted macOS runner using the existing pinned checkout action.
  • Constraints / Guardrails: Preserve Bash 3.2+, trust validation semantics, and existing CI gates. Do not merge this PR.
  • Open Questions / Risks: macOS runner scheduling can delay CI. No known runtime behavior changes beyond restoring startup.
  • Next Concrete Steps: Monitor this PR's checks and CodeRabbit review using the required monitor, addressing findings on this branch.
  • Verification Status: All local checks passed, including all 605 BATS tests. Remote CI and CodeRabbit review must be confirmed before handoff.
  • Source of Truth Links: User-supplied issue identifier 12106; Bash compatibility requirement; main reproduction at f5f3939.

Quick-start For Next Agent

  • First command to run: git status --short --branch in /private/tmp/gtr-bash32-12106-1.
  • First files to open: lib/commands/init.sh and .github/workflows/lint.yml.
  • First pending task to execute: Run /Users/hleehowon/dev/scratch/codex-pr-monitor/wait-for-pr-review.mjs --repo coderabbitai/git-worktree-runner --pr <this-PR-number> if review is still pending.

Continuation Contract

  • Exact files and commands are provided; no Slack context is required.
  • No unresolved implementation blockers; pending validation is explicitly identified.
  • Confirmed local observations are distinguished from pending remote checks.

License Acknowledgment

This contribution is made under the Apache License 2.0.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with the system Bash available on macOS. CLI startup and Bash shell integration now work with older Bash versions, including Bash 3.2.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between f5f3939 and 6c32291.

Files selected for processing: 2
  • .github/workflows/lint.yml
  • lib/commands/init.sh

Included review availability: This review used your included allowance. Your plan provides up to 100 included reviews per hour; 79 remain after this review.

Walkthrough

The trust-helper template now balances a case pattern for Bash 3.2. A macOS workflow job uses system Bash to check both CLI entrypoints, generate Bash initialization, validate its syntax, and source it.

Changes

Bash 3.2 compatibility

Layer / File(s) Summary
Trust-helper pattern and system-Bash validation
lib/commands/init.sh, .github/workflows/lint.yml
The trust-helper template parenthesizes the birth-time rejection pattern without changing its rejected values. A macOS workflow job checks CLI version commands and generated Bash initialization with system Bash.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: helizaga, natoboram

Merge Risk: Minimal · up to 6c322

The compatibility fix and targeted macOS checks align with the documented Bash 3.2+ support contract, with no identified merge-blocking risk.

Architecture risk: Low · up to 6c322

The change affects 1 system.

Changed systems: lib

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — lib (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in lib/commands/init.sh: Added a comment noting the need to balance case patterns inside the substitution for Bash 3.2’s parser.
  • observed — Modified behavior in lib/commands/init.sh: Parenthesized the birth-time rejection pattern; the same values remain rejected: empty, zero, zero-prefixed with a period, or containing characters other than digits and periods.
  • observed — Modified behavior in .github/workflows/lint.yml: Adds a macOS Bash 3.2 compatibility job that checks out the repository without persisted credentials and runs CLI version checks, Bash initialization generation, syntax validation, and sourcing under the system Bash.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: restoring macOS Bash 3.2 compatibility.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checked the Bash case,
Then watched the startup run in place.
The shell syntax passed its test,
The CLI woke and did the rest.
Across the Mac, things hopped along.

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

@howonlee
howonlee merged commit 2d4852d into main Oct 28, 2026
5 checks passed
@howonlee
howonlee deleted the bugfix/12106-1 branch October 28, 2026 22:52
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.

1 participant