Measure semantic activation refresh independently from download and idle time

This commit is contained in:
karl committed 2026-10-13 09:56:34 +02:00
1 parent 9aae3f8216
commit 19d949fd13
6 files changed
+140 -22

No files matched your search

@@ -161,3 +161,30 @@ test('repeated refreshes retain a bounded immutable numeric origin without repla
assert.equal(origin.first_results_ms, 72);
assert.equal(origin.hybrid_final_results_ms, null);
});
test('semantic activation excludes download time and records the promoted context separately', () => {
const original = new SearchMeasurement(100, 100, true, {indexed_chunks:3});
original.submitted('hybrid', 220);
finish(original, 'hybrid', 220, 230, native, false);
original.displayed('hybrid', 230, 238, 3);
const context = {indexed_chunks:4, semantic_ready:true};
const promoted = original.freshForRefresh(144000, 'semantic_activation', context);
context.indexed_chunks = 999;
promoted.submitted('lexical', 144000);
finish(promoted, 'lexical', 144001, 144004, native, false);
promoted.displayed('lexical', 144004, 144005, 1);
promoted.submitted('hybrid', 144120);
finish(promoted, 'hybrid', 144120, 144128, native, false);
promoted.displayed('hybrid', 144128, 144138, 4);
const report = promoted.export();
assert.equal(report.trigger, 'semantic_activation');
assert.equal(report.first_results_ms, 5);
assert.equal(report.hybrid_final_results_ms, 138);
assert.equal(report.context.indexed_chunks, 4);
assert.equal(report.original_input.hybrid_final_results_ms, 138);
assert.equal(report.attempts.length, 2);
assert.equal(original.export().context.indexed_chunks, 3);
const next = promoted.freshForRefresh(300000);
assert.equal(next.export().trigger, 'filesystem_refresh');
assert.deepEqual(next.export().original_input, report.original_input);
});