Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(access): smoke-run the member-access bench on a tiny corpus (GBRA-218)

garrytan9ef4bd816937
diff --git a/test/bench-member-access.test.ts b/test/bench-member-access.test.ts
new file mode 100644
index 0000000000..1c57842580
--- /dev/null
+++ b/test/bench-member-access.test.ts
@@ -0,0 +1,29 @@
+/**
+ * Smoke run of scripts/bench-member-access.ts on a tiny synthetic corpus, so the
+ * GBRA-218 benchmark keeps running as the search and access code it drives moves.
+ * Asserts the output shape and that the member recalls its readable pages, never timings.
+ */
+import { describe, expect, test } from 'bun:test';
+import { join } from 'node:path';
+
+const ROOT = join(import.meta.dir, '..');
+
+describe('bench-member-access', () => {
+ test('a tiny run reports every cell and full member recall', () => {
+ const run = Bun.spawnSync(['bun', 'scripts/bench-member-access.ts', '--pages', '40', '--queries', '2', '--shares', '0,0.5', '--json'], {
+ cwd: ROOT, stdout: 'pipe', stderr: 'pipe', env: { ...process.env, DATABASE_URL: '' },
+ });
+ expect(run.stderr.toString()).not.toContain('bench search degraded or failed');
+ expect(run.exitCode).toBe(0);
+ const out = JSON.parse(run.stdout.toString().trim().split('\n').at(-1)!) as {
+ pages: number; queries: number; cells: { share: number; who: string; match: string; p50: number; p95: number; hit_at_10?: number }[];
+ };
+ expect(out.pages).toBe(40);
+ expect(out.queries).toBe(2);
+ expect(out.cells.map(c => `${c.share}/${c.match}/${c.who}`).sort()).toEqual([
+ '0.5/hybrid/member', '0.5/hybrid/unbound', '0.5/keyword/member', '0.5/keyword/unbound',
+ '0/hybrid/member', '0/hybrid/unbound', '0/keyword/member', '0/keyword/unbound',
+ ]);
+ for (const c of out.cells.filter(c => c.share === 0.5 && c.who === 'member')) expect(c.hit_at_10).toBe(1);
+ }, 120_000);
+});