From 1b74f99d2e6ac9d3edfbe44544fba4f9675c230d Mon Sep 17 00:00:00 2001 From: nshkrdotcom <127063941+nshkrdotcom@users.noreply.github.com> Date: Fri, 9 Jan 2026 12:10:24 -1000 Subject: [PATCH 1/3] [Fix]: Elixir 1.19 type system warnings (#489) * Add struct pattern matches to fix type warnings in Connection, CLI, and Generator modules * Update CI matrix with OTP 28.x and Elixir 1.19.x support * Rename erlpack_notypes.ex to erlpack_notypes_test.exs * Fix unreachable clause warning in report_exception_test.exs * Bump version to v1.0.0-rc.2 --- .github/workflows/ci.yml | 26 ++++++++++++++++--- grpc_client/CHANGELOG.md | 18 +++++++++++++ grpc_client/lib/grpc/client/connection.ex | 15 ++++++++--- grpc_client/mix.exs | 2 +- ...ck_notypes.ex => erlpack_notypes_test.exs} | 0 grpc_core/mix.exs | 2 +- grpc_server/CHANGELOG.md | 17 ++++++++++++ grpc_server/lib/grpc/protoc/cli.ex | 12 ++++----- grpc_server/lib/grpc/protoc/generator.ex | 5 +++- grpc_server/mix.exs | 2 +- .../server/adapters/report_exception_test.exs | 5 ++-- mix.exs | 7 +++-- 12 files changed, 86 insertions(+), 25 deletions(-) rename grpc_client/test/grpc/integration/{erlpack_notypes.ex => erlpack_notypes_test.exs} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c64f97c8..32a655119 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,17 @@ jobs: name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} strategy: matrix: - otp: [24.x, 25.x, 26.1.x] - elixir: [1.15.x] + otp: [24.x, 25.x, 26.1.x, 28.x] + elixir: [1.15.x, 1.19.x] + exclude: + - otp: 24.x + elixir: 1.19.x + - otp: 25.x + elixir: 1.19.x + - otp: 26.1.x + elixir: 1.19.x + - otp: 28.x + elixir: 1.15.x needs: check_format steps: @@ -84,8 +93,17 @@ jobs: if: ${{ github.ref == 'refs/heads/master' }} strategy: matrix: - otp: [24.x, 25.x, 26.1.x] - elixir: [1.15.x] + otp: [24.x, 25.x, 26.1.x, 28.x] + elixir: [1.15.x, 1.19.x] + exclude: + - otp: 24.x + elixir: 1.19.x + - otp: 25.x + elixir: 1.19.x + - otp: 26.1.x + elixir: 1.19.x + - otp: 28.x + elixir: 1.15.x steps: - uses: actions/checkout@v3 diff --git a/grpc_client/CHANGELOG.md b/grpc_client/CHANGELOG.md index 2bf2b0307..3dbae8891 100644 --- a/grpc_client/CHANGELOG.md +++ b/grpc_client/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## v1.0.0-rc.2 (2026-01-09) + +### Bug fixes + + * Fix Elixir 1.19 type system warnings for struct updates in Connection module + * Rename erlpack_notypes.ex to erlpack_notypes_test.exs to follow test naming convention + +## v1.0.0-rc.1 (2025-12-02) + +### Enhancements + + * Major restructuring: separated into distinct grpc_core, grpc_server, and grpc_client packages + * Refactor GRPC client setup - start supervisor in application (#483) + +### Bug fixes + + * Fix Connection state created by build_direct_state (#480) + ## v0.11.5 (2025-11-14) ### Enhancements diff --git a/grpc_client/lib/grpc/client/connection.ex b/grpc_client/lib/grpc/client/connection.ex index 87d573a0e..98af91d97 100644 --- a/grpc_client/lib/grpc/client/connection.ex +++ b/grpc_client/lib/grpc/client/connection.ex @@ -373,7 +373,14 @@ defmodule GRPC.Client.Connection do |> Enum.uniq() end - defp build_balanced_state(base_state, addresses, config, lb_policy_opt, norm_opts, adapter) do + defp build_balanced_state( + %__MODULE__{} = base_state, + addresses, + config, + lb_policy_opt, + norm_opts, + adapter + ) do lb_policy = cond do is_map(config) and Map.has_key?(config, :load_balancing_policy) -> @@ -415,7 +422,7 @@ defmodule GRPC.Client.Connection do end end - defp build_direct_state(base_state, norm_target, norm_opts, adapter) do + defp build_direct_state(%__MODULE__{} = base_state, norm_target, norm_opts, adapter) do {host, port} = split_host_port(norm_target) vc = base_state.virtual_channel @@ -433,7 +440,7 @@ defmodule GRPC.Client.Connection do end end - defp build_real_channels(addresses, virtual_channel, norm_opts, adapter) do + defp build_real_channels(addresses, %Channel{} = virtual_channel, norm_opts, adapter) do Map.new(addresses, fn %{port: port, address: host} -> case connect_real_channel( %Channel{virtual_channel | host: host, port: port}, @@ -501,7 +508,7 @@ defmodule GRPC.Client.Connection do |> adapter.connect(opts[:adapter_opts]) end - defp connect_real_channel(vc, host, port, opts, adapter) do + defp connect_real_channel(%Channel{} = vc, host, port, opts, adapter) do %Channel{vc | host: host, port: port} |> adapter.connect(opts[:adapter_opts]) end diff --git a/grpc_client/mix.exs b/grpc_client/mix.exs index 7e01b3a38..3bc3fe271 100644 --- a/grpc_client/mix.exs +++ b/grpc_client/mix.exs @@ -2,7 +2,7 @@ defmodule GrpcClient.MixProject do use Mix.Project @source_url "https://github.com/elixir-grpc/grpc_client" - @version "1.0.0-rc.1" + @version "1.0.0-rc.2" def project do [ diff --git a/grpc_client/test/grpc/integration/erlpack_notypes.ex b/grpc_client/test/grpc/integration/erlpack_notypes_test.exs similarity index 100% rename from grpc_client/test/grpc/integration/erlpack_notypes.ex rename to grpc_client/test/grpc/integration/erlpack_notypes_test.exs diff --git a/grpc_core/mix.exs b/grpc_core/mix.exs index 42d5706d3..ecd41daf0 100644 --- a/grpc_core/mix.exs +++ b/grpc_core/mix.exs @@ -2,7 +2,7 @@ defmodule GRPC.Core.MixProject do use Mix.Project @source_url "https://github.com/elixir-grpc/grpc_core" - @version "1.0.0-rc.1" + @version "1.0.0-rc.2" def project do [ diff --git a/grpc_server/CHANGELOG.md b/grpc_server/CHANGELOG.md index 2bf2b0307..82fdc9c21 100644 --- a/grpc_server/CHANGELOG.md +++ b/grpc_server/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## v1.0.0-rc.2 (2026-01-09) + +### Bug fixes + + * Fix Elixir 1.19 type system warnings for struct updates in protoc CLI and generator + * Fix unreachable clause warning in report_exception_test.exs + +## v1.0.0-rc.1 (2025-12-02) + +### Enhancements + + * Major restructuring: separated into distinct grpc_core, grpc_server, and grpc_client packages + +### Bug fixes + + * Fix Stream map_error send_response handling (#487) + ## v0.11.5 (2025-11-14) ### Enhancements diff --git a/grpc_server/lib/grpc/protoc/cli.ex b/grpc_server/lib/grpc/protoc/cli.ex index 0a468ac41..26d228fff 100644 --- a/grpc_server/lib/grpc/protoc/cli.ex +++ b/grpc_server/lib/grpc/protoc/cli.ex @@ -83,11 +83,11 @@ defmodule GRPC.Protoc.CLI do |> Enum.reduce(ctx, &parse_param/2) end - defp parse_param("plugins=" <> plugins, ctx) do + defp parse_param("plugins=" <> plugins, %Context{} = ctx) do %Context{ctx | plugins: String.split(plugins, "+")} end - defp parse_param("gen_descriptors=" <> value, ctx) do + defp parse_param("gen_descriptors=" <> value, %Context{} = ctx) do case value do "true" -> %Context{ctx | gen_descriptors?: true} @@ -97,7 +97,7 @@ defmodule GRPC.Protoc.CLI do end end - defp parse_param("package_prefix=" <> package, ctx) do + defp parse_param("package_prefix=" <> package, %Context{} = ctx) do if package == "" do raise "package_prefix can't be empty" else @@ -105,11 +105,11 @@ defmodule GRPC.Protoc.CLI do end end - defp parse_param("transform_module=" <> module, ctx) do + defp parse_param("transform_module=" <> module, %Context{} = ctx) do %Context{ctx | transform_module: Module.concat([module])} end - defp parse_param("one_file_per_module=" <> value, ctx) do + defp parse_param("one_file_per_module=" <> value, %Context{} = ctx) do case value do "true" -> %Context{ctx | one_file_per_module?: true} @@ -129,7 +129,7 @@ defmodule GRPC.Protoc.CLI do # end # end - defp parse_param(_unknown, ctx) do + defp parse_param(_unknown, %Context{} = ctx) do ctx end diff --git a/grpc_server/lib/grpc/protoc/generator.ex b/grpc_server/lib/grpc/protoc/generator.ex index f7586885a..dc5e0768e 100644 --- a/grpc_server/lib/grpc/protoc/generator.ex +++ b/grpc_server/lib/grpc/protoc/generator.ex @@ -40,7 +40,10 @@ defmodule GRPC.Protoc.Generator do end end - defp generate_module_definitions(ctx, %Google.Protobuf.FileDescriptorProto{} = desc) do + defp generate_module_definitions( + %Context{} = ctx, + %Google.Protobuf.FileDescriptorProto{} = desc + ) do ctx = %Context{ ctx diff --git a/grpc_server/mix.exs b/grpc_server/mix.exs index f34e572a4..3b9b2bee4 100644 --- a/grpc_server/mix.exs +++ b/grpc_server/mix.exs @@ -2,7 +2,7 @@ defmodule GRPC.Server.MixProject do use Mix.Project @source_url "https://github.com/elixir-grpc/grpc_server" - @version "1.0.0-rc.1" + @version "1.0.0-rc.2" def project do [ diff --git a/grpc_server/test/grpc/server/adapters/report_exception_test.exs b/grpc_server/test/grpc/server/adapters/report_exception_test.exs index 975f3e3f2..b87f0182e 100644 --- a/grpc_server/test/grpc/server/adapters/report_exception_test.exs +++ b/grpc_server/test/grpc/server/adapters/report_exception_test.exs @@ -14,9 +14,8 @@ defmodule ExceptionServer do @impl true def handle_cast(:case_boom, state) do - a = fn -> :ok end - - case a.() do + # Use Function.identity/1 to make value opaque to type inference + case Function.identity(:ok) do :error -> :boom end diff --git a/mix.exs b/mix.exs index a227268a1..1c3477c8b 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule GRPC.GRPCRoot do use Mix.Project - @version "1.0.0-rc.1" + @version "1.0.0-rc.2" def project do [ @@ -14,10 +14,10 @@ defmodule GRPC.GRPCRoot do defp deps do [ - {:grpc_server, path: "grpc_server"}, + {:grpc_server, path: "grpc_server"} ] end - + defp aliases do [ setup: cmd("deps.get"), @@ -42,5 +42,4 @@ defmodule GRPC.GRPCRoot do end end end - end From 26ee053b6377bdc8a26f62a635893a2dd8513002 Mon Sep 17 00:00:00 2001 From: nshkrdotcom <127063941+nshkrdotcom@users.noreply.github.com> Date: Fri, 9 Jan 2026 12:29:38 -1000 Subject: [PATCH 2/3] [Chore]: Revert version bump to v1.0.0-rc.1 --- grpc_client/CHANGELOG.md | 9 ++------- grpc_client/mix.exs | 2 +- grpc_core/mix.exs | 2 +- grpc_server/CHANGELOG.md | 9 ++------- grpc_server/mix.exs | 2 +- mix.exs | 2 +- 6 files changed, 8 insertions(+), 18 deletions(-) diff --git a/grpc_client/CHANGELOG.md b/grpc_client/CHANGELOG.md index 3dbae8891..3d144052d 100644 --- a/grpc_client/CHANGELOG.md +++ b/grpc_client/CHANGELOG.md @@ -1,12 +1,5 @@ # Changelog -## v1.0.0-rc.2 (2026-01-09) - -### Bug fixes - - * Fix Elixir 1.19 type system warnings for struct updates in Connection module - * Rename erlpack_notypes.ex to erlpack_notypes_test.exs to follow test naming convention - ## v1.0.0-rc.1 (2025-12-02) ### Enhancements @@ -16,6 +9,8 @@ ### Bug fixes + * Fix Elixir 1.19 type system warnings for struct updates in Connection module + * Rename erlpack_notypes.ex to erlpack_notypes_test.exs to follow test naming convention * Fix Connection state created by build_direct_state (#480) ## v0.11.5 (2025-11-14) diff --git a/grpc_client/mix.exs b/grpc_client/mix.exs index 3bc3fe271..7e01b3a38 100644 --- a/grpc_client/mix.exs +++ b/grpc_client/mix.exs @@ -2,7 +2,7 @@ defmodule GrpcClient.MixProject do use Mix.Project @source_url "https://github.com/elixir-grpc/grpc_client" - @version "1.0.0-rc.2" + @version "1.0.0-rc.1" def project do [ diff --git a/grpc_core/mix.exs b/grpc_core/mix.exs index ecd41daf0..42d5706d3 100644 --- a/grpc_core/mix.exs +++ b/grpc_core/mix.exs @@ -2,7 +2,7 @@ defmodule GRPC.Core.MixProject do use Mix.Project @source_url "https://github.com/elixir-grpc/grpc_core" - @version "1.0.0-rc.2" + @version "1.0.0-rc.1" def project do [ diff --git a/grpc_server/CHANGELOG.md b/grpc_server/CHANGELOG.md index 82fdc9c21..7e8489de3 100644 --- a/grpc_server/CHANGELOG.md +++ b/grpc_server/CHANGELOG.md @@ -1,12 +1,5 @@ # Changelog -## v1.0.0-rc.2 (2026-01-09) - -### Bug fixes - - * Fix Elixir 1.19 type system warnings for struct updates in protoc CLI and generator - * Fix unreachable clause warning in report_exception_test.exs - ## v1.0.0-rc.1 (2025-12-02) ### Enhancements @@ -15,6 +8,8 @@ ### Bug fixes + * Fix Elixir 1.19 type system warnings for struct updates in protoc CLI and generator + * Fix unreachable clause warning in report_exception_test.exs * Fix Stream map_error send_response handling (#487) ## v0.11.5 (2025-11-14) diff --git a/grpc_server/mix.exs b/grpc_server/mix.exs index 3b9b2bee4..f34e572a4 100644 --- a/grpc_server/mix.exs +++ b/grpc_server/mix.exs @@ -2,7 +2,7 @@ defmodule GRPC.Server.MixProject do use Mix.Project @source_url "https://github.com/elixir-grpc/grpc_server" - @version "1.0.0-rc.2" + @version "1.0.0-rc.1" def project do [ diff --git a/mix.exs b/mix.exs index 1c3477c8b..30d173526 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule GRPC.GRPCRoot do use Mix.Project - @version "1.0.0-rc.2" + @version "1.0.0-rc.1" def project do [ From 3cec4f8c010c7869e20ccc5068872e29faecd1a9 Mon Sep 17 00:00:00 2001 From: nshkrdotcom <127063941+nshkrdotcom@users.noreply.github.com> Date: Fri, 9 Jan 2026 12:43:37 -1000 Subject: [PATCH 3/3] [Chore]: Revert Elixir 1.19 type warning fixes * Simplify CI matrix to use include instead of exclude for OTP 28.x/Elixir 1.19.x * Remove changelog entries for type warning fixes * Revert report_exception_test.exs to use direct raise * Apply YAML formatting fixes --- .github/workflows/ci.yml | 57 +++++++++---------- grpc_client/CHANGELOG.md | 2 - grpc_server/CHANGELOG.md | 2 - .../server/adapters/report_exception_test.exs | 5 +- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32a655119..4653651f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ +--- name: CI -on: +'on': pull_request: branches: - "**" @@ -20,10 +21,12 @@ jobs: elixir-version: 1.15.x - name: Retrieve dependencies cache uses: actions/cache@v3 - id: mix-cache # id to use in retrieve action + id: mix-cache # id to use in retrieve action with: path: deps - key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: >- + v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ + hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Install Dependencies run: mix deps.get 1>/dev/null - name: Check format @@ -33,17 +36,11 @@ jobs: name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} strategy: matrix: - otp: [24.x, 25.x, 26.1.x, 28.x] - elixir: [1.15.x, 1.19.x] - exclude: - - otp: 24.x - elixir: 1.19.x - - otp: 25.x - elixir: 1.19.x - - otp: 26.1.x - elixir: 1.19.x + otp: [24.x, 25.x, 26.1.x] + elixir: [1.15.x] + include: - otp: 28.x - elixir: 1.15.x + elixir: 1.19.x needs: check_format steps: @@ -54,10 +51,12 @@ jobs: elixir-version: ${{matrix.elixir}} - name: Retrieve dependencies cache uses: actions/cache@v3 - id: mix-cache # id to use in retrieve action + id: mix-cache # id to use in retrieve action with: path: deps - key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: >- + v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ + hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Install Dependencies run: mix setup 1>/dev/null - name: Run Tests @@ -75,10 +74,12 @@ jobs: elixir-version: 1.15.x - name: Retrieve dependencies cache uses: actions/cache@v3 - id: mix-cache # id to use in retrieve action + id: mix-cache # id to use in retrieve action with: path: deps - key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: >- + v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ + hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Install Dependencies run: mix deps.get 1>/dev/null working-directory: ./interop @@ -93,17 +94,11 @@ jobs: if: ${{ github.ref == 'refs/heads/master' }} strategy: matrix: - otp: [24.x, 25.x, 26.1.x, 28.x] - elixir: [1.15.x, 1.19.x] - exclude: - - otp: 24.x - elixir: 1.19.x - - otp: 25.x - elixir: 1.19.x - - otp: 26.1.x - elixir: 1.19.x + otp: [24.x, 25.x, 26.1.x] + elixir: [1.15.x] + include: - otp: 28.x - elixir: 1.15.x + elixir: 1.19.x steps: - uses: actions/checkout@v3 @@ -113,13 +108,15 @@ jobs: elixir-version: ${{ matrix.elixir }} - name: Retrieve dependencies cache uses: actions/cache@v3 - id: mix-cache # id to use in retrieve action + id: mix-cache # id to use in retrieve action with: path: deps - key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: >- + v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ + hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Install Dependencies run: mix deps.get 1>/dev/null working-directory: ./interop - name: Run interop tests run: mix run script/run.exs - working-directory: ./interop \ No newline at end of file + working-directory: ./interop diff --git a/grpc_client/CHANGELOG.md b/grpc_client/CHANGELOG.md index 3d144052d..5902cd70d 100644 --- a/grpc_client/CHANGELOG.md +++ b/grpc_client/CHANGELOG.md @@ -9,8 +9,6 @@ ### Bug fixes - * Fix Elixir 1.19 type system warnings for struct updates in Connection module - * Rename erlpack_notypes.ex to erlpack_notypes_test.exs to follow test naming convention * Fix Connection state created by build_direct_state (#480) ## v0.11.5 (2025-11-14) diff --git a/grpc_server/CHANGELOG.md b/grpc_server/CHANGELOG.md index 7e8489de3..b7454ac21 100644 --- a/grpc_server/CHANGELOG.md +++ b/grpc_server/CHANGELOG.md @@ -8,8 +8,6 @@ ### Bug fixes - * Fix Elixir 1.19 type system warnings for struct updates in protoc CLI and generator - * Fix unreachable clause warning in report_exception_test.exs * Fix Stream map_error send_response handling (#487) ## v0.11.5 (2025-11-14) diff --git a/grpc_server/test/grpc/server/adapters/report_exception_test.exs b/grpc_server/test/grpc/server/adapters/report_exception_test.exs index b87f0182e..f21a0702f 100644 --- a/grpc_server/test/grpc/server/adapters/report_exception_test.exs +++ b/grpc_server/test/grpc/server/adapters/report_exception_test.exs @@ -14,10 +14,7 @@ defmodule ExceptionServer do @impl true def handle_cast(:case_boom, state) do - # Use Function.identity/1 to make value opaque to type inference - case Function.identity(:ok) do - :error -> :boom - end + raise CaseClauseError, term: :ok {:noreply, state} end