-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
JSON diffs don't pretty print for nested properties #13981
Comments
I believe this change #11803 introduced a bug where the json diff is never reached because the string comparison before it will cause it to always print the string diff. Someone who is less green with go can correct me if I am wrong but if I am understanding this correctly, it might make more sense to implement this later in the function: if diff == nil {
if old != new {
p.printTextDiff(strconv.Quote(old), strconv.Quote(new))
return true
}
p.withOp(deploy.OpSame).printPropertyValue(oldValue)
return true
} |
I don't think that's a bug, looks like #11803 is doing what it was intended to do. There is no semantic JSON diff between the text strings so it shows the text diff instead. This behaviour was suggested by @lukehoban at #11799 (comment) because the original behaviour was confusing but clearly this current style is also confusing just in a different way. Maybe something as simple as prefixing it with "(json equivalent, showing text diff)" would help? |
I just read that thread, I agree with the logic. I am just not convinced the json diff is getting printed with priority which makes the previews we get from this for large policy changes next to useless.
I think that would help in the case it is just a diff in the input vs stored text in state but I think we are talking about different things here? |
Yeh ok that's clearly bugged then. I think your assessment that #11803 broke it is correct. |
We are hitting a similar issue. Is there any plan to pick this up/revisit?
|
<!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Fixes #13981. This regressed in #11803. I've added tests to this PR to show both the value diffing and text diffing for when the JSON/YAML string is different but the values are the same. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
What happened?
We made some changes in #5831 whereby we pretty print JSON diffs for things like IAM roles to help with debugging.
However, this doesn't appear to work for nested properties, specifically for an AWS ECS Task Definition with a nested container definition, see the attached screenshot
Example
**
![CleanShot 2023-09-18 at 11 26 36](https://private-user-images.githubusercontent.com/1622940/268739621-7bb6344c-334b-4042-95c1-85464e405c0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNzgzNzgsIm5iZiI6MTcxOTA3ODA3OCwicGF0aCI6Ii8xNjIyOTQwLzI2ODczOTYyMS03YmI2MzQ0Yy0zMzRiLTQwNDItOTVjMS04NTQ2NGU0MDVjMGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjJUMTc0MTE4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjQ5ODYxNzhjNjJiODMxYTI4MzVmMDA0NmRkMzNkNjlhNmZjNjBiNTc4MGViODc0MTZjYmQ1NGJmN2UzY2MxMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ._pQcDcTs3dHoiLXDSoFSlDgz54ono2tHthx0lEc0W7Y)
**
Output of
pulumi about
N/A
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: