-
Notifications
You must be signed in to change notification settings - Fork 138
rfq: refactor and unify incoming quote handling with accept interface and tests #1913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rfq: refactor and unify incoming quote handling with accept interface and tests #1913
Conversation
Summary of ChangesHello @ffranr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the handling of incoming quote requests within the "rfq" package. By introducing a new "Accept" interface and consolidating the logic for both buy and sell quote requests into a single "HandleIncomingQuoteRequest" function, the codebase becomes more streamlined and maintainable. This change reduces code duplication and improves the overall design by promoting a more generic approach to message processing, while also extending test coverage for error scenarios. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the handling of incoming buy and sell quote requests by introducing a unified HandleIncomingQuoteRequest function in rfq/negotiator.go. This new function now accepts a generic rfqmsg.Request interface, replacing the previously separate HandleIncomingBuyRequest and HandleIncomingSellRequest functions. The rfq/manager.go file was updated to call this new generic handler. Additionally, the rfqmsg package was enhanced with a new Accept interface and a NewQuoteAcceptFromRequest factory function to create generic accept messages, with BuyAccept and SellAccept types now implementing this interface. Test files were updated to include a mockPortfolioPilot for the generic ResolveRequest and a new test case to verify error handling for both buy and sell requests within the unified HandleIncomingQuoteRequest. Review comments suggest improving code robustness by adding nil checks for the NewQuoteAcceptFromRequest return value, updating a test assertion to reflect a more generic error message, and enhancing documentation for exported functions and structs to clearly describe their purpose and behavior, particularly regarding potential nil returns and the new generic request handling.
cd9f527 to
9989c28
Compare
0c13d83 to
db6a57b
Compare
f23fc9f to
6169551
Compare
- Add `Accept` interface to define common behavior for quote accept messages. - Implement `acceptMarker` method in BuyAccept and SellAccept to satisfy the interface and keep implementations package-local.
Consolidate negotiator subservice methods HandleIncomingBuyRequest and HandleIncomingSellRequest into HandleIncomingQuoteRequest.
Add test cases for both buy and sell requests to validate rejection and error propagation logic.
db6a57b to
0a5fe6c
Compare
Pull Request Test Coverage Report for Build 20302069336Details
💛 - Coveralls |
Depends on #1913 (comment)
Acceptinterface with marker implementations for buy and sell accept messages (rfqmsg/accept.go,rfqmsg/buy_accept.go,rfqmsg/sell_accept.go).HandleIncomingQuoteRequestto replace separate buy/sell handlers (rfq/negotiator.go,rfq/manager.go).HandleIncomingQuoteRequestcoverage with buy/sell rejection and error propagation tests (rfq/negotiator_test.go).