Skip to content

Conversation

@pcrespov
Copy link
Member

@pcrespov pcrespov commented Jun 22, 2025

What do these changes do?

This PR includes some cleanup and increase of test-coverage undertaken while debugging #7932. The latter was a bug detected in the front-end and solved in #7950

Related issue/s

How to test

cd services/invitations
make install-dev
make test-dev-unit

Dev-ops

@codecov
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.10%. Comparing base (03bc710) to head (696a661).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7945      +/-   ##
==========================================
- Coverage   87.83%   85.10%   -2.74%     
==========================================
  Files        1848      704    -1144     
  Lines       71253    32964   -38289     
  Branches     1250      176    -1074     
==========================================
- Hits        62586    28053   -34533     
+ Misses       8305     4853    -3452     
+ Partials      362       58     -304     
Flag Coverage Δ
integrationtests 64.27% <ø> (+0.01%) ⬆️
unittests 86.95% <100.00%> (+0.50%) ⬆️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_celery_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration ∅ <ø> (∅)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 77.10% <ø> (-7.95%) ⬇️
agent ∅ <ø> (∅)
api_server ∅ <ø> (∅)
autoscaling ∅ <ø> (∅)
catalog ∅ <ø> (∅)
clusters_keeper ∅ <ø> (∅)
dask_sidecar ∅ <ø> (∅)
datcore_adapter ∅ <ø> (∅)
director ∅ <ø> (∅)
director_v2 77.75% <ø> (-13.33%) ⬇️
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 88.33% <ø> (-1.77%) ⬇️
efs_guardian ∅ <ø> (∅)
invitations 93.60% <100.00%> (+0.60%) ⬆️
payments ∅ <ø> (∅)
resource_usage_tracker ∅ <ø> (∅)
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver 87.67% <ø> (+0.01%) ⬆️

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 03bc710...696a661. 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 self-assigned this Jun 22, 2025
@pcrespov pcrespov force-pushed the is7932/credits-invitation-link branch from f58dbfb to fd847b9 Compare June 22, 2025 16:07
@pcrespov pcrespov force-pushed the is7932/credits-invitation-link branch from 3fb8f79 to 696a661 Compare June 23, 2025 12:59
@sonarqubecloud
Copy link

@pcrespov pcrespov changed the title Is7932/credits invitation link ♻️✅ invitations service: small refactoring and cleanup Jun 23, 2025
@pcrespov pcrespov added this to the Engage milestone Jun 23, 2025
@pcrespov pcrespov added the a:invitations invitations service label Jun 23, 2025
@pcrespov pcrespov marked this pull request as ready for review June 23, 2025 13:04
@pcrespov pcrespov enabled auto-merge (squash) June 23, 2025 13:05
@pcrespov pcrespov added the 🤖-automerge marks PR as ready to be merged for Mergify label Jun 23, 2025
@pcrespov
Copy link
Member Author

@mergify queue

@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2025

queue

🛑 The pull request has been removed from the queue default

The pull request can't be updated.

You can take a look at Queue: Embarked in merge queue check runs for more details about the failure.

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 refactors the invitations service to add support for an extra_credits_in_usd field, cleans up the CLI I/O to use Typer's echo/secho, and expands test coverage with new scenarios around invalid invitation codes.

  • Introduces extra_credits_in_usd across events, API, fixtures, and CLI.
  • Replaces raw print calls with typer.echo/typer.secho and proper exit codes in the CLI.
  • Adds a new unit test for handling invalid invitation codes and asserts default log level in settings.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
services/web/server/.../wallets/_events.py Added keyword-only marker (*) for the new extra_credits_in_usd parameter
services/invitations/tests/unit/test_core_settings.py Asserts default LOG_LEVEL equals "INFO"
services/invitations/tests/unit/conftest.py Introduces extra_credits_in_usd fixture and populates invitation_data
services/invitations/tests/unit/test_cli.py Refactors CLI option building, adds extra_credits_in_usd, and tests invalid code
services/invitations/tests/unit/api/test_api_invitations.py Validates extra_credits_in_usd in API inputs and outputs
services/invitations/src/simcore_service_invitations/cli.py Imports os, adds CLI option for extra credits, and switches to typer.echo/secho
Comments suppressed due to low confidence (2)

services/invitations/src/simcore_service_invitations/cli.py:159

  • [nitpick] The error message is generic. Consider making it more descriptive, e.g., typer.secho("Invalid invitation code", fg=typer.colors.RED, bold=True, err=True) to clarify the failure.
        typer.secho("Invalid code", fg=typer.colors.RED, bold=True, err=True)

services/invitations/tests/unit/test_cli.py:65

  • [nitpick] Concatenating other_options directly can introduce extra spaces when options are empty. Consider using other_options.strip() or building the CLI args as a list and joining to ensure consistent spacing.
        f"invite {invitation_data.guest} --issuer={invitation_data.issuer} {other_options}",

@pcrespov pcrespov merged commit 4c6c5df into ITISFoundation:master Jun 23, 2025
95 of 97 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2025

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

The pull request can't be updated.

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@pcrespov pcrespov deleted the is7932/credits-invitation-link branch June 25, 2025 08:11
@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:invitations invitations service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants