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

editoast: remove InternalError usage in Delete and Create Model API #10196

Merged
merged 5 commits into from
Jan 28, 2025

Conversation

leovalais
Copy link
Contributor

@leovalais leovalais commented Dec 24, 2024

  • Creates a custom error type wrapping diesel::result::Error in editoast_models
  • Adapt the API of deletion and creation traits (the rest will come in another PR(s))
  • Propagate the API change in views (mostly)
    • new error variants are created to accommodate some (valid) typing constraints, bringing us closer to our target error management structure
    • simplified a few map_diesel_error here and there
  • The traits will be moved into editoast_models::model later

Tip

Review commit by commit

@github-actions github-actions bot added area:front Work on Standard OSRD Interface modules area:editoast Work on Editoast Service labels Dec 24, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 24, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 79.25532% with 39 lines in your changes missing coverage. Please review.

Project coverage is 81.85%. Comparing base (c2228f0) to head (3cd4117).
Report is 33 commits behind head on dev.

Files with missing lines Patch % Lines
editoast/editoast_models/src/model.rs 77.08% 11 Missing ⚠️
editoast/src/models/prelude/delete.rs 57.89% 8 Missing ⚠️
editoast/src/models/prelude/create.rs 0.00% 4 Missing ⚠️
editoast/src/views/temporary_speed_limits.rs 66.66% 4 Missing ⚠️
editoast/src/views/work_schedules.rs 75.00% 4 Missing ⚠️
editoast/src/models/timetable.rs 0.00% 3 Missing ⚠️
editoast/editoast_derive/src/model/args.rs 0.00% 1 Missing ⚠️
editoast/src/models/rolling_stock_model.rs 92.30% 1 Missing ⚠️
editoast/src/models/temporary_speed_limits.rs 88.88% 1 Missing ⚠️
editoast/src/models/work_schedules.rs 88.88% 1 Missing ⚠️
... and 1 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10196      +/-   ##
==========================================
+ Coverage   81.81%   81.85%   +0.04%     
==========================================
  Files        1073     1075       +2     
  Lines      106718   107176     +458     
  Branches      730      728       -2     
==========================================
+ Hits        87306    87724     +418     
- Misses      19373    19413      +40     
  Partials       39       39              
Flag Coverage Δ
editoast 74.23% <79.25%> (-0.07%) ⬇️
front 89.38% <ø> (+0.03%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 88.14% <ø> (+1.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@leovalais leovalais force-pushed the lva/model-errors branch 2 times, most recently from f75fab0 to f4c7501 Compare December 26, 2024 16:49
@leovalais leovalais changed the title lva/model errors editoast: remove InternalError usage in Delete and Create Model API Dec 26, 2024
@leovalais leovalais marked this pull request as ready for review December 26, 2024 16:54
@leovalais leovalais requested review from a team as code owners December 26, 2024 16:54
@leovalais leovalais enabled auto-merge December 26, 2024 16:54
@leovalais leovalais self-assigned this Jan 6, 2025
@leovalais leovalais added the kind:enhancement Improvement of existing features label Jan 6, 2025
Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

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

Nice job. Not approving yet, let's see where the comments goes first.

@leovalais leovalais force-pushed the lva/model-errors branch 3 times, most recently from b7fd8c4 to 6c55602 Compare January 23, 2025 17:10
Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

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

I think I like this Model::Error associated type, seems logical. I've put a few more comments related to the recent changes, but nothing big. Thank you.

@leovalais
Copy link
Contributor Author

Thanks for the review! Good to know it's the right track, it's still a work in progress though (I think one commit got nuked in the process I just noticed... 👀). I'll try to finish that on monday (if I'm not trapped on permissions again, that is 😨)

Copy link
Contributor

@SharglutDev SharglutDev left a comment

Choose a reason for hiding this comment

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

Lgtm for front (not tested)

@leovalais leovalais force-pushed the lva/model-errors branch 5 times, most recently from 03e753c to 0b69f70 Compare January 28, 2025 11:38
@leovalais
Copy link
Contributor Author

@woshilapin I've added the Error associated type of trait Model and used it in RollingStock, TemporarySpeedLimit and WorkSchedule.

I also removed some #[async_trait]s that are not useful for these definitions anymore :-)

@leovalais leovalais force-pushed the lva/model-errors branch 2 times, most recently from a876252 to a43d5ff Compare January 28, 2025 14:33
@leovalais leovalais added this pull request to the merge queue Jan 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2025
@leovalais leovalais added this pull request to the merge queue Jan 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2025
@leovalais leovalais added this pull request to the merge queue Jan 28, 2025
Merged via the queue into dev with commit 2b56d3e Jan 28, 2025
27 checks passed
@leovalais leovalais deleted the lva/model-errors branch January 28, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:editoast Work on Editoast Service area:front Work on Standard OSRD Interface modules kind:enhancement Improvement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants