diff --git a/docs/releases/2026-11-04-tabs-and-release.md b/docs/releases/2026-11-04-tabs-and-release.md index b9e9d93..abda574 100644 --- a/docs/releases/2026-11-04-tabs-and-release.md +++ b/docs/releases/2026-11-04-tabs-and-release.md @@ -37,3 +37,9 @@ 原库未执行本轮自动化写入。第一套 F 盘测试副本出现目录枚举属性与直接读取属性不一致,被链接检查阻止,未绕过检查。测试随后迁移到独立本机目录;`C:\Users` 目录会被 Mentor 转成共享路径,因此最终试验选择独立的 `C:\Temp` 路径,并保留前序失败记录。 完整 ICDB 修复仍必须取得权威 READY;原生 Repair 成功、能够取消、正常关闭或界面测试通过都不能替代该验收。未合并发布,工单保持未解决。 + +## 结果展示收尾 + +实际冻结运行截图还暴露了结果弹窗包含长路径和 COM 异常、错误列挤压 CBB 名称的问题。结果正文改为简短计数、用户可理解的失败原因和副本恢复入口;原始异常、统计明细及日志路径保留在可展开详情和日志中。名称与结果列共同分配可用宽度,长内容不再把表格撑出窗口。历史备份待核对和待选 PCB 版本仍直接提示。 + +该收尾只调整展示,不改变占用检查、关闭、Repair、校验或恢复行为。以已保存的真实失败结果回放检查布局,未额外写入原生库。相关界面、筛选和副本恢复回归 84 项通过;记录为 `pytest-presentation.log` / `pytest-presentation-result.json`。原先完整回归 1,207 项及冻结原生流程的失败结论仍分别保留,不能把展示回放当作新增原生验收。 diff --git a/src/cbb_refresh_verify/ui/main_window.py b/src/cbb_refresh_verify/ui/main_window.py index 4994d4f..b151c1e 100644 --- a/src/cbb_refresh_verify/ui/main_window.py +++ b/src/cbb_refresh_verify/ui/main_window.py @@ -123,7 +123,8 @@ class MainWindow(QWidget): self.cbb_table = QTableWidget(0, 4) self.cbb_table.setHorizontalHeaderLabels(['CBB 名称', '分区', '状态', '环境检查']) self.cbb_table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch) - for column in (1, 2, 3): + self.cbb_table.horizontalHeader().setSectionResizeMode(3, QHeaderView.Stretch) + for column in (1, 2): self.cbb_table.horizontalHeader().setSectionResizeMode(column, QHeaderView.ResizeToContents) self.cbb_table.setSelectionBehavior(QTableWidget.SelectRows) self.cbb_table.setMinimumHeight(150) @@ -963,26 +964,31 @@ class MainWindow(QWidget): self.icdb_phase.setText('已停止,存在待处理项目' if failed or skipped else '已完成非 READY 检查') if any(not result.safe_to_continue for result in results): text += '\n未确认数据库或会话安全,已停止剩余校验。请查看恢复现场。' - status_text = text - if self._global_icdb_run: - status_text = (f'非 READY 检查结束:通过 {passed},失败/受阻 {failed},未执行 {skipped}。\n' - f'仅检查、未修复 {counts["checked_without_repair"]};' - f'原生修复 {counts["repaired"]},恢复备份待复核 {counts["review_required"]},' - f'ICDB已修复/PCB版本待选 {counts["version_choice_required"]},' - f'修复未确认 {counts["repair_unconfirmed"]}。') + status_text = (f'已结束:通过 {passed},失败/受阻 {failed},' + f'仅检查 {checked},未执行 {skipped + len(self.skipped_names)}。') + if self._global_icdb_run and counts['review_required']: + status_text += f'\n恢复备份待复核 {counts["review_required"]},请核对工程版本。' + if self._global_icdb_run and counts['version_choice_required']: + status_text += f'\n待选择 PCB 版本 {counts["version_choice_required"]}。' first_failure = next((result.stderr for result in results if result.status not in ('PASS', 'SKIPPED') and result.stderr), '') if first_failure: - explanation = '\n首个未完成原因:' + first_failure[:1500] - status_text += explanation - text += explanation + text += '\n首个未完成原因:' + first_failure + if any(result.error_category == 'CBB_REIMPORT_REQUIRED' for result in results): + status_text += '\nMentor 不允许对此已验证过的 CBB 反标注,校验未通过。' + else: + status_text += '\n部分项目未完成,请查看详情。' + if any(not result.safe_to_continue for result in results): + status_text += '\n后续操作已暂停。' if self._reimport_offers: guidance = '\n修复未完成,可选择工程副本恢复。' text += guidance status_text += guidance - self.status_label.setText(status_text); self.output.append(text) + self.status_label.setText(status_text.replace('\n', ' ')); self.output.append(text) self.summary = QMessageBox(self) - self.summary.setWindowTitle('非 READY ICDB 检查与修复结果' if self._global_icdb_run else 'CBB 校验结果'); self.summary.setText(text) + self.summary.setWindowTitle('ICDB 维护结果' if self._global_icdb_run else 'CBB 校验结果') + self.summary.setText(status_text) + self.summary.setDetailedText(text) self.summary.setIcon(QMessageBox.Warning if failed else QMessageBox.Information) self._reimport_summary_action = None if self._reimport_offers: @@ -992,6 +998,7 @@ class MainWindow(QWidget): self._reimport_summary_action.setEnabled(False) # Enabled after the worker finishes. # Modeless notification: do not force activation or steal keyboard focus. from PySide6.QtCore import Qt + self.summary.setTextFormat(Qt.PlainText) self.summary.setAttribute(Qt.WA_ShowWithoutActivating) self.summary.show() diff --git a/tests/test_maintenance_ui.py b/tests/test_maintenance_ui.py index f3716b5..65cf036 100644 --- a/tests/test_maintenance_ui.py +++ b/tests/test_maintenance_ui.py @@ -75,8 +75,12 @@ def test_maintenance_summary_exposes_first_failure_reason(qtbot, tmp_path): window._global_icdb_run = True detail = 'MAINTENANCE_TARGET_UNCONFIRMED: PCB 引用与当前工程不一致' window._batch_done(([VerifyResult('BLOCKED', stderr=detail, safe_to_continue=False)], tmp_path/'batch.log')) - assert detail in window.summary.text() - assert detail in window.status_label.text() + assert detail in window.summary.detailedText() + assert detail in window.output.toPlainText() + assert detail not in window.summary.text() + assert str(tmp_path) not in window.summary.text() + assert detail not in window.status_label.text() + assert '失败/受阻 1' in window.summary.text() def test_safe_maintenance_reloads_authoritative_catalog_after_worker_finishes(qtbot, tmp_path, monkeypatch): diff --git a/tests/test_navigation_tabs.py b/tests/test_navigation_tabs.py index 35c1502..e7b972b 100644 --- a/tests/test_navigation_tabs.py +++ b/tests/test_navigation_tabs.py @@ -31,3 +31,13 @@ def test_long_status_does_not_expand_the_window(qtbot, tmp_path): qtbot.wait(20) assert window.height() <= 650 assert window.status_label.height() <= window.status_label.fontMetrics().lineSpacing() * 3 + 4 + + +def test_failure_detail_keeps_catalog_name_readable(qtbot, tmp_path, monkeypatch): + from test_ui_filters import load_window + window = load_window(qtbot, tmp_path, monkeypatch) + window.resize(1000, 650); window.show() + window.cbb_table.item(0, 3).setText('BackAnnotate: ' + 'long exception ' * 100) + qtbot.wait(20) + assert window.cbb_table.columnWidth(0) >= 200 + assert window.cbb_table.horizontalHeader().length() <= window.cbb_table.viewport().width() diff --git a/tests/test_ui.py b/tests/test_ui.py index cb0079d..4e8f794 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -98,7 +98,7 @@ def test_global_icdb_progress_and_repair_summary(qtbot, tmp_path, monkeypatch): assert window.icdb_progress.value() == 1 assert window.icdb_progress.maximum() == 1 assert '恢复备份待复核 1' in window.status_label.text() - assert window.summary.windowTitle() == '非 READY ICDB 检查与修复结果' + assert window.summary.windowTitle() == 'ICDB 维护结果' reports = list((tmp_path/'reports').glob('icdb-*.json')) assert len(reports) == 1 @@ -359,5 +359,5 @@ def test_batch_summary_exposes_failures_only_report(qtbot, tmp_path): qtbot.addWidget(window) report=tmp_path/'reports/batch-20260929-test.log' window._batch_done(([VerifyResult('FAIL',stderr='Mentor error')],report)) - assert '仅失败日志' in window.summary.text() - assert str(report.with_name('failures-20260929-test.log')) in window.summary.text() + assert '仅失败日志' in window.summary.detailedText() + assert str(report.with_name('failures-20260929-test.log')) in window.summary.detailedText()