fix(wechat): sync MindSpace pages after MP generation and redirect on 401
Memind CI / Test, build, and release guards (push) Failing after 3m31s

WeChat page delivery now triggers syncUserGeneratedPages so write_file HTML
gets page records; public share widget redirects unauthenticated owners to
WeChat OAuth instead of only showing an error.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-11 19:58:25 +08:00
parent 2c3c1f7a52
commit 0e7e4829db
6 changed files with 191 additions and 8 deletions
@@ -51,6 +51,7 @@ export async function bootstrapPortalIntegrationServices({
apiSecret,
mindSpacePages,
mindSpacePageLiveEdit,
syncUserGeneratedPages = null,
logger = console,
healthChannelStore = null,
healthObservationStore = null,
@@ -212,6 +213,35 @@ export async function bootstrapPortalIntegrationServices({
sessionId,
artifacts = [],
}) => {
const relativePaths = [
...new Set(
artifacts
.map((artifact) =>
String(
artifact?.relativePath ??
artifact?.relative_path ??
'',
).trim(),
)
.filter(Boolean),
),
];
if (
typeof syncUserGeneratedPages === 'function' &&
userId
) {
void syncUserGeneratedPages(userId, {
sessionId,
sinceMs: Date.now() - 10 * 60 * 1000,
onlyRelativePaths:
relativePaths.length > 0 ? relativePaths : null,
}).catch((error) => {
logger.warn?.(
'[WeChat MP] page sync after generation failed:',
error instanceof Error ? error.message : error,
);
});
}
for (const artifact of artifacts) {
const pageOwner =
(await userAuth