Repository navigation
fix(deps): update module github.com/jhump/protoreflect to v2 - #368
Open
renovate-bot wants to merge 1 commit into
Open
renovate-bot wants to merge 1 commit into
renovate-bot wants to merge 1 commit into
Conversation
ℹ️ Artifact update noticeFile name: go.modIn order to perform the update(s) described in the table above, Renovate ran the
Details:
|
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.
This PR contains the following updates:
v1.17.0→v2.0.0Release Notes
jhump/protoreflect (github.com/jhump/protoreflect)
v2.0.0: Version 2.0.0Compare Source
This is the first formal v2 release of this module! 🎉
If you are coming from v1, see the v2.0.0-beta.2 release notes for a summary of what changed between v1 and v2: many packages have moved and some have been removed (no longer necessary, since that functionality now lives in the core Protobuf runtime,
google.golang.org/protobuf). The notes below describe all of the changes since that beta.When we released the beta, we said we would make a proper release once we had more test coverage. That is what most of the work since then has been: a massive backfill of tests across every package in this module. Unsurprisingly, the new tests turned up quite a few bugs, including some deadlocks and hangs, all of which are fixed in this release.
This backfill of tests also turned up some rough edges in the APIs. Since this is the last chance to make backwards-incompatible changes before committing to a stable v2 API, we took the opportunity to fix those, too. While we were at it we also decided to rename some things to be more idiomatic Go (such as changing
Rpc,Json, andApitoRPC,JSON, andAPI). So if you have been using the beta, expect to update a few call sites. Most of the incompatible changes are simple renames,. All breaking changes are called out below.Note that this module now requires Go 1.26 or higher. That is the same minimum version supported by the Go team (as of this writing).
"github.com/jhump/protoreflect/v2/grpcdynamic"
Changes/fixes:
Stubhave been renamed:InvokeRpc,InvokeRpcServerStream,InvokeRpcClientStream, andInvokeRpcBidiStreamare nowInvokeRPC,InvokeRPCServerStream,InvokeRPCClientStream, andInvokeRPCBidiStream.InvokeRPCServerStreamwould return a bareio.EOF. It now returns the call's actual status error."github.com/jhump/protoreflect/v2/grpcreflect"
Changes/fixes:
Errormethod ofProtocolErrornow has a pointer receiver, so aProtocolErrorvalue no longer implementserror. The client always returned pointers (*ProtocolError) anyway, so if you were checking for them witherrors.As, you're likely already using a*ProtocolErrortarget. If not, that was a bug in your calling code which this release will force into the right shape.Client.AsResolver()returned the client's own error type when an element was not found. But the core Protobuf runtime requires resolvers to return exactlyprotoregistry.NotFound. So using this resolver to unmarshal messages that had unknown extensions failed, as did using it withprotodesc'sAllowUnresolvableoption. This has been fixed. (The methods ofClientstill return more detailed errors.)protoresolve.ErrNotFoundwhen checked witherrors.Is.AsResolver()now honors theWithFallbackResolversoption, andAllExtensionNumbersForTypenow consults the fallback resolvers when the server does not know the type.ErrorResponsefrom the server with a code of zero (which is "OK") would result in a nil error. It is now treated as an "Unknown" error code.Clienthas been fixed.Client.Resetcould hang forever waiting for the server. This has been fixed."github.com/jhump/protoreflect/v2/protobuilder"
Changes/fixes:
RpcType,RpcTypeMessage, andRpcTypeImportedMessagehave been renamed toRPCType,RPCTypeMessage, andRPCTypeImportedMessage. Also, theJsonNamefield andSetJsonNamemethod ofFieldBuilderhave been renamed toJSONNameandSetJSONName.From*functions for elements other than files, likeFromMessage, copy the element's entire file. So callingFromMessagefor two messages in the same file results in two copies of that file. Identical copies of a file can now be used in the same build. But if the copies differ, such as when they've been modified in different ways, building still fails. In that case, the error now suggests the right approach: useFromFileand then the newFileBuilder.FindElementmethod (see below).Build()now returns errors, instead of panicking, for fields, oneofs, methods, and enum values that do not have a parent, and for methods that are missing a request or response type.TryAddOneOffails and must roll back, when moving a field into a oneof in its own message (which panicked), and when adding a field to a oneof that has no parent. Also, options on group types are now considered when computing a file's imports.Clonefunction instead (see below).Additions:
Clonemethod, which makes a deep copy of the builder, including all of its descendants. There is also a genericClonefunction, which returns the same type as its argument (soprotobuilder.Clone(msgBuilder)returns a*MessageBuilder). This makes it easy to put the same element in two places. Adding a builder to a new parent moves it, so adding a single builder to two different parents does not work; add a clone to one of them instead.FileBuilderhas a newFindElementmethod, which finds an element in the file by its fully-qualified name. Unlike theGet*methods, which only return immediate children, this searches all descendants of the file. To get builders for several elements in the same file, useFromFileand then use this method to find each element."github.com/jhump/protoreflect/v2/protodescs"
Changes/fixes:
SortFileswas broken: instead of sorting the given files, it produced an empty result. This also affectedprotoresolve.FromFileDescriptorSet, which uses the same implementation. This has been fixed.SortFilesnow returns an error if the files have an import cycle (including a file that imports itself), leaves the given slice unchanged when it returns an error, and produces a deterministic order."github.com/jhump/protoreflect/v2/protomessage"
Changes/fixes:
Walknow stops if the callback returns false for the root message.Asnow recognizes extensions that are set on nested messages.ReparseUnrecognizednow only returns true if something was actually recognized."github.com/jhump/protoreflect/v2/protoprint"
Changes/fixes:
3.14instead of3.140000), and infinity and NaN are printed asinf,-inf, andnan.Printerand the options of the descriptors being printed. It no longer does, so it is now safe to use aPrinterfrom multiple goroutines."github.com/jhump/protoreflect/v2/protoresolve"
Changes/fixes:
FindMessageByURL, now set theURLfield ofErrUnexpectedTypeand leaveNameempty, as the docs for those fields indicated. Also, theActualfield is now correctly populated.*ErrUnexpectedType, instead of some other error, fromFindExtensionByNamewhen the given name refers to a normal field and not an extension.String()on aTypeKindthat had more than one bit set would loop forever. This has been fixed. Multiple kinds are listed in the order of their constants, likemessage,enum,extension.FromFilesnow copies the given files, instead of sharing their internal maps. It also now detects conflicting extensions across files.file "x" already registered. Also, a single file that defines multiple extensions with the same extendee and number is now rejected.FromFileDescriptorSetwhen a file can't be registered now readsregister "x.proto": ..., instead of including the entire descriptor proto.Registry.RegisterFileProtono longer modifies the given proto if registration fails.CombineandCombinePoolscould report duplicates, stop early, or ignore the callback's signal to stop. These have been fixed."github.com/jhump/protoreflect/v2/protoresolve/remotereg"
Changes/fixes:
HttpTypeFetcherhas been renamed toHTTPTypeFetcher.DescriptorConverter.DescriptorAsApihas been renamed toDescriptorAsAPI.includeSubPackagesparameter ofRegisterPackageBaseURLhas been removed. A registration now always applies to sub-packages, too (when multiple apply, the one for the nearest ancestor package wins). A value offalsewas previously silently ignored anyway.parLimitparameter forHTTPTypeFetchernow means no limit if zero or less. Previously, such a value caused all fetches to hang forever.RegisterPackageBaseURLwould deadlock whenever the given package did not already have a registration. This has been fixed.TypeFetcherdoes not have a type but theFallbackresolver does, the fallback's descriptor is now cached under the type's URL, so later lookups don't query the fetcher again.CachingTypeFetcherhave been fixed: if one caller's context was cancelled, other callers waiting on the same fetch would fail; waiting callers ignored their own contexts; and a panic during a fetch could poison the cache."github.com/jhump/protoreflect/v2/sourceinfo"
Changes/fixes:
Files.FindFileByPathandFiles.FindDescriptorByNamewould return an error. They now return the plain descriptor instead, like all of the other methods ofFilesandTypesalready did. (TheAddSourceInfoTo*functions still return such errors.)Range*methods has been fixed.v1.19.0Compare Source
This point release addresses a potential issue identified here: GHSA-mm34-2v69-6vg6
"github.com/jhump/protoreflect/dynamic"
Changes/fixes:
dynamic.Message, when unmarshaling untrusted input or when marshaling a message that contains a reference cycle. A mitigation has been added for all three formats: binary, text, and json.*dynamicpb.Message(the dynamic message implementation added to the core runtime in API v2).Additions:
ToDynamicPBmethod todynamic.Message, to aid with users migrating to API v2 and to work around interop issues with API v2'sprototextandprotojsonpackages.v1.18.1Compare Source
This point release addresses a potential issue identified here: GHSA-4qcm-mfjx-j36w
"github.com/jhump/protoreflect/grpcreflect"
Changes/fixes:
v1.18.0Compare Source
This is expected to be the final release of this module with a v1.x version. (All subsequent releases are expected to be v2.x.)
The main change here is to insulate users from any future backwards-incompatible changes in
bufbuild/protocompile. Previous releases (between 1.15 and 1.17, inclusive) depended on this module, but it hasn't yet released a stable v1.0 version, so it has occasionally been a turbulent dependency. More breaking changes are expected since it is expected to get a totally new compiler and API before it reaches v1.0. So anyone still using v1 of this repo should update to this new release before then to avoid being broken when that happens."github.com/jhump/protoreflect/desc/builder"
Changes/fixes:
protoc-gen-go, a nil-dereference panic could occur. This has been fixed. Instead, the legacy extension that would otherwise have caused a panic will now either be ignored or, ifBuilderOptions.RequireInterpretedOptionsis set to true, result in an error that not all options could be interpreted."github.com/golang/protobuf/protoc-gen-go". It was replaced in 2020 by the v2, which is at path"google.golang.org/protobuf/cmd/protoc-gen-go"."github.com/jhump/protoreflect/desc/protoparse"
Changes/fixes:
bufbuild/protocompile, which will maintain stability even when the upstream repo diverges with unstable/breaking changes. The only user-visible changes would be related to Editions support, thanks to unreleased changes in upstream that were included in this repo's fork. (See more below.)Additions:
AllowExperimentalEditionsto theprotoparse.Parserstruct. When set to true, the parser will accept and return descriptors for files that use Edition 2024 (the only experimental edition at this time). It is experimental because it does not implement all of the rules and semantics of Edition 2024. But it does provide the ability to parse and compile files that include new language features in Edition 2024, such as visibility modifiers (exportandlocal) as well as theoptionimport modifier."github.com/jhump/protoreflect/desc/protoprint"
Changes/fixes:
protoc-gen-go, a nil-dereference panic could occur. This has been fixed. Instead, the legacy extension that would otherwise have caused a panic is ignored and will not be included in the printed output (since it would result in an invalid source file that could not be compiled).Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.