Skip to content
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

🐛 Fix Decimal serialization #6854

Merged

Conversation

giancarloromeo
Copy link
Contributor

@giancarloromeo giancarloromeo commented Nov 27, 2024

What do these changes do?

Pydatic v2 serializes Decimals as strings to avoid loss of precision derived from conversion to float. This PR reverts the partial changes made during the migration.

Related issue/s

How to test

Dev-ops checklist

@giancarloromeo giancarloromeo added this to the Event Horizon milestone Nov 27, 2024
@giancarloromeo giancarloromeo self-assigned this Nov 27, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.20%. Comparing base (81e5b8e) to head (e2d4696).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6854      +/-   ##
==========================================
+ Coverage   88.33%   89.20%   +0.87%     
==========================================
  Files        1553     1268     -285     
  Lines       61193    53074    -8119     
  Branches     2095      874    -1221     
==========================================
- Hits        54055    47347    -6708     
+ Misses       6806     5591    -1215     
+ Partials      332      136     -196     
Flag Coverage Δ
integrationtests 65.25% <ø> (+0.10%) ⬆️
unittests 87.29% <100.00%> (+0.78%) ⬆️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library 91.21% <100.00%> (-0.01%) ⬇️
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 70.00% <ø> (ø)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.38% <ø> (ø)
agent 97.00% <ø> (ø)
api_server 89.81% <ø> (ø)
autoscaling 95.21% <ø> (ø)
catalog 90.57% <ø> (ø)
clusters_keeper 98.72% <ø> (ø)
dask_sidecar 91.26% <ø> (ø)
datcore_adapter 93.17% <ø> (ø)
director 76.49% <ø> (ø)
director_v2 91.37% <ø> (-0.08%) ⬇️
dynamic_scheduler 97.01% <ø> (ø)
dynamic_sidecar 89.72% <ø> (-0.04%) ⬇️
efs_guardian 90.12% <ø> (ø)
invitations 93.44% <ø> (ø)
osparc_gateway_server 80.05% <ø> (∅)
payments 92.77% <ø> (ø)
resource_usage_tracker 89.07% <ø> (-0.08%) ⬇️
storage 89.66% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 87.89% <ø> (-0.38%) ⬇️

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 81e5b8e...e2d4696. Read the comment docs.

@giancarloromeo giancarloromeo marked this pull request as ready for review November 27, 2024 15:44
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

This change affects some models in the web api schema. Can you please, cd web/server and

  1. increase minor version make minor-version
  2. update openapi specs make openapi-specs

@giancarloromeo giancarloromeo enabled auto-merge (squash) November 28, 2024 08:29
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.

Can you please wait a bit with merging this one? This will break the api-server. It essentially reverts the changes I did in https://github.com/ITISFoundation/osparc-simcore/pull/6658/files in order to make the api-server as "backwards compatible as possible". I am confident your changes should go in. But it would be nice to have a strategy for how to handle this in the api-server before this breaks it. I will discuss with @pcrespov tomorrow how to handle this. Sorry for the inconvenience.

@bisgaard-itis
Copy link
Contributor

Can you please wait a bit with merging this one? This will break the api-server. It essentially reverts the changes I did in https://github.com/ITISFoundation/osparc-simcore/pull/6658/files in order to make the api-server as "backwards compatible as possible". I am confident your changes should go in. But it would be nice to have a strategy for how to handle this in the api-server before this breaks it. I will discuss with @pcrespov tomorrow how to handle this. Sorry for the inconvenience.

I am a bit scared by the fact that you don't see here that you are breaking backwards compatibility of the api-server. I think I will set up a hook so people see that they are breaking our interface

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

@bisgaard-itis @giancarloromeo I will temporary block it to avoid accidental merging. Let me know if this is a problem for you! :-)

@giancarloromeo
Copy link
Contributor Author

@pcrespov @bisgaard-itis The related PR (#6853) is already in.

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.

OK, this one can go in for me. I will have to handle the backwards compatibility directly in the api-server. I am half way there and this should be quite easy to handle. @pcrespov I believe you can also approve this one

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.

Could you please also update the api-server's openapi.json in this PR?

cd services/api-server
make install-dev
make openapi.json

@bisgaard-itis bisgaard-itis self-requested a review December 3, 2024 11:16
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 effort.

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

Discussed with @bisgaard-itis . It does not affect backwards compatibility f the api-server

@giancarloromeo giancarloromeo enabled auto-merge (squash) December 3, 2024 11:40
Copy link

sonarqubecloud bot commented Dec 4, 2024

@giancarloromeo giancarloromeo merged commit dc28926 into ITISFoundation:master Dec 4, 2024
97 of 99 checks passed
@giancarloromeo giancarloromeo deleted the fix-decimal-serialization branch December 20, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants