diff --git a/docs/reviews/2026-11-06-ui-followup.md b/docs/reviews/2026-11-06-ui-followup.md new file mode 100644 index 0000000..f72ed9e --- /dev/null +++ b/docs/reviews/2026-11-06-ui-followup.md @@ -0,0 +1,7 @@ +# 评论 275/283:结果口径接入 + +管理进度显示历史占用复核;结果分别呈现已确认的原生动作、变更清单完整性和历史会话释放事实。单项 RECOVERY_REQUIRED 但 safe_to_continue=True 时,不再声称整个队列停止;记录失败不伪装成原生上传/移除失败。 + +独立操作回归更新为实际历史记录归档流程:先证明当前占用已释放、保留归档字节,再进行普通验证;不自动 Repair,失败后不遗留新的占用锁。 + +本阶段相关 UI/独立操作/后端回归 29 passed。后端完整回归与最终集成回归另见验证记录。没有执行真实 Mentor 写操作;回退按依赖逆序,不代表恢复原生事务。 diff --git a/src/cbb_refresh_verify/ui/management_dialog.py b/src/cbb_refresh_verify/ui/management_dialog.py index 59bad6b..f883fad 100644 --- a/src/cbb_refresh_verify/ui/management_dialog.py +++ b/src/cbb_refresh_verify/ui/management_dialog.py @@ -14,7 +14,7 @@ from ..management import run_management_batch, validate_name RESULT_LABELS = { 'REMOVED': '已移除', 'UPLOADED': '已上传 / 未自动校验', 'UPLOADED_VERIFIED': '已上传且校验通过', 'UPLOADED_VERIFY_FAILED': '已上传但校验未通过', - 'UPLOAD_FAILED': '上传失败', 'RECOVERY_REQUIRED': '需要人工恢复 / 队列已停止', + 'UPLOAD_FAILED': '上传失败', 'RECOVERY_REQUIRED': '需要人工恢复', 'BLOCKED': '操作被阻止', 'UNSUPPORTED': '当前环境不支持', } STAGE_LABELS = { @@ -25,6 +25,9 @@ STAGE_LABELS = { 'verify': '正在校验上传结果', 'verified': '校验已返回', 'copy': '正在准备来源副本', 'hash': '正在校验主要文件', 'release_check': '正在检查工程是否被占用', + 'previous_release_check': '正在复核历史占用', + 'previous_release_confirmed': '历史会话已确认释放', + 'previous_release_unconfirmed': '占用复核未通过', } @@ -203,6 +206,18 @@ class ManagementDialog(QDialog): for result in results: summary = f'{result.name}:{RESULT_LABELS.get(result.status, result.status)}' text = f'{summary} — {result.detail}' + changes = getattr(result, 'change_report', None) + if changes: + if changes.get('status') == 'RECORDED': + text += (f'\n变更:新增 {len(changes["added"])}、删除 {len(changes["deleted"])}、' + f'修改 {len(changes["modified"])} 个主要文件。') + else: + summary += ',变更清单待核对' + text += '\n'+changes.get('detail', '变更清单未确认') + if getattr(result, 'release_proof', None): + text += '\n历史会话已释放;历史工程数据的恢复状态需另行核对。' + if not result.safe_to_continue: + summary += ',原生会话释放待确认' if self.recovery_from and result.status == 'UPLOADED_VERIFIED': summary += ',版本待核对。' elif result.status not in ('UPLOADED', 'UPLOADED_VERIFIED', 'REMOVED'): diff --git a/tests/test_independent_operations.py b/tests/test_independent_operations.py index 276e94b..d1baa44 100644 --- a/tests/test_independent_operations.py +++ b/tests/test_independent_operations.py @@ -6,7 +6,7 @@ from test_maintenance_entry import case def test_verify_defaults_to_no_repair_and_does_not_retain_a_failure_lock(tmp_path, monkeypatch): from cbb_refresh_verify import verify_runner as runner, library_lock as locks, native_repair - library = tmp_path / 'library.lmc'; library.touch() + library = tmp_path / 'library/library.lmc'; library.parent.mkdir(); library.touch() req = runner.VerifyRequest(library, 'CBB', tmp_path / 'evidence') assert req.auto_repair is False marker = locks.blocker_path(library) @@ -16,11 +16,17 @@ def test_verify_defaults_to_no_repair_and_does_not_retain_a_failure_lock(tmp_pat error_category='ICDB_REPAIR_REQUIRED', safe_to_continue=True) monkeypatch.setattr(runner, '_run_verify_serialized', lambda *a, **k: (calls.append('verify') or result)) monkeypatch.setattr(native_repair, 'attempt_recovery', lambda *a, **k: pytest.fail('verify requested Repair')) - assert runner.run_verify(req) is result + monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: []) + monkeypatch.setattr('cbb_refresh_verify.native_engineering_identity._process_snapshot', lambda: []) + first = runner.run_verify(req) + assert first.status == result.status and first.error_category == result.error_category + assert first.release_proof['status'] == 'RELEASE_CONFIRMED' assert runner.run_verify(req) is result assert calls == ['verify', 'verify'] - assert marker.read_text() == 'historical diagnostic record' - assert locks._key(tmp_path / '.library.cbb-upload.lock') not in locks._owners + assert not marker.exists() + archive = Path(first.release_proof['evidence_path']).with_name('blocker-before-0.json') + assert archive.read_text() == 'historical diagnostic record' + assert locks._key(library.parent / '.library.cbb-upload.lock') not in locks._owners def test_catalog_checkpoint_does_not_disable_ordinary_verify(qtbot, tmp_path, monkeypatch): diff --git a/tests/test_review_management_ui_followup.py b/tests/test_review_management_ui_followup.py new file mode 100644 index 0000000..ef34087 --- /dev/null +++ b/tests/test_review_management_ui_followup.py @@ -0,0 +1,31 @@ +from dataclasses import replace + +from test_management import setup + + +def test_released_item_failure_does_not_claim_entire_queue_stopped(qtbot, setup): + from cbb_refresh_verify.management import ManagementResult + from cbb_refresh_verify.ui.management_dialog import ManagementDialog + request, _, _ = setup + dialog=ManagementDialog([request]);qtbot.addWidget(dialog) + result=ManagementResult(request.operation,request.library,request.name,request.partition, + None,False,'complete','RECOVERY_REQUIRED',True,'native add failed') + dialog._result([result]) + assert '需要人工恢复' in dialog.status_label.text() + assert '队列已停止' not in dialog.status_label.text() + + +def test_report_failure_is_visible_without_inventing_native_failure(qtbot, setup): + from cbb_refresh_verify.management import ManagementResult + from cbb_refresh_verify.ui.management_dialog import ManagementDialog + request, _, _=setup + dialog=ManagementDialog([request]);qtbot.addWidget(dialog) + result=ManagementResult(request.operation,request.library,request.name,request.partition, + None,False,'complete','REMOVED',True,'removed',release_proof={ + 'status':'RELEASE_CONFIRMED','data_recovery_confirmed':False}, + change_report={'status':'UNCONFIRMED','detail':'report disk full'}) + dialog._result([result]) + assert '已移除' in dialog.status_label.text() and '变更清单待核对' in dialog.status_label.text() + assert '历史会话已释放' in dialog.output.toPlainText() + dialog._progress({'stage':'previous_release_check','block':request.name}) + assert '正在复核历史占用' in dialog.status_label.text()