Skip to content

✨ feat(users): add registration filter to user account queries and tests#9024

Merged
pcrespov merged 16 commits intoITISFoundation:masterfrom
pcrespov:is495/user-accounts-register-filter
Apr 15, 2026
Merged

✨ feat(users): add registration filter to user account queries and tests#9024
pcrespov merged 16 commits intoITISFoundation:masterfrom
pcrespov:is495/user-accounts-register-filter

Conversation

@pcrespov
Copy link
Copy Markdown
Member

@pcrespov pcrespov commented Apr 13, 2026

What do these changes do?

ReDoc

Add a new registered query parameter filter to the GET /v0/admin/user-accounts endpoint, enabling admins (i.e. >=PO_USER and support group) to filter user accounts by registration status:

  • registered=true → users with accounts
  • registered=false → pre-registered users pending account creation

Example query:

GET /v0/admin/user-accounts?review_status=PENDING&registered=false

Returns pending users who have not yet created their accounts, useful for tracking registration pipeline.

Updates include:

  • Query filter schema in UsersForAdminListFilter
  • Database query logic to join with users table
  • OpenAPI specs and type definitions
  • ♻️ Comprehensive unit tests covering all filter combinations (and split refactor of tests)

Related issue/s

How to test

  1. Run unit tests:
    pytest -vv tests/unit -k user 
  2. Manual testing with query combinations:
    # Get all pending users (no account yet)
    GET /v0/admin/user-accounts?review_status=PENDING&registered=false
    
    # Get approved users who have registered
    GET /v0/admin/user-accounts?review_status=REVIEWED&registered=true
  3. Verify the registered field in API responses indicates account status (true or false)

Dev-ops

  • No ENV changes required
  • API version bumped: 0.81.1 → 0.82.0

@pcrespov pcrespov self-assigned this Apr 13, 2026
@pcrespov pcrespov added this to the Etna milestone Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.26%. Comparing base (b2b9e3e) to head (2636e3c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9024      +/-   ##
==========================================
+ Coverage   87.25%   89.26%   +2.00%     
==========================================
  Files        2038     1631     -407     
  Lines       79984    67745   -12239     
  Branches     1371      542     -829     
==========================================
- Hits        69794    60470    -9324     
+ Misses       9792     7136    -2656     
+ Partials      398      139     -259     
Flag Coverage Δ
integrationtests 64.01% <21.05%> (+0.03%) ⬆️
unittests 87.93% <65.00%> (+1.81%) ⬆️
Components Coverage Δ
pkg_aws_library ∅ <ø> (∅)
pkg_celery_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library 92.63% <100.00%> (+<0.01%) ⬆️
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 72.81% <ø> (ø)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.94% <ø> (+0.05%) ⬆️
agent 93.26% <ø> (ø)
api_server 91.40% <ø> (ø)
autoscaling 95.48% <ø> (ø)
catalog 92.10% <ø> (ø)
clusters_keeper 98.59% <ø> (ø)
dask_sidecar 91.74% <ø> (ø)
datcore_adapter 97.95% <ø> (ø)
director 75.45% <ø> (ø)
director_v2 91.68% <ø> (+0.04%) ⬆️
dynamic_scheduler 95.97% <ø> (+0.19%) ⬆️
dynamic_sidecar 87.50% <ø> (ø)
efs_guardian 89.73% <ø> (ø)
invitations 90.93% <ø> (ø)
payments 92.87% <ø> (ø)
resource_usage_tracker 92.62% <ø> (-0.21%) ⬇️
storage 86.90% <ø> (-0.05%) ⬇️
webclient ∅ <ø> (∅)
webserver 86.71% <63.15%> (-0.05%) ⬇️

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 b2b9e3e...2636e3c. 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.

Comment thread .github/instructions/python-tests.instructions.md
Comment thread .github/skills/run-python-tests/SKILL.md
@pcrespov pcrespov added the a:webserver webserver's codebase. Assigning the area is particularly useful for bugs label Apr 14, 2026
@pcrespov pcrespov force-pushed the is495/user-accounts-register-filter branch from b75927d to c2c26ec Compare April 14, 2026 16:59
@pcrespov pcrespov marked this pull request as ready for review April 14, 2026 16:59
@pcrespov pcrespov changed the title WIP: ✨ feat(users): add registration filter to user account queries and tests ✨ feat(users): add registration filter to user account queries and tests Apr 14, 2026
Copy link
Copy Markdown
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

Adds a registered query filter to the admin user-accounts listing so admins can distinguish between pre-registered (no platform account yet) and registered users, and restructures/extends the related test suite.

Changes:

  • Add registered: bool | None to the list endpoint query params and propagate it through controller → service → repository to filter by presence of a linked user_id.
  • Update the merged users query to apply the registration filter before pagination/counting.
  • Split the previously large registration REST test file into a folder with focused modules and shared fixtures; bump API version and OpenAPI spec accordingly.

Reviewed changes

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

Show a summary per file
File Description
services/web/server/src/simcore_service_webserver/users/_controller/rest/accounts_rest.py Passes registered query param into the account listing service call.
services/web/server/src/simcore_service_webserver/users/_accounts_service.py Adds filter_registered parameter and forwards it to repository.
services/web/server/src/simcore_service_webserver/users/_accounts_repository.py Applies filter_registered on the merged (pre-reg + users) view prior to distinct/pagination/count.
packages/models-library/src/models_library/api_schemas_webserver/users.py Extends UsersForAdminListFilter / UsersAccountListQueryParams with registered.
services/web/server/src/simcore_service_webserver/api/v0/openapi.json Bumps version and documents registered query parameter for the list endpoint.
services/web/server/VERSION Bumps service version to 0.82.0.
services/web/server/setup.cfg Updates bumpversion current_version to 0.82.0.
services/web/server/tests/unit/with_dbs/03/users/test_users_accounts_repository.py Adds repository-level test coverage for filter_registered combined with status filters.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration/conftest.py Introduces shared fixtures/mocks and DB cleanup for the split registration REST tests.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration/test_users_accounts_rest_registration_list.py Adds list endpoint tests covering review_status + registered combinations and pagination totals.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration/test_users_accounts_rest_registration_search.py Moves/keeps search endpoint tests in a dedicated module.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration/test_users_accounts_rest_registration_preview.py Moves/keeps preview endpoint tests in a dedicated module.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration/test_users_accounts_rest_registration_move.py Moves/keeps move endpoint tests in a dedicated module.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration/test_users_accounts_rest_registration_approve_reject.py Moves/keeps approve/reject flow tests in a dedicated module.
services/web/server/tests/unit/with_dbs/03/invitations/test_users_accounts_rest_registration.py Removes the old monolithic test module after splitting.
.github/skills/run-python-tests/SKILL.md Expands skill description to include static analysis.
.github/instructions/python-tests.instructions.md Clarifies test splitting guidance and adds a “unique test filenames across tree” rule.
.github/PULL_REQUEST_TEMPLATE.md Improves guidance for adding OpenAPI ReDoc badge links in PRs.

Comment thread .github/PULL_REQUEST_TEMPLATE.md
Copy link
Copy Markdown
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

Great, thanks

Copy link
Copy Markdown
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.

Looks good. Please consider my comments on the instructions

Comment thread .github/instructions/python-tests.instructions.md Outdated
Comment thread .github/skills/run-python-tests/SKILL.md
- Implement tests for listing user accounts with various filters including review status and registration status.
- Add tests for moving user accounts to different products, ensuring proper error handling for unknown products.
- Create tests for previewing approval and rejection notifications for pre-registered users, including edge cases for non-existent users.
- Implement search functionality tests for user accounts, ensuring access control based on user roles and verifying correct responses for registered and pre-registered users.
@pcrespov pcrespov force-pushed the is495/user-accounts-register-filter branch from 2398fa8 to 2636e3c Compare April 15, 2026 15:34
@pcrespov pcrespov requested a review from GitHK April 15, 2026 15:34
@pcrespov pcrespov enabled auto-merge (squash) April 15, 2026 15:35
@pcrespov pcrespov added the 🤖-automerge marks PR as ready to be merged for Mergify label Apr 15, 2026
@pcrespov
Copy link
Copy Markdown
Member Author

@mergify queue

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 15, 2026

Merge Queue Status

  • 🟠 Waiting for queue conditions
  • ⏳ Enter queue
  • ⏳ Run checks
  • ⏳ Merge

Waiting for:

  • -closed
  • branch-protection-review-decision = APPROVED
All conditions
  • -closed [📌 queue requirement]
  • any of [🔀 queue conditions]:
    • all of [📌 queue conditions of queue rule default]:
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • #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 = unit-tests
        • check-neutral = unit-tests
        • check-skipped = unit-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
      • any of [🛡 GitHub branch protection]:
        • check-success = SonarCloud Code Analysis
        • check-neutral = SonarCloud Code Analysis
        • check-skipped = SonarCloud Code Analysis
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of [📌 queue -> configuration change requirements]:
    • -mergify-configuration-changed
    • check-success = Configuration changed
  • any of [📌 queue requirement]:
    • check-neutral = Mergify Merge Protections
    • check-skipped = Mergify Merge Protections
    • check-success = Mergify Merge Protections

@sonarqubecloud
Copy link
Copy Markdown

@pcrespov pcrespov disabled auto-merge April 15, 2026 16:33
@pcrespov pcrespov merged commit 16dd1a9 into ITISFoundation:master Apr 15, 2026
94 of 96 checks passed
@pcrespov pcrespov deleted the is495/user-accounts-register-filter branch April 15, 2026 16:33
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.

6 participants