merge: reconcile UI updates with DSH audit fault isolation

This commit is contained in:
阿白叔 committed 2026-10-31 12:11:42 +08:00
commit e565f67b46
145 files changed
+3688 -112

No files matched your search

+35 -2
View File
@@ -26,6 +26,26 @@ const element=id=>`document.querySelector('[data-testid="${id}"]')`;
async function click(id){await wait(()=>c.evaluate(`!!${element(id)}&&!${element(id)}.disabled`),id);await c.click(element(id));}
async function tab(id){await click('dx-operations-tab-'+id);}
async function idle(){await wait(()=>c.evaluate(`![...document.querySelectorAll('button[aria-label="停止生成"]')].some(e=>e.getBoundingClientRect().width>0)`),'generation idle');}
async function pauseLiveRun(){
const original=(await context()).operations.live_run;
report.pauseClicks=[];
for(let attempt=0;attempt<3;attempt++){
const live=(await context()).operations.live_run;
assert.equal(live.run_id,original.run_id,'pause may not retarget a different execution');
assert.equal(live.active,true,'the original execution must still be active');
await tab('running');await click('dx-running-pause');
try{
await wait(async()=>{const ops=(await context()).operations;return (ops.live_run?.run_id===original.run_id&&ops.live_run.pause_requested)||
(ops.last_execution?.run_id===original.run_id&&ops.last_execution.status==='paused');},'safe pause admission',5000);
report.pauseClicks.push({attempt:attempt+1,accepted:true});return;
}catch(error){
if(!error.message.startsWith('Timed out:'))throw error;
const notice=await c.evaluate(`document.querySelector('[data-testid="dx-operations-notice"]')?.textContent||''`);
report.pauseClicks.push({attempt:attempt+1,accepted:false,notice});
}
}
throw Error('Actual pause clicks were not admitted: '+JSON.stringify(report.pauseClicks));
}
async function send(prompt){
report.prompts.push(prompt);
for(let i=0;i<5;i++){
@@ -94,7 +114,7 @@ try{
await select('Board-A');
await send('现在执行 Board-A 任务,只运行这一个工程,按原生确认的范围处理。结束后告诉我真实保存、失败和未命中数量。');
await wait(async()=>(await context()).operations?.live_run?.active===true,'live controlled run');
await tab('running');await click('dx-running-pause');
await pauseLiveRun();
await wait(async()=>{const d=await context();return d.operations?.last_execution?.status==='paused'&&!d.operations?.live_run?.active;},'safe pause receipt');
const receipt=(await context()).operations.last_execution;assert.equal(receipt.tasks[0].no_match_items,1);assert.equal(receipt.tasks[0].saved_items,0);
report.runId=receipt.run_id;await idle();await c.screenshot(path.join(output,'paused-before-restart.png'));
@@ -103,7 +123,20 @@ try{
const prior=JSON.parse(await readFile(path.join(output,'paused-run.json'),'utf8'));
await tab('running');await click('dx-history-refresh');
await wait(async()=>{const d=await context();return d.operations?.activity?.status==='read'&&!d.operations?.busy;},'history read settled');
await click('dx-resume-'+prior.run_id);
report.resumeClicks=[];
for(let attempt=0;attempt<3;attempt++){
await click('dx-resume-'+prior.run_id);
try{
await wait(async()=>{const d=await context();return (d.lifecycle?.request_id&&['awaiting_confirmation','executing','completed'].includes(d.lifecycle.status))||
d.operations?.last_execution?.run_id===prior.run_id;},'original queue resume admission',4000);
report.resumeClicks.push({attempt:attempt+1,accepted:true});break;
}catch(error){
if(!error.message.startsWith('Timed out:'))throw error;
const notice=await c.evaluate(`document.querySelector('[data-testid="dx-operations-notice"]')?.textContent||''`);
report.resumeClicks.push({attempt:attempt+1,accepted:false,notice});
if(attempt===2)throw Error('Actual resume clicks were not admitted: '+JSON.stringify(report.resumeClicks));
}
}
await wait(async()=>(await context()).operations?.last_execution?.status==='completed','restarted original queue completed');
const result=(await context()).operations.last_execution;assert.equal(result.run_id,prior.run_id);assert.equal(result.queue_id,prior.queue_id);assert.equal(result.tasks[0].no_match_items,2);
report.checks.push('second actual application process resumed original frozen queue and skipped completed item');