Skip to content

Conversation

@pcrespov
Copy link
Member

@pcrespov pcrespov commented May 23, 2025

What do these changes do?

  • 🐛 Fixes
    • wrong pagination setup in GET /solvers/pages (and other endpoints)
    • validation error in rpc client (that responded with status code 500) due to lack of alignment of pagination limits between APIs. PageLimitInt upper limit was set strictly
      image
  • ♻️ Refactoring pagination arguments
    • Used optional None pagination arguments to delegate the size of the page (i.e. limit) to the default downstream
    • unified notation and type annotation
  • 📝 Documentation
    • Added SERVICES.md shows info on openapi for each service using swagger/redoc badges image

Related issue/s

How to test

cd services/api-server
make install-dev
pytest tests/unit -k test_solvers_page_pagination_links

Dev-ops

@pcrespov pcrespov added this to the Bazinga! milestone May 23, 2025
@pcrespov pcrespov self-assigned this May 23, 2025
@pcrespov pcrespov added the a:apiserver api-server service label May 23, 2025
@pcrespov pcrespov marked this pull request as ready for review May 23, 2025 13:00
Copy link
Contributor

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 fixes the pagination logic in the GET /solvers/pages endpoint and updates the SERVICES.md documentation with auto‐generated service badge information.

  • Fixes wrong pagination by enforcing that page parameters match the expected metadata and using the correct total count.
  • Updates SERVICES.md to include auto-generated badges and links for the various services.

Reviewed Changes

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

File Description
services/api-server/src/simcore_service_api_server/api/routes/solvers.py Adjusts pagination logic by replacing assignments with assertions and using page_meta.total for accurate counting.
SERVICES.md Introduces an auto-generated file with updated service badges and links for documentation.

@pcrespov pcrespov requested a review from wvangeit May 23, 2025 13:01
@codecov
Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 96.61017% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.28%. Comparing base (5028e5a) to head (9f13c75).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #7747       +/-   ##
===========================================
+ Coverage   76.66%   87.28%   +10.61%     
===========================================
  Files        1738     1814       +76     
  Lines       66459    70740     +4281     
  Branches     1214     1214               
