Repository navigation
Description
Purpose
On a tvOS Simulator, snapshot and snapshot -i fail on any home screen made of horizontal collection-view rows. The focused tile is scaled by the tvOS focus effect (×1.05 here), so its content overshoots the row's frame by 12.5 pt above and below. The clip invariant tolerates 0.0001 pt, so the regular projection refuses the whole capture. snapshot --raw works and shows the same tree. The error also moves with the focus: after tv-remote press right, it fails on the next tile.
#3857 fixed the same class of refusal for oversized iOS system alert content (#3801). The tvOS focus effect is not covered.
Environment
- agent-device 0.21.39 (npm).
packages/capture-kit/src/ios-snapshot-engine/is unchanged onmainat655ede279. - macOS 27.2.1 (26B131), Xcode 27.2 (27B52), Node 24.21.0.
- Apple TV 4K (3rd generation) Simulator, tvOS 27.2 (24K150).
- App: a tvOS app whose home is a vertical collection view of horizontal collection-view rows; the focused cell grows by ×1.05. The same refusal on this home with agent-device 0.21.14 (tvOS 26.5) and 0.21.29 (tvOS 27.0).
Reproduction
pin='--platform ios --target tv --device <sim> --session tv --state-dir <dir> --json'
agent-device snapshot -i $pin
# {"success": false, "error": {"code": "COMMAND_FAILED",
# "message": "regular iOS snapshot node escaped its cumulative clip",
# "details": {"reason": "regular-node-outside-cumulative-clip", "index": 11,
# "frame": {"x": 87.6625, "y": 197.475, "width": 350.175, "height": 526.05},
# "clip": {"x": 0, "y": 210, "width": 1920, "height": 501}}}}
agent-device snapshot $pin # same error
agent-device snapshot -i --raw $pin # success, 243 nodes
agent-device tv-remote press right $pin
agent-device snapshot -i $pin # same reason, index 13, frame x 433.1625 (the next tile)The raw tree, from the escaping node up (snapshot -i --raw):
| raw index | type | label / identifier | rect | focused |
|---|---|---|---|---|
| 28 | Other | (87.66, 197.48, 350.18, 526.05) | ||
| 26 | Other | "" | (87.66, 197.48, 350.18, 526.05) | |
| 25 | Other | "" | (96, 210, 333.5, 501) | |
| 24 | Other | "" | (96, 210, 333.5, 501) | true |
| 22 | Cell | <cell id> |
(96, 210, 333.6, 501) | |
| 21 | CollectionView | (0, 210, 1920, 501) | ||
| 19 | Cell | (0, 210, 1920, 501) | ||
| 12 | CollectionView | <collection view id> |
(0, 0, 1920, 1080) |
Nodes 26 and 28 are node 25 scaled by 1.05 around its centre: 333.5 × 1.05 = 350.175, 501 × 1.05 = 526.05, y = 210 − 12.525. The clip is the row (node 21).
Second finding: details.index (11, then 13) does not name the escaping node in the raw tree. Raw index 11 is a full-screen container, raw 13 a 1728×41 cell. The index seems to be counted in another tree, so it cannot be used to find the node.
Cause (source at v0.21.39)
invariants.ts:104-111throws for any frame outside the cumulative clip.invariants.ts:178-188: the tolerance is 0.0001 pt.- On tvOS the focus effect scales a focused view past its container by design, so this is a normal screen state, not an inconsistent tree.
Required behavior
- A regular tvOS snapshot of a screen with a focused, scaled cell succeeds. For example, clip the overshooting frame to the cumulative clip, as fix(snapshot): clip oversized system alert content #3857 does for system alerts, or accept an overshoot that a focus transform explains.
- The focused node keeps
focused: trueand stays actionable in the regular output. - When the refusal does fire,
details.indexnames a node thatsnapshot --rawlists at that index, or the details say which tree the index belongs to.
Completion conditions
- On a tvOS screen with a focused collection-view cell,
snapshot -isucceeds and lists the focused tile. - A fixture with a child frame scaled ×1.05 around a focused cell inside a row clip passes the regular projection.
Dependencies
Blocked by: none. Same refusal class as #3801, fixed for system alerts by #3857.
Workaround
snapshot --raw (and is ... --raw) on tvOS screens. It keeps off-screen nodes, so a check must ignore them.
Activity
thymikee commentedon Nov 18, 2026
Triage: bug; actionable without more input from you. Current main still rejects any regular node outside its cumulative clip, and the tvOS focus transform has no corresponding projection rule. The fix belongs in presentation of that observed geometry, while retaining finite viewport and actionable-point checks; increasing the global tolerance would hide unrelated errors. Include the reported index/provenance mismatch in the regression evidence.
thymikee commentedon Nov 18, 2026
Decision: #4654 scope split:
The tvOS refusal is fixed in #4700 (head
b2dff79348): the host now revalidates an Apple runner payload with the fold policy that runner compiled, instead of its owncursor-projecteddefault. The focused tile keepsfocused: trueand stays actionable, and the reported error is reproduced at the base and gone at the head. The PR stays a draft until live tvOS evidence exists: the available device inventory has no tvOS target.The other Required-behavior bullet stays open and is split into #4701 rather than folded into that fix. The refusal's
details.indexis counted in the host's projected/compacted tree, whilesnapshot --rawis a different tree, and nothing in the details says which tree the number belongs to. Its owner is the shared error-projection seam (toIosSnapshotEngineErrorDetailsplus theIosSnapshotEngineFailureDetailscontract), which every engine refusal shares, not the tvOS presentation path — so the change reaches non-interactive snapshots too, and picking between the two options this report allows is a decision about what a refusal index means for every producer.Evidence carried to the split, from base
7610947604: the runner route re-indexes the payload (compactRunnerPayloadinpackages/capture-kit/src/ios-snapshot-engine/runner-presentation.ts) and then validates the re-indexed array (validateRunnerOutput), whilevalidateContainedFrameinpackages/capture-kit/src/ios-snapshot-engine/invariants.tspublishesnode.indexfrom that array with no statement of its index space. On a tree where compaction is the identity, the reported index still matches the raw tree — which is why the mismatch only surfaces on a real home screen.fix(snapshot): revalidate Apple runner payloads with the producer's f…
thymikee commentedon Nov 18, 2026
Current state:
b2338f377d. On a tvOS Simulator,snapshotandsnapshot -inow succeed on a focused, focus-scaled tile: the host revalidates the runner's already-presented payload with the fold policy that runner compiled, and the regular tree walk keeps the focus marker on the surviving tile. The reporter verified the final heada5eda40287live on an Apple TV 4K (3rd generation) Simulator, tvOS 27.2: nine captures and twotv-remote press rightpresses all exit 0, each regular view carries exactly onefocused: trueandhittable: truenode on the tile--rawmarks focused, and that tile advances after each press (fix(snapshot): revalidate Apple runner payloads with the producer's fold policy #4700 (comment)).details.indexcounts the host's projected/compacted tree whilesnapshot --rawis a different tree, and nothing states which one the number belongs to.RegularSnapshotTree.appendholds the tvOS focus forward, and no test reaches it through the runner's own traversal loop: the conformance executable re-implements that loop, so a golden case agrees with the copy rather than with the device path. That issue also records why the review's other note — droppingappend'selementTypeparameter — is not a delete, because the runner passesString(describing:)where the harness passesnode.type.Next step: #4701. This report stays open until its index-provenance bullet is answered; the tvOS refusal itself is fixed and verified on a device.