-
Notifications
You must be signed in to change notification settings - Fork 11
Fix deployment of changes that include modification of mappings #870
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
Conversation
… modifications of mappings in configuration file
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #870 +/- ##
==========================================
+ Coverage 49.77% 50.39% +0.62%
==========================================
Files 24 24
Lines 3281 3272 -9
==========================================
+ Hits 1633 1649 +16
+ Misses 1648 1623 -25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Unfortunately this seems to break items being deleted at the same time as their mappings in a pull. I tried a pull where 1 LUT was added alongside a new trivial mapping (LUT, *, lut/) and it seemed fine, the LUT was imported. I then externally deleted the LUT and the mapping and pulled that, it could not determine the internal name of the LUT and did not delete it. (for the record the error was It would seem that the old mappings may be required to correctly handle deletes. These did previously work but now the problem has perhaps just been shifted from adding to deleting. The apparent complexity here in potentially needing both sets of mappings to handle deletes and adds in the same pull is part of what motivated #865 which attempts to extend the existing behaviour of CLS and INC files (possibly others too) in not needing mappings at all to determine their internal name, to more file types (HL7 and LUT). |
You're right, it doesn't make sense to have that behavior inconsistent for CLS/INC and HL7/LUT. I will review your change #865. I'd still like to merge this PR as well because it makes the behavior more logical for other item types. For example if I add a new CSP application. |
Merging this PR will still break deletes though. #865 relies on being able to read the file which is only possible when it is being added, so it only helps when it is adding that is not working. |
I might argue that the new behavior with deletes is better. Removing the mapping for LUT means I no longer want look-up tables to be controlled by Git at all. If I want Embedded Git to delete all the LUTs, I would keep the mapping and delete all the files. Does that sound reasonable? |
I think the scenario of deleting an item and it's mapping with the intention of the item then still existing and subsequently being managed without Embedded Git is likely to be uncommon. There are other scenarios that I suspect are more common where the new deleting behaviour results in a regression that is (in my opinion) highly undesirable. Switching branches is one such example. If one branch has a new mapping and corresponding item, then switching to another branch that does not have them currently results in the new item being deleted. However, with this PR the item will no longer be deleted which I think would almost always be undesirable and unexpected. I personally switch branches all of the time, such as when reviewing the work of others and would not like new items to stick around after I switch away from a branch just because the next branch does not (yet) have a new mapping from some new work. Another example is where an item is deleted with the specific intent of it going away (i.e. the user actually really wants it deleted), then in a later separate commit (e.g. a week later) the corresponding mapping is then deleted too as it may be considered no longer in use by that point. If someone were to do a pull after all of this then it would not at that point in time be able to be distinguished from the situation of someone deleting the item and mapping at the same time with the intention of them remaining and being managed without Embedded Git. I think that the former case, deleting an item so that it's gone/deleted, is probably more likely. There's also the problem here that if another different team member did pulls more frequently, then they would have the item deleted, then in a later pull have the mapping removed (with nil effect otherwise as they have the item deleted already) so different team members could have different end results (one still has the item, the other does not) after pulls depending on when or how often they do them. I think this would be confusing for users and difficult to anticipate and work with, even being aware of it. Irrespective of the above, this PR does break deleting in such a way that the pull handler output is inaccurate and difficult to make sense of. The following is an example with this PR code of switching from one branch (that has 1 new LUT and mapping) to a second branch that does not have them:
In summary, I would very much prefer a fix for #864 that does not break the existing behaviour around deleting items. I concede that #865 is deficient (at least long term) in that it doesn't handle CSP applications at all (I don't currently use them with Git but imagine they're certainly not uncommon) or any other types at all beyond HL7/LUT. I'm not entirely certain what the best approach might be at this stage to have both adds and deletes working, though I wonder if a 2 pass pull event handler approach might work without requiring too much custom logic within pull handlers (and avoiding making them harder for anyone to implement their own), perhaps something like the following:
|
Fair enough, I appreciate the detailed argument and I certainly don't want to break a workflow you're already relying on. I'm going to close this out without merging. |
Fixes #864
Previously internal names for items in a deployment were all calculated at once before the import. Now they are lazily calculated when we import the individual item. Since we deploy changes to the configuration file first, this means changes to mappings are correctly taken into account.