Skip to content

Bugfix?#189

Open
rggjan wants to merge 1 commit into
coincashew:mainfrom
rggjan:patch-1
Open

Bugfix?#189
rggjan wants to merge 1 commit into
coincashew:mainfrom
rggjan:patch-1

Conversation

@rggjan
Copy link
Copy Markdown

@rggjan rggjan commented May 4, 2026

ERROR: ❌ Couldn't find the latest version tag
rggjan@ethnode:$ _repo="hyperledger/besu"
rggjan@ethnode:
$ $(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -hr)
26.5.0-RC1: command not found

Summary by CodeRabbit

  • Bug Fixes

    • Improved error detection when GitHub release tags are unavailable.
  • Refactor

    • Enhanced version sorting and tag selection process for improved reliability and consistency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

📝 Walkthrough

Walkthrough

The PR refactors the selectCustomTag function to use indexed Bash arrays via mapfile instead of space-delimited strings, implements semantic version sorting with sort -V and tac for reversal, and adds explicit error handling when no tags are retrieved before prompting user selection.

Changes

Tag Selection Refactoring

Layer / File(s) Summary
Data Structure & Parsing
update_execution.sh
GitHub release tags are now captured into an indexed array using mapfile instead of a space-delimited string, enabling proper array iteration.
Version Sorting & Validation
update_execution.sh
Tags are sorted semantically via sort -V and reversed with tac. An explicit guard check [ -z "${_listTags[0]}" ] now fails fast if no tags were retrieved.
Selection Loop
update_execution.sh
The select statement now iterates over the array using "${_listTags[@]}" expansion instead of an unquoted variable, ensuring proper handling of tag names with spaces or special characters.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hop hop, the tags now array—no string-splitting fray!
With mapfile and sort -V, versions fall into place with glee.
A guard check keeps the errors at bay,
Select loops proudly expand their array!
Better bash awaits, hip-hip hooray! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Bugfix?' is vague and non-descriptive, using only a generic term without conveying what aspect of the changeset is being fixed. Replace with a specific, descriptive title that captures the main fix, such as 'Fix tag retrieval and sorting in selectCustomTag function' or 'Refactor selectCustomTag to safely handle GitHub API response processing'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
update_execution.sh (1)

59-74: Core fix is correct; same bug still exists in update_consensus.sh.

The switch to mapfile -t + "${_listTags[@]}" in select correctly eliminates the word-splitting problem that caused the original 26.5.0-RC1: command not found error. sort -V is the right algorithm for semantic version ordering (vs. sort -hr which is alphanumeric).

However, the identical issue — sort -hr, scalar string assignment, and unquoted $_listTags in select — remains in update_consensus.sh (lines 43–54), which covers all consensus clients (Lighthouse, Lodestar, Teku, Nimbus, Prysm). The same fix should be applied there.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@update_execution.sh` around lines 59 - 74, In update_consensus.sh apply the
same fix used in update_execution.sh: produce the tag list with mapfile -t (e.g.
mapfile -t _listTags < <(curl -fsSL "https://api.github.com/repos/${_repo}/tags"
| jq -r '.[].name' | sort -V | tac)), test emptiness with [ -z "${_listTags[0]}"
], and use the array form in the select loop (select _tag in "${_listTags[@]}";
do ...) so you avoid word-splitting and replace the old sort -hr, scalar string
assignment, and unquoted $_listTags usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@update_execution.sh`:
- Around line 59-61: The _listTags array is accidentally global because only
_tag is declared local; make _listTags local (as an array) before the mapfile
call so it doesn't leak scope. Update the selectCustomTag function to declare
local -a _listTags (and keep local _tag) prior to the mapfile -t _listTags <
<(... ) invocation so the array is confined to the function.

---

Nitpick comments:
In `@update_execution.sh`:
- Around line 59-74: In update_consensus.sh apply the same fix used in
update_execution.sh: produce the tag list with mapfile -t (e.g. mapfile -t
_listTags < <(curl -fsSL "https://api.github.com/repos/${_repo}/tags" | jq -r
'.[].name' | sort -V | tac)), test emptiness with [ -z "${_listTags[0]}" ], and
use the array form in the select loop (select _tag in "${_listTags[@]}"; do ...)
so you avoid word-splitting and replace the old sort -hr, scalar string
assignment, and unquoted $_listTags usage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23e2e92f-02b7-40ed-9b37-427cd6bfad47

📥 Commits

Reviewing files that changed from the base of the PR and between 08ab3c2 and 5f11827.

📒 Files selected for processing (1)
  • update_execution.sh

Comment thread update_execution.sh
Comment on lines +59 to +61
local _tag
# Create array from tags, using mapfile for proper handling
mapfile -t _listTags < <(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -V | tac)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

_listTags leaks to global scope — add local -a _listTags.

The original code had local _listTags _tag together. The new code only declares local _tag, so mapfile writes _listTags into the global scope. Any code that runs after selectCustomTag returns will see a stale _listTags array. Fix by declaring it local before the mapfile call:

🛠️ Proposed fix
-	local _tag
-	# Create array from tags, using mapfile for proper handling
-	mapfile -t _listTags < <(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -V | tac)
+	local _tag
+	local -a _listTags
+	# Create array from tags, using mapfile for proper handling
+	mapfile -t _listTags < <(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -V | tac)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
local _tag
# Create array from tags, using mapfile for proper handling
mapfile -t _listTags < <(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -V | tac)
local _tag
local -a _listTags
# Create array from tags, using mapfile for proper handling
mapfile -t _listTags < <(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -V | tac)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@update_execution.sh` around lines 59 - 61, The _listTags array is
accidentally global because only _tag is declared local; make _listTags local
(as an array) before the mapfile call so it doesn't leak scope. Update the
selectCustomTag function to declare local -a _listTags (and keep local _tag)
prior to the mapfile -t _listTags < <(... ) invocation so the array is confined
to the function.

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