Skip to content

fix(transmission-done): send log output to stderr, not stdout - #207

Merged
twistedmelonman merged 1 commit into
mainfrom
claude/fix-log-stdout-pollution
Sep 24, 2026
Merged

twistedmelonman merged 1 commit into
mainfrom
claude/fix-log-stdout-pollution

Conversation

@twistedmelonman

Copy link
Copy Markdown
Member

When Star Trek: Strange New Worlds S04E10 finished this morning, transmission-done sent it to triage/failed instead of the library, and Plex never heard about it. It should have been filed like S04E07 to E09 were.

Multiple options for ambiguous file path: .../star.trek.strange.new.worlds.s04e10.1080p.web.h264-cakes[EZTVx.to].mkv: [Star Trek: Strange New Worlds, Star Trek, Star Trek]
Failed to process group: {Series=Star Trek: Strange New Worlds (2022)}

Outside test mode, log() tees every line to stdout. detect_media_type_heuristic logs and then echoes its answer, so media_type=$(...) came back as three log lines plus "tv", the case statement matched nothing, and the preview fell through to strict auto-detection, which refuses the ambiguous name. This has been true since the import, but it only started mattering with #197, which gates the preview on that value. Every test runs with TEST_MODE=true, where log() writes only to the file, so none of them could catch it.

log() now tees to stderr. Nothing reads transmission-done's stdout (the trigger watcher only checks its exit code), and interactive runs still see the lines in the terminal. The two new tests flip TEST_MODE to false: one checks that log() puts nothing on stdout, and one runs the heuristic on the E10 filename and expects exactly "tv". The E10 file still needs reprocessing from triage/failed once this is deployed.

Outside test mode log() tee'd every line to stdout, so any function that
returns a value by echo and also logs handed its caller the log lines
too. media_type=$(detect_media_type_heuristic ...) never equalled "tv",
the preview ran strict auto-detection instead of TheTVDB, and SNW S04E10
was triaged to failed as an ambiguous "Star Trek" match. The existing
tests run with TEST_MODE=true, where log() never touches stdout, so they
could not see it. Regression exposed by #197's heuristic-gated preview.
@twistedmelonman
twistedmelonman merged commit ef97b90 into main Sep 24, 2026
3 checks passed
@twistedmelonman
twistedmelonman deleted the claude/fix-log-stdout-pollution branch September 24, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant