digidem / digidem/comapeo-core-react-native

iOS: fold waitForFile into connectWithRetry for parity with Android

Open
#53 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: ios priority: P3 tech-debt
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:) 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.