digidem / digidem/comapeo-core-react-native
iOS: fold waitForFile into connectWithRetry for parity with Android
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 1
- Forks
- 0
- Avg merge
- 8h 24m
- Merged PRs (30d)
- 9
Description
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:)fromios/NodeJSIPC.swift. - Update
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. - Delete
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). - Update doc references in
agents.md,docs/ARCHITECTURE.md,README.mdonce the iOS-side mentions become stale too.
Why this matters
- Consistency: both
NodeJSIPCimplementations 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
- PR #52 (Android fix): https://github.com/digidem/comapeo-core-react-native/pull/52
- Code review of #52 noted iOS parity as a sensible follow-up, not in scope for the bug fix.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ios/NodeJSIPC.swift and the existing NodeJSIPCTests, then compare the Android cleanup in PR #52. Verify the iOS delayed-bind coverage, remove the obsolete WatchForFileTests.swift coverage if equivalent, and update agents.md, docs/ARCHITECTURE.md, and README.md where references are stale. Done means iOS retries both missing and not-yet-accepting sockets under the 30-second deadline with the shared shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100