@remnic/bench 9.3.590 → 9.3.592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -62,6 +62,8 @@ interface IngestionLog {
62
62
  }
63
63
  interface IngestionBenchAdapter {
64
64
  ingest(inputDir: string): Promise<IngestionLog>;
65
+ /** Flush asynchronous ingestion work before graph scoring. */
66
+ drain?(): Promise<void>;
65
67
  getMemoryGraph(): Promise<MemoryGraph>;
66
68
  reset(): Promise<void>;
67
69
  destroy(): Promise<void>;
package/dist/index.js CHANGED
@@ -2778,7 +2778,11 @@ function mergeAbortSignals(timeoutSignal, callerSignal) {
2778
2778
  }
2779
2779
  function createTimeoutGuardedIngestionAdapter(adapter, options) {
2780
2780
  assertPositiveTimeout(options.timeoutMs, "benchmark phase timeout");
2781
- const run = async (phase, fn) => runWithBenchmarkPhaseTimeout(`${options.benchmarkId}:${phase}`, options.timeoutMs, fn, options);
2781
+ if (options.drainTimeoutMs !== void 0) {
2782
+ assertPositiveTimeout(options.drainTimeoutMs, "benchmark drain timeout");
2783
+ }
2784
+ const drainTimeoutMs = options.drainTimeoutMs ?? options.timeoutMs;
2785
+ const run = async (phase, fn, timeoutMs = options.timeoutMs) => runWithBenchmarkPhaseTimeout(`${options.benchmarkId}:${phase}`, timeoutMs, fn, options);
2782
2786
  return {
2783
2787
  ingest(inputDir) {
2784
2788
  return run(`ingestion.ingest inputDir=${inputDir}`, () => adapter.ingest(inputDir));
@@ -2789,6 +2793,15 @@ function createTimeoutGuardedIngestionAdapter(adapter, options) {
2789
2793
  reset() {
2790
2794
  return run("ingestion.reset", () => adapter.reset());
2791
2795
  },
2796
+ ...adapter.drain ? {
2797
+ drain() {
2798
+ return run(
2799
+ "ingestion.drain",
2800
+ () => adapter.drain?.() ?? Promise.resolve(),
2801
+ drainTimeoutMs
2802
+ );
2803
+ }
2804
+ } : {},
2792
2805
  destroy() {
2793
2806
  return adapter.destroy();
2794
2807
  }
@@ -25580,6 +25593,33 @@ async function runIngestionEntityRecallBenchmark(options) {
25580
25593
  ];
25581
25594
  return buildResult(options, tasks2, durationMs);
25582
25595
  }
25596
+ try {
25597
+ await options.ingestionAdapter.drain?.();
25598
+ } catch (error) {
25599
+ const message = error instanceof Error ? error.message : String(error);
25600
+ const tasks2 = [
25601
+ {
25602
+ taskId: `entity-recall-${fixture.id}`,
25603
+ question: `Extract entities from ${fixture.id} fixture`,
25604
+ expected: `${fixture.goldGraph.entities.length} entities`,
25605
+ actual: `(ingestion drain error: ${message})`,
25606
+ scores: {
25607
+ entity_recall: -1
25608
+ },
25609
+ latencyMs: durationMs,
25610
+ tokens: { input: 0, output: 0 },
25611
+ details: {
25612
+ fixtureId: fixture.id,
25613
+ goldEntityCount: fixture.goldGraph.entities.length,
25614
+ ingestionErrors: ingestionLog.errors,
25615
+ drainError: message,
25616
+ commandsIssued: ingestionLog.commandsIssued,
25617
+ promptsShown: ingestionLog.promptsShown
25618
+ }
25619
+ }
25620
+ ];
25621
+ return buildResult(options, tasks2, durationMs);
25622
+ }
25583
25623
  const graph = await options.ingestionAdapter.getMemoryGraph();
25584
25624
  const { overall, byType } = entityRecall(graph.entities, fixture.goldGraph.entities);
25585
25625
  const scores = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/bench",
3
- "version": "9.3.590",
3
+ "version": "9.3.592",
4
4
  "description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "hyparquet": "^1.25.7",
36
36
  "yaml": "^2.4.2",
37
- "@remnic/core": "^9.3.590"
37
+ "@remnic/core": "^9.3.592"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^8.5.1",