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

fix(upgrade): raise an HTTP 417 exception when an upgrade has unmet requirements #2047

Conversation

mabw-rte
Copy link
Contributor

@mabw-rte mabw-rte commented Jun 4, 2024

Context:
This PR addresses two potential issues that can occur when upgrading studies:

  • Upgrading a variant study could potentially corrupt it.
  • Upgrading a parent study that has variant children could potentially corrupt those children.

Issue:
At present, our system does not support the upgrade of commands, which complicates the resolution of these issues. Until we develop a solution for upgrading commands, this PR implements measures to prevent the two situations mentioned above.

Solution:
The modifications in this PR will trigger a 417 HTTP ERROR if an attempt is made to upgrade a study that either has children or is a variant. This is a temporary measure until we implement a solution for upgrading commands.

@mabw-rte mabw-rte self-assigned this Jun 4, 2024
@laurent-laporte-pro laurent-laporte-pro added bug Something isn't working hot back-end labels Jun 4, 2024
@laurent-laporte-pro laurent-laporte-pro added this to the v2.17.1 milestone Jun 4, 2024
@makdeuneuv
Copy link
Contributor

makdeuneuv commented Jun 4, 2024

@mabw-rte It's better to be more specific in the errors messages. For example :

if it's a raw study:
"Raw Study {uuid} cannot be upgraded: it has children studies, this feature isn't supported for parent of variant"
if it's a variant study:
"Variant study {child_uuid} cannot be upgraded : the feature isn't supported for variant"

I'll let you correct me if there are mistakes in my suggestions.

Copy link
Contributor

@laurent-laporte-pro laurent-laporte-pro left a comment

Choose a reason for hiding this comment

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

Il y a des petites améliorations à faire (ou pas).

Revoir les tests unitaires : il faut simplifier.
À mon avis, les tests doivent fonctionner correctement sous Windows, car on gère seulement des cas d'erreur sans utiliser le gestionnaire de taches (c'est lui qui pose problème sous Windows).

antarest/study/repository.py Outdated Show resolved Hide resolved
antarest/core/exceptions.py Outdated Show resolved Hide resolved
antarest/study/service.py Outdated Show resolved Hide resolved
tests/integration/test_studies_upgrade.py Outdated Show resolved Hide resolved
tests/integration/test_studies_upgrade.py Outdated Show resolved Hide resolved
tests/integration/test_studies_upgrade.py Outdated Show resolved Hide resolved
tests/integration/test_studies_upgrade.py Outdated Show resolved Hide resolved
tests/integration/test_studies_upgrade.py Outdated Show resolved Hide resolved
tests/integration/test_studies_upgrade.py Outdated Show resolved Hide resolved
Copy link
Contributor

@laurent-laporte-pro laurent-laporte-pro left a comment

Choose a reason for hiding this comment

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

Peut-on supprimer le TODO ?

antarest/study/repository.py Outdated Show resolved Hide resolved
antarest/study/service.py Outdated Show resolved Hide resolved
@laurent-laporte-pro
Copy link
Contributor

laurent-laporte-pro commented Jun 5, 2024

@mabw-rte It's better to be more specific in the errors messages. For example :

if it's a raw study: "Raw Study {uuid} cannot be upgraded: it has children studies, this feature isn't supported for parent of variant" if it's a variant study: "Variant study {child_uuid} cannot be upgraded : the feature isn't supported for variant"

I'll let you correct me if there are mistakes in my suggestions.

En général, on cherche quand même à avoir des messages d'erreur assez courts, par exemple :

  • "Upgrade not supported for variant study"
  • "Upgrade not supported for parent of variants"

Ici, on dit bien que ce n'est pas supporté et on dit pourquoi.

