Skip to content

fix(auto-updater): fix arithmetic operation failure with set -e - #201

Merged
baleen37 merged 1 commit into
mainfrom
fix/auto-updater-set-e-arithmetic
Jan 27, 2026
Merged

fix(auto-updater): fix arithmetic operation failure with set -e#201
baleen37 merged 1 commit into
mainfrom
fix/auto-updater-set-e-arithmetic

Conversation

@baleen37

@baleen37 baleen37 commented Jan 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixed update-all-plugins.sh script failing after first plugin installation
  • Root cause: ((success_count++)) and ((failed_count++)) treated as failures under set -euo pipefail
  • Solution: Added || true to arithmetic operations to prevent premature exit

Test plan

  • Run update-all-plugins.sh script completes successfully
  • All 6 plugins install/update without premature exit
  • Summary section displays correct counts

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved plugin update reliability to avoid unexpected termination during execution, ensuring updates complete and report results consistently.
  • Tests

    • Added automated tests for the plugin update flow, verifying successful runs, exit status, and summary output for multiple plugins.

✏️ Tip: You can customize this high-level summary in your review settings.

@baleen37
baleen37 enabled auto-merge (squash) January 27, 2026 12:10
@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A small change prevents a bash script from exiting under set -euo pipefail when arithmetic increments fail, and a new Bats test file is added to verify script execution, strict-mode handling, and expected output summary.

Changes

Cohort / File(s) Summary
Script Error Handling
plugins/auto-updater/scripts/update-all-plugins.sh
Added fallback || true after ((success_count++)) and ((failed_count++)) to avoid termination on arithmetic errors under strict mode; core logic unchanged.
Test Coverage
tests/update-all-plugins.bats
New Bats test file added. Verifies script exists and is executable, exercises the script under set -e with mocked marketplace/curl/claude, asserts exit code 0 and output contains "Installing/updating", "Summary", and "Successfully installed/updated: 2 plugins".

Sequence Diagram(s)

(omitted — changes are small bug-fix + tests; no new multi-component control flow to visualize)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Counters once toppled in strict-mode's fierce stew,
A tiny || true hopped in, steady and true,
Tests danced around, mocking curl and the rest,
Now the updater runs calm, no more failing test,
A rabbit's small hop keeps the pipeline anew! 🐇

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing an arithmetic operation failure issue in the auto-updater script when using set -e.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

The script was failing after the first plugin installation due to
((success_count++)) and ((failed_count++)) arithmetic operations
being treated as failures under set -euo pipefail.

Added || true to these operations to prevent premature script exit.

Co-Authored-By: Claude <noreply@anthropic.com>
@baleen37
baleen37 force-pushed the fix/auto-updater-set-e-arithmetic branch from 6937902 to 66d2499 Compare January 27, 2026 12:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tests/update-all-plugins.bats`:
- Around line 37-40: The curl mock in tests/update-all-plugins.bats currently
ignores `-o` and just cats $mock_marketplace to stdout; change the mock curl
function to detect when `-o <file>` (or `--output <file>`) is passed and write
the contents of $mock_marketplace into that target file (fall back to stdout
when no output flag present), so update the inline curl() { ... } mock to parse
args and redirect the mock JSON into the requested output file while preserving
other flags/behavior.

Comment thread tests/update-all-plugins.bats Outdated
@baleen37
baleen37 merged commit 23988f1 into main Jan 27, 2026
1 check passed
@baleen37
baleen37 deleted the fix/auto-updater-set-e-arithmetic branch January 27, 2026 12:14
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