fix(page-data): isolate invalid workspace bindings

This commit is contained in:
john
2026-07-20 11:39:17 +08:00
parent 105a72c1f1
commit b6f2b40942
3 changed files with 34 additions and 16 deletions
+11
View File
@@ -44,6 +44,17 @@ test('detectPageDataDatasetUsageFromHtml resolves dataset constants', () => {
assert.deepEqual(usage.get('reading_survey'), { read: true });
});
test('detectPageDataDatasetUsageFromHtml ignores template-literal row id interpolation', () => {
const html = `
const DATASET = 'daily_log';
await client.listRows(DATASET, { limit: 200 });
rows.map((row) => \`<button onclick="window.deleteRow(\${row.id})">删除</button>\`);
`;
const usage = detectPageDataDatasetUsageFromHtml(html);
assert.deepEqual([...usage.entries()], [['daily_log', { read: true }]]);
assert.equal(usage.has('$'), false);
});
test('assertPolicyMatchesHtmlDatasets rejects mismatched dataset names', () => {
const html = `await c.insertRow('tkmind_exp_survey', {});`;
assert.throws(