diff --git a/src/dx_productivity/trial_task_center/ui/main_window.py b/src/dx_productivity/trial_task_center/ui/main_window.py index aeaf736..e8bc5ae 100644 --- a/src/dx_productivity/trial_task_center/ui/main_window.py +++ b/src/dx_productivity/trial_task_center/ui/main_window.py @@ -358,12 +358,6 @@ class TrialTaskCenterWindow(MaterialMainWindow): if self._close_saving: event.ignore() return - if self.verification_panel.busy: - self._close_pending = True - self.verification_panel.begin_shutdown() - event.ignore() - QTimer.singleShot(100, self.close) - return if self._workers or self.history_panel._worker: self._close_pending = True if self._dsh_automation and getattr(self._dsh_automation, '_owns_execution_lane', False): @@ -415,6 +409,12 @@ class TrialTaskCenterWindow(MaterialMainWindow): self._dsh_view.stopped.connect(lambda: QTimer.singleShot(0, self, self.close)) self._dsh_view.shutdown() return + if self.verification_panel.busy: + self._close_pending = True + self.verification_panel.begin_shutdown() + event.ignore() + QTimer.singleShot(100, self.close) + return self._cancel_dsh_diagnosis() for name, widget in self._layout_widgets().items(): self._layout_settings.setValue(f'single_project/{name}', widget.saveState()) diff --git a/src/dx_productivity/trial_task_center/ui/verification_workspace.py b/src/dx_productivity/trial_task_center/ui/verification_workspace.py index bc213e3..4686811 100644 --- a/src/dx_productivity/trial_task_center/ui/verification_workspace.py +++ b/src/dx_productivity/trial_task_center/ui/verification_workspace.py @@ -67,7 +67,7 @@ class VerificationWorkspace(QWidget): has=bool(self.controller.task_id);item=bool(self.controller.item_id) self.import_button.setEnabled(has);self.start_button.setEnabled(has);self.selected_button.setEnabled(has and item) self.rerun_button.setEnabled(item);self.export_button.setEnabled(has) - self.stop_button.setEnabled(bool(self._run_id) or getattr(self.service,'busy',False)) + self.stop_button.setEnabled(bool(self._run_id)) self.busy_changed.emit() def set_active(self,active): @@ -111,6 +111,7 @@ class VerificationWorkspace(QWidget): query=self.search.text(),cursor=cursor,read_control=control),lambda result:self._task_received(result,append),self._error,cancellable=True) def _task_received(self,result,append): + self._run_id=(result.get('run') or {}).get('run_id') if not append and result['view_revision']==self._last_revision and len(self._rows)>100: self._gates();return self._last_revision=result['view_revision'] @@ -171,7 +172,8 @@ class VerificationWorkspace(QWidget): def _started(self,result):self._run_id=result['run_id'];self.refresh() def _stop(self): - if self._run_id:self.controller.command(lambda:self.service.stop(self._run_id,request_id=uuid4().hex),lambda _:self.refresh()) + run_id=self._run_id + if run_id:self.controller.command(lambda:self.service.stop(run_id,request_id=uuid4().hex),lambda _:self.refresh()) def _rerun(self): item=self.controller.item_id diff --git a/src/dx_productivity/trial_task_center/verification/queries.py b/src/dx_productivity/trial_task_center/verification/queries.py index cce32ed..57d6fbe 100644 --- a/src/dx_productivity/trial_task_center/verification/queries.py +++ b/src/dx_productivity/trial_task_center/verification/queries.py @@ -93,6 +93,7 @@ class VerificationQueries: def read_task(self,task_id,*,state='',query='',cursor=None,limit=100,read_control=None): with self.repo.store.transaction(): task=self.repo.task(task_id);rows=self._rows(task_id,read_control) + run=self.repo.connection.execute("SELECT run_id,state,stop_requested FROM verification_runs WHERE task_id=? AND state IN ('queued','running','stopping') ORDER BY created LIMIT 1",(task_id,)).fetchone() self.validate_rows(rows,read_control) filtered=[] for row in rows: @@ -103,7 +104,7 @@ class VerificationQueries: if query.casefold() in text.casefold():filtered.append(row) binding=digest([task_id,task['view_revision'],state,query]) page,next_cursor=paginate(filtered,cursor,limit,binding,100) - return dict(task,items=page,cursor=next_cursor,summary=summarize_items(rows)) + return dict(task,items=page,cursor=next_cursor,summary=summarize_items(rows),run=dict(run) if run else None) def read_item(self,item_id,*,version=None,attempt_id=None,read_control=None): row=self.snapshot_item(item_id,version=version,attempt_id=attempt_id,read_control=read_control) diff --git a/src/dx_productivity/trial_task_center/verification/report.py b/src/dx_productivity/trial_task_center/verification/report.py index 0c23aac..3a530a0 100644 --- a/src/dx_productivity/trial_task_center/verification/report.py +++ b/src/dx_productivity/trial_task_center/verification/report.py @@ -47,7 +47,9 @@ def diagram(pins): def item_html(result): validate_result(result) evidence=result.get('evidence') or {};pins=evidence.get('pins',[]) - out=[f'
{text(result.get("scope","未核对换料规则"))} · 由网表生成 · 未覆盖:封装库内部映射、引脚级 Value
'] keys=sorted({tuple(p['endpoint'][:2]) for p in pins}) for key in keys: @@ -55,10 +57,19 @@ def item_html(result): out.append(f'| 物理脚 | 修改前 | 修改后 | 事实 |
|---|---|---|---|
| {text(pin["endpoint"][2])} | {text(pin["before"])} | {text(pin["after"])} | {"连接变化" if pin["connection_changed"] else "文字变化" if pin["text_changed"] else "未发现变化"} |
| {text(pin["endpoint"][2])} | {text(description(pin["before"]))} | {text(description(pin["after"]))} | {"连接变化" if pin["connection_changed"] else "文字变化" if pin["text_changed"] else "未发现变化"} |
'+text({key:result.get(key) for key in ('attempt_state','reason','resource_state','checks','issues','uncovered','attempt_id','input_version','input_digest','policy')})+'')
- out.append(''+text(evidence.get('binding',{}))+'')
+ out.append('执行说明:'+text(result['reason'])+'
') + out.append(''+text({key:result.get(key) for key in ('attempt_state','resource_state','checks','issues','uncovered','attempt_id','input_version','input_digest','policy')})+''+text(evidence.get('binding',{}))+'