fix(qmd): measure embed throughput after warm-up and fail on embed errors

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian lechnerandClaude Opus 5.5 committed 2026-10-08 11:47:48 +02:00
1 parent d8a5ad7492
commit 29e712e751
2 files changed
+23 -10

No files matched your search

+7 -1
View File
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { passes, fixtureDocuments, describeDevices } from '../../shared/qmd/qmd-benchmark.mjs';
import { passes, fixtureDocuments, describeDevices, embedThroughput } from '../../shared/qmd/qmd-benchmark.mjs';
test('both thresholds must pass', () => {
assert.equal(passes({ querySeconds: 5, chunksPerSecond: 20 }, {}), true);
@@ -23,3 +23,9 @@ test('fixture is deterministic and large enough for throughput', () => {
assert.deepEqual(a, fixtureDocuments(100));
assert.ok(a.every((d) => d.text.length > 2500));
});
test('embed throughput rejects errors and empty runs', () => {
assert.deepEqual(embedThroughput({ chunksEmbedded: 200, durationMs: 4000, errors: 0 }), { chunksPerSecond: 50, ok: true });
assert.equal(embedThroughput({ chunksEmbedded: 200, durationMs: 4000, errors: 1 }).ok, false);
assert.equal(embedThroughput({ chunksEmbedded: 0, durationMs: 4000, errors: 0 }).ok, false);
});