Fix transcribe treating empty source as a directory scan#89
Closed
alexkroman wants to merge 2 commits into
Closed
Conversation
`assembly transcribe ""` silently batch-walked the working directory: an
empty string fell through the `source is None` guard in expand_sources, and
since Path("") resolves to ".", it was treated as "batch this directory" and
recursively rglob'd every audio file under cwd. With a valid key that would
upload arbitrary local audio.
Treat an empty source like a missing one (`not source`) so it stays on the
single-source path, where it correctly reads as "Provide an audio path or URL."
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Superseded by #90, which independently shipped the identical fix ( |
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.
Problem
Found during exploratory error testing of the CLI. Running
assembly transcribe ""(empty-string source) silently entered batch mode and recursively walked the working directory, queuing every audio file it found anywhere underneath:Root cause
In
expand_sources(aai_cli/transcribe_batch.py), an empty string fell through thesource is Noneguard.Path("")resolves to., sopath.is_dir()wasTrueand the source was treated as "batch this directory" →rglob("*")over the entire tree. With a valid API key this would upload arbitrary local audio (a real cost/privacy footgun).Fix
Treat an empty source like a missing one (
not source) so it stays on the single-source path, where it already reads correctly as:A real directory argument (
assembly transcribe .) still batches as before — only the empty string is redirected.Tests
test_non_batch_sources_return_noneto cover"".test_empty_source_argument_does_not_batch_the_working_directory, a CLI-level regression test that monkeypatchesPath.rglobto fail loudly if an empty source ever reaches directory scanning again, and asserts exit code 2 + the correct message.Full
./scripts/check.shgate passes (incl. 100% patch coverage + mutation gate).🤖 Generated with Claude Code