-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Made template diffing a bit smarter. #11378
Conversation
Previously templates diff always showed up as delete & add. The new code always diffs if there is only one template and if there are multiple templates it uses DestPath as unique identifier (this works because nomad checks that this is actually unique).
c0d644a
to
16dd186
Compare
Nice! Thanks for catching this 🙂 Looking at the new code and the previous code, they both seem very similar, so I thought that maybe the issue is that the current So I prototyped this approach where the function can receive another helper function that returns that unique ID value for each object: 6930f37 I added your updated test case to that commit as well. I'm waiting on the full CI to run to make sure I didn't break anything, but at least the This approach could also help us improve other blocks, like What do you think of this approach? |
+100 I didn't know how many changes would be accepted so I stayed in line with what the file was using till now. But your approach can hopefully clean up that file a bit 😃 feel free to force push over my PR or close it if you wish to push your changes in a new one.
…On Wed, Oct 27, 2021, at 01:44, Luiz Aoqui wrote:
Nice! Thanks for catching this 🙂
Looking at the new code and the previous code, they both seem very
similar, so I thought that maybe the issue is that the current
`primitiveObjectSetDiff` function is hard coded to always use the
object hash. But as you've correctly pointed out, there are some blocks
that actually have some kind of unique ID.
So I prototyped this approach where the function can receive another
helper function that returns that unique ID value for each object:
6930f37
<6930f37>
I added your updated test case to that commit as well. I'm waiting on
the full CI to run to make sure I didn't break anything, but at least
the `TestTaskDiff` passed locally 😄
This approach could also help us improve other blocks, like `artifact`,
which I suspect suffers from the same issue.
What do you think of this approach?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11378 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAT5C22HAJB4IQV23D3RMLUI44NHANCNFSM5GSCWYUQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Cool, since you don't mind I will close this and raise a new one. Last time I caused a bit of confusion by approving and merging my own code 😅 Thanks so much for raising this! |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Previously templates diff always showed up as delete & add. The new code
always diffs if there is only one template and if there are multiple
templates it uses DestPath as unique identifier (this works because
nomad checks that this is actually unique).
@lgfa29 This is similar to the service diffing PR of mine that you reviewed. But this one is massively easier since
DestPath
has to be uniqe.