fix(prod): dedupe scheduled tasks and reconcile orphan delivery contracts
Memind CI / Test, build, and release guards (push) Successful in 2m58s

Prevent duplicate active scheduled tasks, fail static preparing contracts
when HTML is missing, raise MindSpace remote timeout default to 30s, and
add 103 repair scripts for inspection follow-ups.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-16 08:52:16 +08:00
parent f20302fe65
commit 843e4d1002
8 changed files with 296 additions and 5 deletions
+18
View File
@@ -47,6 +47,24 @@ export async function markPageDeliveryContractReady({ pool, userId, relativePath
return Number(result?.affectedRows ?? 0) > 0;
}
export async function markPageDeliveryContractFailed({
pool,
userId,
relativePath,
failureReason = 'delivery_material_missing',
} = {}) {
const workspaceRelativePath = normalizeDeliveryRelativePath(relativePath);
if (!pool || !userId || !workspaceRelativePath) return false;
const now = Date.now();
const [result] = await pool.query(
`UPDATE h5_page_delivery_contracts
SET status = 'failed', failure_reason = ?, updated_at = ?
WHERE user_id = ? AND workspace_relative_path = ? AND status = 'preparing'`,
[String(failureReason ?? 'delivery_material_missing'), now, userId, workspaceRelativePath],
);
return Number(result?.affectedRows ?? 0) > 0;
}
export async function releaseMaterializedPageDeliveryContracts({
pool,
userId,