Tolerate a recording whose screen never changed at all - #13
Merged
eiliya-luzia merged 1 commit intoSep 17, 2026
Merged
eiliya-luzia merged 1 commit into
eiliya-luzia merged 1 commit into
Conversation
Co-Authored-By: Claude Opus 5 (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.
The bug
aua record stopexits 3 withrecording_coverage_failedwhenever the screen stayed static for the entire recording window — even though a valid MP4 was written and the encoder never faltered.Reproduced on
Pixel_6_Pro_API_34(API 34, arm64, macOS host) with v0.27.5:The file on disk was fine: 37,320 bytes,
ISO Media, MP4 v2,ffprobe→nb_frames=1. The same sequence with any on-screen activity passed (media_duration_s: 16.677,duration_check: "passed").Why
android_recording.pyalready excuses stillness per segment, and says so in its own comment (the rule added in v0.20.0, "a static stretch costs media seconds without costing any footage"). It appends astatic_screen_no_framesgap and does not setfailed.The aggregate guard on the next lines then overrode it:
screenrecordemits a frame when the screen changes, so a window whose screen never changed once encodes a single frame — and one frame is exactly0.0seconds of media, not merely a short one. "Captured nothing at all" and "nothing happened" turn out to be the same number. The result was inverted against the intent: a partly idle window passed, a wholly idle one failed.The change
Zero media now fails only where no
static_screen_no_framesgap accounts for it:any(...)rather than "all gaps are stillness":gapsalso receivesencoder_startup,segment_rotationandrecording_ended_before_stop. Since the supervisor rotatesscreenrecordat its 180s limit, an all-gaps test would fix the 8-second case but keep failing the same idle screen at 400 seconds.test_a_static_window_that_rotated_segments_also_passespins that.The safety net is untouched. Everything a dead recorder actually produces is judged before this line — no segments, no finish event,
encoder_failed, a missing or unreadable segment file, a non-zero recorder exit, anddarkstretches where the encoder was not running. A recording with zero finalized segments never reaches coverage at all;stop()raisesrecording_no_playable_segments.Note on an existing test
This replaces
test_capturing_nothing_at_all_still_fails. Its premise was the bug:_timeline(media_s=0.0)is a fully idle window, so the test asserted the behaviour reported here. Rather than loosen it, it is replaced by five tests whose premises hold — two for the bug (plain and rotated), one that stillness is still reported rather than hidden, and two regression guards: zero media that stillness does not explain, and a recorder that produced no segment at all. Please sanity-check that call, since it is the one judgement in this PR that removes an existing assertion.docs/recording.mdhad one stale sentence describing this same rule; it is corrected here.Verification
Full recording area (12 files):
156 passed, 2 skipped in 15.29s.ruff check .→All checks passed!The full suite is not green on this host before the change either (
22 failedon cleanmainvs26 failedwith the change, sets differing in both directions under-n auto; the 6 that failed only in the patched run all pass serially on both trees). The 20 collection errors areModuleNotFoundError: No module named 'jsonschema', an optional dev dependency missing from this environment. No recording module is involved in any of it.No device run was used to verify the fix itself — the emulator was used only to reproduce the original failure. The post-fix check is at package level through the editable install, replaying the reported numbers.