fix(wechat): isolate stale images and page links
Memind CI / Test, build, and release guards (pull_request) Successful in 2m36s

This commit is contained in:
john
2026-07-22 13:30:44 +08:00
parent aea3c1e83e
commit db225b784e
11 changed files with 416 additions and 37 deletions
+25
View File
@@ -63,6 +63,31 @@ test('syncUserZonesFromAssets backfills from canonical storage', async () => {
);
});
test('syncUserZonesFromAssets does not overwrite an existing workspace edit', async () => {
const h5Root = fs.mkdtempSync(path.join(os.tmpdir(), 'h5-existing-'));
const storageRoot = path.join(h5Root, 'data', 'mindspace');
const userId = USER_ID;
const storageKey = path.posix.join('users', userId, 'assets', 'page-1', 'versions', 'v1');
const sourcePath = path.join(storageRoot, storageKey);
fs.mkdirSync(path.dirname(sourcePath), { recursive: true });
fs.writeFileSync(sourcePath, '<html>stored version</html>');
const workspace = resolveUserWorkspaceRoot(h5Root, { id: userId, username: 'john' });
const workspacePath = path.join(workspace, 'public', 'page.html');
fs.mkdirSync(path.dirname(workspacePath), { recursive: true });
fs.writeFileSync(workspacePath, '<html>new Agent edit</html>');
const before = fs.statSync(workspacePath).mtimeMs;
const pool = {
async query() {
return [[{ original_filename: 'page.html', category_code: 'public', storage_key: storageKey }]];
},
};
await syncUserZonesFromAssets(pool, storageRoot, userId, workspace);
assert.equal(fs.readFileSync(workspacePath, 'utf8'), '<html>new Agent edit</html>');
assert.equal(fs.statSync(workspacePath).mtimeMs, before);
});
test('user space publishing guidance points to sandbox file tools', () => {
const workspaceRoot = `/var/h5/MindSpace/${USER_ID}`;
const hints = renderUserSpaceHints({