fix: retain capture evidence and control failed task recovery

This commit is contained in:
abaishu0730 committed 2026-10-26 11:00:11 +08:00
1 parent c19be938fc
commit 5bae83922c
17 files changed
+333 -35

No files matched your search

+18
View File
@@ -26,3 +26,21 @@ test('changed current task summary or node blocks native capture before any form
let current=row,captures=0;const p=new BpmOrderProvider({manager:manager(),client:{scan:async()=>[current]},readonlyReader:async()=>{captures++;throw Error('must not capture');}});const scanned=(await p.scan(connection,principal))[0];
for(const changed of [{...row,title:'changed'},{...row,nodeName:'BOM确认'}]){current=changed;await assert.rejects(()=>p.capture(connection,principal,scanned),/变化|不一致/);}assert.equal(captures,0);
});
test('provider retains fields-only diagnostics after PDF failure without treating them as a successful capture',async()=>{
const partialDetail={detailUrl:'https://bpm.skyworthdigital.com/YZSoft/Forms/XForm/海外运营订单评审V13.aspx?tid=100&pid=200',detail:{tid:'100',pid:'200',formVersion:'V13',formPath:'/YZSoft/Forms/XForm/海外运营订单评审V13.aspx',fields:{'OFR_WY_Applicant.OrderNum':'000123'},fieldSources:{'OFR_WY_Applicant.OrderNum':{source:'DataProvider.GetFormProcessData'}}},snapshot:null,fieldsOnly:true,capturedAt:'2026-10-26T00:00:00Z',evidenceHash:'evidence'};
const p=new BpmOrderProvider({manager:manager(),client:{scan:async()=>[row]},readonlyReader:async()=>{throw Object.assign(Error('PDF structure'),{status:409,code:'FORM_STRUCTURE_UNSUPPORTED',diagnostics:{reason:'ROW_COUNT_MISMATCH'},partialDetail});}});
const scanned=(await p.scan(connection,principal))[0];
await assert.rejects(()=>p.capture(connection,principal,scanned),error=>{
assert.equal(error.partialCapture.sample.taskId,'200');assert.equal(error.partialCapture.sample.connectionId,'c');
assert.equal(error.partialCapture.snapshot.purpose,'field-mapping');assert.equal(error.partialCapture.snapshot.html,undefined);
assert.equal(error.partialCapture.snapshot.fields[0].value,'000123');
assert.doesNotMatch(JSON.stringify(error.partialCapture),/EPHEMERAL-FIXTURE/);return true;
});
assert.equal(p.capabilities().pdfExport,false);
});
test('task absent from current list has a distinct recovery code and never loads its old form',async()=>{
const p=new BpmOrderProvider({manager:manager(),client:{scan:async()=>[]},readonlyReader:async()=>{throw Error('must not load form');}});
await assert.rejects(()=>p.capture(connection,principal,row),error=>error.code==='BPM_TASK_NOT_CURRENT');
});