Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Fix Elixir 1.20 compiler warnings and upgrade dependencies#539

Open
gilbertwong96 wants to merge 4 commits into
elixir-grpc:masterfrom
gilbertwong96:fix/elixir-1.20-warnings-and-dep-upgrades
Open

Fix Elixir 1.20 compiler warnings and upgrade dependencies#539
gilbertwong96 wants to merge 4 commits into
elixir-grpc:masterfrom
gilbertwong96:fix/elixir-1.20-warnings-and-dep-upgrades

Conversation

@gilbertwong96

Copy link
Copy Markdown

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 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 value

2. Switch to local path dependencies

grpc and grpc_server now use path: "../grpc_core" instead of the 1.0.0-rc.1 hex 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 original mix.exs.

3. Upgrade dependencies

Dep Before After
castore 1.0.16 1.0.19
cowboy 2.14.2 2.16.0
cowlib 2.16.0 2.17.1
ex_doc 0.39.1 0.40.3
jason 1.4.4 1.4.5
makeup_syntect 0.1.3 0.1.4
mint 1.7.1 1.9.0
protobuf 0.15.0 0.17.0
telemetry 1.3.0 1.4.2

gun is intentionally kept at 2.2.0 (not 2.4.0) because 2.4.0 added strict HTTP header value validation that rejects the term_to_binary payload used in server_test.exs exception_log_filter tests.

4. Code migrations for the upgrades

  • Protobuf.Decoder.decode/2Protobuf.decode/2 in grpc_core/lib/grpc/codec/web_text.ex and grpc_server/lib/grpc/protoc/cli.ex (protobuf 0.17 made the former private)
  • conn.window_sizeconn.send_window_size in the mint connection-process test (mint 1.9 split the single window_size field). Production code was unaffected — it uses the public Mint.HTTP2.get_window_size/2 API which is unchanged.

Test results

grpc_core:   96 passed  (6 doctests,  90 tests)
grpc_server: 192 passed (2 doctests, 190 tests)
grpc:        309 passed (10 doctests, 299 tests)
Total:       597 passed

One remaining item

grpc/test/grpc/integration/stub_test.exs:145 deliberately passes nil to Helloworld.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 a FunctionClauseError and passes at runtime. This warning does not fire when --warnings-as-errors is passed (the test is excluded by test_helper.exs), so CI is unaffected.

- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant