Skip to content

Commit 1679ca8

Browse files
GSMLG-BOTclaude
andcommitted
fix: correct Dialyzer type specs in runtime modules
Update type specifications to match actual implementation behavior: - Runtime.start/1: Returns port() directly, not {:ok, pid()} - Runtime.terminate/2: Returns :normal | :shutdown | {:shutdown, term()} via cleanup_runtime_process/2 and normalize_exit_reason/1 - render_response: Simplified from GenServer reply tuple to direct result, as the __using__ macro wraps the response in {:reply, _, state} Resolves all Dialyzer warnings in: - lib/phoenix/react_server/runtime.ex - lib/phoenix/react_server/runtime/bun.ex - lib/phoenix/react_server/runtime/deno.ex 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 41348e6 commit 1679ca8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/phoenix/react_server/runtime.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,14 @@ defmodule Phoenix.ReactServer.Runtime do
104104
@type runtime_config :: keyword()
105105

106106
@typedoc "Render response"
107-
@type render_response :: {:reply, {:ok, html()}, t()} | {:reply, {:error, term()}, t()}
107+
@type render_response :: {:ok, html()} | {:error, term()}
108108

109109
@doc """
110110
Starts the runtime with given arguments.
111+
112+
Returns a port that can be used to communicate with the runtime process.
111113
"""
112-
@callback start(start_args()) :: {:ok, pid()} | {:error, term()}
114+
@callback start(start_args()) :: port()
113115

114116
@doc """
115117
Starts a file watcher for the component directory.

lib/phoenix/react_server/runtime/bun.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ defmodule Phoenix.ReactServer.Runtime.Bun do
142142
end
143143

144144
@impl true
145-
@spec start(Phoenix.ReactServer.Runtime.start_args()) :: port() | {:error, term()}
145+
@spec start(Phoenix.ReactServer.Runtime.start_args()) :: port()
146146
def start(component_base: _component_base) do
147147
config = config()
148148
cmd = config[:cmd]
@@ -258,7 +258,8 @@ defmodule Phoenix.ReactServer.Runtime.Bun do
258258
end
259259

260260
@impl true
261-
@spec terminate(term(), Phoenix.ReactServer.Runtime.t()) :: :ok
261+
@spec terminate(term(), Phoenix.ReactServer.Runtime.t()) ::
262+
:normal | :shutdown | {:shutdown, term()}
262263
def terminate(reason, state) do
263264
Logger.debug("Bun.Server terminating")
264265
cleanup_runtime_process(state.runtime_port, reason)

lib/phoenix/react_server/runtime/deno.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ defmodule Phoenix.ReactServer.Runtime.Deno do
156156
end
157157

158158
@impl true
159+
@spec start(Phoenix.ReactServer.Runtime.start_args()) :: port()
159160
def start(component_base: _component_base) do
160161
config = config()
161162
cmd = config[:cmd]
@@ -293,6 +294,8 @@ defmodule Phoenix.ReactServer.Runtime.Deno do
293294
end
294295

295296
@impl true
297+
@spec terminate(term(), Phoenix.ReactServer.Runtime.t()) ::
298+
:normal | :shutdown | {:shutdown, term()}
296299
def terminate(reason, state) do
297300
Logger.debug("Deno.Server terminating")
298301
Telemetry.record_runtime_shutdown("Deno", reason)

0 commit comments

Comments
 (0)