feat(mindspace): enforce PostgreSQL user data delivery

This commit is contained in:
john
2026-07-13 15:29:29 +08:00
parent b33c943b69
commit a6620fb719
57 changed files with 2779 additions and 164 deletions
+34
View File
@@ -98,6 +98,40 @@ test('detectWorkspaceSyncedDeliverables filters auto-synced public html pages',
assert.equal(summary.pageCount, 1);
});
test('detectWorkspaceSyncedDeliverables stays inside current run artifact paths', async () => {
const pool = {
async query(sql, params) {
assert.match(sql, /workspace_relative_path IN \(\?, \?\)/);
assert.deepEqual(params, [
'user-1',
1000,
'public/current.html',
'public/current-admin.html',
]);
return [[{
page_id: 'page-current',
title: 'Current',
workspace_relative_path: 'public/current.html',
}]];
},
};
const summary = await detectWorkspaceSyncedDeliverables(pool, 'user-1', {
sinceMs: 1000,
onlyRelativePaths: ['public/current.html', 'public/current-admin.html'],
});
assert.equal(summary.pageCount, 1);
assert.equal(summary.pages[0].workspaceRelativePath, 'public/current.html');
});
test('detectWorkspaceSyncedDeliverables skips workspace sweep for an empty run scope', async () => {
const pool = { async query() { throw new Error('must not query'); } };
const summary = await detectWorkspaceSyncedDeliverables(pool, 'user-1', {
sinceMs: 1000,
onlyRelativePaths: [],
});
assert.equal(summary.pageCount, 0);
});
test('prepareAndDetectSessionDeliverables merges session and workspace pages after prepare hook', async () => {
const prepareCalls = [];
const pool = {