Skip to content

fix: Replace .expect() panics with error propagation#107

Merged
2witstudios merged 1 commit intomainfrom
pu/improve-2
Mar 8, 2026
Merged

fix: Replace .expect() panics with error propagation#107
2witstudios merged 1 commit intomainfrom
pu/improve-2

Conversation

@2witstudios
Copy link
Owner

Summary

  • Changed print_response() from returning () to Result<(), CliError>, replacing .expect() calls with ? operator
  • Fixed 4 .expect() panic sites in output.rs, prompt.rs, and grid.rs that could crash the CLI on JSON serialization failure
  • Updated all 25+ callers across 14 command files to propagate errors through the existing CliError::Json variant

Test plan

  • cargo build — clean compilation
  • cargo test — all 312 tests pass (70 CLI + 231 core + 11 engine)
  • cargo clippy --all-targets — zero warnings
  • cargo fmt --all — formatting verified

🤖 Generated with Claude Code

print_response() and several command handlers used .expect() for JSON
serialization, which would panic on failure. Changed print_response()
to return Result<(), CliError> and replaced all .expect() calls with ?
operator, leveraging the existing CliError::Json variant for proper
error propagation through the call chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2026

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f14b03f-daf2-47d5-8573-677bfd270e86

📥 Commits

Reviewing files that changed from the base of the PR and between 55aa882 and 534fe75.

📒 Files selected for processing (14)
  • crates/pu-cli/src/commands/agent_def.rs
  • crates/pu-cli/src/commands/attach.rs
  • crates/pu-cli/src/commands/clean.rs
  • crates/pu-cli/src/commands/diff.rs
  • crates/pu-cli/src/commands/grid.rs
  • crates/pu-cli/src/commands/health.rs
  • crates/pu-cli/src/commands/kill.rs
  • crates/pu-cli/src/commands/logs.rs
  • crates/pu-cli/src/commands/prompt.rs
  • crates/pu-cli/src/commands/schedule.rs
  • crates/pu-cli/src/commands/spawn.rs
  • crates/pu-cli/src/commands/status.rs
  • crates/pu-cli/src/commands/swarm.rs
  • crates/pu-cli/src/output.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pu/improve-2

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.

@2witstudios
Copy link
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@2witstudios 2witstudios merged commit 7ce5206 into main Mar 8, 2026
5 checks passed
@2witstudios 2witstudios deleted the pu/improve-2 branch March 8, 2026 20:45
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