Repository navigation
feat(eval): 新增按 case id 与 tag 筛选评测用例 - #284
Merged
Merged
Conversation
kbkb628
reviewed
Oct 3, 2026
kbkb628
left a comment
Collaborator
There was a problem hiding this comment.
我按仓库的测试规范在本机独立复现了一遍,结论:行为与描述一致,没有阻塞性缺陷。
实测(bun 1.4.2 / Windows,worktree 检出 b5dac6c4)
| 命令 | 结果 |
|---|---|
bun test scripts/eval/select-cases.test.ts |
exit 0 — 8 pass / 0 fail |
bun test scripts/eval |
exit 0 — 22 pass / 0 fail(4 文件) |
bun run typecheck |
exit 0,29.6s,5 个 workspace 全 0 |
bun scripts/eval/run.ts --tag provider-failure --max-cases 1 --mode fixture |
exit 0 — [1/1] ✓ fv1-provider-001,validity: valid,requested=1 started=1 evaluated=1 |
另外单独验了几个边界:
--smoke的 15 条与改动前内联实现的 15 条逐 id 完全相同(从pr-284^还原旧逻辑后对比,IDENTICAL=true),没有行为漂移;selectCases只在run.ts:783调用一次,位于 dataset 解析之后,所以gold-case/v1与folio-agent-v1-zh同样生效(实测--tag在 gold 数据集上能筛出drg-v1-single-fact);EvaluationCase.tags是必填字段(packages/core/src/evaluation.ts:93),三个数据集都没有缺 tags 的 case,所以caseItem.tags.some(...)不会崩;--smoke+--case→ 显式筛选胜出;重复--case会去重;--case缺值会报Flag --case requires a value.(都是期望行为)。
非阻塞建议(按优先级)
- 未命中时只输出
No cases selected.(run.ts:787-790):--case typo与"合法但交集为空"当前无法区分。建议把请求集合与命中结果比一下,把未命中的 id/tag 打出来。目前的测试只固定了函数级missing → [],CLI 行为没覆盖。 - 空值会静默降级:
--case ""/--case " "被trim().filter(Boolean)吃掉(select-cases.ts:31-32),于是变成"没有筛选",会跑全量数据集。建议显式给了 flag 但值为空时直接报错。 - README 只写了"任一 tag 命中",没写
--case与--tag是 AND(交集)、显式筛选优先于--smoke、匹配大小写敏感、输出保持 dataset 顺序。这几条只存在于代码注释和--help文案里,建议补进参数表。 bun run typecheck不覆盖scripts/(根tsconfig.json:31只 includepackages/*/src、apps/*/src,tsc --listFilesOnly里scripts/下 0 个文件),而且pr.yml的 focused-tests 按packages/*/、apps/electron/匹配,scripts/**变化时会被整段跳过 —— 所以这个改动实际只被full-unit-advisory(非阻塞)跑到。这是仓库既有约定、不是本 PR 引入的,只是提醒一下"绿灯"的含义比看起来弱;如果要更强的保障,可以在 PR 里附一条bun test scripts/eval的手动结果(你已经附了)。
环境提示
本机 bun install --frozen-lockfile 会因 unable to write files to tempdir: EPERM 直接失败,可用 BUN_INSTALL_CACHE_DIR=<other-dir> bun install --frozen-lockfile --ignore-scripts 绕过 —— 与 PR 无关,只是方便后续复现。
以上 4 条都不阻塞。另外 Closes #15 会在合并时直接关闭 #15 —— 我核对了 #15 的验收项,schema 与数据集已由已合并的 #77 落地、Langfuse 关联由 #74 落地,本 PR 补上的是"按单 case / tag / dataset 执行"这条,baseline/aggregate 也已有,所以关掉是说得通的,由维护者确认即可。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明
本 PR 完成 #15 中「选择 dataset / case / tag 运行」的第一步:让 eval runner 支持按单个/多个 case id 和 tag 精确筛选运行,并把筛选逻辑抽成可单测的函数。
scripts/eval/select-cases.ts,提供selectCases(dataset, smoke, maxCases, filter);run.ts新增可重复的--case <id>与--tag <tag>参数:--case只保留命中的 case id;--tag只保留携带任一 tag 的 case;--smoke;--max-cases在筛选之后生效;run.ts内联的旧选择逻辑,原 smoke 行为保持不变;scripts/eval/README.md补充示例命令与参数表。关联 Issue
Closes #15
测试报告(正式审核前必填)
环境
实际执行命令与结果
已知失败 / Baseline(如有)
无。
UI 截图(仅可见 UI 变化时必填)
Before(适用时)
After(适用时)
Scope / 后续
本 PR 只覆盖 #15 中的「按 case / tag 筛选运行」子能力;Gold Case dataset 扩充、metrics、Langfuse 关联与真实模型 E2E 验收仍按 Issue 后续推进。