Skip to content

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Aug 5, 2025

What do these changes do?

This pull request is a spin-off from the larger PR #8141 and can be merged independently to help reduce the size of the original PR.

Model and Validation Improvements:

  • Refactored field pre-processing in BaseProjectModel by replacing custom field_validator methods with Pydantic's BeforeValidator for the description and thumbnail fields, simplifying and standardizing validation logic. [1] [2]
  • Updated Node, output_node, output_nodes, and parent fields to explicitly mark deprecated fields and improve OpenAPI schema documentation. [1] [2] [3]

Database Utilities and Repositories:

  • Added a new exists method to ProjectsRepo to efficiently check for the existence of a project, supporting optional explicit DB connections.
  • Improved batch insert logic in ProjectNodesRepo.add to ensure all rows have consistent keys, raising an error on mismatch, and refactored field exclusion and serialization logic for converting DB models to API models. [1] [2] [3] [4]
  • Fixed imports and clarified utility function usage for DB exception mapping and connection handling. [1] [2]

Other Notable Changes:

  • Updated Pydantic configuration in projects_nodes.py to use validate_by_name and validate_by_alias for more robust field validation.
  • Minor code cleanup, such as removing unused variables and improving function documentation. [1] [2]

Related issue/s

How to test

Testing Enhancements:

  • Added new faker factory helpers for generating random service keys, versions, and project node data, and updated existing factories to use them for more realistic test data. [1] [2] [3] [4]
  • Introduced comprehensive tests for the new ProjectsRepo.exists method, covering both existing and non-existing projects with and without explicit connections.
  • Added tests for model serialization/deserialization between Node, ProjectNodeCreate, and ProjectNode, ensuring adapter compatibility and correct field mapping. [1] [2]
  • Improved test coverage for service key/version validation using faker-generated data.

Dev-ops

None

@pcrespov pcrespov self-assigned this Aug 5, 2025
Copy link

codecov bot commented Aug 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.36%. Comparing base (0bbcd00) to head (3ab48f9).
⚠️ Report is 79 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8192      +/-   ##
==========================================
- Coverage   88.02%   87.36%   -0.66%     
==========================================
  Files        1919     1677     -242     
  Lines       74311    67960    -6351     
  Branches     1305     1180     -125     
==========================================
- Hits        65413    59376    -6037     
+ Misses       8505     8234     -271     
+ Partials      393      350      -43     
Flag Coverage Δ
integrationtests 63.44% <ø> (-0.52%) ⬇️
unittests 86.41% <100.00%> (-0.25%) ⬇️
Components Coverage Δ
pkg_aws_library 93.93% <ø> (ø)
pkg_celery_library 87.37% <ø> (ø)
pkg_dask_task_models_library 79.62% <ø> (ø)
pkg_models_library 93.04% <100.00%> (-0.01%) ⬇️
pkg_notifications_library 85.26% <ø> (ø)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 70.19% <ø> (ø)
pkg_service_library 72.34% <ø> (-0.02%) ⬇️
pkg_settings_library 90.17% <ø> (ø)
pkg_simcore_sdk 65.29% <ø> (-19.75%) ⬇️
agent 93.90% <ø> (ø)
api_server 92.84% <ø> (ø)
autoscaling 95.89% <ø> (ø)
catalog 92.34% <ø> (ø)
clusters_keeper 99.13% <ø> (ø)
dask_sidecar 92.15% <ø> (-0.23%) ⬇️
datcore_adapter 97.94% <ø> (ø)
director 75.81% <ø> (ø)
director_v2 90.87% <ø> (-0.10%) ⬇️
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 89.19% <ø> (-0.91%) ⬇️
efs_guardian ∅ <ø> (∅)
invitations 91.44% <ø> (ø)
payments 92.61% <ø> (ø)
resource_usage_tracker 92.13% <ø> (+0.42%) ⬆️
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver 88.09% <ø> (+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 0bbcd00...3ab48f9. 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 added a:database associated to postgres service and postgres-database package a:models-library labels Aug 5, 2025
@pcrespov pcrespov added this to the Voyager milestone Aug 5, 2025
Copy link
Contributor

mergify bot commented Aug 11, 2025

🧪 CI Insights

Here's what we observed from your CI run for 3ab48f9.

❌ Job Failures

Pipeline Job Health on master Retries 🔍 CI Insights 📄 Logs
CI integration-tests Healthy 0 View View
system-tests Broken 0 View View
unit-tests Broken 0 View View

Copy link

@pcrespov pcrespov changed the title WIP: Is8141/project node repo ♻️ Refactor Models, Schema Validation, and DB Utilities (Spin-off 1 from #8141) Sep 11, 2025
@pcrespov pcrespov changed the title ♻️ Refactor Models, Schema Validation, and DB Utilities (Spin-off 1 from #8141) ♻️ Refactor Models, Schema Validation, and DB Utilities (Spin-off 1 from PR #8141) Sep 11, 2025
@pcrespov pcrespov closed this Sep 11, 2025
@pcrespov pcrespov changed the title ♻️ Refactor Models, Schema Validation, and DB Utilities (Spin-off 1 from PR #8141) ♻️ is8141/project_node_repo Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:database associated to postgres service and postgres-database package a:models-library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants