fix(wechat): repair share preview on disk for sanitized delivery artifacts
Memind CI / Test, build, and release guards (push) Failing after 6s
Memind CI / Test, build, and release guards (push) Failing after 6s
Production WeChat delivery strips localPath from artifacts, so share-preview auto-repair never wrote back to HTML. Resolve paths via publishDir + relativePath, repair at materialize and delivery prep, and pass h5Root from Portal so page.generate can patch missing meta before sending links. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -61,6 +61,7 @@ import {
|
||||
collectWechatGeneratedImages,
|
||||
} from './wechat/verify/generated-thumbnail.mjs';
|
||||
import { resolveBillingTokenState } from './billing-token-state.mjs';
|
||||
import { resolveMindSpaceUserPublishDir } from './mindspace-runtime-config.mjs';
|
||||
import {
|
||||
buildPageDataCollectFailureText,
|
||||
} from './mindspace-page-data-finish-guard.mjs';
|
||||
@@ -1503,6 +1504,7 @@ export function createWechatMpService({
|
||||
pageDataDeliveryReviewer = null,
|
||||
wechatFetch = undiciFetch,
|
||||
linkExists = defaultPublicHtmlLinkExists,
|
||||
h5Root = '',
|
||||
logger = console,
|
||||
}) {
|
||||
const sessionStore = resolveSessionAccess({ userAuth, sessionAccess });
|
||||
@@ -1513,6 +1515,11 @@ export function createWechatMpService({
|
||||
}
|
||||
const requireFreshPageThumbnail = config.requireFreshPageThumbnail === true;
|
||||
const repairFreshPageThumbnail = config.repairFreshPageThumbnail === true;
|
||||
const resolveUserPublishDir = (userId) => {
|
||||
const normalizedUserId = String(userId ?? '').trim();
|
||||
if (!normalizedUserId || !String(h5Root ?? '').trim()) return '';
|
||||
return resolveMindSpaceUserPublishDir(h5Root, { id: normalizedUserId });
|
||||
};
|
||||
config = {
|
||||
...loadWechatMpConfig({}),
|
||||
...config,
|
||||
@@ -2650,6 +2657,9 @@ export function createWechatMpService({
|
||||
htmlGenerationNeedsRetry,
|
||||
replyHasPublicLinks,
|
||||
topic: wechatIntent?.topic ?? intent?.agentText ?? '',
|
||||
repairContext: {
|
||||
publishDir: resolveUserPublishDir(user.userId),
|
||||
},
|
||||
});
|
||||
if (pageOutcome.action === 'session_retry') {
|
||||
throw new Error('stale_session_poisoned_completion');
|
||||
@@ -2969,6 +2979,9 @@ export function createWechatMpService({
|
||||
htmlGenerationNeedsRetry,
|
||||
replyHasPublicLinks,
|
||||
topic: wechatIntent?.topic ?? intent?.agentText ?? '',
|
||||
repairContext: {
|
||||
publishDir: resolveUserPublishDir(user.userId),
|
||||
},
|
||||
});
|
||||
if (pageOutcome.action === 'session_retry' || pageOutcome.action === 'fail') {
|
||||
const text = pageOutcome.failureText ?? buildPagePublishFailureText();
|
||||
|
||||
Reference in New Issue
Block a user