Repository navigation
feat(proto)!: keep unknown State/Resource fields - #65
Merged
Merged
Conversation
Two lockfile updates merged without a rebase left entries that name syn 3.0.4, a version the lockfile no longer has. Cargo rewrote them on every build, and cargo build --locked failed. Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
jonasz-lasut
force-pushed
the
feat/keep-unknown-fields
branch
from
November 19, 2026 08:39
43d5434 to
c555d88
Compare
prost discards fields it does not know, so a function built on this SDK stripped any field a newer Crossplane adds to the desired state it copies forward with response::to. function-sdk-go keeps such fields. Write State and Resource by hand with a prost::Message impl that decodes and encodes known fields as the generated one does, keeps unknown fields, and writes them back on encode. Codegen skips both messages through extern_path and initializes the new field in their serde constructors. BREAKING CHANGE: State and Resource have a new public unknown_fields field. Struct literals and patterns that list every field no longer compile; add ..Default::default() or `..`. Their Debug output includes unknown_fields. Fixes #31 Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
jonasz-lasut
force-pushed
the
feat/keep-unknown-fields
branch
from
November 19, 2026 08:50
c555d88 to
5870678
Compare
jonasz-lasut
marked this pull request as ready for review
November 19, 2026 08:59
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.
StateandResourceare now written by hand insdk/src/proto/state.rs, with aprost::Messageimpl that keeps fields it doesn't know and writes them back on encode. A field a newer Crossplane adds to desired state then passes throughresponse::toas it does in function-sdk-go. Codegen skips both messages withextern_pathand initializes the newunknown_fieldsfield in their generated serde constructors. The tests compare the hand-written encoding with prost-derived copies of both messages, and one fails when the vendored proto changes either message.This is a breaking change, so the next release is 0.5.0: a
StateorResourcestruct literal that lists every field needs..Default::default(), and theirDebugoutput includesunknown_fields.The first commit fixes two
Cargo.lockentries that namedsyn 3.0.4, a version the lockfile no longer has.cargo build --lockedfailed on main because of them.Fixes #31