fix(android): report the clip an Android recording really captured - #2566
Open
thymikee wants to merge 3 commits into
Open
fix(android): report the clip an Android recording really captured#2566thymikee wants to merge 3 commits into
thymikee wants to merge 3 commits into
Conversation
Android `screenrecord` encodes a frame only when the screen changes, so a window that ends on an unchanged screen returns a video far shorter than the requested duration, and `record stop` had nothing to say about it: the reported `durationMs` is host wall clock from `record start` until the export finished, which is not the length of the file that was just pulled. `record stop` now measures the pulled MP4 timelines and reports them as `capturedDurationMs`, and warns with the clip length against the window when the video is two or more seconds short. The window is measured on the device's own elapsed clock, read before the stop signal and at launch, because host wall clock drifts against the clock the encoder timestamps frames with; an unreadable clock or a chunk that answers no duration costs the caller the claim, never the recording. Measuring the timeline needed an ISO-BMFF box walk, which now lives in `@agent-device/capture-kit/recording-mp4-duration` and replaces the private top-level atom scan that MP4 container detection was doing. Stop replay through daemon recovery carries the field too, so a completion read back from the session resource reports the same numbers it did live.
…n holds `@agent-device/capture-kit/recording-mp4-duration` and its fixture sibling are new declared package subpaths, so the boundary enumeration that holds every exported workspace subpath has to name them for the layering scan to accept the Android recorder's read of a pulled clip's timeline.
|
Size Report
Startup median (7 runs, lower is better):
|
…ated The Coverage job's ADR-0019 eager-closure probe failed: `recording/video.ts` evaluated 25 modules on import where the merge-base evaluated 24, because the MP4 container gate statically imported the box walk it now shares with the clip-duration read, and `recording/overlay.ts` grew by the same module. An entry the merge-base already carries gets no growth budget, so the edge moves behind a function-scoped `await import`: the scan is something recording completion asks for, and importing this module for `waitForStableFile` or WebM detection should not evaluate a box walker. The alternative the probe offered -- hosting the walker in a module both growing entries already evaluate -- would have put an ISO-BMFF walk in `swift-cache.ts` or `video-webm.ts`, or made the duration read import the Swift validator machinery that sits behind `video.ts`.
Member
Author
|
No blocking findings at e590e85. The measured duration reaches the response and recovery metadata, and the short-clip warning reaches normal CLI output. The reported Android run matches ffprobe and current checks are green. The shared MP4 reader replaces the existing scan and reasonably accounts for the size increase; ready for human review. |
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
Android
screenrecordencodes a frame only when the screen changes, so a window that ends on an unchanged screen returns a video far shorter than the requested duration, whilerecord stopreported only host wall-clockdurationMs.record stopnow also reportscapturedDurationMs, measured from the pulled MP4 timelines, and warns with the clip length against a window measured on the device's own elapsed clock, because host wall clock drifts against the clock the encoder timestamps frames with. An unreadable clock or an unparseable chunk costs the claim, never the recording. iOS is unchanged.Closes #2551. 35 files, inside the recording family plus its contracts, MCP schema, help, and docs. Measuring the timeline needed an ISO-BMFF box walk, which replaces the private atom scan MP4 container detection used to do.
Validation
emulator-5554(Android 16), one swipe then idle: atc2c93d164ccapturedDurationMs: 9733againstffprobe duration=9.732689; ate590e8574dcapturedDurationMs: 689againstffprobe duration=0.688811with the warning above. Sessions closed.pnpm check:affected --runate590e8574d: format, lint, typecheck, layering, fallow, build, gate-manifest, depgraph, tmpdir-leaks, coverage-model, wire-compat-model, production-exports, bundle-owner-files, fixture-cache/fallback, command-docs, agent-guidance, xctest-selection, packaged-runner-swift and maestro-conformance passed.mutation-modelfails on a kernel is owned by tests that reach it indirectly (gestures.test.ts→scroll-edge-state); it fails identically at merge-baseab3d11e0, so it is not this PR's. Validation is therefore not fully green.c2c93d164con the ADR-0019 eager-closure probe: the container gate statically imported the box walk, sorecording/video.tsevaluated 25 modules where the merge-base evaluated 24.e590e8574dmoves that edge behind a function-scopedawait import;scripts/__tests__/eager-closure-budgets.test.ts(594 tests) is green locally. Integration Tests passed.