perf: optimize full interface loading and refresh paths

This commit is contained in:
abaishu0730 committed 2026-10-28 09:24:04 +08:00
1 parent 649a0df832
commit f317314a3c
57 files changed
+791 -136

No files matched your search

+13
View File
@@ -88,6 +88,19 @@ test('status reads only effective settings and in-memory capabilities',async t=>
assert.deepEqual(await response.json(),{settings:{enabled:false},capabilities:{liveTodo:true,pdfExport:false,automaticArchive:false}});
});
test('catalog and notification settings avoid history and unrelated configuration resources',async t=>{
const rules=memoryRules(t);poisonHistory(rules);
for(const kind of ['field-adapters','scope-catalog','scope-process-catalog'])rules.db.prepare('INSERT OR REPLACE INTO records VALUES(?,?,?)').run(kind,'corrupt',Buffer.from('not encrypted'));
const f=await dashboard(t,{rules});
const catalogResponse=await f.request('/api/order-rules/catalog');assert.equal(catalogResponse.status,200);
const catalog=await catalogResponse.json();assert.equal(catalog.rules.length,15);assert.equal(catalog.templateUsage.length,15);
assert.deepEqual(Object.keys(catalog.rules[0]).sort(),['categoryId','name']);assert.equal(catalog.templateUsage[0].status,'draft');
assert.doesNotMatch(JSON.stringify(catalog),/"orders":|"fields":|"adapters":|"draft":/);
const settingsResponse=await f.request('/api/order-rules/notification-settings');assert.equal(settingsResponse.status,200);
assert.deepEqual(await settingsResponse.json(),{settings:rules.settings(),restrictedTest:null});
for(const route of ['/api/order-rules/catalog','/api/order-rules/notification-settings'])assert.equal((await f.request(route,{role:'anonymous'})).status,401);
});
test('rule write receipts retain complete editor versions without historic reads or relaxing stale-version validation',async t=>{
const rules=memoryRules(t),{captured}=activateReferenceMapping(rules,'bs-change',{connectionId:'own',instanceId:'i',taskId:'t',revision:'1'});
const draft=rules.saveRule({...rules.get('rules','bs-change').draft,to:['admin@example.test'],attachPdf:false,archiveDirectory:'\\\\server\\orders',filenameDate:'appDate'},'admin');rules.capturedPreview(captured.id);