285ced674f
Addresses teknium1's review (#64195) finding #2: the multi-rung resolver needs Electron tests covering precedence, stale-PID rejection, fallback behavior, and the remote boot path. The pure decision helpers are now covered by 29 unit tests in `profile-migration.test.ts` (vitest electron project). Coverage: - precedence: legacy > single-running-gateway > state.db heuristic - stale-PID rejection: recycled PIDs not owned by hermes are dropped - malformed pid files: JSON parse errors, non-integer PIDs, zero/negative - scoring edge cases: ancient files (recency floored at 0.1), tiny files (size floored at MIN_SIZE), larger DB beats smaller at similar recency - single-profile fallback: best === 'default' suppresses the write - no-op cases: preference file already exists, missing profiles root The remote boot path is verified by code review of the call-site move (commit preceding this one) — `migrateActiveProfileIfMissing()` now runs before `primaryProfileKey()` is first read in `startHermes()`. The pure decision logic that the orchestrator relies on is covered end- to-end below; this matches the repo's testable-helper pattern (see `profile-delete-routing.test.ts`).