Skip to content

iOS: fold waitForFile into connectWithRetry for parity with Android #53

@gmaclennan

Description

@gmaclennan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions