fix(scheduled-task): deliver verified WeChat links only after page is ready
Memind CI / Test, build, and release guards (push) Successful in 8m42s
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:
@@ -1,8 +1,15 @@
|
||||
function resolveWechatDispatchSent(result) {
|
||||
if (result && typeof result === 'object') {
|
||||
return result.sent !== false && !result.deferred && !result.skipped;
|
||||
}
|
||||
return result !== false;
|
||||
}
|
||||
|
||||
export function createNotificationDispatcher({ sendWechatTextToUser, logger = console } = {}) {
|
||||
const sendWechat = async (userId, text) => {
|
||||
const sendWechat = async (userId, text, options = {}) => {
|
||||
if (typeof sendWechatTextToUser !== 'function') return false;
|
||||
await sendWechatTextToUser(userId, text);
|
||||
return true;
|
||||
const result = await sendWechatTextToUser(userId, text, options);
|
||||
return resolveWechatDispatchSent(result);
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -16,13 +23,14 @@ export function createNotificationDispatcher({ sendWechatTextToUser, logger = co
|
||||
});
|
||||
return sent;
|
||||
},
|
||||
async sendScheduleNotification({ userId, text }) {
|
||||
const sent = await sendWechat(userId, text);
|
||||
async sendScheduleNotification({ userId, text, verifiedHtmlUrls = [] }) {
|
||||
const sent = await sendWechat(userId, text, { verifiedHtmlUrls });
|
||||
logger.info?.('Notification dispatch:', {
|
||||
type: 'schedule_notification',
|
||||
userId,
|
||||
dedupeKey: null,
|
||||
sent,
|
||||
verifiedHtmlCount: verifiedHtmlUrls.length,
|
||||
});
|
||||
return sent;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user