Repository navigation
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 8f67c72. Configure here.
|
|
||
| if !result.not_canceled.is_empty() { | ||
| anyhow::bail!("one or more orders could not be canceled"); | ||
| } |
There was a problem hiding this comment.
JSON cancel failure emits two documents
Medium Severity
print_cancel_result writes the cancellation payload and then returns an error. In JSON mode, print_error also writes an error object to stdout, so scripts receive two concatenated JSON documents instead of a single result or error object.
Reviewed by Cursor Bugbot for commit 8f67c72. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
not_canceledentriesProblem
Cancellation commands printed failed entries from the CLOB response but unconditionally returned success. Automation therefore received exit status 0 even when one or more orders remained open.
Approach
print_cancel_resultcontinues to render the full response first, then returns an error whennot_canceledis nonempty. All cancellation commands share this formatter, so the behavior applies consistently to single, batch, market, and cancel-all operations.Tests
cargo +1.91.1 fmt --checkcargo +1.91.1 clippy --locked --all-targets -- -D warningsgit diff --checkRisk
Low. Output remains available before the command returns an error; only the process success classification changes for responses that already report failed cancellations.
Fixes #91
Note
Low Risk
Only exit status changes when the response already included failed cancellations; output content and successful paths are unchanged.
Overview
CLOB cancel commands now exit with an error when the API reports any orders in
not_canceled. Table and JSON output are unchanged and still show the full partial result before the process fails.print_cancel_resultchecksnot_canceledafter rendering, so single, batch, market, and cancel-all flows that use this formatter get consistent non-zero exit codes for automation. Fully successful cancellations (emptynot_canceled) still return success.Unit tests cover partial failure and full success for both table and JSON output modes.
Reviewed by Cursor Bugbot for commit 8f67c72. Bugbot is set up for automated code reviews on this repo. Configure here.