-
-
Notifications
You must be signed in to change notification settings - Fork 189
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: delete conditionally created file when answer changes #982
fix: delete conditionally created file when answer changes #982
Conversation
Codecov Report
@@ Coverage Diff @@
## master #982 +/- ##
==========================================
- Coverage 96.41% 96.27% -0.15%
==========================================
Files 43 43
Lines 3317 3352 +35
==========================================
+ Hits 3198 3227 +29
- Misses 119 125 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hello @sisp, thanks for the great work you're doing on this project 🚀 ! Your changes sound good to me. Would you also update the Mermaid diagram in the docs? |
Thanks for the praise, @pawamoy! 🙏 I've updated the diagram and added a step index (e.g. While changing the diagram, I decided to move step 4 (computing the diff) up and perform it after step 1 because it's clearer that computing the diff doesn't depend on answer migration. Also, the diagram becomes easier to read because there are fewer jumps when following the order of the steps. This change is a no-op. |
Just checked the diagram, nice! Copier has a complex update process but with a bit of focus the diagram is perfectly readable 👍 |
I just resolved a merge conflict with |
Sorry I had to do an important fix in #1068. Could you solve conflicts again please? |
I fixed another problem in #1072 with an approach similar to yours. That does include a test that was failing. Could you check after rebasing on top of that (once it gets merged)? |
That's great! I spent quite some time verifying that the recent fixes also fix this issue as a side effect. I suspected some missing edge case when answering interactively during the update process and extended the test case accordingly, but it looks like everything works fine now. Also, to the best of my knowledge the workflow diagram does not need to be changed anymore because there don't seem to be any changes in the workflow at the abstraction level of the diagram. So I reverted that change. As it turns out, this PR now only adds a test case. You'll need to adjust the commit message accordingly. I followed your example in #1072 and parametrized the test case to cover both interactive and non-interactive answering instead of creating a second test case for interactive answering in |
As an exception I kept the |
I've fixed the
copier update
behavior to remove a conditionally created file when the answer changes such that the file would not be created anymore.To achieve this behavior, I needed to change the update workflow a little.
Before:
--data
/--defaults
flags are passed accordingly.After:
--data
/--defaults
flags are passed accordingly, thus, changes in the questionnaire can be addressed by explicit new answers.This workflow seems to work according to the test suite, but the (modified) implementation in
main.py::Worker._apply_update(...)
is a bit hacky and might need some refactoring. For instance, blocks likeor
don't feel right, but I think some more fundamental refactoring is needed to improve them. I'd postpone it to a follow-up PR to keep the scope of this PR small and ship improvements more quickly.
Fixes #686. Related to #619.
/cc @pawamoy