fix: five from the full review

- doctor printed OPENAI_BASE_URL raw, the third place a credential-bearing URL
  reached the terminal; it goes through _endpoint like the others.
- dev.run left its output readers unjoined, so a child's last lines could be
  lost on exit. The threads are kept and joined during teardown.
- logs read each file and then reopened it to follow, so anything written in
  between appeared in neither. One handle now serves both.
- dev took --port straight from argparse: 0 would have served on an ephemeral
  port while printing 0, and oversized values reach socket.bind. It goes
  through _port_number first.
- doctor --redis-url overrode only the broker, so a stale result backend or
  cache was still pinged and the flag looked broken. All three endpoints now
  come from the URL given.
This commit is contained in:
Alex committed 2026-09-17 13:15:56 +01:00
1 parent d0a0b352e0
commit da58c072a0
4 files changed
+131 -18

No files matched your search

+11
View File
@@ -123,6 +123,17 @@ class TestRun:
assert "api | hello" in out.getvalue()
assert code == 1, "a child that ends by itself ends the session, however it exited"
def test_output_in_flight_is_not_lost_when_run_returns(self, tmp_path):
"""The reader is a thread: without joining it, a child's last lines can never be printed."""
out = io.StringIO()
lines = [f"line {number}\n" for number in range(200)]
children = [dev.Child(name="api", command=["x"], cwd=tmp_path)]
code = dev.run(children, out=out, spawn=self._spawn([FakeProcess(lines, code=0)]),
sleep=lambda _: None, colour=False)
assert code == 1
printed = out.getvalue()
assert "line 0" in printed and "line 199" in printed, "every line the child wrote is printed"
def test_a_failing_child_returns_its_code(self, tmp_path):
out = io.StringIO()
children = [dev.Child(name="api", command=["false"], cwd=tmp_path)]