fix(ios): reject ambiguous modal-surface pairings

Merged
TH
1d ago
+83-9

Summary

Four follow-ups to the modal-surface rule (#4125), in 4 files, host only:

  • Duplicate children. The walk paired a kept child with the first plain child that has the same element. If a node lists one element more than once and the honor-modal read keeps only some of those occurrences, the walk could pick the wrong one and report a false surface. That now reads as unknown(duplicatedChild). Occurrences that are all kept still pair in order, as the scroll bars in the prompt recordings do. One element under two parents is unaffected.
  • Root mismatch. Reads that start at different roots now read as unknown(rootMismatch) instead of unorderedRead.
  • Coverage. AlertSurfaceTests again checks every recording's expect against the honor-modal exclusion, independently of expectModalScope.
  • Capture script. It now reports separately whether it kept expect and expectModalScope.

A single unmatched child still makes the whole reading unknown.

Validation

Head 1154659e6e, base f7879cf2d2.

  • pnpm check:affected --run --head 1154659e6e: all runnable checks passed. An earlier run hit two unrelated timeouts under host load; both pass alone.
  • swift test --package-path apple/snapshot-presentation: 51 tests passed. On the base, the new duplicate and root tests fail: the duplicate case reads modal(host: 2, roots: [3]), and the root case reads unorderedRead.
  • Mutation check: editing one recording's expect either way fails the restored test. Reverted.
  • TS parity (geometry-policy-presented-surface, snapshot-source/tree): 35 passed.
  • No device run: the runner does not pass a modal reading yet.

šŸ¤– Generated with Claude Code