fix(ios): carry the snapshot viewport across the runner boundary as a declared fact

Merged
TH
2mo ago
+837-249

Closes #2891. Related: #2881 (same contracts/fixtures/ mechanism, different payload).

Summary

The runner spelled "viewport unknown" as CGRect.infinite. SnapshotGeometry.isGeometricallyActionable
read that sentinel as "everything is actionable" before it computed any center, while the host's
IosViewportEvidence does not publish the bit at all. The viewport now crosses the boundary as a
SnapshotViewport fact with three cases:

  • reported(box, interfaceOrientation)
  • derived(box)
  • missing(reason)

Only factories can construct a box-bearing case. Only reported carries an orientation, so a derived
or missing viewport cannot anchor a rotation. SnapshotGeometrySpace takes the fact, not a sentinel
CGRect.

With no box, a node whose actionability depends on containment has no hittable on the wire, which is
how the host bridge leaves it. A disabled node or a degenerate frame is still a declared false.
Clipping stays separate from containment. SnapshotPresentationInvariant reads "no box" as no root clip
to violate, not as an unbounded clip.

contracts/fixtures/snapshot-actionability-policy.json pins the shared predicate for shapes that the
fixed 320x240 fold fixture cannot reach. Every row declares both languages. A Swift-only row names its
asymmetry.

Validation

Tested SHA 771322a9e9, rebased on 86d719dc33.

  • pnpm test:ios-snapshot-differential: Swift 16 tests, node 5 tests, all pass.
  • pnpm check:affected --run: exit 0. pnpm check:xctest-selection: pass.
  • Runner build with unit tests (iOS). 86 affected RunnerTests on a new iPhone 17 Pro / iOS 26.2 simulator: Executed 86 tests, with 0 failures.
  • Host: packages/platform-apple/src/runner/__tests__/snapshot-presentation.test.ts sends a payload with hittable absent through presentAppleRunnerSnapshot, and the bit stays absent.
  • Live, same simulator, repo CLI at this head: open com.apple.Preferences, then snapshot --json. The tree backend was healthy: 73 nodes, 65 hittable: true, 8 false, none absent.
  • Earlier head e222012106: the author ran an A/B on the rnav-repro simulator against an origin/main runner. Both runners returned the same 22-node snapshot.

Not checked live: the CLI has no rotate command, and a .missing viewport cannot be forced on a device. Unit tests cover both paths. A box shaped like CGRect.infinite that reaches the TypeScript predicate is still actionable there. The refusal belongs to the producer that parses an Apple frame.