fix: show confirmed scope beside actual residual release results
This commit is contained in:
1 parent
651b539d0e
commit
14c9a74bbf
3 files changed
+43
-3
No files matched your search
@@ -0,0 +1,7 @@
|
||||
# PR #12 comment 348 follow-up
|
||||
|
||||
The review's process-isolation and oversized-output findings target the earlier `5eb4b2d` tree; both are addressed by `651b539` and remain covered by the real private-desktop and bounded-evidence regressions.
|
||||
|
||||
The remaining consent/result presentation gap is fixed here. The residual table retains its original six columns and adds confirmation scope and actual result. A row that was allowed at confirmation but rejected after a fresh activity/identity check now shows both facts beside its reason. The result message also counts confirmation-allowed rows and how many remain unreleased; it does not reinterpret preview consent as successful execution or bypass an active-write guard.
|
||||
|
||||
The new regression failed before the change. The release-dialog, residual follow-up and private-desktop regression group passed 35 tests. No production/native database action was performed. Integrated full validation is recorded at the PR #13 tip; no candidate build, merge or field acceptance is implied.
|
||||
@@ -30,8 +30,8 @@ class ResidualReleaseDialog(QDialog):
|
||||
self.message = QLabel('正在检查当前库关联的会话…')
|
||||
self.message.setWordWrap(True)
|
||||
layout.addWidget(self.message)
|
||||
self.table = QTableWidget(0, 6)
|
||||
self.table.setHorizontalHeaderLabels(['工程', '程序', 'PID', '状态', '窗口位置', '程序路径'])
|
||||
self.table = QTableWidget(0, 8)
|
||||
self.table.setHorizontalHeaderLabels(['工程', '程序', 'PID', '状态', '窗口位置', '程序路径', '确认范围', '执行结果'])
|
||||
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
|
||||
self.table.horizontalHeader().setSectionResizeMode(3, QHeaderView.Stretch)
|
||||
self.table.setEditTriggers(QTableWidget.NoEditTriggers)
|
||||
@@ -88,9 +88,14 @@ class ResidualReleaseDialog(QDialog):
|
||||
def _rows(self, sessions):
|
||||
self.table.setRowCount(len(sessions))
|
||||
for index, session in enumerate(sessions):
|
||||
allowed = session.get('consent_allowed')
|
||||
permission = '允许' if allowed is True else '未允许' if allowed is False else '待确认'
|
||||
outcome = {'RELEASED': '已释放', 'WAITING': '未释放', 'IDENTITY_CHANGED': '身份已变化',
|
||||
'CANCELLED': '已停止', 'REQUESTING': '执行中', 'NOT_STARTED': '尚未执行'}.get(
|
||||
session.get('release_status'), '待执行')
|
||||
for column, value in enumerate((session.get('project', ''), session['name'],
|
||||
session['pid'], session.get('detail', ''), ', '.join(session.get('desktops', [])),
|
||||
session.get('image', session.get('executable', '')))):
|
||||
session.get('image', session.get('executable', '')), permission, outcome)):
|
||||
self.table.setItem(index, column, QTableWidgetItem(str(value)))
|
||||
if sessions: self.table.setCurrentCell(0, 0)
|
||||
|
||||
@@ -226,6 +231,9 @@ class ResidualReleaseDialog(QDialog):
|
||||
self.message.setText(f'已释放 {count} 个会话,其余会话或库状态仍待确认。'
|
||||
+ ('\n'+result['detail'] if result.get('detail') else '可查看原生提示、处理保存或请求取消后重新检查。')
|
||||
+ ('\n记录保存失败:'+result['evidence_error'] if result.get('evidence_error') else ''))
|
||||
allowed = [row for row in result['sessions'] if row.get('consent_allowed') is True]
|
||||
pending = sum(row.get('release_status') != 'RELEASED' for row in allowed)
|
||||
self.message.setText(self.message.text()+f'\n确认允许 {len(allowed)} 项,其中未释放 {pending} 项。')
|
||||
def execute():
|
||||
action = lambda: release_residual_sessions(plan, self.evidence_dir, stop=self.stop, force=force)
|
||||
return self.native_queue.run(action, stop=self.stop) if self.native_queue is not None else action()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
|
||||
|
||||
def test_confirmed_scope_and_execution_divergence_are_visible(qtbot, tmp_path, monkeypatch):
|
||||
library = tmp_path/'lib.lmc'
|
||||
rows = [dict(name='ExpeditionPCB.exe', pid=pid, project=name, detail='可正常关闭')
|
||||
for pid, name in ((10, 'A'), (20, 'B'))]
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda *_: dict(library=str(library), sessions=rows))
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', lambda *a, **kw:
|
||||
dict(status='PARTIAL', sessions=[
|
||||
dict(rows[0], consent_allowed=True, release_status='RELEASED', detail='已退出'),
|
||||
dict(rows[1], consent_allowed=True, release_status='WAITING', detail='原生操作进行中')]))
|
||||
dialog = ResidualReleaseDialog(library, tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
dialog.confirm_button.click()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert dialog.table.columnCount() == 8
|
||||
assert dialog.table.item(0, 6).text() == dialog.table.item(1, 6).text() == '允许'
|
||||
assert dialog.table.item(0, 7).text() == '已释放'
|
||||
assert dialog.table.item(1, 7).text() == '未释放'
|
||||
assert '原生操作进行中' in dialog.table.item(1, 3).text()
|
||||
assert '确认允许 2' in dialog.message.text() and '未释放 1' in dialog.message.text()
|
||||
Reference in new issue
Block a user