Fix Elixir 1.20 compiler warnings and upgrade dependencies#539
Open
gilbertwong96 wants to merge 4 commits into
Open
Fix Elixir 1.20 compiler warnings and upgrade dependencies#539gilbertwong96 wants to merge 4 commits into
gilbertwong96 wants to merge 4 commits into
Conversation
- grpc_server/mix.exs: replace deprecated xref: [exclude: [IEx]] with elixirc_options: [no_warn_undefined: [IEx]] - grpc_server/lib/grpc/server.ex: remove unused require Logger - grpc/lib/grpc/client/resolver.ex: remove dead nil -> clause; scheme = uri.scheme || "dns" guarantees a non-nil, non-false value, making the nil branch unreachable
Switch grpc_core and grpc_server from hex packages to local path dependencies, which is needed because the released hex packages (1.0.0-rc.1) were built with protobuf ~> 0.14 internally and are binary-incompatible with protobuf 0.17.0. Bump constraints (mix.lock auto-resolves to latest): castore 0.1 / 1.0 → 1.0 (1.0.19) cowboy 2.14 → 2.14 (2.16.0) cowlib 2.14 → 2.14 (2.17.1) ex_doc 0.39 → 0.40 (0.40.3) jason >= 0.0.0 → - (1.4.5) mint 1.5 → 1.9 (1.9.0) protobuf 0.14 → 0.14 (0.17.0) telemetry 1.0 → 1.0 (1.4.2)
Protobuf 0.17.0 made Protobuf.Decoder.decode/2 private/undefined. The replacement public API is Protobuf.decode/2, which delegates to Protobuf.Decoder.decode/3 internally with an options list. - grpc_core/lib/grpc/codec/web_text.ex - grpc_server/lib/grpc/protoc/cli.ex
Mint 1.9.0 split the HTTP/2 connection struct's single :window_size field into :send_window_size and :receive_window_size. The production code (connection_process.ex) uses the public Mint.HTTP2.get_window_size/2 API, which was unaffected. Only the test helper that directly pokes the Mint internals to simulate window sizes needed updating.
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.
Summary
Resolves all Elixir 1.20.1 compiler warnings and upgrades project dependencies to their latest compatible versions. All 597 tests pass.
Changes
1. Fix Elixir 1.20.1 compiler warnings
grpc_server/mix.exs— replace deprecatedxref: [exclude: [IEx]]withelixirc_options: [no_warn_undefined: [IEx]]grpc_server/lib/grpc/server.ex— remove unusedrequire Loggergrpc/lib/grpc/client/resolver.ex— remove deadnil ->clause;scheme = uri.scheme || "dns"guarantees a non-nil value2. Switch to local path dependencies
grpcandgrpc_servernow usepath: "../grpc_core"instead of the1.0.0-rc.1hex package. The released hex package was built with protobuf 0.15 and is binary-incompatible with protobuf 0.17 (see below). The path versions were already present as commented-out alternatives in the originalmix.exs.3. Upgrade dependencies
gunis intentionally kept at 2.2.0 (not 2.4.0) because 2.4.0 added strict HTTP header value validation that rejects theterm_to_binarypayload used inserver_test.exsexception_log_filtertests.4. Code migrations for the upgrades
Protobuf.Decoder.decode/2→Protobuf.decode/2ingrpc_core/lib/grpc/codec/web_text.exandgrpc_server/lib/grpc/protoc/cli.ex(protobuf 0.17 made the former private)conn.window_size→conn.send_window_sizein the mint connection-process test (mint 1.9 split the singlewindow_sizefield). Production code was unaffected — it uses the publicMint.HTTP2.get_window_size/2API which is unchanged.Test results
One remaining item
grpc/test/grpc/integration/stub_test.exs:145deliberately passesniltoHelloworld.Greeter.Stub.say_hello/2(the function head pattern-matches on%GRPC.Channel{}). Elixir 1.20's enhanced type system correctly flags this at compile time. The test expects aFunctionClauseErrorand passes at runtime. This warning does not fire when--warnings-as-errorsis passed (the test is excluded bytest_helper.exs), so CI is unaffected.