@polderlabs/bizar 4.9.0 → 5.0.1
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/bizar-dash/dist/assets/icons-Bo0iH9EC.js +701 -0
- package/bizar-dash/dist/assets/icons-Bo0iH9EC.js.map +1 -0
- package/bizar-dash/dist/assets/{index-DU61awG3.js → index-DmpSFPJY.js} +1 -1
- package/bizar-dash/dist/assets/{index-DU61awG3.js.map → index-DmpSFPJY.js.map} +1 -1
- package/bizar-dash/dist/assets/main-C1cpttnv.js +19 -0
- package/bizar-dash/dist/assets/main-C1cpttnv.js.map +1 -0
- package/bizar-dash/dist/assets/main-DTkNlLrw.css +1 -0
- package/bizar-dash/dist/assets/markdown-DIquRulQ.js +29 -0
- package/bizar-dash/dist/assets/markdown-DIquRulQ.js.map +1 -0
- package/bizar-dash/dist/assets/mobile-BtxQJftK.js +2 -0
- package/bizar-dash/dist/assets/mobile-BtxQJftK.js.map +1 -0
- package/bizar-dash/dist/assets/mobile-DD-FZrTC.js +1 -0
- package/bizar-dash/dist/assets/{mobile-CL5uUQEC.js.map → mobile-DD-FZrTC.js.map} +1 -1
- package/bizar-dash/dist/assets/react-vendor-DZRUXSPQ.js +40 -0
- package/bizar-dash/dist/assets/react-vendor-DZRUXSPQ.js.map +1 -0
- package/bizar-dash/dist/index.html +6 -3
- package/bizar-dash/dist/mobile.html +5 -2
- package/bizar-dash/node_modules/.package-lock.json +6 -0
- package/bizar-dash/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/bizar-dash/package-lock.json +6 -0
- package/bizar-dash/skills/eval/SKILL.md +237 -0
- package/bizar-dash/src/server/api.mjs +35 -0
- package/bizar-dash/src/server/auth.mjs +155 -1
- package/bizar-dash/src/server/diagnostics-store.mjs +452 -2
- package/bizar-dash/src/server/eval-store.mjs +226 -0
- package/bizar-dash/src/server/eval.mjs +347 -0
- package/bizar-dash/src/server/memory-store.mjs +46 -0
- package/bizar-dash/src/server/ocr.mjs +55 -0
- package/bizar-dash/src/server/plugins/registry.mjs +363 -0
- package/bizar-dash/src/server/plugins/sandbox.mjs +655 -0
- package/bizar-dash/src/server/plugins/store.mjs +659 -0
- package/bizar-dash/src/server/providers-store.mjs +11 -4
- package/bizar-dash/src/server/routes/_shared.mjs +2 -2
- package/bizar-dash/src/server/routes/clipboard.mjs +173 -0
- package/bizar-dash/src/server/routes/doctor.mjs +71 -0
- package/bizar-dash/src/server/routes/env-vars.mjs +67 -1
- package/bizar-dash/src/server/routes/eval.mjs +147 -0
- package/bizar-dash/src/server/routes/memory.mjs +3 -0
- package/bizar-dash/src/server/routes/ocr.mjs +182 -0
- package/bizar-dash/src/server/routes/opencode-session-detail.mjs +61 -42
- package/bizar-dash/src/server/routes/plugins.mjs +220 -0
- package/bizar-dash/src/server/routes/schedules.mjs +55 -0
- package/bizar-dash/src/server/routes/users.mjs +84 -0
- package/bizar-dash/src/server/routes/voice.mjs +131 -0
- package/bizar-dash/src/server/routes/workspaces.mjs +204 -0
- package/bizar-dash/src/server/serve-info.mjs +172 -0
- package/bizar-dash/src/server/voice-store.mjs +202 -0
- package/bizar-dash/src/server/voice-transcribe.mjs +72 -0
- package/bizar-dash/src/server/workspaces.mjs +626 -0
- package/bizar-dash/src/web/App.tsx +48 -11
- package/bizar-dash/src/web/components/AutosaveField.tsx +50 -0
- package/bizar-dash/src/web/components/DoctorPanel.tsx +160 -0
- package/bizar-dash/src/web/components/EnvVarManager.tsx +245 -62
- package/bizar-dash/src/web/components/InviteDialog.tsx +205 -0
- package/bizar-dash/src/web/components/ScheduleTemplateCard.tsx +71 -0
- package/bizar-dash/src/web/components/ScreenshotCapture.tsx +138 -0
- package/bizar-dash/src/web/components/ScreenshotOCR.tsx +42 -0
- package/bizar-dash/src/web/components/SettingsNav.tsx +101 -0
- package/bizar-dash/src/web/components/Sidebar.tsx +25 -1
- package/bizar-dash/src/web/components/StatusBadge.tsx +33 -2
- package/bizar-dash/src/web/components/Topbar.tsx +11 -0
- package/bizar-dash/src/web/components/VoiceNotesPanel.tsx +182 -0
- package/bizar-dash/src/web/components/VoiceRecorder.tsx +104 -0
- package/bizar-dash/src/web/components/WorkspaceSelector.tsx +158 -0
- package/bizar-dash/src/web/components/chat/ChatInfoPanel.tsx +64 -0
- package/bizar-dash/src/web/components/chat/Composer.tsx +1 -1
- package/bizar-dash/src/web/components/chat/useChat.ts +118 -1
- package/bizar-dash/src/web/hooks/useAutosave.ts +107 -0
- package/bizar-dash/src/web/lib/types.ts +134 -0
- package/bizar-dash/src/web/styles/chat.css +8 -5
- package/bizar-dash/src/web/styles/main.css +77 -2
- package/bizar-dash/src/web/styles/memory.css +82 -0
- package/bizar-dash/src/web/styles/settings.css +265 -0
- package/bizar-dash/src/web/views/Chat.tsx +15 -1
- package/bizar-dash/src/web/views/Doctor.tsx +317 -0
- package/bizar-dash/src/web/views/Memory.tsx +17 -2
- package/bizar-dash/src/web/views/MiniMaxUsage.tsx +1 -0
- package/bizar-dash/src/web/views/Schedules.tsx +94 -12
- package/bizar-dash/src/web/views/Settings.tsx +78 -45
- package/bizar-dash/src/web/views/Workspace.tsx +294 -0
- package/bizar-dash/src/web/views/memory/ConfigPanel.tsx +114 -133
- package/bizar-dash/src/web/views/memory/FromScreenshotPanel.tsx +23 -0
- package/bizar-dash/src/web/views/memory/VaultFromClipboardPanel.tsx +101 -0
- package/bizar-dash/src/web/views/settings/AgentSection.tsx +23 -12
- package/bizar-dash/src/web/views/settings/EnvVarsSection.tsx +5 -6
- package/bizar-dash/src/web/views/settings/GeneralSection.tsx +38 -15
- package/bizar-dash/src/web/views/settings/MemorySection.tsx +92 -8
- package/bizar-dash/src/web/views/settings/WorkspacesSection.tsx +189 -0
- package/bizar-dash/tests/autosave.test.tsx +276 -0
- package/bizar-dash/tests/bundle-analysis.test.mjs +5 -2
- package/bizar-dash/tests/chat-composer.test.tsx +140 -0
- package/bizar-dash/tests/clipboard.test.mjs +147 -0
- package/bizar-dash/tests/components/doctor-panel.test.tsx +105 -0
- package/bizar-dash/tests/components/screenshot-ocr.test.tsx +75 -0
- package/bizar-dash/tests/components/workspace-selector.test.tsx +73 -0
- package/bizar-dash/tests/deploy-templates.test.mjs +100 -0
- package/bizar-dash/tests/diagnostics-store.test.mjs +206 -0
- package/bizar-dash/tests/env-vars-extended.test.mjs +190 -0
- package/bizar-dash/tests/eval/fixtures.test.mjs +141 -0
- package/bizar-dash/tests/eval/report.test.mjs +284 -0
- package/bizar-dash/tests/eval/runner.test.mjs +471 -0
- package/bizar-dash/tests/layout-spacing.test.mjs +101 -0
- package/bizar-dash/tests/memory-default-vault.test.mjs +98 -0
- package/bizar-dash/tests/minimax-bar.test.tsx +113 -0
- package/bizar-dash/tests/minimax-models.test.mjs +123 -0
- package/bizar-dash/tests/ocr.test.mjs +87 -0
- package/bizar-dash/tests/opencode-sessions-detail.test.mjs +158 -0
- package/bizar-dash/tests/plugins-registry.test.mjs +387 -0
- package/bizar-dash/tests/plugins-sandbox.test.mjs +374 -0
- package/bizar-dash/tests/plugins-store.test.mjs +455 -0
- package/bizar-dash/tests/routes-doctor.test.mjs +159 -0
- package/bizar-dash/tests/schedules-templates.test.mjs +144 -0
- package/bizar-dash/tests/settings-layout.test.tsx +129 -0
- package/bizar-dash/tests/settings-mode-wiring.test.tsx +151 -0
- package/bizar-dash/tests/settings-nav.test.tsx +126 -0
- package/bizar-dash/tests/users.test.mjs +108 -0
- package/bizar-dash/tests/voice-recorder.test.tsx +95 -0
- package/bizar-dash/tests/voice-store.test.mjs +148 -0
- package/bizar-dash/tests/voice-transcribe.test.mjs +87 -0
- package/bizar-dash/tests/workspaces.test.mjs +527 -0
- package/cli/bin.mjs +72 -2
- package/cli/commands/clip.mjs +146 -0
- package/cli/commands/deploy/cloudflare.mjs +250 -0
- package/cli/commands/deploy/docker.mjs +221 -0
- package/cli/commands/deploy/fly.mjs +161 -0
- package/cli/commands/deploy/vercel.mjs +225 -0
- package/cli/commands/deploy.mjs +240 -0
- package/cli/commands/eval.mjs +378 -0
- package/cli/commands/marketplace.mjs +64 -0
- package/cli/commands/minimax.mjs +5 -2
- package/cli/commands/ocr.mjs +165 -0
- package/cli/commands/plugin.mjs +358 -0
- package/cli/commands/voice.mjs +211 -0
- package/cli/commands/workspace.mjs +247 -0
- package/cli/tests/minimax-cli.test.mjs +79 -0
- package/config/agents/frigg.md +1 -1
- package/config/agents/heimdall.md +1 -1
- package/config/agents/mimir.md +1 -1
- package/config/agents/quick.md +1 -1
- package/config/agents/semble-search.md +1 -1
- package/config/agents/vor.md +1 -1
- package/config/opencode.json +28 -21
- package/config/opencode.json.template +8 -1
- package/package.json +12 -8
- package/plugins/bizar/index.ts +77 -0
- package/plugins/bizar/src/compaction.d.mts +48 -0
- package/plugins/bizar/src/compaction.mjs +192 -0
- package/plugins/bizar/tests/compaction.test.ts +264 -0
- package/templates/deploy/cloudflare/README.md +32 -0
- package/templates/deploy/cloudflare/functions-index.template.js +15 -0
- package/templates/deploy/cloudflare/wrangler.toml.template +9 -0
- package/templates/deploy/docker/.env.template +16 -0
- package/templates/deploy/docker/README.md +58 -0
- package/templates/deploy/docker/docker-compose.template.yml +23 -0
- package/templates/deploy/fly/README.md +35 -0
- package/templates/deploy/fly/fly.toml.template +28 -0
- package/templates/deploy/vercel/README.md +29 -0
- package/templates/deploy/vercel/api-index.template.js +18 -0
- package/templates/deploy/vercel/vercel.json.template +16 -0
- package/templates/eval-fixtures/README.md +58 -0
- package/templates/eval-fixtures/code-search-basic.json +28 -0
- package/templates/eval-fixtures/latency-bounds.json +16 -0
- package/templates/eval-fixtures/regression-suite.json +79 -0
- package/templates/eval-fixtures/response-format.json +30 -0
- package/templates/eval-fixtures/tool-call-correctness.json +24 -0
- package/templates/plugin-template/README.md +121 -0
- package/templates/plugin-template/index.js +66 -0
- package/templates/plugin-template/plugin.json +42 -0
- package/templates/plugin-template/tests/plugin.test.js +83 -0
- package/templates/schedules/daily-backup.json +12 -0
- package/templates/schedules/daily-cleanup.json +12 -0
- package/templates/schedules/hourly-health-check.json +12 -0
- package/templates/schedules/webhook-on-push.json +13 -0
- package/templates/schedules/weekly-digest.json +13 -0
- package/bizar-dash/dist/assets/main-DaC1Lc6q.js +0 -366
- package/bizar-dash/dist/assets/main-DaC1Lc6q.js.map +0 -1
- package/bizar-dash/dist/assets/main-DfmIfOUS.css +0 -1
- package/bizar-dash/dist/assets/mobile-CL5uUQEC.js +0 -1
- package/bizar-dash/dist/assets/mobile-D5WTWvuh.js +0 -338
- package/bizar-dash/dist/assets/mobile-D5WTWvuh.js.map +0 -1
- package/bizar-dash/src/web/views/settings/BackupSection.tsx +0 -16
- package/bizar-dash/src/web/views/settings/ProvidersSection.tsx +0 -16
- package/bizar-dash/src/web/views/settings/SkillsSection.tsx +0 -16
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tests/eval/report.test.mjs
|
|
3
|
+
*
|
|
4
|
+
* v5.0.0 — Tests for eval run comparison / diff reporting.
|
|
5
|
+
*
|
|
6
|
+
* Verifies:
|
|
7
|
+
* - compareRuns correctly categorizes fixtures as improved/regressed/unchanged
|
|
8
|
+
* - saveRun and getRun work correctly
|
|
9
|
+
* - listRuns returns runs in order
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { describe, it, beforeEach, afterEach } from 'node:test';
|
|
13
|
+
import assert from 'node:assert';
|
|
14
|
+
import { tmpdir } from 'node:os';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
import { mkdirSync, rmSync } from 'node:fs';
|
|
17
|
+
|
|
18
|
+
const storeHome = join(tmpdir(), `bizar-eval-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
19
|
+
process.env.BIZAR_STORE_HOME = storeHome;
|
|
20
|
+
mkdirSync(storeHome, { recursive: true });
|
|
21
|
+
|
|
22
|
+
const EVAL_STORE = await import('../../src/server/eval-store.mjs');
|
|
23
|
+
|
|
24
|
+
describe('eval store — run comparison', () => {
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
EVAL_STORE.__resetStoreForTests();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('compareRuns', () => {
|
|
31
|
+
it('categorizes improved fixtures (was failing, now passing)', async () => {
|
|
32
|
+
const run1 = {
|
|
33
|
+
id: 'run_1',
|
|
34
|
+
startedAt: new Date().toISOString(),
|
|
35
|
+
finishedAt: new Date().toISOString(),
|
|
36
|
+
suitePath: '/test',
|
|
37
|
+
total: 2,
|
|
38
|
+
passed: 1,
|
|
39
|
+
failed: 1,
|
|
40
|
+
results: [
|
|
41
|
+
{ fixtureId: 'f1', ok: false, latencyMs: 100 },
|
|
42
|
+
{ fixtureId: 'f2', ok: true, latencyMs: 100 },
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
const run2 = {
|
|
46
|
+
id: 'run_2',
|
|
47
|
+
startedAt: new Date().toISOString(),
|
|
48
|
+
finishedAt: new Date().toISOString(),
|
|
49
|
+
suitePath: '/test',
|
|
50
|
+
total: 2,
|
|
51
|
+
passed: 2,
|
|
52
|
+
failed: 0,
|
|
53
|
+
results: [
|
|
54
|
+
{ fixtureId: 'f1', ok: true, latencyMs: 100 },
|
|
55
|
+
{ fixtureId: 'f2', ok: true, latencyMs: 100 },
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
await EVAL_STORE.saveRun(run1);
|
|
60
|
+
await EVAL_STORE.saveRun(run2);
|
|
61
|
+
|
|
62
|
+
const diff = await EVAL_STORE.compareRuns('run_1', 'run_2');
|
|
63
|
+
|
|
64
|
+
assert.strictEqual(diff.improved.length, 1);
|
|
65
|
+
assert.strictEqual(diff.improved[0].fixtureId, 'f1');
|
|
66
|
+
assert.strictEqual(diff.regressed.length, 0);
|
|
67
|
+
assert.strictEqual(diff.unchanged.length, 1);
|
|
68
|
+
assert.strictEqual(diff.unchanged[0].fixtureId, 'f2');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('categorizes regressed fixtures (was passing, now failing)', async () => {
|
|
72
|
+
const run1 = {
|
|
73
|
+
id: 'run_a',
|
|
74
|
+
startedAt: new Date().toISOString(),
|
|
75
|
+
finishedAt: new Date().toISOString(),
|
|
76
|
+
suitePath: '/test',
|
|
77
|
+
total: 2,
|
|
78
|
+
passed: 2,
|
|
79
|
+
failed: 0,
|
|
80
|
+
results: [
|
|
81
|
+
{ fixtureId: 'f1', ok: true, latencyMs: 100 },
|
|
82
|
+
{ fixtureId: 'f2', ok: true, latencyMs: 100 },
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
const run2 = {
|
|
86
|
+
id: 'run_b',
|
|
87
|
+
startedAt: new Date().toISOString(),
|
|
88
|
+
finishedAt: new Date().toISOString(),
|
|
89
|
+
suitePath: '/test',
|
|
90
|
+
total: 2,
|
|
91
|
+
passed: 1,
|
|
92
|
+
failed: 1,
|
|
93
|
+
results: [
|
|
94
|
+
{ fixtureId: 'f1', ok: false, latencyMs: 100 },
|
|
95
|
+
{ fixtureId: 'f2', ok: true, latencyMs: 100 },
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
await EVAL_STORE.saveRun(run1);
|
|
100
|
+
await EVAL_STORE.saveRun(run2);
|
|
101
|
+
|
|
102
|
+
const diff = await EVAL_STORE.compareRuns('run_a', 'run_b');
|
|
103
|
+
|
|
104
|
+
assert.strictEqual(diff.regressed.length, 1);
|
|
105
|
+
assert.strictEqual(diff.regressed[0].fixtureId, 'f1');
|
|
106
|
+
assert.strictEqual(diff.improved.length, 0);
|
|
107
|
+
assert.strictEqual(diff.unchanged.length, 1);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('categorizes unchanged fixtures', async () => {
|
|
111
|
+
const run1 = {
|
|
112
|
+
id: 'run_x',
|
|
113
|
+
startedAt: new Date().toISOString(),
|
|
114
|
+
finishedAt: new Date().toISOString(),
|
|
115
|
+
suitePath: '/test',
|
|
116
|
+
total: 1,
|
|
117
|
+
passed: 1,
|
|
118
|
+
failed: 0,
|
|
119
|
+
results: [{ fixtureId: 'f1', ok: true, latencyMs: 100 }],
|
|
120
|
+
};
|
|
121
|
+
const run2 = {
|
|
122
|
+
id: 'run_y',
|
|
123
|
+
startedAt: new Date().toISOString(),
|
|
124
|
+
finishedAt: new Date().toISOString(),
|
|
125
|
+
suitePath: '/test',
|
|
126
|
+
total: 1,
|
|
127
|
+
passed: 1,
|
|
128
|
+
failed: 0,
|
|
129
|
+
results: [{ fixtureId: 'f1', ok: true, latencyMs: 120 }],
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
await EVAL_STORE.saveRun(run1);
|
|
133
|
+
await EVAL_STORE.saveRun(run2);
|
|
134
|
+
|
|
135
|
+
const diff = await EVAL_STORE.compareRuns('run_x', 'run_y');
|
|
136
|
+
|
|
137
|
+
assert.strictEqual(diff.unchanged.length, 1);
|
|
138
|
+
assert.strictEqual(diff.improved.length, 0);
|
|
139
|
+
assert.strictEqual(diff.regressed.length, 0);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('returns error when run not found', async () => {
|
|
143
|
+
const diff = await EVAL_STORE.compareRuns('nonexistent', 'also-nonexistent');
|
|
144
|
+
assert.ok(diff.error);
|
|
145
|
+
assert.strictEqual(diff.error, 'run not found');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('handles fixtures that only exist in one run', async () => {
|
|
149
|
+
const run1 = {
|
|
150
|
+
id: 'run_new',
|
|
151
|
+
startedAt: new Date().toISOString(),
|
|
152
|
+
finishedAt: new Date().toISOString(),
|
|
153
|
+
suitePath: '/test',
|
|
154
|
+
total: 2,
|
|
155
|
+
passed: 2,
|
|
156
|
+
failed: 0,
|
|
157
|
+
results: [
|
|
158
|
+
{ fixtureId: 'f1', ok: true, latencyMs: 100 },
|
|
159
|
+
{ fixtureId: 'f2', ok: true, latencyMs: 100 },
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
const run2 = {
|
|
163
|
+
id: 'run_old',
|
|
164
|
+
startedAt: new Date().toISOString(),
|
|
165
|
+
finishedAt: new Date().toISOString(),
|
|
166
|
+
suitePath: '/test',
|
|
167
|
+
total: 1,
|
|
168
|
+
passed: 1,
|
|
169
|
+
failed: 0,
|
|
170
|
+
results: [{ fixtureId: 'f1', ok: true, latencyMs: 100 }],
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
await EVAL_STORE.saveRun(run1);
|
|
174
|
+
await EVAL_STORE.saveRun(run2);
|
|
175
|
+
|
|
176
|
+
const diff = await EVAL_STORE.compareRuns('run_new', 'run_old');
|
|
177
|
+
// f2 only exists in run_new, so it's not in the diff
|
|
178
|
+
assert.strictEqual(diff.unchanged.length, 1);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
describe('saveRun / getRun', () => {
|
|
183
|
+
it('saves and retrieves a run', async () => {
|
|
184
|
+
const run = {
|
|
185
|
+
id: 'run_save_test',
|
|
186
|
+
startedAt: new Date().toISOString(),
|
|
187
|
+
finishedAt: new Date().toISOString(),
|
|
188
|
+
suitePath: '/test',
|
|
189
|
+
total: 1,
|
|
190
|
+
passed: 1,
|
|
191
|
+
failed: 0,
|
|
192
|
+
results: [{ fixtureId: 'f1', ok: true, latencyMs: 100 }],
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const saved = await EVAL_STORE.saveRun(run);
|
|
196
|
+
assert.strictEqual(saved.ok, true);
|
|
197
|
+
assert.ok(saved.path.includes('run_save_test'));
|
|
198
|
+
|
|
199
|
+
const retrieved = await EVAL_STORE.getRun('run_save_test');
|
|
200
|
+
assert.strictEqual(retrieved.id, 'run_save_test');
|
|
201
|
+
assert.strictEqual(retrieved.total, 1);
|
|
202
|
+
assert.strictEqual(retrieved.passed, 1);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('returns null for nonexistent run', async () => {
|
|
206
|
+
const result = await EVAL_STORE.getRun('nonexistent_run_id');
|
|
207
|
+
assert.strictEqual(result, null);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
describe('listRuns', () => {
|
|
212
|
+
it('returns runs in newest-first order', async () => {
|
|
213
|
+
for (let i = 0; i < 5; i++) {
|
|
214
|
+
const run = {
|
|
215
|
+
id: `run_list_${i}`,
|
|
216
|
+
startedAt: new Date().toISOString(),
|
|
217
|
+
finishedAt: new Date().toISOString(),
|
|
218
|
+
suitePath: '/test',
|
|
219
|
+
total: 1,
|
|
220
|
+
passed: 1,
|
|
221
|
+
failed: 0,
|
|
222
|
+
results: [],
|
|
223
|
+
};
|
|
224
|
+
await EVAL_STORE.saveRun(run);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const runs = await EVAL_STORE.listRuns({ limit: 3 });
|
|
228
|
+
assert.strictEqual(runs.length, 3);
|
|
229
|
+
// Should be newest first
|
|
230
|
+
assert.strictEqual(runs[0].id, 'run_list_4');
|
|
231
|
+
assert.strictEqual(runs[1].id, 'run_list_3');
|
|
232
|
+
assert.strictEqual(runs[2].id, 'run_list_2');
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('respects limit parameter', async () => {
|
|
236
|
+
// Save a few runs first
|
|
237
|
+
for (let i = 0; i < 4; i++) {
|
|
238
|
+
const run = {
|
|
239
|
+
id: `run_limit_${i}`,
|
|
240
|
+
startedAt: new Date().toISOString(),
|
|
241
|
+
finishedAt: new Date().toISOString(),
|
|
242
|
+
suitePath: '/test',
|
|
243
|
+
total: 1,
|
|
244
|
+
passed: 1,
|
|
245
|
+
failed: 0,
|
|
246
|
+
results: [],
|
|
247
|
+
};
|
|
248
|
+
await EVAL_STORE.saveRun(run);
|
|
249
|
+
}
|
|
250
|
+
const runs = await EVAL_STORE.listRuns({ limit: 2 });
|
|
251
|
+
assert.strictEqual(runs.length, 2);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
describe('deleteRun', () => {
|
|
256
|
+
it('deletes a run', async () => {
|
|
257
|
+
const run = {
|
|
258
|
+
id: 'run_to_delete',
|
|
259
|
+
startedAt: new Date().toISOString(),
|
|
260
|
+
finishedAt: new Date().toISOString(),
|
|
261
|
+
suitePath: '/test',
|
|
262
|
+
total: 1,
|
|
263
|
+
passed: 1,
|
|
264
|
+
failed: 0,
|
|
265
|
+
results: [],
|
|
266
|
+
};
|
|
267
|
+
await EVAL_STORE.saveRun(run);
|
|
268
|
+
const result = await EVAL_STORE.deleteRun('run_to_delete');
|
|
269
|
+
assert.strictEqual(result.ok, true);
|
|
270
|
+
const retrieved = await EVAL_STORE.getRun('run_to_delete');
|
|
271
|
+
assert.strictEqual(retrieved, null);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
describe('buildRunId', () => {
|
|
276
|
+
it('generates unique IDs', () => {
|
|
277
|
+
const id1 = EVAL_STORE.buildRunId();
|
|
278
|
+
const id2 = EVAL_STORE.buildRunId();
|
|
279
|
+
assert.notStrictEqual(id1, id2);
|
|
280
|
+
assert.ok(id1.startsWith('run_'));
|
|
281
|
+
assert.ok(id2.startsWith('run_'));
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|