fix: close discovery dispatch and persistent UI state races

This commit is contained in:
abaishu0730 committed 2026-10-19 14:33:09 +08:00
1 parent 0a366f43d6
commit 9d8d6971c1
19 files changed
+237 -77

No files matched your search

@@ -39,7 +39,7 @@ test('HTTP todo, captured field binding, real PDF, verified share and loopback S
now=new Date('2026-10-19T08:59:00+08:00');await dispatcher.tick();now=new Date('2026-10-19T09:00:00+08:00');await dispatcher.tick();
// The dashboard's configured morning cutoff is 09:00, but this received-at is
// exactly 09:00 and belongs to the later half-open window. It must not leak.
assert.equal(messages.length,0);now=new Date('2026-10-19T16:59:00+08:00');await dispatcher.tick();now=new Date('2026-10-19T17:00:00+08:00');await dispatcher.tick();
assert.equal(messages.length,0);now=new Date('2026-10-19T16:59:00+08:00');await dispatcher.tick();now=new Date('2026-10-19T17:00:00+08:00');await call('/api/order-execution/scan',{connectionId:connection.id,idempotencyKey:'cutoff-complete'});await dispatcher.tick();
assert.equal(messages.length,1);const message=await simpleParser(messages[0]);assert.deepEqual(message.to.value.map(v=>v.address),['recipient@example.test']);assert.equal(message.attachments.length,1);assert.equal(crypto.createHash('sha256').update(message.attachments[0].content).digest('hex'),evidence.sha256);assert.match(message.text,/000123/);
assert.equal((await call('/api/order-execution')).data.tasks[0].status,'sent');assert.equal(rules.all('batches').filter(b=>b.status==='sent').length,1);
});