Repository navigation
fix: v1.0.1 follow-ups (low-bitrate crash, output_format case, CI) - #9
Merged
Merged
Conversation
- get_audio_bitrate: a bitrate under 1 kbps floored to 0 and made
calculate_segment_time divide by zero (500). Fall back to 320 kbps, the
same default used when ffprobe reports no bitrate.
- output_format is now matched case-insensitively ("WAV" == "wav"), like
input extensions already are.
- CI: on PRs and pushes to main, build the image, run it read-only as in
the Helm chart, and smoke /health, /ready and /split. Dependabot keeps the
workflow's actions current.
- Docs: Python 3.14 (base image moved in #7); output_format case note.
- Chart 0.1.1 / appVersion 1.0.1.
…llback Review found that falling back to 320 kbps for a bitrate under 1 kbps amplifies work: segments are sized for 320 kbps while the file is (for example) 800 bps, so a 1 MiB upload produced 4,001 chunk files before the MAX_CHUNKS check, or 41 tiny chunks where one 10 MB chunk was asked for. No real audio in the supported formats is under 1 kbps, so reject it up front with an explicit 400, before FFmpeg runs. CI: generate the smoke tone at 128 kbps (4 chunks instead of a 1-chunk margin) and use --fail-with-body so a failing run shows the error.
GitHub's default run shell is 'bash -e' without pipefail, so curl's exit code in 'curl | python3' was ignored; the step only failed because an error body happened to trip the chunk-count assert. 'shell: bash' runs with -eo pipefail.
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
Follow-ups that complete v1.0.1, after merging #7 (python 3.14-slim) and #8 (uvicorn 0.54.0, aiofiles 25.1.0):
split_audio: 400 "Unsupported audio: bitrate is below 1 kbps"calculate_segment_timeraisedZeroDivisionError, giving a 500. Reproduced with an 800 bps WAV (bit_rate=820). The request is now rejected up front, before FFmpeg runs.output_formatis lowercasedWAVwas rejected with 400, while.WAVuploads were accepted because input extensions are already lowercased. Invalid formats still return 400, quoting the user's own spelling..github/workflows/ci.yml(new)main, it builds the image, runs it read-only as the Helm chart does, and smoke-tests/health,/readyand/spliton a 20 s, 128 kbps tone generated by the image's own FFmpeg (so the runner needs no extra dependencies). Failing requests print their error body..github/dependabot.ymlgithub-actions, which keeps the workflow'sactions/checkoutcurrent.output_formatand the new 400.0.1.1/ appVersion1.0.1Review rounds
Two rounds, each through three validators: correctness, contracts/security, and regression/operability.
Round 1 blocker, found and fixed. The first fix fell back to 320 kbps, which a reviewer proved amplifies work. Segments were sized for 320 kbps while the file was, say, 800 bps: a 1 MiB upload produced 4,001 chunk files before the
MAX_CHUNKScheck (or 41 tiny chunks when one 10 MB chunk was requested), and 400k files with an 8 bps header. Options weighed:Adopted:
--fail-with-body;shell: bashon the smoke step (round 2), because GitHub's defaultbash -ehas nopipefail, so curl's exit code incurl | python3was ignored.Declined:
Known limitation (pre-existing, not changed here)
Round 2 confirmed that the sub-1 kbps path is closed, but the segment count is still driven by file-declared metadata, and
MAX_CHUNKSis only checked after FFmpeg finishes writing. Two crafted inputs reproduce identically onorigin/main:A proper fix bounds output while FFmpeg runs. That is a design change, tracked separately. It is mitigated today by internal-only deployment,
FFMPEG_TIMEOUT_SECONDS, and the 2Gi/tmplimit.Verification (final commit)
main's pins): 52 are identical. The 10 that differ are all intended:outfmt_upper: 400 → 200;1.0.0→1.0.1changed.output_format=WAV→chunk_000.wav;EXE→ 400;/tmpis clean, with no unhandled errors.300a7c9the smoke step runs underbash -e -o pipefailand produces 4 chunks. The workflow passes actionlint and validates against its schema, and so does the dependabot config.