Guard load_repo_tools Against an Empty install.linux Set (#916) - #917
Conversation
A host-tools.json with tools but zero install.linux entries makes the jq filter in load_repo_tools produce an empty rows string. The here-string <<< "$rows" still feeds the while read loop one line (a here-string always appends a trailing newline), so the loop ran once with name/manager/package all empty and died on the non-empty-tool-name check even though the declaration was valid and simply had nothing to add. Return early when rows is empty, before entering the loop. Fixes #916 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthrough
ChangesLinux tool loading
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This change makes an empty Linux tool set a no-op while preserving the existing path for declared tools; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
PR Summary by QodoGuard repo tool loading when install.linux yields no rows
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab) |
Summary
host-setup/linux/install-tools.sh --repo PATHdied on ahost-tools.jsonthat declarestools but zero
install.linuxentries, instead of treating "nothing to add" as a no-op.Root cause
In
load_repo_tools(), when no.tools[]entry has.install.linux, thejqfilterproduces no output, so
rowsis the empty string.<<< "$rows"still feeds thewhile readloop one line (a here-string always appends a trailing newline, even foran empty string), so the loop ran once with
name/manager/packageall empty andimmediately died on the "non-empty tool name" check — even though the declaration was
otherwise valid and simply had nothing to add.
Fix
Guard the loop on an empty
$rowsbefore entering it, per the issue's suggested fix.Testing
host-tools.jsonwith a realinstall.linuxentry)still works.
python3 -m unittest scripts.tests.test_host_gate— 83 tests pass.scripts/repo_gate.pyandscripts/prose_lint.py— clean.Fixes #916
🤖 Generated with Claude Code
Summary by CodeRabbit