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
Display text-based diff if yaml/json diff is semantically equal #11803
Conversation
Changelog[uncommitted] (2023-01-18)Bug Fixes
|
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.
Can we add test coverage for this?
cb6cff9
to
be6ad25
Compare
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.
LGTM
Nit: Let's try to get the correct changelog before we merge.
bors r+ |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
11803: Display text-based diff if yaml/json diff is semantically equal r=aq17 a=aq17 Fixes #11799 #9380 and #9484 introduced changes that render JSON/YAML parsable strings as objects in diffs – therefore, examples such as`"foo:\n bar: {}\n baz: {}\n"` and `"#foo\nfoo:\n bar: {}\n baz: {}\n"` are recognized as equal. This change causes the display to fall back to showing the text-based diff if the JSON/YAML rendering does not indicate any diff. It also prints all object keys even if the value is empty, i.e. `bar: {}` or `bar: ""` will be printed instead of `bar` being omitted. Co-authored-by: aq17 <aqiu@pulumi.com>
Build failed: |
bors retry |
11803: Display text-based diff if yaml/json diff is semantically equal r=aq17 a=aq17 Fixes #11799 #9380 and #9484 introduced changes that render JSON/YAML parsable strings as objects in diffs – therefore, examples such as`"foo:\n bar: {}\n baz: {}\n"` and `"#foo\nfoo:\n bar: {}\n baz: {}\n"` are recognized as equal. This change causes the display to fall back to showing the text-based diff if the JSON/YAML rendering does not indicate any diff. It also prints all object keys even if the value is empty, i.e. `bar: {}` or `bar: ""` will be printed instead of `bar` being omitted. Co-authored-by: aq17 <aqiu@pulumi.com>
Build failed: |
bors retry |
11803: Display text-based diff if yaml/json diff is semantically equal r=aq17 a=aq17 Fixes #11799 #9380 and #9484 introduced changes that render JSON/YAML parsable strings as objects in diffs – therefore, examples such as`"foo:\n bar: {}\n baz: {}\n"` and `"#foo\nfoo:\n bar: {}\n baz: {}\n"` are recognized as equal. This change causes the display to fall back to showing the text-based diff if the JSON/YAML rendering does not indicate any diff. It also prints all object keys even if the value is empty, i.e. `bar: {}` or `bar: ""` will be printed instead of `bar` being omitted. Co-authored-by: aq17 <aqiu@pulumi.com>
Build failed: |
bors retry |
Build succeeded: |
<!--- 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. -->
Fixes #11799
#9380 and #9484 introduced changes that render JSON/YAML parsable strings as objects in diffs – therefore, examples such as
"foo:\n bar: {}\n baz: {}\n"
and"#foo\nfoo:\n bar: {}\n baz: {}\n"
are recognized as equal.This change causes the display to fall back to showing the text-based diff if the JSON/YAML rendering does not indicate any diff.
It also prints all object keys even if the value is empty, i.e.
bar: {}
orbar: ""
will be printed instead ofbar
being omitted.