fix(test): resolve trash_spec.lua flakes from leaked mutation state
Problem: `mutation_in_progress` and `buffers_locked` are module-level locals in `mutator/init.lua` and `view.lua`. When a trash test times out mid-mutation, these flags stay true and `reset_editor()` never clears them. Subsequent tests' `save()` calls bail on `mutation_in_progress`, silently skipping mutations so `OilMutationComplete` never fires — causing cascading 10s timeouts. Solution: Add `mutator.reset()` to clear leaked mutation state, and call it from `reset_editor()` when `is_mutating()` is true. A 50ms event loop drain lets in-flight libuv callbacks settle before the reset. Baseline: 4/10 sequential passes. After fix: 49/50 parallel passes with zero timing overhead on the happy path (~2.4s).
This commit is contained in:
parent
a1b2679130
commit
2b7e722f4d
2 changed files with 12 additions and 0 deletions
|
|
@ -510,6 +510,10 @@ M.is_mutating = function()
|
|||
return mutation_in_progress
|
||||
end
|
||||
|
||||
M.reset = function()
|
||||
mutation_in_progress = false
|
||||
end
|
||||
|
||||
---@param confirm nil|boolean
|
||||
---@param cb? fun(err: nil|string)
|
||||
M.try_write_changes = function(confirm, cb)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue