fix: preserve rule coverage and verify isolated sample delivery

This commit is contained in:
abaishu0730 committed 2026-10-23 16:18:49 +08:00
1 parent 5c34851347
commit f936940ec0
9 files changed
+65 -5

No files matched your search

+4
View File
@@ -32,6 +32,10 @@ test('unmatched arrivals never enter order lists, counts or details while classi
for(const id of ['candidate:candidate-a','candidate:candidate-b','unmatched-order','task:unmatched-task'])assert.throws(()=>orderDetail(c,id,user),e=>e.status===404);
assert.equal(c.orderRules.all('execution-candidates').length,2);assert.equal(c.orderRules.get('orders','unmatched-order').status,'blocked');
});
test('removed orders disappear from the center without erasing archive or dedup evidence',()=>{
const c=fixture(),order=c.orderRules.get('orders','o0');order.archive={files:[{name:'retained.pdf',sha256:'a'.repeat(64)}]};order.removedAt='2026-10-23T08:00:00Z';order.status='ignored';
assert.equal(queryOrders(c,{},user).total,82);assert.equal(summary(c,user).counts.orders,82);assert.throws(()=>orderDetail(c,'o0',user),e=>e.status===404);assert.equal(c.orderRules.get('orders','o0').archive.files[0].name,'retained.pdf');
});
test('file endpoint reauthorizes and validates bytes against durable evidence',async()=>{
const c=fixture(),bytes=Buffer.from('%PDF-x');c.orderRules.get('orders','o0').archive={files:[{name:'a.pdf',path:'server-only',size:bytes.length,sha256:require('node:crypto').createHash('sha256').update(bytes).digest('hex')}]};
assert.deepEqual((await readOrderFile(c,'o0',0,user)).bytes,bytes);c.execution.archive.read=async()=>Buffer.from('tampered');await assert.rejects(()=>readOrderFile(c,'o0',0,user));await assert.rejects(()=>readOrderFile(c,'foreign',0,user));