fix(safety): reject frozen queue policy changes before project backup

This commit is contained in:
阿白叔 committed 2026-10-21 15:26:55 +08:00
1 parent 2c88be99ce
commit 0151552f55
2 files changed
+24 -2

No files matched your search

@@ -6,6 +6,18 @@ from .schematic_backup import create_schematic_backup
def prepare_private_single_step(preparer, task_id, projects, rules, copy_part_number_to_value, *, runtime=None):
from .quick_run import (_queue_value_mode, _value_mode, _read_status_details,
_queue_has_mutation_evidence)
root = preparer.data_root / 'quick-run'
command, status = root / 'command.tsv', root / 'status.tsv'
# Reject a frozen-policy conflict before even opening the project tree for
# backup. This preflight only reads evidence and cannot archive/rewrite it.
if (command.is_file() and status.is_file()
and _queue_value_mode(command) != _value_mode(copy_part_number_to_value)
and (_read_status_details(status) or any(root.glob('snapshot-*'))
or _queue_has_mutation_evidence(root))):
raise TaskCenterError('quick_run_pending',
'recorded Value policy differs; reconcile the old queue before creating a new task')
progress = preparer.progress(task_id, projects, rules,
copy_part_number_to_value=copy_part_number_to_value)
if progress.queue_complete or progress.next_project_path is None: