perf(ios): check surface hosts inside the snapshot bridge, not with pgrep
Ā
TH
1d ago+1151+1151+0123456789012345678901234567890123456789-630-630-012345678901234567890123456789
Summary
Fixes #2751. A warm bridge-served Simulator snapshot has no ready runner, so each capture first spawned the host presence probe (pgrep -f Ć2 plus ps).
- When no runner can answer, the bridge request names the registered host executables. The guest scans the process table in place (
sysctl, before and after capture) and refuses withsystem-surface-host-present(host carries thisSIMULATOR_UDID) orsystem-surface-host-unverified.bridgeFailureDispositionclassifies both as a capture-scopedsystem-surface-hostconsequence, so they go to the runner and never retire the generation. The host probe is deleted. - Rejected (ADR 0004): caching
absentuntil the next action, since a poll after a tap caches it before the host starts; trusting the bridge tree, which shows the occluded app (#2438). stats.backendscounts the serving producer (simulator-ax-bridge, notxctest); suite merges sum each run's counts.- 33 files.
Validation
Head 364eee6c3b, iPhone Air, iOS 27.0.
- Tests: exact host processes on the real resolver and acquisition paths (0
pgrep, 3ps); native scan on live decoys (scoped present, other device absent, unscoped unverified, an exited host absent throughprocessExited, a siblingName.app/NameHelperor an env value naming the fragment not a match); producer counts and merge; the registry stays inside the guest's host and length bounds. The native scan test is darwin-only; Linux CI skips it. - Live, SafariViewService lingering, no runner: guest refused
system-surface-host-present(11 ms); runner served. The unverified refusal and the post-capture scan were not run live; see the PR comment for why. - Ten-step batch, 3 alternating rounds vs
a0e7c7dc23, all no-runner, load 171ā201, per-step medians (ms):
| step | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| main | 91 | 93 | 99 | 99 | 105 | 92 | 91 | 85 | 92 | 110 |
| PR | 39 | 33 | 36 | 37 | 38 | 35 | 48 | 37 | 42 | 39 |
- Warm bridge snapshots spawn 0
pgrepand 3ps, not zero:ps -o lstart=pid-reuse reads (resolver 1, acquisition 2), about 5 ms each. Replacing them needs a new guest identity API. - Native scan test, run explicitly on darwin at
364eee6c3b: 6/6 passed (see the PR comment for the list). pnpm check:affected --run --head 364eee6c3bdid not reachunit. Both attempts (run-jIkwLy,run-9g6v8s) failedvitest-relatedon unrelated provider-integration timeouts at host load 300ā410.apple-platform-output-guardfailed 2/2 on main and passed 2/2 on this branch;apple-app-log-runtime-providerpassed 2/2 run alone. The last full pass was3b6bf10b82(run-SD1NXc).
š¤ Generated with Claude Code