fix(transmission-done): send log output to stderr, not stdout - #207
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.