@mabw-rte mabw-rte force-pushed the bugfix/1375-raise-exception-upgrade-unmet-requirements branch 2 times, most recently from 20fc88a to 24faa90 Compare June 5, 2024 16:17
@laurent-laporte-pro laurent-laporte-pro changed the title Bugfix/1375 raise exception upgrade unmet requirements fix(upgrade): raise HTTP exception for upgradre with unmet requirements Jun 5, 2024
@laurent-laporte-pro laurent-laporte-pro changed the title fix(upgrade): raise HTTP exception for upgradre with unmet requirements fix(upgrade): raise an HTTP exception when an upgradre has unmet requirements Jun 5, 2024
@laurent-laporte-pro laurent-laporte-pro changed the title fix(upgrade): raise an HTTP exception when an upgradre has unmet requirements fix(upgrade): raise an HTTP 417 exception when an upgradre has unmet requirements Jun 5, 2024
@laurent-laporte-pro laurent-laporte-pro changed the title fix(upgrade): raise an HTTP 417 exception when an upgradre has unmet requirements fix(upgrade): raise an HTTP 417 exception when an upgrade has unmet requirements Jun 5, 2024
@mabw-rte mabw-rte force-pushed the bugfix/1375-raise-exception-upgrade-unmet-requirements branch from 24faa90 to 038b164 Compare June 5, 2024 16:42
antarest/core/exceptions.py Show resolved Hide resolved
antarest/study/service.py Outdated Show resolved Hide resolved
antarest/study/repository.py Outdated Show resolved Hide resolved
antarest/study/repository.py Outdated Show resolved Hide resolved
@mabw-rte mabw-rte merged commit 5545e6f into hotfix/v2.17.1 Jun 5, 2024
7 checks passed
@mabw-rte mabw-rte deleted the bugfix/1375-raise-exception-upgrade-unmet-requirements branch June 5, 2024 18:06
skamril pushed a commit that referenced this pull request Jun 6, 2024
…equirements (#2047)

Context: 
This PR addresses two potential issues that can occur when upgrading
studies:
- Upgrading a variant study could potentially corrupt it.
- Upgrading a parent study that has variant children could potentially
corrupt those children.

Issue: 
At present, our system does not support the upgrade of commands, which
complicates the resolution of these issues. Until we develop a solution
for upgrading commands, this PR implements measures to prevent the two
situations mentioned above.

Solution: 
The modifications in this PR will trigger a 417 HTTP ERROR if an attempt
is made to upgrade a study that either has children or is a variant.
This is a temporary measure until we implement a solution for upgrading
commands.
MartinBelthle pushed a commit that referenced this pull request Jun 10, 2024
…equirements (#2047)

Context: 
This PR addresses two potential issues that can occur when upgrading
studies:
- Upgrading a variant study could potentially corrupt it.
- Upgrading a parent study that has variant children could potentially
corrupt those children.

Issue: 
At present, our system does not support the upgrade of commands, which
complicates the resolution of these issues. Until we develop a solution
for upgrading commands, this PR implements measures to prevent the two
situations mentioned above.

Solution: 
The modifications in this PR will trigger a 417 HTTP ERROR if an attempt
is made to upgrade a study that either has children or is a variant.
This is a temporary measure until we implement a solution for upgrading
commands.
skamril pushed a commit that referenced this pull request Jun 10, 2024
…equirements (#2047)

Context: 
This PR addresses two potential issues that can occur when upgrading
studies:
- Upgrading a variant study could potentially corrupt it.
- Upgrading a parent study that has variant children could potentially
corrupt those children.

Issue: 
At present, our system does not support the upgrade of commands, which
complicates the resolution of these issues. Until we develop a solution
for upgrading commands, this PR implements measures to prevent the two
situations mentioned above.

Solution: 
The modifications in this PR will trigger a 417 HTTP ERROR if an attempt
is made to upgrade a study that either has children or is a variant.
This is a temporary measure until we implement a solution for upgrading
commands.
skamril pushed a commit that referenced this pull request Jun 10, 2024
…equirements (#2047)

Context: 
This PR addresses two potential issues that can occur when upgrading
studies:
- Upgrading a variant study could potentially corrupt it.
- Upgrading a parent study that has variant children could potentially
corrupt those children.

Issue: 
At present, our system does not support the upgrade of commands, which
complicates the resolution of these issues. Until we develop a solution
for upgrading commands, this PR implements measures to prevent the two
situations mentioned above.

Solution: 
The modifications in this PR will trigger a 417 HTTP ERROR if an attempt
is made to upgrade a study that either has children or is a variant.
This is a temporary measure until we implement a solution for upgrading
commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end bug Something isn't working hot size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants