Skip to content
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

Add a fallback for detailed diff replace decisions to ensure detailed diff is presentation-only #2757

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

VenelinMartinov
Copy link
Contributor

@VenelinMartinov VenelinMartinov commented Dec 17, 2024

This change adds a fallback for the detailed diff replace decision. This ensures that the detailed diff is presentation only.

If we fail to identify the reason for a replace in the detailed diff calculation we mark it against __meta, similar to what we did before:

replaces = append(replaces, "__meta")

If we incorrectly identify a non-existent replace we demote it to an update/create/delete.

This is flagged behind the Accurate Previews flag.

I've stood up #2747 again as it got accidentally merged into another branch.

fixes #2674
fixes #2726

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 93.02326% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.63%. Comparing base (f2272e5) to head (3b77fce).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/tfbridge/detailed_diff.go 91.89% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2757   +/-   ##
=======================================
  Coverage   69.63%   69.63%           
=======================================
  Files         302      302           
  Lines       38736    38775   +39     
=======================================
+ Hits        26972    27001   +29     
- Misses      10247    10256    +9     
- Partials     1517     1518    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -900,7 +900,7 @@ func TestUnknownCollectionForceNewDetailedDiff(t *testing.T) {
runTest(t, program2, autogold.Expect(`
+ prov:index/aux:Aux: (create)
[urn=urn:pulumi:test::test::prov:index/aux:Aux::auxRes]
+-prov:index/test:Test: (replace)
~ prov:index/test:Test: (update)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that TF is optimistic about replacing ForceNew properties with unknown and we were being pessimistic. This change ensures we match TF and ForceNew proeprties replaced with unknowns are now predicted NOT to cause a replacement.

We can add a workaround if we disagree here.

@VenelinMartinov
Copy link
Contributor Author

I've stood up #2747 again as it got accidentally merged into another branch.

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that I reviewed another version of this PR already.

Base automatically changed from vvm/pf_tests_disable_accurate_previews to master December 17, 2024 14:28
@VenelinMartinov VenelinMartinov merged commit 6f2c424 into master Dec 17, 2024
17 checks passed
@VenelinMartinov VenelinMartinov deleted the vvm/detailed_diff_replace_fallback2 branch December 17, 2024 14:33
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.99.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants