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: PacedTrain: add simulation summary and simulation endpoints #11022

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

younesschrifi
Copy link
Contributor

@younesschrifi younesschrifi commented Mar 4, 2025

Add simulation summary and simulation endpoints for paced trains.
Part of https://github.com/osrd-project/osrd-confidential/issues/779

@github-actions github-actions bot added the area:editoast Work on Editoast Service label Mar 4, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2025

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

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.10%. Comparing base (164c697) to head (956a5d7).
Report is 11 commits behind head on dev.

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

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #11022      +/-   ##
==========================================
+ Coverage   80.63%   81.10%   +0.46%     
==========================================
  Files        1099      801     -298     
  Lines      112187    81000   -31187     
  Branches      745      747       +2     
==========================================
- Hits        90460    65692   -24768     
+ Misses      21684    15265    -6419     
  Partials       43       43              
Flag Coverage Δ
editoast ?
front 89.92% <100.00%> (-0.03%) ⬇️
gateway 2.18% <ø> (ø)
osrdyne 2.53% <ø> (ø)
railjson_generator 87.58% <ø> (ø)
tests 87.90% <ø> (ø)

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.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch from 1b17958 to 6d14fda Compare March 4, 2025 10:32
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Mar 4, 2025
@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch from 6d14fda to be809ed Compare March 4, 2025 10:33
@younesschrifi younesschrifi changed the title editoast: add simulation summary and simulation endpoints for paced t… editoast: PacedTrain: add simulation summary and simulation endpoints Mar 4, 2025
@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch 4 times, most recently from 03cc77d to 422d56e Compare March 5, 2025 10:12
@younesschrifi younesschrifi marked this pull request as ready for review March 5, 2025 10:35
@younesschrifi younesschrifi requested review from a team as code owners March 5, 2025 10:35
@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch 4 times, most recently from 73ffba7 to e44d339 Compare March 6, 2025 09:50
@younesschrifi younesschrifi requested a review from woshilapin March 6, 2025 09:56
Copy link
Contributor

@leovalais leovalais left a comment

Choose a reason for hiding this comment

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

Thanks! Left a few comments, but nothing really blocking apart the ones about tests

)
.as_str(),
);
app.fetch(request).assert_status(StatusCode::OK);
Copy link
Contributor

Choose a reason for hiding this comment

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

This test isn't really testing anything really. If we break the simulation processing at some point, but still return OK, this test won't catch anything even though there is indeed a regression. Better assert on the output of the endpoint, or at least check for some properties on it if it's too lengthy. Otherwise you could use insta for snapshot testing (it's already used in editoast to test the output of derive macros).

"ids": vec![paced_train_id],
}));
app.fetch(request).assert_status(StatusCode::OK);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Error cases could be tested as well.

@younesschrifi younesschrifi removed the request for review from woshilapin March 6, 2025 10:56
@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch 2 times, most recently from 7c1cb3f to e1d6882 Compare March 6, 2025 14:28
@@ -172,7 +172,7 @@ pub struct InfraIdQueryParam {

#[derive(Debug, Serialize, ToSchema)]
#[serde(tag = "status", rename_all = "snake_case")]
enum SimulationSummaryResult {
pub enum SimulationSummaryResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to change the visibility? If I understand correctly, it's only used in submodules?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also need it for tests.

@@ -1105,7 +1107,7 @@ mod tests {
)
}

fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient {
pub(in crate::views) fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of changing the visibility, how about moving this function inside src/views/mod.rs and exposing it only for tests. Because if it's a function that is supposed to be used by 2 different submodules of views, then it's now a utility of views, not anymore a simple function of view::train_schedule.

Suggested change
pub(in crate::views) fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient {
#[cfg(test)]
pub fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient {

@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch from e1d6882 to 13b13bc Compare March 6, 2025 15:17
@@ -15,8 +15,10 @@ const config: ConfigFile = {
'postInfraByInfraIdPathfinding',
'postInfraByInfraIdPathfindingBlocks',
'postInfraByInfraIdPathProperties',
'postPacedTrainSimulationSummary',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'postPacedTrainSimulationSummary',

@@ -15,8 +15,10 @@ const config: ConfigFile = {
'postInfraByInfraIdPathfinding',
'postInfraByInfraIdPathfindingBlocks',
'postInfraByInfraIdPathProperties',
'postPacedTrainSimulationSummary',
'postTrainSchedule',
Copy link
Contributor

Choose a reason for hiding this comment

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

Not (directly) related to your PR, this one doesn't exist anymore since this PR.

@younesschrifi younesschrifi force-pushed the yci/add-simulation-paced-endpoint branch from 13b13bc to 956a5d7 Compare March 6, 2025 15:43
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.

5 participants