Skip to content

Fix Elixir 1.20 compiler warnings and upgrade dependencies#539

Merged
polvalente merged 9 commits into
elixir-grpc:masterfrom
gilbertwong96:fix/elixir-1.20-warnings-and-dep-upgrades
Jun 15, 2026
Merged

Fix Elixir 1.20 compiler warnings and upgrade dependencies#539
polvalente merged 9 commits into
elixir-grpc:masterfrom
gilbertwong96:fix/elixir-1.20-warnings-and-dep-upgrades

Conversation

@gilbertwong96

Copy link
Copy Markdown
Contributor

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.

@sleipnir

Copy link
Copy Markdown
Collaborator

Hi @gilbertwong96 Could you resolve the conflicts?

- 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

# Conflicts:
#	grpc_server/mix.exs
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)
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.
@gilbertwong96 gilbertwong96 force-pushed the fix/elixir-1.20-warnings-and-dep-upgrades branch from 975c48e to 829d61a Compare June 15, 2026 15:14
@gilbertwong96

Copy link
Copy Markdown
Contributor Author

Hi @gilbertwong96 Could you resolve the conflicts?

Just rebased

@polvalente polvalente merged commit 4fd0f99 into elixir-grpc:master Jun 15, 2026
7 checks passed
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.

3 participants