Repository navigation
Make concurrency regression tests independent of wall time - #65353
Conversation
The race-enabled suite can delay a valid completion beyond the test's ten-second watchdog, causing a false deadlock failure on busy workers. Deadlock coverage should depend on blocked goroutines, not elapsed wall time.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change replacing the completion regression test’s wall-clock timeout with synctest deadlock detection.
No open issues 🎉
What changed in this PR
This PR makes the completion deadlock regression test independent of wall time, avoiding false failures when race-enabled runs are slow while preserving coverage for completions with symbols and existing imports.
Changes:
- Wraps the test setup and completion request in
synctest.Test. - Removes the goroutine, result channel, and ten-second watchdog.
- Preserves the assertion that the expected auto-import completion is returned.
| File | Description |
|---|---|
tsc/internal/api/session_completion_test.go |
Replaces the wall-clock timeout with synctest deadlock detection. |
Review effort: Balanced
Other in-memory concurrency regressions use wall-clock watchdogs or sleep to infer that work is blocked. On busy workers those checks can report false failures or miss premature shutdown, while the mapper initialization test always spends five real seconds waiting for its deadline.
Andrew Branch (andrewbranch)
left a comment
There was a problem hiding this comment.
Actually, can you add a line to Copilot's testing instructions about this?
|
As in, "don't use sleeps, use synctest"? Yeah. |
|
Er, the compiler and fourslash test skill exists and we've been shoving instructions in it, but it's not supposed to be loaded for regular tests like these. Should that be renamed? I can tack into it in any case. |
Wall-clock watchdogs can mistake slow race-enabled execution for a deadlock. Keep guidance alongside the existing testing instructions so future in-memory concurrency tests avoid timing-dependent assertions.
|
I'm confusing this for the API skill. I don't think it should go in any of those so I'm moving it to the general file. |
Concurrency tests outside compiler and fourslash work also need this guidance. Repository-wide instructions make it discoverable without requiring an unrelated testing skill to be loaded.
Regression from #64178, but then other fixes.
I recommend reviewing with https://github.com/microsoft/TypeScript/pull/65353/changes?w=1