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: add consist params validation #10332

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

Wadjetz
Copy link
Member

@Wadjetz Wadjetz commented Jan 13, 2025

fix #9543

Adding backend validation for the consists values to prevent calculation errors.

@Wadjetz Wadjetz self-assigned this Jan 13, 2025
@github-actions github-actions bot added the area:editoast Work on Editoast Service label Jan 13, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2025

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

Codecov Report

Attention: Patch coverage is 98.68421% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.85%. Comparing base (da06215) to head (bfe451f).
Report is 21 commits behind head on dev.

Files with missing lines Patch % Lines
editoast/src/views/timetable/stdcm.rs 94.44% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10332      +/-   ##
==========================================
+ Coverage   81.83%   81.85%   +0.01%     
==========================================
  Files        1081     1081              
  Lines      106879   106946      +67     
  Branches      721      721              
==========================================
+ Hits        87466    87538      +72     
+ Misses      19372    19367       -5     
  Partials       41       41              
Flag Coverage Δ
editoast 74.39% <98.68%> (+0.06%) ⬆️
front 89.38% <ø> (ø)
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 88.14% <ø> (ø)

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.

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 2 times, most recently from 2f8c41b to 55eb68c Compare January 13, 2025 10:29
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 2 times, most recently from 19d7604 to a6f1f27 Compare January 13, 2025 11:19
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Jan 13, 2025
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch from a6f1f27 to 60bf549 Compare January 13, 2025 13:55
@Wadjetz Wadjetz marked this pull request as ready for review January 13, 2025 14:43
@Wadjetz Wadjetz requested a review from a team as a code owner January 13, 2025 14:43
Copy link
Contributor

@bougue-pe bougue-pe left a comment

Choose a reason for hiding this comment

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

After discussing in the office, the main goal of the issue is to protect from unclear crash.
The front part already does the main job, so we should just protect the backend from unclear crashes, without narrowing use when it's technically OK (at a reasonable cost).

👍 Thanks for getting rid of a new part of the 'validator' use 🎉

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch from 60bf549 to 6681143 Compare February 4, 2025 10:26
@github-actions github-actions bot removed the area:front Work on Standard OSRD Interface modules label Feb 4, 2025
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 5 times, most recently from fa1d99d to e83746b Compare February 4, 2025 13:37
@Wadjetz Wadjetz requested a review from a team as a code owner February 4, 2025 13:37
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Feb 4, 2025
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 2 times, most recently from dcb9b9e to e7b1c75 Compare February 4, 2025 14:49
@Wadjetz Wadjetz requested a review from bougue-pe February 4, 2025 15:08
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 3 times, most recently from 866b407 to e888917 Compare February 5, 2025 18:12
Copy link
Contributor

@bougue-pe bougue-pe left a comment

Choose a reason for hiding this comment

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

LGTM.
Feel free to resolve those 2 comments if applied.

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch from e888917 to 9c09767 Compare February 6, 2025 14:18
@Wadjetz Wadjetz requested a review from SharglutDev February 6, 2025 14:18
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)

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch from 9c09767 to 71d0a09 Compare February 10, 2025 10:11
@Wadjetz Wadjetz requested a review from leovalais February 10, 2025 10:53
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 4 times, most recently from b692e10 to c1a380c Compare February 12, 2025 10:33
Copy link
Contributor

@bougue-pe bougue-pe left a comment

Choose a reason for hiding this comment

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

LGTM, just please squash before merge 🙏

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch 2 times, most recently from 556da32 to 019cdc9 Compare February 13, 2025 08:46
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm-consist-validation branch from 019cdc9 to bfe451f Compare February 13, 2025 08:53
@Wadjetz Wadjetz added this pull request to the merge queue Feb 14, 2025
Merged via the queue into dev with commit 9b6320c Feb 14, 2025
27 checks passed
@Wadjetz Wadjetz deleted the ebe/editoast/stdcm-consist-validation branch February 14, 2025 09:00
Comment on lines +102 to +105
#[error("Invalid consist mass: {message}")]
InvalidConsistMass { message: String },
#[error("Invalid consist length: {message}")]
InvalidConsistLength { message: String },
Copy link
Contributor

Choose a reason for hiding this comment

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

It would have been great to have numerical values instead of a generic message string :/

Because of that, 1) the full error message is split in several places and 2) in tests you have to assert_eq on strings instead of numerical values which are more stable.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

editoast: towed rolling stocks should really have a minimum value
6 participants