Bugfix?#189
Conversation
📝 WalkthroughWalkthroughThe PR refactors the ChangesTag Selection Refactoring
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
update_execution.sh (1)
59-74: Core fix is correct; same bug still exists inupdate_consensus.sh.The switch to
mapfile -t+"${_listTags[@]}"inselectcorrectly eliminates the word-splitting problem that caused the original26.5.0-RC1: command not founderror.sort -Vis the right algorithm for semantic version ordering (vs.sort -hrwhich is alphanumeric).However, the identical issue —
sort -hr, scalar string assignment, and unquoted$_listTagsinselect— remains inupdate_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
| 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) |
There was a problem hiding this comment.
_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.
| 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.
ERROR: ❌ Couldn't find the latest version tag
rggjan@ethnode:
$ _repo="hyperledger/besu"$ $(curl -fsSL https://api.github.com/repos/"${_repo}"/tags | jq -r '.[].name' | sort -hr)rggjan@ethnode:
26.5.0-RC1: command not found
Summary by CodeRabbit
Bug Fixes
Refactor