Skip to content

tvOS: a regular snapshot refuses the whole screen (regular-node-outside-cumulative-clip) because the focused cell's focus scale overshoots its row #4654

Open

Description

@nstfn

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 on main at 655ede279.
  • 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-111 throws 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: true and stays actionable in the regular output.
  • When the refusal does fire, details.index names a node that snapshot --raw lists 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 -i succeeds 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

  1. added
    bug
    on Nov 18, 2026
  2. thymikee commented on Nov 18, 2026

    @thymikee
    Member

    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.

  3. added
    in-progress
    on Nov 18, 2026
  4. thymikee commented on Nov 18, 2026

    @thymikee
    Member

    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 own cursor-projected default. The focused tile keeps focused: true and 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.index is counted in the host's projected/compacted tree, while snapshot --raw is a different tree, and nothing in the details says which tree the number belongs to. Its owner is the shared error-projection seam (toIosSnapshotEngineErrorDetails plus the IosSnapshotEngineFailureDetails contract), 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 (compactRunnerPayload in packages/capture-kit/src/ios-snapshot-engine/runner-presentation.ts) and then validates the re-indexed array (validateRunnerOutput), while validateContainedFrame in packages/capture-kit/src/ios-snapshot-engine/invariants.ts publishes node.index from 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.

  5. thymikee commented on Nov 18, 2026

    @thymikee
    Member

    Current state:

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugin-progressready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions