Skip to content

test(bash): set the variable before calling check_version - #7839

Merged
viceice merged 1 commit into
mainfrom
viceice/test/check-version-temp-env
Oct 19, 2026
Merged

viceice merged 1 commit into
mainfrom
viceice/test/check-version-temp-env

Conversation

@viceice

@viceice viceice commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Changes

  • test/bash/util.bats: set the variable before calling check_version instead of assigning it only for the call
  • bash 5.3 (Ubuntu 26.04) drops a variable assigned only for a function call after the call, even when the function exports it; bash 5.2 kept it

Unblocks #7487 (runners on ubuntu-26.04), where only this test fails.

Context

Please select one of the following:

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Test fix and analysis with Claude Code (Claude Opus 5.5).

Use of AI in replying to PR comments

Who answers review comments:

  • @viceice will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted. Name the account.
  • An agent will draft replies and reply autonomously. This is heavily discouraged, and we prefer that there are humans in the loop
  • Nobody has explicitly committed to replying.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified tests

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated the version-check test to set its environment value in the test shell while retaining coverage for both version formats.

Co-Authored-By: Claude Opus 5.5 <michael.kriese+claude-code@mend.io>
@viceice
viceice enabled auto-merge October 19, 2026 14:22
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix check_version test for Bash 5.3 variable scoping

🐞 Bug fix 🧪 Tests 🕐 Less than 10 minutes

Grey Divider

AI Description

• Assign test variables before calling check_version so assertions work on Bash 5.3.
• Preserve coverage for plain and v-prefixed versions, unblocking Ubuntu 26.04 test runs.
Diagram

graph TD
  A["Bats test"] --> B["Assign FOO"] --> C["check_version"] --> D["Assert FOO"]
Loading
High-Level Assessment

Keep the change in the test: it avoids Bash-version-dependent temporary-assignment behavior without changing the deprecated production function or the cases being tested.

Files changed (1) +6 / -2

Tests (1) +6 / -2
util.batsSet FOO before both check_version calls +6/-2

Set FOO before both check_version calls

• Separates each FOO assignment from its check_version call so the subsequent assertion can read the variable on newer Bash versions. Retains the plain-version and v-prefix normalization checks.

test/bash/util.bats

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: containerbase/coderabbit/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2bdda78-f507-4207-a53e-cbb5291046f5
📥 Commits

Reviewing files that changed from the base of the PR and between 0bdde0e and 3469a91.

📒 Files selected for processing: 1
  • test/bash/util.bats
📝 Walkthrough

The check_version tests now assign each version value to FOO in the test shell before calling the function.

Changes: Version check tests

Layer / File(s) Summary
Set version values in test shell
test/bash/util.bats
The tests assign 1.2.3 and v1.2.3 to FOO before calling check_version.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 3469a

The change adjusts test setup while preserving the version-check assertions. No current merge-blocking risk is evident.

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 describes the main change: setting the variable before calling check_version in the Bash test.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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 functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ 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

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.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can import rules and skills only from the repositories your team follows

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@viceice
viceice added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit af5c227 Oct 19, 2026
59 checks passed
@viceice
viceice deleted the viceice/test/check-version-temp-env branch October 19, 2026 15:05
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 14.44.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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