test: end-to-end proof that FLAC repair is lossless and safe#34
Merged
Conversation
The existing repair tests (tests/unit/test_repair_functions.py) mock the `flac` CLI and cover the orchestration. They don't prove the property a hi-fi user actually cares about: that repair returns the *same audio*. This adds a real end-to-end test using the `flac` binary (module-skipped if it's not on PATH): - test_repair_roundtrip_is_bit_identical — decode→re-encode yields PCM that is np.array_equal to the original, sample for sample (lossless; no DSP). - test_repair_preserves_metadata — tags survive the round-trip. - test_repair_replace_source_keeps_backup — replace_source=True always writes a byte-identical .corrupted.bak first, and the replaced file is the same audio. Backs the "Repair: lossless reconstruction" docs section with executable proof. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Test bout-en-bout : prouver que la réparation est lossless
Les tests de réparation existants (
tests/unit/test_repair_functions.py) mockent le binaireflac: ils valident l'orchestration, mais pas la propriété qui compte pour un public hi-fi — est-ce que la réparation rend le même son ?Ce PR ajoute un test end-to-end réel (utilise le vrai
flac; le module se skip proprement siflacn'est pas sur le PATH, comme le gate ffmpeg) :test_repair_roundtrip_is_bit_identical— decode → re-encode redonne un PCMnp.array_equalà l'original, échantillon par échantillon (lossless prouvé, aucun DSP).test_repair_preserves_metadata— les tags survivent au round-trip.test_repair_replace_source_keeps_backup—replace_source=Trueécrit toujours un.corrupted.bakbyte-identique à l'original avant de remplacer, et le fichier remplacé contient le même audio.C'est la preuve exécutable derrière la section docs « Repair: lossless reconstruction » : on ne retouche pas le son, on reconstruit sans perte, avec sauvegarde.
🤖 Generated with Claude Code