Skip to content

Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest. - #2066

Merged
jglogan merged 1 commit into
apple:mainfrom
jglogan:directorywatcher-flake
Aug 4, 2026
Merged

Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest.#2066
jglogan merged 1 commit into
apple:mainfrom
jglogan:directorywatcher-flake

Conversation

@jglogan

@jglogan jglogan commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Fixes [Bug]: Localhost DNS /etc/resolvers directory watcher has racy startup, results in test flakes. #2065.
  • startWatching() returns before the watcher is ready to receive events, resulting in dropped events. Add readyEvents, an AsyncStream that yields once the watcher is actually active, so callers can await real readiness instead of guessing a sleep duration.
  • Prevent concurrent callers to startWatching(), as it does not support this mode of operation.
  • This fixes DirectoryWatcherTest's intermittent flakes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Principally to address test flakes, but it does address startup races.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

- Fixes apple#2065.
- `startWatching()` returns before the watcher is ready
  to receive events, resulting in dropped events. Add
  readyEvents, an AsyncStream that yields once the
  watcher is actually active, so callers can await
  real readiness instead of guessing a sleep duration.
- Prevent concurrent callers to startWatching(), as it
  does not support this mode of operation.
- This fixes DirectoryWatcherTest's intermittent flakes.
@jglogan
jglogan requested a review from JaewonHur August 4, 2026 01:47
@jglogan jglogan changed the title Add readiness signal to DirectoryWatcher, fix flaky DirectoryWatcherT… Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest. Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 24.25%
Integration 66.22%
Combined 75.56%

@jglogan
jglogan merged commit cb8cad4 into apple:main Aug 4, 2026
8 of 10 checks passed
@jglogan
jglogan deleted the directorywatcher-flake branch August 4, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Localhost DNS /etc/resolvers directory watcher has racy startup, results in test flakes.

2 participants