fix: allow fresh session device binding#677
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
987b6f2 to
26f3886
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 987b6f2d80
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| flags: CommandFlags, | ||
| lockPlatform: NormalizedLockPlatform, | ||
| ): void { | ||
| for (const key of freshSessionSelectorKeysForPlatform(lockPlatform, flags.target)) { |
There was a problem hiding this comment.
Treat macOS platform as desktop for Apple locks
When the lock platform is apple and a fresh request uses --platform macos --udid ... or --ios-simulator-device-set ... without an explicit --target desktop, this call passes only flags.target as undefined, so freshSessionSelectorKeysForPlatform() takes the non-desktop Apple branch and does not flag the iOS-only selector. With reject the request gets past lock-policy validation and then fails later during device resolution; with strip it leaves the stale iOS selector instead of stripping it before targeting the host Mac. Please account for flags.platform === 'macos' as a desktop Apple request here.
Useful? React with 👍 / 👎.
2c57efa to
3f334a4
Compare
3f334a4 to
c0316e6
Compare
|
Summary
Allow fresh named sessions to use compatible explicit device selectors for their first binding while preserving existing-session selector conflict checks.
Deepen request binding into
src/daemon/request-binding.tsso fresh/existing session lock identity and locked request binding live behind one daemon module instead of being split across admission and execution scope.Fresh session binding now locks both the first-binding session key and the resolved device key when possible. That prevents concurrent fresh requests with the same session name but different explicit devices from racing and overwriting the session binding.
Fresh locked
openrequests still use compatible selectors for first binding, but incompatible selectors now fail during lock-policy validation instead of later during device resolution.Apple-family fresh-session lock policy now treats explicit
--platform macosas a desktop Apple selector, including strip/reject handling for stale iOS-only selectors.Centralize selector intent in
src/daemon/device-selector-intent.tsand reusesession-selectorconflict logic when deciding whether a request still targets the active session device. Touched files: 10. Scope stayed within daemon request binding/session selector behavior and focused tests.Validation
Verified focused daemon behavior with
pnpm exec vitest run src/daemon/__tests__/request-lock-policy.test.ts src/daemon/__tests__/request-router-lock-policy.test.ts src/daemon/handlers/__tests__/session-device-utils.test.ts src/daemon/__tests__/request-execution-scope.test.ts, including fresh--session+--udidbinding, default lock-platform device serialization, same-session/different-device first-binding serialization, incompatible fresh-session selector rejection before binding, macOS-under-Apple selector handling, and simulator-set selector conflict reuse.Ran
pnpm check:fallow --base origin/mainandpnpm check:quicksuccessfully.pnpm check:unitpassed unsandboxed: 230 unit files / 2037 tests and 7 smoke tests.