Skip to content

test(cat-mode): regression guard for blink-period collapse on compressed video#202

Merged
systemslibrarian merged 1 commit into
mainfrom
test/cat-mode-refine-bp-regression
Jun 4, 2026
Merged

test(cat-mode): regression guard for blink-period collapse on compressed video#202
systemslibrarian merged 1 commit into
mainfrom
test/cat-mode-refine-bp-regression

Conversation

@systemslibrarian
Copy link
Copy Markdown
Owner

Follow-up to the cat-mode decode-reliability fix in #201 (commit 7101314), which had no automated regression guard.

What this does

  • Refactor (no behaviour change): extracts the blink-period refinement from a closure inside _decode_cat_video to a module-level _refine_blink_period, so the critical artifact-collapse guard is directly unit-testable.
  • Adds 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 (auto-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 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 bp held at 3.0 / 6.0 (no collapse).

🤖 Generated with Claude Code

…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 systemslibrarian merged commit 79ead97 into main Jun 4, 2026
29 checks passed
@systemslibrarian systemslibrarian deleted the test/cat-mode-refine-bp-regression branch June 4, 2026 21:56
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant