fix: close batch execution and recovery lifecycle

This commit is contained in:
阿白叔 committed 2026-11-17 16:56:29 +08:00
1 parent b19afc6a53
commit d9cf6a07e9
91 files changed
+5779 -454

No files matched your search

+7 -7
View File
@@ -70,11 +70,11 @@ def test_changed_confirmed_plan_is_rejected_before_any_executor(tmp_path):
assert not service.calls
def test_preflight_named_error_after_dispatch_needs_receipt_before_continuing(tmp_path):
def test_dispatched_error_isolates_the_project_after_its_owned_resources_exit(tmp_path):
service = Service(tmp_path, {'A': TaskCenterError('quick_run_preflight', 'target absent')})
result = execute_task_queue(service, ('A', 'B'), stop_event=Event())
assert result.paused and result.entries[0].state == 'blocked'
assert service.calls == [('start', 'A')]
assert not result.paused and result.entries[0].state == 'blocked'
assert service.calls == [('start', 'A'), ('start', 'B'), ('end', 'B')]
def test_actual_read_phase_failure_allows_next_project(tmp_path):
@@ -93,12 +93,12 @@ def test_actual_read_phase_failure_allows_next_project(tmp_path):
assert service.calls == [('start', 'B'), ('end', 'B')]
def test_uncertain_result_blocks_next_task(tmp_path):
def test_uncertain_result_is_quarantined_without_replaying_before_next_independent_task(tmp_path):
service = Service(tmp_path, {'A': TaskCenterError('quick_run_uncertain', 'unknown')})
result = execute_task_queue(service, ('A', 'B'), stop_event=Event())
assert result.paused
assert not result.paused
assert result.entries[0].state == 'blocked'
assert service.calls == [('start', 'A')]
assert service.calls == [('start', 'A'), ('start', 'B'), ('end', 'B')]
def test_pause_finishes_current_item_and_does_not_start_next_task(tmp_path):
@@ -122,7 +122,7 @@ def test_pause_between_problem_tasks_preserves_resumable_batch(tmp_path, monkeyp
assert result.paused and result.current_task_id in {'A', 'B'}
assert [entry.state for entry in result.entries] == ['failed', 'completed']
import json
checkpoint = json.loads((tmp_path / 'task-queues' / (result.queue_id + '.json')).read_text())
checkpoint = json.loads((tmp_path / 'task-queues' / (result.queue_id + '.json')).read_text(encoding='utf-8'))
assert checkpoint['phase'] == 'problems'