Skip to content

Support listing gridpool orders without price or quantity#182

Merged
cwasicki merged 2 commits into
frequenz-floss:v0.x.xfrom
cwasicki:odetail
Aug 20, 2025
Merged

Support listing gridpool orders without price or quantity#182
cwasicki merged 2 commits into
frequenz-floss:v0.x.xfrom
cwasicki:odetail

Conversation

@cwasicki
Copy link
Copy Markdown
Collaborator

When listing, gridpool orders that do not contain a price or quantity were previously considered invalid and raised an exception. Since this prevented listing any set of orders where at least one order was considered invalid, this has been changed and users have to validate orders themselves.

Copilot AI review requested due to automatic review settings August 15, 2025 12:20
@cwasicki cwasicki requested a review from a team as a code owner August 15, 2025 12:20
@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests labels Aug 15, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes validation that previously required gridpool orders to have valid price and quantity fields, allowing orders with missing or invalid price/quantity to be processed without raising exceptions. This change enables listing of order sets that contain some orders with missing data.

  • Removed validation logic that checked for missing price or quantity in non-canceled orders
  • Updated tests to reflect the new behavior where missing fields no longer raise exceptions
  • Added release notes documenting the breaking change

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/frequenz/client/electricity_trading/_types.py Removed validation logic and exception raising for orders with missing price/quantity
tests/test_types.py Updated tests to remove exception assertions and added comments explaining the behavior change
RELEASE_NOTES.md Added upgrade note about the behavior change requiring user validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/test_types.py Outdated
# Missing price
od_pb1 = electricity_trading_pb2.OrderDetail()
od_pb1.CopyFrom(ORDER_DETAIL_PB)
OrderDetail.from_pb(od_pb1)
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test calls OrderDetail.from_pb(od_pb1) before clearing the price field, but this call doesn't seem to serve any purpose in testing the missing price scenario. Consider removing line 558 or adding an assertion to clarify its intent.

Suggested change
OrderDetail.from_pb(od_pb1)
# Removed unnecessary call before clearing price

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fully agree on that but if @matthias-wende-frequenz prefers I am not insisting and can remove it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread tests/test_types.py Outdated
# Missing quantity (same logic as above)
od_pb2 = electricity_trading_pb2.OrderDetail()
od_pb2.CopyFrom(ORDER_DETAIL_PB)
OrderDetail.from_pb(od_pb2)
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the price test, this calls OrderDetail.from_pb(od_pb2) before clearing the quantity field without any apparent purpose. Consider removing line 567 or adding an assertion to clarify its intent.

Suggested change
OrderDetail.from_pb(od_pb2)
# Removed unnecessary call to OrderDetail.from_pb(od_pb2)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@matthias-wende-frequenz matthias-wende-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good apart from the two copilot comments

Copy link
Copy Markdown
Collaborator Author

@cwasicki cwasicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment thread tests/test_types.py Outdated
# Missing price
od_pb1 = electricity_trading_pb2.OrderDetail()
od_pb1.CopyFrom(ORDER_DETAIL_PB)
OrderDetail.from_pb(od_pb1)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

When listing, gridpool orders that do not contain a price or quantity
were previously considered invalid and raised an exception. Since this
prevented listing any set of orders where at least one order was
considered invalid, this has been changed and users have to validate
orders themselves.

Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
@cwasicki cwasicki added this pull request to the merge queue Aug 20, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 0af468b Aug 20, 2025
5 checks passed
@cwasicki cwasicki deleted the odetail branch August 20, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants