From 4ebd5594da98886febe0b60baf15c946adbe931f Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 28 Sep 2026 17:23:53 -0400 Subject: [PATCH] Report the hotcell-server version in describe A cell's `hotcell.describe` answer carried only the protocol version, which stays at 1 across releases, so nothing in it said which `hotcell-server` release the cell ran. Add `server_version`, the cell's `HotCell::Server::VERSION`. ref: https://github.com/basecamp/hotcell/issues/21 --- CHANGELOG.md | 1 + hotcell-server/lib/hot_cell/control.rb | 6 +++++- hotcell-server/test/control_test.rb | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd7a8e..6a82910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Some actions that application developers should consider taking when upgrading f #### Added * `hot_cell/health_operations` defines `health.echo` and `health.reopen`, the round trips an application calls to prove it can use a cell's work socket. A cell serves them only if it requires the file. +* The `hotcell.describe` response now includes `server_version`. This value is the version of the `hotcell-server` gem that the cell runs. You do not need a shell in the container to find it. (#21) #### Improved diff --git a/hotcell-server/lib/hot_cell/control.rb b/hotcell-server/lib/hot_cell/control.rb index 5db9574..e6916ff 100644 --- a/hotcell-server/lib/hot_cell/control.rb +++ b/hotcell-server/lib/hot_cell/control.rb @@ -40,8 +40,12 @@ def answer(line, running:, queued:) # Static, and called once per registered cell at app boot. It is the cheapest way to catch a client # whose own timeout is below what this cell may take, and it is what `bin/hotcell describe` reads. + # + # `v` is the wire format and changes only when the format does; `server_version` says which release of + # hotcell-server is answering. def describe - { v: PROTOCOL_VERSION, operations: Registry.names, groups: groups, **@configuration.to_h } + { v: PROTOCOL_VERSION, server_version: Server::VERSION, operations: Registry.names, groups: groups, + **@configuration.to_h } end private diff --git a/hotcell-server/test/control_test.rb b/hotcell-server/test/control_test.rb index 3d0a205..22a722e 100644 --- a/hotcell-server/test/control_test.rb +++ b/hotcell-server/test/control_test.rb @@ -16,6 +16,12 @@ def test_describe_reports_what_the_cell_carries_and_how_long_it_may_take end end + def test_describe_reports_which_build_of_the_cell_is_running + TestCell.boot do |cell| + assert_equal HotCell::Server::VERSION, assert_ok(cell.control("hotcell.describe")).result[:server_version] + end + end + # Counts lag responses, and the wait is the assertion rather than a workaround. The worker writes the # response and the supervisor increments the counter when it later reads that worker's idle report — two # processes — so a caller can be holding its answer before the count exists. Anything reading these for