-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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: create and delete feed changes #3476
Conversation
… production if feed was deleted
NV-2347 Create Feed changes tests
Create and then delete feed creates two changes to promote, depending on the order of promotion the deleted feed will be created in prod with no option of deleting it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one concern about the logic.
if (command.item.deleted) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it doesn't make sense to have it here. If the item passed in the command has the deleted property, it will come already so we can check it and do the early return before even we do the repository call, saving one hit to the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is to handle the case of a promotion of a delete that does not yet exists in prod. Meaning -> created, deleted and only then promoted.
If the first call finds it in prod(created->promoted->deleted->promoted), it will not get to this check and will delete it from prod at the end of this file. If doesn't find it in prod and not deleted now -> will create it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But for the case you mention I would expect item.deleted
to not be set. If it is passed I think something would be very wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why wouldn't it be set ? I don't think I follow @p-fernandez
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that item is the prod feed and command.item is the dev feed.
Say a feed was created in dev, then deleted in dev. Then promoted.
The command.item is the aggregated item of all changes in dev-> which means that command.item should also have the deleted flag.
It looks for the feed in prod, which doesn't exist - as it was never created. And then if the promotion is of a feed that was deleted anyway - there is no reason to do anything for prod env.
But I might be missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this changes things a bit. I would rename item to productionItem
as from the variables we have no way to know that we are looking for an item in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟
if (command.item.deleted) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this changes things a bit. I would rename item to productionItem
as from the variables we have no way to know that we are looking for an item in production.
What change does this PR introduce?
create and then delete feed creates two changes to promote, depending on the order of promotion the deleted feed will be created in prod with no option of deleting it.
Why was this change needed?
Other information (Screenshots)