===========================================
+ Hits        50953    61745    +10792     
+ Misses      15178     8652     -6526     
- Partials      328      343       +15     
Flag Coverage Δ
integrationtests 64.36% <47.05%> (+5.88%) ⬆️
unittests 86.50% <96.61%> (+0.68%) ⬆️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library 93.92% <ø> (ø)
pkg_dask_task_models_library 79.55% <ø> (ø)
pkg_models_library 93.08% <100.00%> (+<0.01%) ⬆️
pkg_notifications_library 85.26% <ø> (ø)
pkg_postgres_database 88.61% <ø> (ø)
pkg_service_integration 69.92% <ø> (ø)
pkg_service_library 71.86% <ø> (ø)
pkg_settings_library 90.90% <ø> (ø)
pkg_simcore_sdk 85.07% <ø> (+19.78%) ⬆️
agent 96.46% <ø> (ø)
api_server 91.79% <100.00%> (+<0.01%) ⬆️
autoscaling 96.07% <ø> (∅)
catalog 92.29% <ø> (ø)
clusters_keeper 99.25% <ø> (ø)
dask_sidecar 91.67% <ø> (ø)
datcore_adapter ∅ <ø> (∅)
director 76.78% <ø> (ø)
director_v2 91.02% <ø> (+5.73%) ⬆️
dynamic_scheduler 96.76% <ø> (ø)
dynamic_sidecar 90.19% <ø> (ø)
efs_guardian 89.79% <ø> (ø)
invitations 93.28% <ø> (ø)
payments 92.63% <ø> (ø)
resource_usage_tracker 88.91% <ø> (-0.27%) ⬇️
storage 87.81% <ø> (∅)
webclient ∅ <ø> (∅)
webserver 85.70% <100.00%> (+28.93%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5028e5a...9f13c75. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pcrespov pcrespov force-pushed the fix/public-api-solvers-pagination branch from 9726279 to 35daa2b Compare May 23, 2025 15:36
@pcrespov pcrespov enabled auto-merge (squash) May 23, 2025 16:21
@pcrespov pcrespov changed the title 🐛 Fixes public-api solvers pagination 🐛 Fixes public-api pagination issues May 23, 2025
@pcrespov pcrespov requested review from Copilot and sanderegg May 23, 2025 16:45
Copy link
Contributor

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 fixes pagination issues in the public API by aligning pagination limits between endpoints and refactoring how pagination parameters are handled.

  • Fixes wrong pagination parameters in GET /solvers/page endpoints.
  • Refactors pagination arguments to accept None defaults and use unified type annotations.
  • Updates tests and documentation to reflect these changes.

Reviewed Changes

Copilot reviewed 15 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
services/api-server/tests/unit/api_solvers/test_api_routers_solvers.py Adds new tests for pagination links and last page behavior
services/api-server/src/simcore_service_api_server/services_rpc/catalog.py Refactors pagination metadata extraction via a helper function and adjusts parameter types
services/api-server/src/simcore_service_api_server/services_http/webserver.py Updates type annotations for pagination in HTTP endpoints
services/api-server/src/simcore_service_api_server/models/pagination.py Updates REST pagination type definitions and limits
services/api-server/src/simcore_service_api_server/api/routes/solvers.py Changes default pagination limits and adjusts page totals in responses
Other files Similar refactoring of pagination argument names and types, with updates in tests and documentation
Files not reviewed (3)
  • services/web/server/VERSION: Language not supported
  • services/web/server/setup.cfg: Language not supported
  • services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml: Language not supported
Comments suppressed due to low confidence (2)

services/api-server/tests/unit/api_solvers/test_api_routers_solvers.py:215

  • The error message duplicates 'prev' in its description. Consider updating it to uniquely list all required pagination links (e.g. 'prev', 'self', and 'first' links) to avoid confusion.
assert (total_items > 1), "Total items in MOCK examples should be greater than 1 for pagination test since we need 'prev', 'self' and 'prev' links"

services/api-server/src/simcore_service_api_server/api/routes/solvers.py:139

  • Changing the pagination limit from DEFAULT_PAGINATION_LIMIT to MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE in the iteration may affect how many items are processed per page. Please confirm that this change is intentional and that downstream consumers are compatible with this higher limit.
for page_params in iter_pagination_params(limit=MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE):

@pcrespov pcrespov changed the title 🐛 Fixes public-api pagination issues 🐛♻️ Fixes public-api pagination issues and overall normalization & documentation May 23, 2025
Copy link
Contributor

@bisgaard-itis bisgaard-itis left a comment

Choose a reason for hiding this comment

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

thanks

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

Looking good, but please double check the paths if they really match.
Also why do the pagination offsets limits have to be aligned?

@pcrespov pcrespov force-pushed the fix/public-api-solvers-pagination branch from 24838cd to 165b25c Compare May 26, 2025 07:51
@pcrespov pcrespov force-pushed the fix/public-api-solvers-pagination branch from 4facc7a to 9609abc Compare May 26, 2025 12:31
@pcrespov pcrespov added the 🤖-automerge marks PR as ready to be merged for Mergify label May 26, 2025
@pcrespov
Copy link
Member Author

@mergify queue

@mergify
Copy link
Contributor

mergify bot commented May 26, 2025

queue

🟠 Waiting for conditions to match

  • -closed [📌 queue requirement]
  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue default]
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • any of: [🛡 GitHub branch protection]
        • check-neutral = unit-tests
        • check-skipped = unit-tests
        • check-success = unit-tests
      • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
      • #approved-reviews-by>=2
      • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
      • #changes-requested-reviews-by=0
      • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
      • #review-threads-unresolved=0
      • -conflict
      • -draft
      • base=master
      • label!=🤖-do-not-merge
      • label=🤖-automerge
      • any of: [🛡 GitHub branch protection]
        • check-skipped = deploy to dockerhub
        • check-neutral = deploy to dockerhub
        • check-success = deploy to dockerhub
      • any of: [🛡 GitHub branch protection]
        • check-success = system-tests
        • check-neutral = system-tests
        • check-skipped = system-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = check OAS' are up to date
        • check-neutral = check OAS' are up to date
        • check-skipped = check OAS' are up to date
      • any of: [🛡 GitHub branch protection]
        • check-success = integration-tests
        • check-neutral = integration-tests
        • check-skipped = integration-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = build-test-images (frontend) / build-test-images
        • check-neutral = build-test-images (frontend) / build-test-images
        • check-skipped = build-test-images (frontend) / build-test-images
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of: [📌 queue -> configuration change requirements]
    • -mergify-configuration-changed
    • check-success = Configuration changed

@pcrespov pcrespov disabled auto-merge May 26, 2025 14:22
@pcrespov pcrespov merged commit 8f187a7 into ITISFoundation:master May 26, 2025
15 of 16 checks passed
@pcrespov pcrespov deleted the fix/public-api-solvers-pagination branch May 26, 2025 14:22
@sonarqubecloud
Copy link

@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Jun 6, 2025
92 tasks
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:apiserver api-server service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants