-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 Ordering, Query Parsing, and Type Annotation Refinements and Unification #8599
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
🎨 Ordering, Query Parsing, and Type Annotation Refinements and Unification #8599
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8599 +/- ##
==========================================
+ Coverage 87.13% 88.83% +1.70%
==========================================
Files 2012 1595 -417
Lines 79110 66285 -12825
Branches 1404 560 -844
==========================================
- Hits 68930 58884 -10046
+ Misses 9786 7254 -2532
+ Partials 394 147 -247
*This pull request uses carry forward flags. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🧪 CI InsightsHere's what we observed from your CI run for 200695f. ✅ Passed Jobs With Interesting Signals
|
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.
Pull Request Overview
This PR unifies ordering for listing operations in REST APIs, refines type annotation and documentation practices using annotated_types.doc(), and enhances code robustness and clarity through improved validation and utility functions.
- Introduces new ordering utilities (
OrderClause,OrderDirection,check_ordering_list) with comprehensive validation for duplicates and conflicts - Updates Python coding guidelines to require
annotated_types.doc()for documenting non-obvious parameters and returns - Refactors invitation models to use
Annotatedtypes with validators for improved type safety, including case-insensitive email handling
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/models-library/src/models_library/list_operations.py | New module defining ordering operations including OrderDirection, OrderClause, and check_ordering_list utility |
| packages/models-library/src/models_library/rest_ordering.py | Refactored to use new ordering utilities, added generic OrderingQueryParams for flexible multi-field ordering |
| packages/models-library/src/models_library/invitations.py | Updated to use Annotated types, added email lower-casing validator, replaced timezone.utc with UTC |
| packages/models-library/src/models_library/string_types.py | Added to_lower=True for case-insensitive string matching |
| packages/models-library/tests/test_list_operations.py | New tests for ordering validation, duplicate handling, and conflict detection |
| packages/models-library/tests/test_rest_ordering.py | Added tests for OrderingQueryParams parsing and validation |
| services/invitations/tests/unit/test_invitations.py | Added test verifying consecutive invitations have different timestamps |
| services/invitations/tests/unit/conftest.py | Updated to test case-insensitive email handling |
| services/web/server/src/simcore_service_webserver/users/_accounts_service.py | Refactored to use annotated_types.doc() for parameter documentation |
| services/web/server/src/simcore_service_webserver/login_accounts/_service.py | Fixed host URL formatting to strip trailing slashes |
| services/web/server/src/simcore_service_webserver/templates/common/request_account.jinja2 | Added PO center link to email template |
| services/web/server/tests/unit/with_dbs/03/test_users_rest_search.py | Updated test to verify case-insensitive email search |
| packages/notifications-library/src/notifications_library/templates/on_account_requested.email.content.* | Added PO center link and fixed HTML formatting |
| api/specs/web-server/_common.py | Improved assertion error message for default factories |
| .github/instructions/python.instructions.md | Added comprehensive guidelines for using annotated_types.doc() and documentation best practices |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bisgaard-itis
left a comment
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.
Very cool! Thanks a lot
e6ff38b to
200695f
Compare
|
@mergify queue |
🟠 Waiting for conditions to matchDetails
|
|
matusdrobuliak66
left a comment
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.
thanks



What do these changes do?
This PR unifies ordering for listing operations in rest APIs. It also refines type annotation and documentation practices, and enhances overall code robustness and clarity. These changes are used in a follow up PR but submitted them separately for clarity and to facilitate the review.
Here are some of details (AI generated):
Ordering and Query Parameter Improvements
OrderClause,OrderDirection, andcheck_ordering_listutilities inlist_operations.pyto support robust, type-safe ordering for API queries, including duplicate and conflict detection.rest_ordering.pyto use the new ordering utilities, introduced genericOrderingQueryParamsfor flexible multi-field ordering from query strings, and improved validation and parsing logic. [1] [2]Type Annotation and Documentation Enhancements
annotated_types.doc()for documenting non-obvious parameter and return types, with clear examples and conventions for concise docstrings.invitations.pymodels to useAnnotatedtypes and validators for improved clarity and type safety, including lower-casing of email fields and explicit handling of optional values. [1] [2] [3] [4]String Type Improvements
Miscellaneous Fixes and Enhancements
_common.pyfor assertion failures related to default factories.Related issue/s
How to test
Dev-ops