fix: harden script error paths and auto-discover smoke tests#6
Merged
Conversation
3 tasks
- scan_podcast.swift: validate input existence, positive sample interval, readable duration, and a minimum sample count so audio-only or missing inputs fail with a clean error instead of a Swift range trap - download_sample_media.sh: encode to a .partial file and atomically rename on success so interrupted downloads never leave truncated samples; reject multiple positional output dirs - cut_clips.py: catch ffmpeg failures with a clean error, write the manifest for already-successful clips before exiting, and shlex-quote the dry-run command output - auto-discover tests/test_*.sh in smoke.test.ts and scripts/test.sh instead of maintaining the list in two places - add a cut_clips --dry-run parsing test (markdown separators, JSON, CSV, dedupe, spaced paths) and scanner degenerate-input tests Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1e647d8 to
827a7c8
Compare
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.
Summary
Second PR from the whole-project review — the robustness batch.
scan_podcast.swiftno longer crashes on degenerate inputs. Audio-only files (a documented use case), missing paths, zero intervals, and unreadable durations previously hit a Swift range trap (Range requires lowerBound <= upperBound) and dumped a stack trace; each now exits with a clean one-line error.download_sample_media.shwrites atomically. A mid-stream network failure used to leave a truncated.mp4(with attribution files already written), which later "reuse existing outputs" passes would trust. The encode now targets a.partialfile renamed into place on success, with a cleanup trap. Also rejects multiple positional output dirs instead of silently keeping the last one.cut_clips.pyhandles ffmpeg failure. Previously: rawCalledProcessErrortraceback and no manifest, losing the record of clips that had already been cut. Now: clean error naming the failing clip, manifest written for completed clips, and the--dry-runcommand printed withshlex.joinso spaced paths are copy-pasteable.tests/test_*.shglob) in bothtests/smoke.test.tsandscripts/test.sh— the list was previously maintained by hand in two places, where a forgotten entry meant a test silently not running.--dry-runparsing test for cut_clips (markdown-->/-/toseparators, fractional seconds, dedupe, JSON, CSV, spaced media paths — the highest-entropy input surface previously had one assertion) and scanner degenerate-input tests asserting clean failures.Test plan
format:check/lint/typecheckpass🤖 Generated with Claude Code