Skip to content

Conversation

@giancarloromeo
Copy link
Contributor

@giancarloromeo giancarloromeo commented Jun 6, 2025

What do these changes do?

ReDoc

This PR enhances the list API Keys endpoint, adding a new query parameter (includeAutogenerated) that filters out (by default) the autogenerated ones.

image

Related issue/s

How to test

cd services/web/server
pytest -vv --pdb tests/unit/with_dbs/01/test_api_keys.py

Dev-ops

@giancarloromeo giancarloromeo self-assigned this Jun 6, 2025
@giancarloromeo giancarloromeo added this to the Bazinga! milestone Jun 6, 2025
@giancarloromeo giancarloromeo added the a:webserver webserver's codebase. Assigning the area is particularly useful for bugs label Jun 6, 2025
@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.21%. Comparing base (9c3a929) to head (d797575).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7855      +/-   ##
==========================================
+ Coverage   87.89%   88.21%   +0.32%     
==========================================
  Files        1836     1474     -362     
  Lines       71014    61242    -9772     
  Branches     1219      476     -743     
==========================================
- Hits        62415    54025    -8390     
+ Misses       8256     7096    -1160     
+ Partials      343      121     -222     
Flag Coverage Δ
integrationtests 64.25% <57.14%> (+0.04%) ⬆️
unittests 87.93% <82.35%> (+1.45%) ⬆️
Components Coverage Δ
api 76.84% <ø> (ø)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library 93.18% <90.00%> (+0.01%) ⬆️
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 69.92% <ø> (ø)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.05% <ø> (ø)
agent 96.29% <ø> (ø)
api_server 91.76% <ø> (ø)
autoscaling 96.03% <ø> (ø)
catalog 92.29% <ø> (ø)
clusters_keeper 99.13% <ø> (ø)
dask_sidecar 91.79% <ø> (ø)
datcore_adapter 97.94% <ø> (ø)
director 76.73% <ø> (ø)
director_v2 91.10% <100.00%> (+0.07%) ⬆️
dynamic_scheduler 96.69% <ø> (ø)
dynamic_sidecar 90.09% <ø> (ø)
efs_guardian 89.65% <ø> (ø)
invitations 93.00% <ø> (ø)
payments 92.57% <ø> (ø)
resource_usage_tracker 88.98% <ø> (ø)
storage 87.53% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 83.79% <60.00%> (-3.82%) ⬇️

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 9c3a929...d797575. 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.

@giancarloromeo giancarloromeo requested a review from Copilot June 10, 2025 08:45

This comment was marked as outdated.

@giancarloromeo giancarloromeo requested a review from Copilot June 10, 2025 08:49
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 enhances the API key management by introducing a filter for auto‐generated API keys when listing them.

  • Updated the list API endpoint to accept a new query parameter ("includeAutogenerated") which controls whether auto-generated keys are returned.
  • Added new tests and fixtures to verify the filter behavior.
  • Updated OpenAPI specifications and related modules to reflect the changes in API behavior.

Reviewed Changes

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

Show a summary per file
File Description
tests/unit/with_dbs/01/test_api_keys.py Added fake_auto_api_keys fixture and tests to verify filtering of autogenerated API keys
src/simcore_service_webserver/api_keys/_service.py Updated list_api_keys signature to include the include_autogenerated flag
src/simcore_service_webserver/api_keys/_repository.py Modified the SQL query to conditionally filter out auto-generated API keys based on the new flag
src/simcore_service_webserver/api_keys/_controller/rest.py Updated the endpoint controller to handle query parameters for filtering autogenerated keys
src/simcore_service_webserver/api/v0/openapi.yaml Revised OpenAPI definitions to add a POST endpoint for key creation and a GET endpoint supporting the new query parameter
services/director-v2/src/simcore_service_director_v2/modules/osparc_variables/_api_auth.py Updated auto-generated API key naming scheme to use the new prefix constant
packages/models-library/src/models_library/auth.py Introduced API_KEY_AUTOGENERATED_PREFIX constant for consistency
packages/models-library/src/models_library/api_schemas_webserver/auth.py Added a new ApiKeyListQueryParams schema to support query parameter in API key listing
api/specs/web-server/_auth_api_keys.py Updated FastAPI endpoint definitions to incorporate the new query parameter via dependency injection
Comments suppressed due to low confidence (1)

services/web/server/src/simcore_service_webserver/api_keys/_repository.py:171

  • Consider adding a brief comment here to explain that this condition filters out auto-generated API keys based on the display_name prefix.
if not include_autogenerated:

@giancarloromeo giancarloromeo marked this pull request as ready for review June 10, 2025 08:54
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 a lot for the quick fix

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

OK, but please consider my comment

@giancarloromeo giancarloromeo enabled auto-merge (squash) June 10, 2025 21:11
@giancarloromeo giancarloromeo added the 🤖-automerge marks PR as ready to be merged for Mergify label Jun 10, 2025
@giancarloromeo
Copy link
Contributor Author

giancarloromeo commented Jun 10, 2025

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Jun 10, 2025

queue

🛑 The pull request has been removed from the queue default

The following conditions don't match anymore:

  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue default]
      • any of: [🛡 GitHub branch protection]
        • check-neutral = deploy to dockerhub
        • check-skipped = deploy to dockerhub
        • check-success = deploy to dockerhub
      • any of: [🛡 GitHub branch protection]
        • check-neutral = system-tests
        • check-skipped = system-tests
        • check-success = system-tests
      • any of: [🛡 GitHub branch protection]
        • check-neutral = unit-tests
        • check-skipped = unit-tests
        • check-success = unit-tests
      • any of: [🛡 GitHub branch protection]
        • check-neutral = integration-tests
        • check-skipped = integration-tests
        • check-success = integration-tests

@sonarqubecloud
Copy link

@mergify
Copy link
Contributor

mergify bot commented Jun 11, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@giancarloromeo giancarloromeo merged commit 1ce595e into ITISFoundation:master Jun 11, 2025
145 of 149 checks passed
@giancarloromeo giancarloromeo deleted the is7852/filter-autogenerated-api-keys branch June 23, 2025 20:03
@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:webserver webserver's codebase. Assigning the area is particularly useful for bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter list of api-keys

4 participants