Skip to content

test(watch): remove filesystem timing assumptions - #388

Merged
fylorn merged 1 commit into
mainfrom
codex/watch-debounce-tests
Nov 1, 2026
Merged

fylorn merged 1 commit into
mainfrom
codex/watch-debounce-tests

Conversation

@fylorn

@fylorn fylorn commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

What this changes

Make the tw-watch and tw-config filesystem tests verify change delivery without assuming a fixed notification count. Keep exact batching assertions in the queued raw-event test. The macOS fd-budget test now waits for the exact descriptor count during backend handover, with a five-second deadline.

Why

Writes and notification delivery can span several 200 ms quiet windows when I/O or scheduling stalls. Multiple notifications are then correct, so a write loop or a single truncate/write operation cannot require exactly one signal.

A change notification can also arrive before FSEvents finishes starting and the old descriptors are released. A quiet notification channel does not establish that the backend handover has completed.

How it was verified

  • Formatting and workspace clippy passed.
  • Workspace nextest: 4,291 passed, 8 skipped; smoke: 86 passed, 0 failed.
  • A forced 400 ms write pause reproduces the old burst assertion failure; the corrected filesystem tests pass with the same pause.
  • A forced two-second handover delay reproduces the old fd assertion failure; the state-based wait passes with the same delay.
  • Deliberately emitting per queued event fails the exact batching test. Deliberately leaking watched descriptors still fails the fd-budget test.

Notes for review

All changes are confined to test code and comments. Production watcher code and timing parameters are unchanged. Exact batching and descriptor-count assertions remain active.

Write loops and individual truncate/write operations can span multiple
200 ms quiet windows, making a fixed notification count invalid. Keep
exact batching assertions on queued raw events and check change delivery
in filesystem integration tests.

The fd-budget test can also observe a signal before the asynchronous
FSEvents handover finishes. Wait for the exact descriptor count with a
bounded deadline instead of treating channel silence as completion.

Production watcher logic and timing parameters are unchanged.
@fylorn
fylorn merged commit caf324e into main Nov 1, 2026
6 checks passed
@fylorn
fylorn deleted the codex/watch-debounce-tests branch November 1, 2026 04:22
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant