-
Notifications
You must be signed in to change notification settings - Fork 43
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 PF provider_server detailed diff handling #2628
Fix PF provider_server detailed diff handling #2628
Conversation
This change is part of the following stack: Change managed by git-spice. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2628 +/- ##
==========================================
+ Coverage 69.35% 69.39% +0.03%
==========================================
Files 301 301
Lines 38558 38560 +2
==========================================
+ Hits 26743 26759 +16
+ Misses 10295 10281 -14
Partials 1520 1520 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
b677d0f
to
3d1d6b5
Compare
3d1d6b5
to
e2a772c
Compare
e2a772c
to
cdb2b0f
Compare
cdb2b0f
to
b1a1cbf
Compare
2bd520a
to
02d9ef9
Compare
b1a1cbf
to
27b43ab
Compare
27b43ab
to
906cb5a
Compare
65f21fc
to
bfdda83
Compare
906cb5a
to
f7fd6eb
Compare
bfdda83
to
ad7f844
Compare
f7fd6eb
to
0dac56b
Compare
0dac56b
to
72c930a
Compare
72c930a
to
4fe072a
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.
This is code that is copied over from pulumi/.../plugin
, so I'm hesitant to change it. Can we delegate to upstream's implementation?
Also, this change needs tests in this PR. For stacked PRs, each PR still needs to be atomically OK.
We already have changes to our copy, so resolving the divergence is out of scope here. Getting rid of our copy is blocked on the config encoding work. The upstream copy does not seem to work correctly for the detailed diff either but is only used in tests. EDIT: Added some unit tests. The tests in #2629 should add quite broad coverage here. I have separated this into a different PR to make reviewing easier. |
f5786e2
to
fb926f8
Compare
4c61646
to
4acb27b
Compare
Very surprised but this seems to hold? https://github.com/search?q=org%3Apulumi%20plugin.NewProviderServer&type=code Looks like these are mostly non-production uses. |
Can you point out which line had the bug you're fixing? Very non-obvious. |
I'm inclined to get this in given your finding that this Core code is not in prod anywhere. We need to maintain a working copy then. Oof. Please address the enum cast concern the rest are nits. |
4acb27b
to
10b8e75
Compare
diffs = make([]string, len(diff.ChangedKeys)) | ||
for i, k := range diff.ChangedKeys { | ||
diffs[i] = string(k) | ||
} | ||
replaces = make([]string, len(diff.ReplaceKeys)) | ||
for i, k := range diff.ReplaceKeys { | ||
replaces[i] = string(k) | ||
} | ||
|
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 you point out which line had the bug you're fixing? Very non-obvious.
The fix is really here - diffs and replaces should be top-level keys, which we already calculate before coming here. The meat of this change is to use these instead of re-calculating these incorrectly.
@t0yv0
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.
🚢
f8aba52
to
12bb0f7
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.
Please open a bug in core so they can make this change upstream.
This change fixes an issue with the
provider_server
implementation's detailed diff handling. Previously passing a detailed diff to it would result in the previews being deleted. This is tested as part of #2629The problem was that we were re-calculating the
diffs
andreplaces
keys for the GRPC Diff protocol in theprovider_server
implementation but also doing that incorrectly. Instead this change now makesprovider_server
'smarshalDiff
just pass through thediffs
andreplaces
which we have already calculated inpulumi-terraform-bridge/pkg/pf/tfbridge/provider_diff.go
Lines 108 to 109 in 1d6b032
fixes #2620