Skip to content

Add bid validation module with EUPHEMIA compliance checks#7

Merged
tommed merged 3 commits into
mainfrom
feat/add-bids-module
Mar 13, 2026
Merged

Add bid validation module with EUPHEMIA compliance checks#7
tommed merged 3 commits into
mainfrom
feat/add-bids-module

Conversation

@tommed

@tommed tommed commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds validation.py with comprehensive EUPHEMIA-compliance checks, data quality validation, temporal constraint enforcement, and portfolio-level sanity checks
  • Exports all validation functions and exception types (ValidationError, EuphemiaValidationError, DataQualityError, TemporalValidationError, PortfolioValidationError) from the top-level package
  • Documents validation usage with examples in the README

Test plan

  • 248 tests pass (make test)
  • 97% overall code coverage (validation module at 95%)
  • mypy src — no issues
  • ruff check src tests — all checks passed

🤖 Generated with Claude Code

Adds a comprehensive validation layer covering EUPHEMIA rules (max curve
steps, block duration limits), data quality (minimum volumes, price
increments), temporal constraints (gate closure, delivery periods), and
portfolio-level sanity checks.

Exports all validation functions and exception types from the top-level
package and documents usage in the README.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Mar 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tommed

tommed commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

@claude can you improve the code coverage for the 7 lines missing in validation.py?

@claude

claude Bot commented Mar 13, 2026

Copy link
Copy Markdown

Claude finished @tommed's task in 5m 14s —— View job


Improving code coverage for validation.py

  • Read validation.py and test_validation.py to identify uncovered lines
  • Add tests to cover the 7 missing lines:
    • Line 154: return in validate_price_step_increments for single-step curve → test_validate_price_step_increments_single_step_passes
    • Line 312: raise ValueError in validate_delivery_within_day for naive auction_daytest_validate_delivery_within_day_requires_timezone_aware_auction_day
    • Line 338: raise ValueError in validate_mtu_within_day for naive auction_daytest_validate_mtu_within_day_requires_timezone_aware_auction_day
    • Line 436: return in validate_exclusive_group_volumes for < 2 bids → test_validate_exclusive_group_volumes_single_bid_skips_check (uses model_construct to bypass the Pydantic validator that normally prevents < 2 bids)
    • Line 488: validate_linked_block_bid(bid) in validate_bidtest_validate_bid_dispatches_linked_block_bid
    • Line 490: validate_exclusive_group_bid(bid) in validate_bidtest_validate_bid_dispatches_exclusive_group_bid
    • Line 564: submission_time = datetime.now(UTC)test_validate_order_book_for_submission_defaults_submission_time
  • Commit and push changes

7 new tests added in tests/test_validation.py (+101 lines). The changes are pushed to the branch and CI should confirm 100% line coverage for validation.py.
|

github-actions Bot and others added 2 commits March 13, 2026 19:38
- validate_price_step_increments: single-step curve early return
- validate_delivery_within_day: naive auction_day raises ValueError
- validate_mtu_within_day: naive auction_day raises ValueError
- validate_exclusive_group_volumes: single-bid group early return (via model_construct)
- validate_bid: dispatch to validate_linked_block_bid
- validate_bid: dispatch to validate_exclusive_group_bid
- validate_order_book_for_submission: defaults submission_time to datetime.now(UTC)

Co-authored-by: Tom Medhurst <tommed@users.noreply.github.com>
@tommed tommed merged commit 741babc into main Mar 13, 2026
3 checks passed
@tommed tommed deleted the feat/add-bids-module branch March 13, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant