fix(subtitle): unify create() return value and check result in caller - #1244
Open
yu3394 wants to merge 1 commit into
Open
fix(subtitle): unify create() return value and check result in caller#1244yu3394 wants to merge 1 commit into
yu3394 wants to merge 1 commit into
Conversation
yu3394
commented
Aug 22, 2026
- Add return type annotation -> str to subtitle.create()
- Return empty string instead of None when model loading fails, consistent with import failure
- Return subtitle_file path on success so callers can verify generation
- Check create() return value in task.py before calling correct(), skip correction and return early on failure
- Add return type annotation -> str to subtitle.create() - Return empty string instead of None when model loading fails, consistent with import failure - Return subtitle_file path on success so callers can verify generation - Check create() return value in task.py before calling correct(), skip correction and return early on failure
Owner
|
Thank you for fixing the inconsistent Whisper subtitle result contract. The production change is small and the caller-side guard is the right direction, but the PR is not yet merge-ready because the repository tests were not updated with the new contract. My local run reports 2 failures, 53 passes, and 3 skips:
Please update those tests, make the successful fake return Thanks again—once the tests reflect the new contract, this should be a low-risk reliability improvement. |
LiamVisionary
added a commit
to LiamVisionary/hivemind-content-studio
that referenced
this pull request
Aug 28, 2026
From upstream harry0703/MoneyPrinterTurbo#1244 by @yu3394 — the only one of the seven PRs open there that still applies to this fork. `subtitle.create()` returned `None` when the Whisper model could not load and nothing at all on success, and the caller ignored both. So on a machine where Whisper is unavailable the run went straight on to `subtitle.correct()` over a path that was never written — and that does not raise, because `file_to_subtitles` answers `[]` for a missing file. The result was a finished video with no subtitles, no error, and a log line reading "correcting subtitle" as though it had worked. It returns the path it wrote now, `""` when it wrote nothing, and the caller stops rather than correcting a file that does not exist. Two existing tests pinned the old shape and are updated rather than deleted. `test_create_returns_none_...` asserted `None` while its own docstring asked only for "a failure result the task layer can act on", so it now asserts the failure result and not which falsy value carries it. And the Whisper fake in test_task.py wrote its file but returned nothing, which is a fake of the old contract and now reads to the caller as a failure — it returns the path. One test of my own, and it took two goes to make it worth having: the first version set `subtitle_provider` on the params stub, but that is read from `config.app`, so the test took the `edge` branch and returned early. It passed with the fix and without it. It patches the config now, and fails without the change. The other six upstream PRs do not apply: this fork has rewritten the files they patch, and their own patches fail on 4 to 31 hunks each. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.