fix(ios): reject blank native capture frames - #55
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d37b4c6449
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🟡 Changes recommended
The updated behavior is not fully reflected in the new documentation text (and a related code comment is misleading), which should be corrected to keep release notes aligned with actual runtime behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Apple capture runtime to avoid returning “blank” native frames by detecting transparent/near-white outputs, retrying engine-surface captures with view-hierarchy capture when needed, and reporting the actual coverage that produced the returned frame.
Changes:
- Added pixel-content validation to reject transparent/near-white captures and added an engine-surface → view-hierarchy retry path.
- Propagated the actual capture coverage through to
CaptureResultand expanded XCTest coverage for the new behaviors. - Bumped
TugboatCaptureRuntimeCocoaPods version to0.1.1and documented the runtime behavior in the compatibility table.
File summaries
| File | Description |
|---|---|
| TugboatCaptureRuntime.podspec | Bumps the CocoaPods version to 0.1.1. |
| platforms/apple/Tests/TugboatCaptureRuntimeTests/CaptureRuntimeModeTests.swift | Adds tests for retrying blank engine-surface captures and rejecting blank/white outputs. |
| platforms/apple/Sources/TugboatCaptureRuntime/Internal/AppleViewCapture.swift | Implements blank-frame detection, retry logic, and tracks the coverage used for the returned bitmap. |
| platforms/apple/Sources/TugboatCaptureRuntime/CaptureRuntime.swift | Returns the bitmap’s actual coverage and improves surface-availability detection before reporting failures. |
| docs/releases/compatibility.md | Documents the 0.1.1 Apple runtime behavior in the compatibility table. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
The implementation behavior conflicts with the PR description around engine-surface fallback, and the new blank-frame detection should tighten its alpha/visibility heuristic to avoid accepting effectively transparent frames.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
| let y = linearIndex / width | ||
| let x = linearIndex % width | ||
| let pixel = bytes.advanced(by: y * stride + x * 4) | ||
| let isVisible = pixel[3] != 0 |
| pixelWidth: pixelWidth, | ||
| pixelHeight: pixelHeight, | ||
| coverage: .engineSurface, | ||
| afterScreenUpdates: false | ||
| ), bitmap.hasCapturedContent else { return nil } |
Summary
Physical-device evidence
Verification
The Flutter package will explicitly select the hierarchy retry and increase degraded screenshot resolution after CocoaPods trunk publishes 0.1.1.