Context
PR #52 fixes an Android-specific FileObserver wd-collision bug by dropping waitForFile entirely and folding the file-existence check into the connect retry loop. iOS does not have this bug — it already uses 50 ms polling rather than a DispatchSource-based observer (per agents.md:255) — but it still keeps waitForFile and connectWithRetry as two separate primitives.
Proposed change
Apply the same architectural cleanup on iOS:
- Remove
waitForFile(atPath:timeoutSeconds:) from ios/NodeJSIPC.swift.
- Update
connectWithRetry to retry on the connect-side IOError/POSIXError for both "file missing" (ENOENT) and "file exists but server not yet accepting" (ECONNREFUSED), bounded by a 30 s deadline.
- Delete
ios/Tests/WatchForFileTests.swift. The existing NodeJSIPCTests cover the same end-to-end behavior (connect-after-delayed-bind path is what waitsForSocketFileCreation already exercises on Android, and the iOS suite likely has the equivalent — verify and add if missing).
- Update doc references in
agents.md, docs/ARCHITECTURE.md, README.md once the iOS-side mentions become stale too.
Why this matters
- Consistency: both
NodeJSIPC implementations share the same shape. Easier to reason about, easier to keep in sync when one side gets a bug fix.
- Less code: ~−100 lines (mirrors the Android side's −436 with proportionally smaller iOS test files).
- One race-prone primitive instead of two.
Why this is not urgent
iOS does not have the wd-collision bug. Polling 50 ms file-existence + retry-connect works correctly today. This is a refactor for consistency, not a bug fix.
References
Context
PR #52 fixes an Android-specific
FileObserverwd-collision bug by droppingwaitForFileentirely and folding the file-existence check into the connect retry loop. iOS does not have this bug — it already uses 50 ms polling rather than aDispatchSource-based observer (peragents.md:255) — but it still keepswaitForFileandconnectWithRetryas two separate primitives.Proposed change
Apply the same architectural cleanup on iOS:
waitForFile(atPath:timeoutSeconds:)fromios/NodeJSIPC.swift.connectWithRetryto retry on the connect-sideIOError/POSIXErrorfor both "file missing" (ENOENT) and "file exists but server not yetaccepting" (ECONNREFUSED), bounded by a 30 s deadline.ios/Tests/WatchForFileTests.swift. The existingNodeJSIPCTestscover the same end-to-end behavior (connect-after-delayed-bind path is whatwaitsForSocketFileCreationalready exercises on Android, and the iOS suite likely has the equivalent — verify and add if missing).agents.md,docs/ARCHITECTURE.md,README.mdonce the iOS-side mentions become stale too.Why this matters
NodeJSIPCimplementations share the same shape. Easier to reason about, easier to keep in sync when one side gets a bug fix.Why this is not urgent
iOS does not have the wd-collision bug. Polling 50 ms file-existence + retry-connect works correctly today. This is a refactor for consistency, not a bug fix.
References