fix: preserve blocked state after rebuild cleanup failure

This commit is contained in:
阿白叔 committed 2026-10-30 08:51:00 +08:00
1 parent 12895e9868
commit 7da623d055
5 files changed
+154 -3

No files matched your search

+23
View File
@@ -193,6 +193,29 @@ def test_prewrite_failure_releases_old_desktop_and_retries_only_once(tmp_path, m
and release['released_at'] > 0 for release in releases)
def test_rebuild_does_not_hide_cad_shutdown_failure(tmp_path):
from dx_productivity.trial_task_center.batch_runtime import BatchCadRuntime
from dx_productivity.trial_task_center.errors import TaskCenterError
class FailingCad(Cad):
def __exit__(self, *_exc):
self.closed = True
self.desktop.close()
raise OSError('CAD quit confirmation failed')
runtime = BatchCadRuntime(tmp_path / 'data', 'execution',
desktop_factory=Desktop, cad_factory=FailingCad)
runtime.__enter__()
runtime._ensure_desktop()
runtime._ensure_cad()
with pytest.raises(TaskCenterError, match='CAD quit confirmation failed'):
runtime.close(rebuilding=True)
with pytest.raises(TaskCenterError, match='CAD quit confirmation failed'):
runtime.__exit__(None, None, None)
record = json.loads(runtime.path.read_text())
assert record['state'] == 'blocked'
def test_possible_mutation_prevents_automatic_replay(tmp_path, monkeypatch):
from dx_productivity.trial_task_center.worker_monitor import WorkerMonitorError
command, _ = command_for(tmp_path)