aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-18 11:05:47 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-18 11:05:47 +0200
commit063c5f0750b775362e45e21a97e0dc2250c89f77 (patch)
tree9db3276c691bc1d49621cb144587e3a0be68d281 /packages/meshbay-hub
parentc03512aeab576a06f8d5026e5eb484897ec45f99 (diff)
downloadmeshbay-063c5f0750b775362e45e21a97e0dc2250c89f77.tar.gz
fix(cast): keep the Chromecast progress log out of the terminal
The receiver reports its state on a timer, so `player status: PLAYING` repeats for as long as a film runs and buries everything else in the terminal the app was started from. The progress lines now go through Node's own `debuglog`, which costs nothing when disabled — the message is never formatted — and is restored with: NODE_DEBUG=cast-chromecast npm start The socket error stays on console.error. It fires when the connection to the receiver dies and is the only trace of why a cast stopped; routing it through the same switch would make the one failure worth seeing the one that disappears. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UGY17EPph5LsLzePPXhUVc
Diffstat (limited to 'packages/meshbay-hub')
-rw-r--r--packages/meshbay-hub/tests/test_cast_subtitles.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_cast_subtitles.py b/packages/meshbay-hub/tests/test_cast_subtitles.py
index 722a56a..3fe627d 100644
--- a/packages/meshbay-hub/tests/test_cast_subtitles.py
+++ b/packages/meshbay-hub/tests/test_cast_subtitles.py
@@ -391,3 +391,30 @@ def test_a_stream_without_subtitles_declares_none(loaded):
"""
assert "tracks" not in loaded["without"]["media"]
assert loaded["without"]["options"]["activeTrackIds"] == []
+
+
+@chromecast_only
+def test_progress_logging_is_off_unless_asked_for():
+ """
+ The receiver reports its state on a timer, so `player status: PLAYING`
+ repeats for as long as a film runs. Left on `console.log` it fills the
+ terminal the app was started from and buries everything else in it.
+
+ Read rather than run because the noisy line only fires with a device on the
+ network. What is checked is the property that matters: nothing in this
+ module reaches the terminal unconditionally except a failure. `console.warn`
+ and `console.info` are named too — a future line using either would be just
+ as loud, and this guard would not otherwise see it.
+ """
+ src = CHROMECAST.read_text(encoding="utf-8")
+ unconditional = [
+ line.strip() for line in src.splitlines()
+ if ("console.log(" in line or "console.warn(" in line
+ or "console.info(" in line)
+ and not line.lstrip().startswith(("*", "//"))]
+ assert unconditional == [], (
+ "these reach the terminal whatever the user asked for; route them "
+ f"through `debug` or `console.error`: {unconditional}")
+ # And the failure path is still audible, or a cast that dies takes its own
+ # explanation with it.
+ assert "console.error(`[cast-chromecast] client error" in src