Conversation
There was a problem hiding this comment.
Review of PR #1092: Return an error when CbfNode is started twice
Suggestions for Improvement
- Add Swift Binding Test
Currently only Android/Kotlin tests the generated exception. Consider adding equivalent Swift test coverage to ensure consistency across all bindings.
- Documentation: Recovery Strategies
Add guidance in docstring about error handling patterns for users. Include examples of how to handle the error gracefully.
- Consider Adding State Inspection Method
To help consumers avoid race conditions, consider adding (as a follow-up):
pub fn is_running(&self) -> bool {
self.node.lock().unwrap().is_none()
}- Changelog Label
The PR description mentions 'Please apply changelog: breaking' but notes the label wasn't added. Ensure this is applied before merge - this is required.
- Comment in Concurrent Test
The concurrent_run_calls_allow_one_caller test is excellent but could use inline comments explaining the barrier pattern for clarity.
fe24089 to
8f2496a
Compare
|
@henrypeters Thanks for the review. I checked each suggestion against the current API:
The branch is now rebased onto current @thunderbiscuit, could you apply |
Description
Closes #1084.
Changes the exported
CbfNode::run()method to returnResult<(), CbfError>and adds the binding-visibleNodeAlreadyStartederror. The first caller starts the node; later or racing callers receive the typed error instead of silently succeeding.Regression coverage exercises consumed, sequential, and concurrent calls in Rust. The Android binding test also verifies the generated
CbfException.NodeAlreadyStartedexception.Notes to the reviewers
This intentionally covers only duplicate lifecycle calls. Reporting Tokio runtime construction or Kyoto node-exit failures remains tracked separately in #1089.
Binding verification completed with Kotlin generation plus
:lib:compileDebugAndroidTestKotlin, and Swift generation plusswift test.Documentation
Changelog
Breaking API change:
CbfNode.run()now throws/returns an error. Please applychangelog: breaking.Checklists
All Submissions:
cargo fmtandcargo clippybefore committingchangelog:*labelBugfixes: