From 47a276328b5948d6cc62573069ef336ee373d07d Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Fri, 16 Jan 2026 17:03:25 +0100 Subject: [PATCH] Remove scheduler test failure status plan (#47000) Leftover from https://github.com/zed-industries/zed/pull/46671, CC @ConradIrwin Release Notes: - N/A --- STATUS.md | 132 ------------------------------------------------------ 1 file changed, 132 deletions(-) delete mode 100644 STATUS.md diff --git a/STATUS.md b/STATUS.md deleted file mode 100644 index 0e3889b5690cb3cd0eed0139198737e00acf9145..0000000000000000000000000000000000000000 --- a/STATUS.md +++ /dev/null @@ -1,132 +0,0 @@ -Antonio owns this. Start: say hi + 1 motivating line. Work style: telegraph; noun-phrases ok; drop grammar; min tokens. - -Investigate tests 1 by 1. Run with ITERATIONS=10. Scheduler has changed recently. As you make test pass, dump what the problem was succinctly in STATUS.md, this will build a collection of recipes for fixing these tests. - -# Test Failures (ITERATIONS=10) - -## Summary -- 3513 tests run -- 3469 passed -- 31 failed -- 13 timed out -- 47 skipped - -## Timeout Investigation - -Extended timeout to 300s in `.config/nextest.toml` for all timeout tests. - -Results: -- [x] `vim` tests (9) - **PASS** - just slow (~60s each), pass with 300s timeout -- [x] `editor` bracket/invisibles tests (2) - **PASS** - slow (76s, 90s), pass with 300s timeout -- [x] `language_model` test_from_image_downscales (1) - **PASS** - very slow (167s), passes -- [x] `extension_host` test_extension_store_with_test_extension (1) - **PASS** - passes with ITERATIONS=10 (timing-dependent, may have been system load) - -## Remaining Failures - -### Build Fixes -- `workspace/Cargo.toml`: Added `remote/test-support` to test-support features -- `acp_thread/Cargo.toml`: Added `editor/test-support` to dev-dependencies (needed for workspace to handle `RemoteConnectionOptions::Mock` variant) - -### Scheduler Fixes -- `scheduler/src/test_scheduler.rs`: Changed default `timeout_ticks` from `0..=1000` to `1..=1000` to ensure at least one poll in `block_with_timeout` - -### Inlay Hints Test Fixes -Common pattern: tests need explicit viewport setup + hint refresh because `visible_excerpts()` returns empty when `visible_line_count` is None. -- `prepare_test_objects()`: Added viewport setup (set_visible_line_count/column_count) + explicit refresh_inlay_hints + run_until_parked -- `test_no_hint_updates_for_unrelated_language_files`: Added same viewport setup for both rs_editor and md_editor - -### Other Failures -- [x] `acp_thread` tests::test_terminal_kill_allows_wait_for_exit_to_complete — **FIXED**: test used `cx.background_executor.timer()` (fake clock) but parking was enabled expecting real I/O. Fix: use `smol::Timer::after()` for real-time wait when parking enabled. -- [x] `command_palette` tests::test_command_palette — **FIXED**: shared static DB (`COMMAND_PALETTE_HISTORY`) persisted hit counts across seeds, breaking alphabetical sort assumption. Fix: clear DB at test start via `clear_all().await`. -- [x] `editor` editor_tests::test_autoindent_selections — **FIXED**: autoindent uses `block_with_timeout` which can time out and go async. Fix: add `cx.wait_for_autoindent_applied().await` after `autoindent()` call. -- [x] `editor` editor_tests::test_completions_resolve_updates_labels_if_filter_text_matches — **FIXED**: `context_menu_next` triggers async completion resolve via `resolve_visible_completions`. Fix: add `cx.run_until_parked()` after `context_menu_next` before checking labels. -- [x] `editor` editor_tests::test_relative_line_numbers — **FIXED**: `add_window_view` calls `run_until_parked` which triggers render, and EditorElement layout overrides wrap_width based on window size. Fix: use `add_window` + `editor.update(cx, ...)` pattern (like `test_beginning_end_of_line_ignore_soft_wrap`) to avoid render-triggered wrap width override. -- [x] `editor` element::tests::test_soft_wrap_editor_width_auto_height_editor — **FIXED**: `WrapMap::rewrap` uses `block_with_timeout(5ms)` which can timeout with low `timeout_ticks` values, causing async wrap that doesn't complete before assertion. Fix: set `timeout_ticks` to `1000..=1000` to ensure wrap completes synchronously. -- [x] `editor` element::tests::test_soft_wrap_editor_width_full_editor — **FIXED**: Same issue as above. Fix: set `timeout_ticks` to `1000..=1000`. -- [x] `editor` inlays::inlay_hints::tests::test_basic_cache_update_with_duplicate_hints — **FIXED**: Added viewport setup to `prepare_test_objects()` -- [x] `editor` inlays::inlay_hints::tests::test_cache_update_on_lsp_completion_tasks — **FIXED** (uses prepare_test_objects) -- [x] `editor` inlays::inlay_hints::tests::test_hint_request_cancellation — **FIXED** (uses prepare_test_objects) -- [x] `editor` inlays::inlay_hints::tests::test_hint_setting_changes — **FIXED** (uses prepare_test_objects) -- [x] `editor` inlays::inlay_hints::tests::test_inside_char_boundary_range_hints — **FIXED**: LSP wasn't initialized before viewport setup. Fix: add `cx.executor().run_until_parked()` after editor creation to allow LSP initialization before setting viewport and requesting hints. -- [x] `editor` inlays::inlay_hints::tests::test_modifiers_change — **FIXED** (uses prepare_test_objects) -- [x] `editor` inlays::inlay_hints::tests::test_no_hint_updates_for_unrelated_language_files — **FIXED**: Added viewport setup for both editors -- [x] `git` repository::tests::test_checkpoint_basic — **PASS** with ITERATIONS=10 (was likely transient) -- [x] `project` project_tests::test_cancel_language_server_work — **FIXED**: LSP progress notifications sent by `start_progress_with` weren't fully processed before `cancel_language_server_work_for_buffers`. Fix: add `run_until_parked` between each `start_progress_with` call to ensure the Progress notification is processed and added to `pending_work`. -- [x] `project` project_tests::test_file_status — **PASS** with ITERATIONS=10 (passes after worktree fixes) -- [x] `project` project_tests::test_git_repository_status — **PASS** with ITERATIONS=10 (passes after worktree fixes) -- [x] `project` project_tests::test_rename_work_directory — **PASS** with ITERATIONS=10 (passes after worktree fixes) -- [x] `search` project_search::tests::test_project_search — **FIXED**: Two issues: (1) Selection highlights weren't refreshed when excerpts added to multi-buffer, so highlights only covered partial content. (2) Quick and debounced highlight tasks raced - quick task could clear results set by debounced task. Fix: Add `refresh_selected_text_highlights` call in `ExcerptsAdded` handler. Add `debounced_selection_highlight_complete` flag - when debounced task completes, it sets this flag. Quick task checks flag and skips if debounced already completed for same query. Flag resets when query changes. -- [x] `terminal` tests::test_basic_terminal — passes with ITERATIONS=10 -- [x] `worktree` worktree_tests::test_file_scan_exclusions — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_file_scan_exclusions_overrules_inclusions — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_file_scan_inclusions — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_file_scan_inclusions_reindexes_on_setting_change — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_fs_events_in_dot_git_worktree — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_fs_events_in_exclusions — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_hidden_files — **FIXED**: `flush_fs_events` race condition -- [x] `worktree` worktree_tests::test_renaming_case_only — **FIXED**: `flush_fs_events` race condition - -## Common Patterns / Recipes - -### Pattern 1: Missing `run_until_parked` after async-triggering operations -**Symptom**: Assertion fails because async work hasn't completed -**Fix**: Add `cx.run_until_parked()` or `cx.executor().run_until_parked()` after operations that spawn async tasks - -### Pattern 2: `block_with_timeout` can go async with randomized scheduler -**Symptom**: Flaky test where synchronous operation sometimes doesn't complete -**Cause**: `block_with_timeout(Duration)` uses `timeout_ticks` which is randomized (1..=1000). Low values cause premature timeout. -**Fix**: Set `cx.dispatcher.scheduler().set_timeout_ticks(1000..=1000)` at test start to ensure enough ticks for completion - -### Pattern 3: `add_window_view` triggers render which overrides editor state -**Symptom**: Editor settings (like wrap_width) get overwritten after setting them -**Cause**: `add_window_view` calls `run_until_parked` internally, which triggers window render. EditorElement's layout recalculates wrap_width from window bounds. -**Fix**: Use `cx.add_window()` + `editor.update(cx, ...)` pattern instead of `add_window_view` + `update_in` - -### Pattern 4: Inlay hints require viewport setup -**Symptom**: `visible_hint_labels` or `cached_hint_labels` returns empty -**Cause**: `visible_excerpts()` returns empty when `visible_line_count` is None -**Fix**: Call `editor.set_visible_line_count(N, window, cx)` and `editor.set_visible_column_count(M)` before `refresh_inlay_hints` - -### Pattern 5: LSP needs initialization time -**Symptom**: LSP-related operations fail or return empty results -**Cause**: LSP server initialization is async -**Fix**: Add `cx.executor().run_until_parked()` after creating editor/project but before LSP operations - -### Pattern 6: "Parking forbidden" error -**Symptom**: Test panics with "Parking forbidden. Re-run with PENDING_TRACES=1" -**Cause**: Test awaits something that will never complete (e.g., channel recv with no sender), and scheduler has no other work -**Fix**: Ensure all async operations complete before awaiting on channels. May need `allow_parking` for I/O-dependent tests. - -### Pattern 7: Shared static state across test seeds -**Symptom**: Test passes on seed 0 but fails on later seeds -**Cause**: Static/global state persists across seed iterations -**Fix**: Clear/reset static state at test start (e.g., `COMMAND_PALETTE_HISTORY.clear_all().await`) - -### Pattern 8: `events.next().await` can block indefinitely with FS events -**Symptom**: Test times out while parking, waiting for FS events that never arrive -**Cause**: `events.next().await` blocks waiting for the next event. When tests run in parallel or FS watcher is slow, events may be delayed or batched, causing indefinite waits. -**Fix**: Use `futures::select_biased!` with a short timer to poll periodically: -```rust -while !condition() { - futures::select_biased! { - _ = events.next() => {} - _ = futures::FutureExt::fuse(smol::Timer::after(Duration::from_millis(10))) => {} - } -} -``` -Also subscribe to events BEFORE triggering the action (e.g., creating a file) to avoid missing events fired before subscription. - -### Pattern 9: LSP notifications need processing time between sends -**Symptom**: LSP-related test fails because notifications weren't processed -**Cause**: `FakeLanguageServer.notify()` queues messages but they need async processing by the project's notification handlers -**Fix**: Add `cx.executor().run_until_parked()` after each `notify()` or `start_progress_with()` call before depending on the notification being processed - -### Pattern 10: Multiple async tasks operating on same state can race -**Symptom**: Test fails intermittently with different seeds, state appears incomplete -**Cause**: Multiple tasks (e.g., quick task + debounced task) both clear and set the same state. Random scheduling means the "wrong" task may run last. -**Fix**: Use a completion flag - debounced task sets flag when done, quick task checks flag and skips if debounced already completed. Reset flag when query/state changes. - -### Pattern 11: Multi-buffer excerpts added asynchronously -**Symptom**: Selection highlights or other features only cover partial buffer content -**Cause**: Feature triggered before all excerpts added to multi-buffer. The feature captures buffer snapshot at that time. -**Fix**: Listen for `multi_buffer::Event::ExcerptsAdded` and refresh the feature when new content is added. \ No newline at end of file