perf(apple): reuse the process identity for native-build cache locks
Summary
Fold and bridge cache acquisitions lock before testing for a cached binary, so even a hit builds a lock owner record. Each one looked up this process's start time in the process table.
The record now takes PID and start time from readCurrentOwnerIdentity(), the host-kit owner of that identity. It keeps the first readable answer for the life of the process and asks again after an unreadable one. Cache keys, cache verification and foreign-owner checks are unchanged.
Own start-time reads, counted by the new test (/proc hidden, so every read goes through the process table):
| Acquisitions | Base | Head |
|---|---|---|
| 2, readable | 3 | 1 |
| 3, first read unanswered | 4 | 2 |
On Linux outside the test, the read comes from /proc, so the saved process spawn applies to macOS hosts.
Validation
Tested at fd5c42c8375051aebb265ce289c2624812d6a0b7 on macOS:
vitest run --project unit-coreonnative-build/host-lock.test.tsandnative-build/cache.test.ts: 5 passed.- With base
host.ts, both new tests fail on the read count. oxfmtandoxlinton the changed files: clean.
Typecheck, layering, coverage and the full unit suite are CI obligations. No device run: lock record contents are unchanged. Self-review was a re-read of the diff; no independent reviewer ran.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.