perf: streamline rule reads and unblock background discovery
This commit is contained in:
1 parent
b14fa2f4d1
commit
b17b975812
19 files changed
+263
-42
No files matched your search
@@ -9,6 +9,12 @@ function fixture(){
|
||||
return {orderRules:store,workspace:{recordSources:()=>[{id:'a',owner:'alice'},{id:'b',owner:'bob'}]},execution:{archive:{read:async()=>Buffer.from('%PDF-x')}}};
|
||||
}
|
||||
const user={username:'alice',role:'operator'};
|
||||
|
||||
test('summary computes dynamic collecting batches once per request and never retains a previous result',t=>{
|
||||
const c=fixture(),collecting=require('../../src/modules/order-rules/collecting-batches.cjs');let reads=0;
|
||||
t.mock.method(collecting,'list',()=>{reads++;return [];});
|
||||
summary(c,user);assert.equal(reads,1);summary(c,user);assert.equal(reads,2);
|
||||
});
|
||||
test('failed task detail exposes bounded read-only evidence only for the same authorized capture',()=>{
|
||||
const c=fixture(),task={id:'capture-failed',connectionId:'a',categoryIds:['cat'],status:'failed',step:'capture',errorCode:'FORM_STRUCTURE_UNSUPPORTED',retryPolicy:'manual',nextRetryAt:null,diagnostics:[{code:'ROW_MAPPING',table:'OrderItems',reason:'明细行关系不明确',rowCount:2,cookie:'SECRET'}],captureEvidenceId:'evidence',row:{taskId:'T1',instanceId:'I1'}};
|
||||
c.orderRules.all('execution-tasks').push(task);
|
||||
|
||||
Reference in new issue
Block a user