Repository navigation
Convert private state types to use common state get/set logic - #1367
Open
chrismarget-j wants to merge 7 commits into
Open
chrismarget-j wants to merge 7 commits into
chrismarget-j wants to merge 7 commits into
Conversation
chrismarget-j
force-pushed
the
1362-convert-private-state-objects-to-use-a-centralized-marshaler
branch
2 times, most recently
from
November 15, 2026 23:10
30ac6b1 to
8fee416
Compare
chrismarget-j
force-pushed
the
1362-convert-private-state-objects-to-use-a-centralized-marshaler
branch
2 times, most recently
from
November 16, 2026 19:08
da23d36 to
13a3f73
Compare
Base automatically changed from
1361-virtual-network-resource-fails-to-record-dchpenabled-correctly
to
main
November 16, 2026 19:09
chrismarget-j
force-pushed
the
1362-convert-private-state-objects-to-use-a-centralized-marshaler
branch
from
November 16, 2026 19:09
13a3f73 to
999d599
Compare
rajagopalans
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to this PR, structs which represented private state data implemented the following interface which defined functions that read and write the struct value to and from private state:
Those functions rely on a fixed key, often hard-coded into the implementation of the interface.
Newer implementations of the interface used reflection to derive a key based on their type name. So the data from
private.Somethingwould be read and written using the key"private.Something".Each type wound up implementing more-or-less the same logic in the
SetPrivateState()andLoadPrivateState()functions.This PR centralizes that logic into new
unexpectedun-exported functionsprivate.setPrivateState()andprivate.loadPrivateState()to which the various structs now pass themselves. This approach ensures consistent keying and prevents accidental derivation of a pointer-based key name like*private.Something.To support migration from the legacy functions which used a hard-coded key, both
setPrivateState()andloadPrivateState()allow a legacy key to be passed via a variadic (used to effect "optional") function parameter. When the legacy key string is passed,setPrivateState()writes the data to both locations in private state.loadPrivateState()reads the legacy key first, and falls back to the preferred key for forward compatibility with a provider which has removed legacy support.At some point in the future, we'll complete the migration by deprecating the old key and removing the data stored using it.
Closes #1362