perf(macos): reuse the helper fingerprint between unchanged calls
Summary
Every local macOS helper call read the Swift sources and ran swift --version before checking the installed helper.
The helper now remembers its fingerprint while:
- the sources are unchanged: an installed package's are immutable for the process; a checkout's are stamped (path, device, inode, size, mtime), including additions and removals;
- the selected Swift compiler (
DEVELOPER_DIRorxcode-select, plus stamps of the compiler and any Xcode bundleversion.plist) is unchanged; - the shared manifest and executable, still checked on every call, accept it.
Any other call reads and probes afresh, so a rebuild records what it compiles. A failed probe, or an unidentifiable compiler, is never remembered. Configured and provider helpers still skip this. The digest format is unchanged.
Before / after
No observable change: same helper, same rebuild triggers. Fingerprint resolution on one macOS host (Xcode 27.1, 30 samples each; "before" forces a full read and probe; at 7a3dbc1331):
| Layout | Before median / p90 | After median / p90 |
|---|---|---|
| checkout (17 Swift files) | 289 / 637 ms | 4.3 / 13.0 ms |
| installed (11) | 164 / 259 ms | 0.33 / 0.48 ms |
Validation
At 4981629c94, helper-build.test.ts passes (9/9); with the previous helper-fingerprint.ts, the bundle version file test fails. OXC format and lint pass on the changed files. Remaining gates: CI.
Residual risk: a compiler swapped in place behind PATH or TOOLCHAINS is seen only after a daemon restart or when the shared helper stops matching. No independent review; self-reviewed.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.