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(dossier): on fork merge, always remove previous champ version #11144

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

tchak
Copy link
Member

@tchak tchak commented Dec 16, 2024

Si le type_de_champ d'un champ se désynchronise avec son type, le champ persisté ne fera pas partie de la collection filled_champs. Dans le code de merge des fork, nous devons supprimer le champ précédent, sans tenir compte de son type. Le problème aurait dû être détecté plus tôt, mais notre index unique n'est pas réellement unique parce que notre version de PG ne prend pas en charge NULLS NOT DISTINCT. L'index unique ne fonctionne que pour les champs dans les répétitions.

https://demarches-simplifiees.sentry.io/issues/6122522207/events/068fb3ab31a14bc1aaf23c5d9cf036af/

If champ type_de_champ gets out of sync with its type, the persisted champ will not be part of the filled champs collection. In the merge code, we need to remove the previous champ, disregarding its type. The problem should have been caught earlier, but our unique index is not actually unique because our version of PG misses `NULLS NOT DISTINCT`. The unique index only works for champs in repetitions.
@tchak tchak added the bug label Dec 16, 2024
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.47%. Comparing base (a6f39b3) to head (dc5bfb8).
Report is 85 commits behind head on main.

Files with missing lines Patch % Lines
...ntenance/t20241216remove_non_unique_champs_task.rb 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11144      +/-   ##
==========================================
- Coverage   84.48%   84.47%   -0.02%     
==========================================
  Files        1186     1187       +1     
  Lines       26240    26250      +10     
  Branches     4946     4948       +2     
==========================================
+ Hits        22170    22175       +5     
- Misses       4070     4075       +5     

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

@tchak tchak added this pull request to the merge queue Dec 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 17, 2024
@colinux colinux added this pull request to the merge queue Dec 17, 2024
Merged via the queue into demarches-simplifiees:main with commit bd90a79 Dec 17, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Communiqué, ou a ne pas communiqué
Development

Successfully merging this pull request may close these issues.

3 participants