Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(desktop): require the relaunch gain the A/B claims
Alfredo Lopez6301c17c7ca0
diff --git a/desktop-app/scripts/bench-chat-open/benchmark.test.mjs b/desktop-app/scripts/bench-chat-open/benchmark.test.mjsindex 137cee2ea..e24d843af 100644--- a/desktop-app/scripts/bench-chat-open/benchmark.test.mjs+++ b/desktop-app/scripts/bench-chat-open/benchmark.test.mjs@@ -164,3 +164,61 @@ test('HEAD delegates to the compiled export and settle waits for the cleanups itawait settlingassert.deepEqual(calls, ['export', 'cleanup:synthetic', 'index:synthetic', 'cleanup:end'])})++test('HEAD drives the real chat:getIndex handler through the adapter deps', async () => {+ // The stub above witnesses delegation; this runs the shipped handler against+ // the adapter's untyped deps, so a renamed dependency fails here instead of+ // surfacing only as a cleanup warning in a benchmark run.+ const source = await fs.readFile(+ new URL('../../src/chatGetIndexHandler.ts', import.meta.url),+ 'utf8'+ )+ const { outputText } = ts.transpileModule(source, {+ compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 },+ })+ const compiled = { exports: {} }+ new Function('module', 'exports', outputText)(compiled, compiled.exports)+ assert.equal(typeof compiled.exports.runChatGetIndex, 'function')++ const calls = []+ let release+ const gate = new Promise(resolve => {+ release = resolve+ })+ const result = { chats: [1] }+ const store = {+ async retryPendingDeleteCleanups(scope, agentRef) {+ assert.deepEqual(scope, AUTHORITY_SCOPE)+ calls.push(`cleanup:${agentRef}`)+ await gate+ calls.push('cleanup:end')+ },+ async getIndex(agentRef) {+ calls.push(`index:${agentRef}`)+ return result+ },+ }+ const context = head.context(store, {+ runChatGetIndex: (deps, agentRef) => {+ calls.push('export')+ return compiled.exports.runChatGetIndex(deps, agentRef)+ },+ })++ let returned+ const reading = context.getIndex('synthetic').then(index => {+ returned = index+ })+ try {+ await new Promise(resolve => setImmediate(resolve))+ // The index is returned while the cleanup it started is still gated.+ assert.equal(returned, result)+ assert.deepEqual(calls, ['export', 'cleanup:synthetic', 'index:synthetic'])+ } finally {+ release()+ await reading+ }+ await context.settle()+ assert.deepEqual(calls, ['export', 'cleanup:synthetic', 'index:synthetic', 'cleanup:end'])+ assert.equal(context.cleanupErrors, 0)+})diff --git a/desktop-app/test/e2e-playwright/chat-open-ab.spec.ts b/desktop-app/test/e2e-playwright/chat-open-ab.spec.tsindex 2e71dfc81..5b3832d46 100644--- a/desktop-app/test/e2e-playwright/chat-open-ab.spec.ts+++ b/desktop-app/test/e2e-playwright/chat-open-ab.spec.ts@@ -1083,6 +1083,11 @@ if (throw new Error(`L recorded ${found.length} ${build} ${metric} samples.`)return found}+ // The L claim is that chat:getIndex no longer waits for the 10 pending cleanups, so AFTER+ // must keep most of that gain, not merely be faster. On 48fcd0b30 the p50 ratio was 0.05+ // (rows) and 0.10 (transcript); with the inline cleanup await restored in AFTER it was+ // 0.93 and 0.90. A ratio of at most 0.5 separates the two by a wide margin.+ const RELAUNCH_MAX_RATIO = 0.5// relaunch_rows_ms: window load to the first stateful sidebar row, observed before the// test clicks anything; the non-blocking chat:getIndex is what shortens it.const rowsUnclicked = samples@@ -1096,7 +1101,8 @@ if (before: rowsBefore,after: rowsAfter,observed_before_click: rowsUnclicked,- passed: rowsUnclicked && rowsAfter < rowsBefore,+ max_ratio: RELAUNCH_MAX_RATIO,+ passed: rowsUnclicked && rowsAfter <= RELAUNCH_MAX_RATIO * rowsBefore,})// relaunch_ms: window load to the transcript of the selected chat, including the explicit// open. Desktop never restores the last active chat on launch.@@ -1107,7 +1113,8 @@ if (definition: 'window load -> sidebar row -> explicit open -> transcript with all messages',before,after,- passed: after < before,+ max_ratio: RELAUNCH_MAX_RATIO,+ passed: after <= RELAUNCH_MAX_RATIO * before,})} else {// W needs a control: BEFORE runs the same suspended-Host relaunches as AFTER.