Skip to content

remove unreachable!(), improve panic messages, fix tautological test#139

Open
anaslimem wants to merge 1 commit intoagentclientprotocol:mainfrom
anaslimem:chore/code-quality-sweep
Open

remove unreachable!(), improve panic messages, fix tautological test#139
anaslimem wants to merge 1 commit intoagentclientprotocol:mainfrom
anaslimem:chore/code-quality-sweep

Conversation

@anaslimem
Copy link
Copy Markdown
Contributor

Summary

  • Remove unreachable!() from retry loop (mcp_bridge.rs): Refactored connect_with_retry to use a last_error accumulator, eliminating the unreachable!() macro and replacing it with a real error return. The logic is now self-evident without tracing the loop.
  • Improve mutex panic messages (trace-viewer/lib.rs): Changed four bare .unwrap() calls on Mutex::lock() to .expect("events mutex poisoned"). Same behaviour, but a crash now tells you exactly what failed instead of a generic Rust internal message.
  • Fix example placeholder string (simple_agent.rs): Replaced the "TODO" literal in the dispatch error handler with "unhandled message" a string safe to ship and accurate for users who copy this example.
  • assert!debug_assert! for internal invariant (conductor.rs): assert!(self.proxies.is_empty()) was firing in release builds. Changed to debug_assert! since this guards an internal precondition, not user input catches bugs in development without hard-crashing production.
  • Fix tautological test assertion (jsonrpc_error_handling.rs): assert!(result.is_ok() || result.is_err()) is always true and validates nothing. Replaced withassert!(result.is_ok(), ...) so when issue docs: add missing READMEs for sacp-tee, sacp-test, and yopo crates #64 is fixed and the #[ignore] is removed, the test actually guards the intended behaviour.

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