feat: harden orchestrator execution runtime

This commit is contained in:
john
2026-07-24 23:53:32 +08:00
parent 396bb78200
commit f6f2cd0933
55 changed files with 5122 additions and 194 deletions
+35
View File
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import test from 'node:test';
import {
buildPageDataPolicyScopeHash,
getPageDataPolicyIndexByWorkspacePath,
upsertPageDataPolicyIndex,
} from './page-data-policy-index.mjs';
import {
@@ -46,6 +47,40 @@ test('upsertPageDataPolicyIndex writes mysql row', async () => {
assert.equal(queries[0].params[0], 'page-1');
});
test('getPageDataPolicyIndexByWorkspacePath resolves the local delivery binding', async () => {
const queries = [];
const pool = {
async query(sql, params) {
queries.push({ sql, params });
return [[{
page_id: 'page-1',
owner_user_id: 'user-1',
access_mode: 'password',
dataset_count: 3,
scope_hash: 'scope-1',
updated_at: 123,
current_publish_id: 'publish-1',
}]];
},
};
const result = await getPageDataPolicyIndexByWorkspacePath(
pool,
'user-1',
'public/storefront-admin.html',
);
assert.deepEqual(result, {
pageId: 'page-1',
ownerUserId: 'user-1',
accessMode: 'password',
datasetCount: 3,
scopeHash: 'scope-1',
updatedAt: 123,
publicationId: 'publish-1',
});
assert.match(queries[0].sql, /JOIN h5_page_records/);
assert.deepEqual(queries[0].params, ['user-1', 'public/storefront-admin.html']);
});
test('syncPageDataPolicyAccessMode updates policy access mode after publish', () => {
const workspaceRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'page-data-publish-sync-'));
writePageAccessPolicy(workspaceRoot, {