Skip to content

macOS: FSEvents reports a change twice; the second report re-arms a candidate's debounce #233

Closed

Description

@7schmiede

On macOS, FSEvents often reports a change to a file a second time, a moment later. The watcher takes the second report as a new change. Two visible effects so far:

  1. A pending candidate is checked once more right after a switch. The daemon drops it as unchanged (candidate_unchanged) a few milliseconds later; harmless, but visible. lifecycle_services_only waits for it since feat: macOS as a developer platform in preview, Homebrew, arm64 Linux (ADR-0054) #225.
  2. A job can run twice for one change. Two services after the same job, one edit that both build: the second report re-arms one candidate's debounce, so it starts building about 240 ms after the other. By then the job's run for the first one has begun, and the job runs again for the second. Seen on the macos-14 runner, a_job_runs_once_for_two_candidates, run 39941117097 (seed ran 3 times, expected 2).

Possible fix: in crates/devstack-daemon/src/watch.rs, drop a report for a path whose metadata (mtime, size) has not changed since the last report for it. Or don't let a report re-arm a debounce that is already armed for the same path, and fire at the first report's deadline.

Done when: a_job_runs_once_for_two_candidates passes reliably on macos-14 (e.g. 10 runs in a row).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions