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

Adding an error inventory to editoast #6632

Merged
merged 1 commit into from
Feb 20, 2024
Merged

Adding an error inventory to editoast #6632

merged 1 commit into from
Feb 20, 2024

Conversation

sim51
Copy link
Contributor

@sim51 sim51 commented Feb 13, 2024

See https://github.com/osrd-project/osrd-confidential/issues/281 for more details
close #6193

What I did is :

  • editoast generates API errors definition into openapi.yaml by looking at all object that derives from EditoastError
  • frontend task "api-errors-i18n" reads the openapi.yml and i18n errors.json file to check if there are some missing or invalid values
  • frontend task is run on the CI, within the check of the openapi (see job check_editoast_openapi)

Moreover, the function extractMessageFromError in front/src/utils/error.ts has been changed, to search the message to display in the I18N.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Attention: 110 lines in your changes are missing coverage. Please review.

Comparison is base (32daf08) 27.74% compared to head (a6b59f6) 27.79%.

Files Patch % Lines
front/scripts/api-errors-i18n.ts 0.00% 87 Missing and 1 partial ⚠️
front/src/utils/error.ts 0.00% 13 Missing ⚠️
editoast/editoast_derive/src/error.rs 86.56% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #6632      +/-   ##
============================================
+ Coverage     27.74%   27.79%   +0.05%     
  Complexity     2172     2172              
============================================
  Files          1042     1043       +1     
  Lines        128465   128710     +245     
  Branches       2569     2570       +1     
============================================
+ Hits          35640    35773     +133     
- Misses        91340    91451     +111     
- Partials       1485     1486       +1     
Flag Coverage Δ
core 79.36% <ø> (ø)
editoast 75.32% <94.11%> (+0.10%) ⬆️
front 8.34% <0.00%> (-0.01%) ⬇️
gateway 2.50% <ø> (ø)
railjson_generator 87.25% <ø> (ø)
tests 81.95% <ø> (ø)

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.

@sim51 sim51 force-pushed the bsi/error-messages branch 6 times, most recently from c676413 to 42a7338 Compare February 14, 2024 16:53
@sim51 sim51 marked this pull request as ready for review February 14, 2024 17:07
@sim51 sim51 requested review from a team as code owners February 14, 2024 17:07
@sim51 sim51 force-pushed the bsi/error-messages branch 2 times, most recently from 3294c2a to 26f7be8 Compare February 15, 2024 11:19
@sim51 sim51 enabled auto-merge February 15, 2024 14:27
@sim51 sim51 force-pushed the bsi/error-messages branch from 26f7be8 to 4d4f1f4 Compare February 16, 2024 09:02
Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

There are a few changes to make. I haven't reviewed the utoipa part yet.

Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

LGTM, we need to fix the opened comment.

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.

Thank you for this PR ! Left some comments (most of them on spelling or syntax)

@sim51 sim51 force-pushed the bsi/error-messages branch from 65890a3 to 0fd8ad3 Compare February 19, 2024 13:40
Copy link
Member

@ElysaSrc ElysaSrc left a comment

Choose a reason for hiding this comment

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

Reviewed the GitHub CI part, LGTM

@sim51 sim51 force-pushed the bsi/error-messages branch 5 times, most recently from cd74fb3 to 885a1d6 Compare February 19, 2024 16:28
@sim51 sim51 force-pushed the bsi/error-messages branch 2 times, most recently from f317a18 to f2657ee Compare February 19, 2024 20:42
@flomonster flomonster changed the title editoast: managing i18n for API errors Adding an error inventory to editoast Feb 20, 2024
@sim51 sim51 force-pushed the bsi/error-messages branch 10 times, most recently from 61b370c to 7f6d9fa Compare February 20, 2024 09:31
@sim51 sim51 force-pushed the bsi/error-messages branch from 7f6d9fa to 3d32d79 Compare February 20, 2024 09:54
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.

Thank you for the changes. Lgtm and tested. Just one last comment (my fault)

- editoast generates API errors definition into openapi.yaml by looking
  at all object that derives from 'EditoastError'
- frontend task "script:i18n-api-errors" reads the openapi.yml and i18n
  errors.json file to check if there are some missing or invalid values
- frontend task is run on the CI, within the check of the openapi
@sim51 sim51 force-pushed the bsi/error-messages branch from 3d32d79 to a6b59f6 Compare February 20, 2024 10:41
@sim51 sim51 added this pull request to the merge queue Feb 20, 2024
@sim51
Copy link
Contributor Author

sim51 commented Feb 20, 2024

For memory, I opened this ticket #6685
It follows our discussion about the way to find property's type

Merged via the queue into dev with commit e541b24 Feb 20, 2024
22 checks passed
@sim51 sim51 deleted the bsi/error-messages branch February 20, 2024 17: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.

front: incorrect error message when not enough traction
4 participants