fix(scheduled-task): deliver verified WeChat links only after page is ready
Memind CI / Test, build, and release guards (push) Successful in 8m42s

Wait for HTML materialization before releasing delivery contracts, pass
verified MindSpace URLs through proactive WeChat sends, resend on reconcile
when pages land late, and report deferred customer-service delivery as unsent.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-17 22:07:41 +08:00
parent 0a7b2df5fe
commit 1ca06e58e7
10 changed files with 374 additions and 63 deletions
+20
View File
@@ -73,11 +73,30 @@ test('notification dispatcher forwards schedule notification text unchanged', as
userId: 'user-2',
dedupeKey: null,
sent: true,
verifiedHtmlCount: 0,
},
},
]);
});
test('notification dispatcher returns false when wechat sender defers delivery', async () => {
const dispatcher = createNotificationDispatcher({
async sendWechatTextToUser() {
return { sent: false, deferred: true, errcode: 45015 };
},
logger: { info() {} },
});
assert.equal(
await dispatcher.sendScheduleNotification({
userId: 'user-4',
text: '定时任务完成',
verifiedHtmlUrls: ['https://m.tkmind.cn/MindSpace/user-4/public/news.html'],
}),
false,
);
});
test('notification dispatcher returns false when wechat sender is unavailable', async () => {
const logs = [];
const dispatcher = createNotificationDispatcher({
@@ -120,6 +139,7 @@ test('notification dispatcher returns false when wechat sender is unavailable',
userId: 'user-3',
dedupeKey: null,
sent: false,
verifiedHtmlCount: 0,
},
},
]);