Repository navigation
Conversation
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
Problem
CLOB responses with
success: falsewere printed and then returned as command success. Trading automation could therefore treat rejected orders as accepted.Approach
Shared response validation now classifies unsuccessful single responses and aggregates batch failures only after output has been rendered. This covers create-order, market-order, and batch posting paths.
Tests
cargo +1.91.1 fmt --checkcargo +1.91.1 clippy --locked --all-targets -- -D warningsRisk
Low. Response output is unchanged; only process status changes when the server explicitly reports rejection.
Fixes #94
Note
Low Risk
Only CLI exit status changes when the server reports rejection; response printing and successful paths are unchanged.
Overview
CLOB create, market, and batch post commands now exit with failure when the API returns
success: false, instead of printing the rejection and still exiting 0.Shared helpers derive rejection text from
error_msg(with an unknown error fallback) and run after existing print helpers so stdout/JSON output is unchanged. Batch failures aggregate every rejected order into one message with singular/plural wording.Unit tests cover accepted/rejected single orders and full/partial batch rejections.
Reviewed by Cursor Bugbot for commit fc52679. Bugbot is set up for automated code reviews on this repo. Configure here.