basecamp / basecamp/hotcell

TwoCellsTest flakes on macOS when the temp path crosses SUN_PATH_MAX

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
23
Forks
0
Avg merge
11h 43m
Merged PRs (30d)
27

Description

`TwoCellsTest` fails intermittently on the macOS CI job, and whether it fails depends on how many digits the test process's pid has.

```
RuntimeError: the cell did not boot: HotCell::ConfigurationError:
/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/hotcell-test20260824-13358-d0nrot/documents/control.sock
is 105 bytes and a Unix socket path on this platform holds 104. Choose a shorter directory.
```

The check itself is right — `SUN_PATH_MAX` is 104 on Darwin (`hotcell-server/lib/hot_cell/supervisor.rb:91`) and the error message is exactly the one an operator would want. The problem is that the test harness builds a path that sits on the boundary, so a five-digit pid fails where a four-digit one passes.

The pieces that add up:

- macOS `Dir.tmpdir` is a long per-user path — `/var/folders/xx/<22 chars>/T/` on a GitHub runner.
- `Dir.mktmpdir("hotcell-test")` appends `--`, and the pid's width varies.
- `TwoCellsTest` then nests a per-cell directory under that, and the socket name `control.sock` is the longer of the two.

`with_two_cells` (`hotcell-client/test/two_cells_test.rb:77`) is the worst case because it names two cells inside one temp root.

Seen twice on 2026-08-24 on unrelated PRs, once on [#25](https://github.com/basecamp/hotcell/pull/25); a re-run of the same commit passed. It is not a product bug and it is not caused by either change it interrupted — the failure is entirely in how long a name the suite chooses.

Worth fixing because a flake that only bites on one platform, and only sometimes, costs a re-run and a few minutes of deciding whether it is yours. Options, cheapest first:

- Shorten the prefix the suite passes to `Dir.mktmpdir`, and shorten the per-cell directory names in `with_two_cells`. Buys headroom without changing anything structural.
- Have the test helper skip with a clear message when `Dir.tmpdir` leaves too little room for the longest socket path it will need, rather than failing at boot. This matches how `resource_limits_test.rb` already skips where a clamp is not enforceable.
- Give the suite a short temp root of its own on Darwin, since the limit is a platform property rather than a per-test one.

The first two together are probably enough.

Contributor guide

Open the contributing guide

Research direction

Start with with_two_cells in hotcell-client/test/two_cells_test.rb:77 and reproduce the failure on the macOS CI job, then compare the skip behavior in resource_limits_test.rb. Account for the temp-root, per-cell, and control.sock lengths described in the issue. Done means TwoCellsTest no longer flakes when the pid gains digits, while the existing SUN_PATH_MAX check and operator-facing error remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, ruby
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.