test(cat-mode): regression guard for blink-period collapse on compressed video#202
Merged
Merged
Conversation
…sed video The refine_bp artifact-collapse fix (commit 7101314) had no automated guard. Extract the blink-period refinement from a closure inside _decode_cat_video to a module-level _refine_blink_period so it is directly unit-testable (no behaviour change), and add web_demo/test_cat_mode_refine_bp.py: - Unit tests feed run-lists that mirror compressed video (real ~6-frame single-blink runs polluted by 1-3 frame transition artifacts). Verified load-bearing: the pre-fix unfiltered median collapses to ~2.0 on this data while the band-filtered + clamped version holds at the true 6.0. - Integration tests (skipped without cv2+ffmpeg) generate a cat video, transcode it to VP9, decode via _decode_cat_video, and assert the exact 256-bit payload is recovered with bp held at the true period — the end-to-end scenario that was broken. Confirmed passing at 50ms and 100ms blink speeds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
systemslibrarian
added a commit
that referenced
this pull request
Jun 4, 2026
The guard added in #202 lived in web_demo/, which CI never collects (testpaths=[tests]), and importing web_demo/app.py needs Flask — not a CI dep — so the regression for the compressed-video blink-period collapse fix (7101314) was not actually guarded on any push. Extract the pure blink-period algorithm to a dependency-free package module meow_decoder/cat_blink.refine_blink_period (no OpenCV/Flask), imported by web_demo/app.py via the _refine_blink_period alias. Add tests/test_cat_blink.py (5 pure unit tests) and register it in the ci.yml batch-1 list so it runs on every push. Verified load-bearing: the pre-fix unfiltered median collapses to ~2.0 on the artifact-polluted run-list while the band-filtered + clamped version holds at 6.0. Ran through the real CI conftest (Rust backend) locally: 5 passed. web_demo/test_cat_mode_refine_bp.py is trimmed to the ffmpeg+cv2 VP9 end-to-end check (auto-skips where those are absent); the full round trip was confirmed locally recovering the exact 256-bit payload at 50ms and 100ms with bp held. 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.
Follow-up to the cat-mode decode-reliability fix in #201 (commit 7101314), which had no automated regression guard.
What this does
_decode_cat_videoto a module-level_refine_blink_period, so the critical artifact-collapse guard is directly unit-testable.web_demo/test_cat_mode_refine_bp.py:cv2+ffmpeg) generate a cat video, transcode it to VP9, decode via_decode_cat_video, and assert the exact 256-bit payload is recovered with bp held at the true period — the real end-to-end scenario that was broken.Verification done locally
All 6 tests pass (~13s). The VP9 round trip recovers the exact payload at both 50 ms and 100 ms blink speeds with
bpheld at 3.0 / 6.0 (no collapse).🤖 Generated with Claude Code