perf(apple-runner): read an installed package's runner fingerprint once

Merged
TH
4h ago
+138-31

Summary

Every runner command that reuses a session recomputes the expected runner cache metadata, and its source fingerprint walks and stats every runner source file: about 2.5 ms of synchronous daemon work per command, twice per snapshot (the two surface host appState reads) and more per press/fill. An installed package's runner sources change only with its version, and a new version replaces the daemon (the #2458 identity model), so its fingerprint now holds for the life of the process. A checkout still reads its sources on every reuse, so a runner edit still restarts the runner.

The runner host port gains isSourceCheckoutProjectRoot.

Value

Installed tree, iPhone 17 Simulator: daemon CPU in runner-cache-metadata fell from 5.3 ms to ~0 per snapshot -i.

Validation

  • Part of a read-latency series (#5193–#5197). Combined, on the external sign-in harness (iPhone 17 Simulator, iOS 27.0, checkout, warm runner): snapshot -i median 61–73 ms → 38–42 ms; press, fill, flow and batch unchanged or faster (all ops succeeded, flow reply tokens identical).

  • index.test.ts: an installed root reads its fingerprint once (fails on origin/main); the change-detection tests now model checkouts explicitly.

  • pnpm exec vitest run --project apple-runner: 1012 passed.

  • CI owns the full gates.

šŸ¤– Generated with Claude Code