python-yama 0.10.3__tar.gz → 0.10.5__tar.gz
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.
- {python_yama-0.10.3 → python_yama-0.10.5}/PKG-INFO +6 -5
- {python_yama-0.10.3 → python_yama-0.10.5}/README.md +5 -4
- {python_yama-0.10.3 → python_yama-0.10.5}/README.zh-CN.md +5 -4
- {python_yama-0.10.3 → python_yama-0.10.5}/docs/agent-skill-test-framework-design.md +28 -11
- {python_yama-0.10.3 → python_yama-0.10.5}/docs/case-schema-reference.md +14 -14
- {python_yama-0.10.3 → python_yama-0.10.5}/skills/eval-plugin-with-yama/SKILL.md +10 -6
- {python_yama-0.10.3 → python_yama-0.10.5}/skills/eval-plugin-with-yama/references/case-schema.md +10 -9
- {python_yama-0.10.3 → python_yama-0.10.5}/skills/eval-plugin-with-yama/references/debugging.md +15 -10
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_cli.py +211 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_judge_llm.py +179 -42
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_report.py +4 -4
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_runner.py +48 -1
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_workspace.py +30 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/cli.py +58 -11
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/judge_llm.py +15 -5
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/judge_routing.py +4 -1
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/report.py +1 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/runner.py +16 -6
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/workspace.py +1 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/.github/workflows/publish.yml +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/.gitignore +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/CLAUDE.md +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/LICENSE +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/docs/yama-intro.html +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/pyproject.toml +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/skills/eval-plugin-with-yama/references/install-upgrade.md +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_assertions.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_cli_shim.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_dashboard.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_framework.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_llm.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_main_entrypoint.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_mocks.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_openai_llm.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_pr.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_preview.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_public_api.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_report_bundle.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_report_upload.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_run_plan.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_skill_loader.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_skill_tool.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_thread_case.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_tool_loader.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/tests/test_usage.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/uv.lock +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/__init__.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/__main__.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/assertions.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/dashboard.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/llm.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/loaders/__init__.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/loaders/case.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/loaders/common.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/loaders/skill_loader.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/loaders/tool_loader.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/mocks.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/models.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/openai_llm.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/pr.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/preview.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/report_bundle.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/report_upload.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/thread_case.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/__init__.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/base.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/bash/__init__.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/bash/_cli_shim.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/bash/bash.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/bash/fs.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/skill/__init__.py +0 -0
- {python_yama-0.10.3 → python_yama-0.10.5}/yama/tools/skill/skill.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: python-yama
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.5
|
|
4
4
|
Summary: A reproducible evaluation runner for tool-using Agent skills
|
|
5
5
|
Project-URL: Repository, https://github.com/world-sim-dev/yama
|
|
6
6
|
Project-URL: Issues, https://github.com/world-sim-dev/yama/issues
|
|
@@ -34,7 +34,8 @@ English | [简体中文](https://github.com/world-sim-dev/yama/blob/main/README.
|
|
|
34
34
|
## Quick start
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
# Run from a plugin root; collects __evals__/cases/**/*.yaml by default
|
|
37
|
+
# Run from a plugin root; collects __evals__/cases/**/*.yaml by default,
|
|
38
|
+
# excluding macOS AppleDouble ._* sidecars
|
|
38
39
|
cd dingding-simple
|
|
39
40
|
YAMA_LLM_API_KEY=... uv run --project yama yama
|
|
40
41
|
|
|
@@ -46,7 +47,7 @@ Instead of prefixing every command, you can put credentials in a `.env` file: on
|
|
|
46
47
|
|
|
47
48
|
### Judge routing
|
|
48
49
|
|
|
49
|
-
Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, Judge routing recognizes OpenAI/GPT/o-family names as Codex, Claude/Anthropic names as Claude Code, and Grok/xAI names as Cursor. An exact per-agent map may translate an API model name to a local CLI model slug
|
|
50
|
+
Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, Judge routing recognizes OpenAI/GPT/o-family names as Codex, Claude/Anthropic names as Claude Code, and Grok/xAI names as Cursor. An exact per-agent map may translate an API model name to a local CLI model slug. Without a mapping, every recognized family first passes the original Judge model name to its local Agent. If any local attempt that explicitly names a model fails, Yama retries the same Agent with its default model; if that default attempt also fails, Yama calls the original Judge API. Other families become local-first only through an exact mapping. This local-first chain never enters the fallback Agent.
|
|
50
51
|
|
|
51
52
|
```toml
|
|
52
53
|
[defaults.judge.local.models.codex]
|
|
@@ -64,9 +65,9 @@ name = "claude" # "claude", "codex", or "cursor"
|
|
|
64
65
|
model = "claude-sonnet-4-5"
|
|
65
66
|
```
|
|
66
67
|
|
|
67
|
-
An unmapped, unrecognized model is API-first. Only after its original API exhausts retryable failures may `[defaults.judge.local.agent]` run as the terminal fallback: configured local model, then the same Agent's default
|
|
68
|
+
An unmapped, unrecognized model is API-first. Only after its original API exhausts retryable failures may `[defaults.judge.local.agent]` run as the terminal fallback: configured local model, then the same Agent's default whenever that named-model attempt fails, then end. There is no fallback-model API call. External cancellation always stops the chain immediately. The HTML report shows the complete Judge attempt chain, including mapped/configured/default/fallback source, retries, failures, and the effective local model when the Agent reports it.
|
|
68
69
|
|
|
69
|
-
CI and `pr-run` are API-only. Local agents receive the mapped model slug
|
|
70
|
+
CI and `pr-run` are API-only. Local agents receive the mapped model slug or original Judge model name and a compatible `reasoning_effort`, but never temperature, credentials, or endpoint settings. Cursor Judge passes `--trust` only for its per-attempt empty temporary workspace so non-interactive execution cannot stop at Workspace Trust; it still omits `--force`/`--yolo`, and Yama does not edit Cursor's global trust configuration. Evaluated Agent API attempts default to a 180-second transport timeout; Judge API attempts and local Judge processes default to 120 seconds. The whole-Step timeout remains independently configured by `execution.timeout_seconds_per_step` (default 300 seconds).
|
|
70
71
|
|
|
71
72
|
## Writing a Case
|
|
72
73
|
|
|
@@ -7,7 +7,8 @@ English | [简体中文](https://github.com/world-sim-dev/yama/blob/main/README.
|
|
|
7
7
|
## Quick start
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
# Run from a plugin root; collects __evals__/cases/**/*.yaml by default
|
|
10
|
+
# Run from a plugin root; collects __evals__/cases/**/*.yaml by default,
|
|
11
|
+
# excluding macOS AppleDouble ._* sidecars
|
|
11
12
|
cd dingding-simple
|
|
12
13
|
YAMA_LLM_API_KEY=... uv run --project yama yama
|
|
13
14
|
|
|
@@ -19,7 +20,7 @@ Instead of prefixing every command, you can put credentials in a `.env` file: on
|
|
|
19
20
|
|
|
20
21
|
### Judge routing
|
|
21
22
|
|
|
22
|
-
Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, Judge routing recognizes OpenAI/GPT/o-family names as Codex, Claude/Anthropic names as Claude Code, and Grok/xAI names as Cursor. An exact per-agent map may translate an API model name to a local CLI model slug
|
|
23
|
+
Evaluated Agent calls always use the configured OpenAI-compatible API. In an ordinary non-CI run, Judge routing recognizes OpenAI/GPT/o-family names as Codex, Claude/Anthropic names as Claude Code, and Grok/xAI names as Cursor. An exact per-agent map may translate an API model name to a local CLI model slug. Without a mapping, every recognized family first passes the original Judge model name to its local Agent. If any local attempt that explicitly names a model fails, Yama retries the same Agent with its default model; if that default attempt also fails, Yama calls the original Judge API. Other families become local-first only through an exact mapping. This local-first chain never enters the fallback Agent.
|
|
23
24
|
|
|
24
25
|
```toml
|
|
25
26
|
[defaults.judge.local.models.codex]
|
|
@@ -37,9 +38,9 @@ name = "claude" # "claude", "codex", or "cursor"
|
|
|
37
38
|
model = "claude-sonnet-4-5"
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
An unmapped, unrecognized model is API-first. Only after its original API exhausts retryable failures may `[defaults.judge.local.agent]` run as the terminal fallback: configured local model, then the same Agent's default
|
|
41
|
+
An unmapped, unrecognized model is API-first. Only after its original API exhausts retryable failures may `[defaults.judge.local.agent]` run as the terminal fallback: configured local model, then the same Agent's default whenever that named-model attempt fails, then end. There is no fallback-model API call. External cancellation always stops the chain immediately. The HTML report shows the complete Judge attempt chain, including mapped/configured/default/fallback source, retries, failures, and the effective local model when the Agent reports it.
|
|
41
42
|
|
|
42
|
-
CI and `pr-run` are API-only. Local agents receive the mapped model slug
|
|
43
|
+
CI and `pr-run` are API-only. Local agents receive the mapped model slug or original Judge model name and a compatible `reasoning_effort`, but never temperature, credentials, or endpoint settings. Cursor Judge passes `--trust` only for its per-attempt empty temporary workspace so non-interactive execution cannot stop at Workspace Trust; it still omits `--force`/`--yolo`, and Yama does not edit Cursor's global trust configuration. Evaluated Agent API attempts default to a 180-second transport timeout; Judge API attempts and local Judge processes default to 120 seconds. The whole-Step timeout remains independently configured by `execution.timeout_seconds_per_step` (default 300 seconds).
|
|
43
44
|
|
|
44
45
|
## Writing a Case
|
|
45
46
|
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
## 快速开始
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
# 在 Plugin 根目录下直接运行,默认收集 __evals__/cases/**/*.yaml
|
|
10
|
+
# 在 Plugin 根目录下直接运行,默认收集 __evals__/cases/**/*.yaml,
|
|
11
|
+
# 并忽略 macOS AppleDouble 的 ._* 边车文件
|
|
11
12
|
cd dingding-simple
|
|
12
13
|
YAMA_LLM_API_KEY=... uv run --project yama yama
|
|
13
14
|
|
|
@@ -19,7 +20,7 @@ YAMA_LLM_API_KEY=... uv run --project yama yama --plugin dingding-simple
|
|
|
19
20
|
|
|
20
21
|
### Judge 路由
|
|
21
22
|
|
|
22
|
-
被评测 Agent 的调用始终使用配置好的 OpenAI-compatible API。普通非 CI 运行中,Judge 路由把 OpenAI/GPT/o 系列交给 Codex、Claude/Anthropic 系列交给 Claude Code、Grok/xAI 系列交给 Cursor。每个 Agent 都可用精确映射把 API 模型名翻译成本地 CLI 模型 slug
|
|
23
|
+
被评测 Agent 的调用始终使用配置好的 OpenAI-compatible API。普通非 CI 运行中,Judge 路由把 OpenAI/GPT/o 系列交给 Codex、Claude/Anthropic 系列交给 Claude Code、Grok/xAI 系列交给 Cursor。每个 Agent 都可用精确映射把 API 模型名翻译成本地 CLI 模型 slug;未配置映射时,三个已识别系列都会先把原始 Judge 模型名传给对应本地 Agent。凡是显式携带模型名的本地尝试发生任何错误,Yama 都会改用同一 Agent 的默认模型重试;默认模型仍失败后才调用原始 Judge API。其他系列只有精确映射命中后才会变为 local-first,该链不会再进入 fallback Agent。
|
|
23
24
|
|
|
24
25
|
```toml
|
|
25
26
|
[defaults.judge.local.models.codex]
|
|
@@ -37,9 +38,9 @@ name = "claude" # 支持 "claude"、"codex" 或 "cursor"
|
|
|
37
38
|
model = "claude-sonnet-4-5"
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
未映射且未识别的模型走 API-first。只有原始 API 的可重试错误耗尽后,才会启用 `[defaults.judge.local.agent]` 作为终止型兜底:“配置的本地模型 →
|
|
41
|
+
未映射且未识别的模型走 API-first。只有原始 API 的可重试错误耗尽后,才会启用 `[defaults.judge.local.agent]` 作为终止型兜底:“配置的本地模型 → 该次尝试发生任何错误时使用同一 Agent 默认模型 → 结束”。不再调用 fallback-model API;外部取消始终立即终止整条链。HTML 报告会展示完整 Judge 尝试链,包括映射/原始配置/默认/兜底来源、重试、失败原因,以及本地 Agent 能上报时的实际模型。
|
|
41
42
|
|
|
42
|
-
CI 和 `pr-run` 均只走 API。本地 Agent 只接收命中的本地模型 slug
|
|
43
|
+
CI 和 `pr-run` 均只走 API。本地 Agent 只接收命中的本地模型 slug 或原始 Judge 模型名,以及兼容的 `reasoning_effort`;不会接收 temperature、凭据或 endpoint 设置。Cursor Judge 只为当前单次调用的空临时 Workspace 传入 `--trust`,避免非交互执行停在 Workspace Trust;仍不使用 `--force`/`--yolo`,Yama 也不会修改 Cursor 的全局信任配置。被评测 Agent 的 API 单次请求默认超时为 180 秒;Judge API 单次请求和本地 Judge 进程默认超时均为 120 秒。整条 Step 的超时仍由 `execution.timeout_seconds_per_step` 独立控制,默认 300 秒。
|
|
43
44
|
|
|
44
45
|
## 编写一个 Case
|
|
45
46
|
|
|
@@ -304,6 +304,9 @@ PATTERN 含 `*`/`?`/`[` 任一字符时按 `fnmatch` 通配符(大小写敏感
|
|
|
304
304
|
所以被筛掉的 Case 即使 YAML 损坏也不会阻塞本次运行;`--list` 同样受筛选影响。
|
|
305
305
|
筛选后一个 Case 都不剩时报 `No eval cases matched the case filter.` 并以退出码 2
|
|
306
306
|
结束(与"根本没收集到 Case"同级别,但错误信息区分两种情况)。
|
|
307
|
+
glob 或显式路径展开后,basename 以 `._` 开头的 macOS AppleDouble 边车文件会在
|
|
308
|
+
`is_file()` 校验和上述筛选之前直接丢弃;它们是 exFAT 等文件系统上的二进制元数据,
|
|
309
|
+
不是 Case YAML。这里只保留 `._*` 前缀,不会泛化为忽略所有点文件。
|
|
307
310
|
|
|
308
311
|
**Case/run 两级并发调度(`--concurrency` / `--run-concurrency`,`cli.py:_run`)。**
|
|
309
312
|
收集到的多个 Case 先用 `asyncio.Semaphore(concurrency)` + `asyncio.gather` 在同一事件
|
|
@@ -322,9 +325,15 @@ PATTERN 含 `*`/`?`/`[` 任一字符时按 `fnmatch` 通配符(大小写敏感
|
|
|
322
325
|
- 结果数组保持**收集顺序**(`gather` 保序),与完成先后无关;汇总表格、`--json`
|
|
323
326
|
输出、HTML 报告的 Case 顺序因此稳定;Case 内第二层 `gather` 同样让 `runs` 始终按
|
|
324
327
|
`run_index` 排列。
|
|
325
|
-
- 某个 Case
|
|
326
|
-
`RunResult.error`)时,其余 Case 仍会跑完并写完产物(`gather`
|
|
327
|
-
`return_exceptions=True
|
|
328
|
+
- 某个 Case 逸出普通、非 `LLMError` 的 `Exception`(罕见:run 内的错误通常都会被
|
|
329
|
+
`_run_once` 捕获进 `RunResult.error`)时,其余 Case 仍会跑完并写完产物(`gather`
|
|
330
|
+
`return_exceptions=True`);CLI 随后为该 Case 合成一个 `run_index=1`、
|
|
331
|
+
`status=error`、`error_kind=framework` 的 RunResult,使终端、JSON、HTML 和 PR
|
|
332
|
+
summary/report 都保留正确的 Case 顺序、错误计数或错误详情,HTML 另保留 traceback。
|
|
333
|
+
suite 完成报告后返回退出码 2;
|
|
334
|
+
普通 CLI 的顶层 `LLMError` 继续走现有 LLM error 出口;`pr-run` 则把它附着为
|
|
335
|
+
对应 Case 的 `error_kind=llm` 结果,以便继续写完整 summary/report。
|
|
336
|
+
`KeyboardInterrupt`、`SystemExit`、`asyncio.CancelledError` 等非普通异常仍向上传播。
|
|
328
337
|
- run 间的 Mock state、bash 沙箱工作目录、持久 shell 会话和产物目录都已按
|
|
329
338
|
`run_index` 隔离;Case 级旧目录清理只在并发任务启动前执行一次。
|
|
330
339
|
- 进度输出按实际并发模式切换(见第 13 节):多个 Case 可重叠或任一 Case 的有效 run
|
|
@@ -1581,6 +1590,11 @@ mock 脚本与旧文件,结果不可复现。run 结束(成功、断言失
|
|
|
1581
1590
|
进程贯穿整个 run,`cd`、`export`、写文件等状态天然延续到下一次 Tool Call,不需要
|
|
1582
1591
|
额外的状态字典维护 cwd/环境。
|
|
1583
1592
|
|
|
1593
|
+
启动前删除通过 `shutil.rmtree(onexc=...)` 逐项处理:某个目录项已经消失产生的
|
|
1594
|
+
`FileNotFoundError`/`ENOENT` 视为删除目标已达成并继续遍历,权限、I/O、非空目录等
|
|
1595
|
+
其他异常不被静默吞掉。这个精确容错同时用于下述旧产物目录清理,专门覆盖 macOS +
|
|
1596
|
+
exFAT 上 AppleDouble `._*` 文件在扫描与 `unlink` 之间消失的竞态。
|
|
1597
|
+
|
|
1584
1598
|
**命令执行:持久 shell + marker 协议。** 每次 Tool Call 把命令包装成如下 payload
|
|
1585
1599
|
写入这个 shell 的 stdin:
|
|
1586
1600
|
|
|
@@ -2509,6 +2523,8 @@ class ToolCallRecord:
|
|
|
2509
2523
|
`execution.repeat` 比上次小,不清理就会留下过期的 `run-002` 等目录,人工或脚本
|
|
2510
2524
|
扫描 `.yama/runs` 时会把旧执行误当成本次结果。`--no-artifacts` 时不写也不删任何
|
|
2511
2525
|
产物目录(用户显式选择不落盘,不应顺带删掉历史产物),但 fs-runs 工作目录照常清理。
|
|
2526
|
+
每个 run 重写自身产物目录前也使用同一条“只忽略 ENOENT”的删除规则;创建目录、复制
|
|
2527
|
+
fixture 或写入新产物失败仍产生 framework error,不会被清理容错隐藏。
|
|
2512
2528
|
|
|
2513
2529
|
`--report` 触发的单文件 HTML 报告(`report.py:write_html_report` /
|
|
2514
2530
|
`write_timestamped_report`)是 CLI 层面单独生成的汇总产物,**不属于**上面这份逐
|
|
@@ -2628,18 +2644,19 @@ Judge 只评价无法可靠写成确定性规则的质量维度。执行逻辑
|
|
|
2628
2644
|
|
|
2629
2645
|
1. `judge.model.name` 可路由到本地 Agent 时,OpenAI/GPT/o 系列交给 Codex,
|
|
2630
2646
|
Claude/Anthropic 系列交给 Claude Code,Grok/xAI 系列交给 Cursor。精确映射命中时把
|
|
2631
|
-
映射值作为本地 `--model
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2647
|
+
映射值作为本地 `--model`。未映射时三个已识别系列都先把原始 Judge 模型名作为
|
|
2648
|
+
`--model`。其他系列只有精确映射命中后才成为 local-first。凡显式携带映射 slug 或原始
|
|
2649
|
+
模型名的本地尝试发生错误,都省略 `--model` 重试同一 Agent 默认模型;默认模型失败时,
|
|
2650
|
+
使用原始完整 Judge model 对象回退 API。链最终以原始 API 兜底,不进入
|
|
2651
|
+
`defaults.judge.local.agent`。
|
|
2635
2652
|
2. `judge.model.name` 未命中内置系列或映射时,先用原始完整 Judge model 对象调用 API。
|
|
2636
2653
|
只有可重试错误在 `max_retries` 后仍失败,且 Workspace 显式配置了
|
|
2637
|
-
`defaults.judge.local.agent`,才继续尝试配置的本地 Agent
|
|
2638
|
-
|
|
2639
|
-
|
|
2654
|
+
`defaults.judge.local.agent`,才继续尝试配置的本地 Agent 与模型。该显式模型尝试发生
|
|
2655
|
+
任何错误时,省略 `--model` 使用该 Agent 默认模型重试;默认模型仍失败时直接结束,
|
|
2656
|
+
不再调用 fallback-model API。不可重试的原始 API 错误
|
|
2640
2657
|
直接抛出;未配置 `defaults.judge.local.agent` 时不启用这条链。
|
|
2641
2658
|
|
|
2642
|
-
CI 和 `yama pr-run` 的 Judge 只走 API。本地 Agent 尝试只接收兼容的
|
|
2659
|
+
外部取消不会触发默认模型或 API 回退。CI 和 `yama pr-run` 的 Judge 只走 API。本地 Agent 尝试只接收兼容的
|
|
2643
2660
|
`reasoning_effort`,不接收 `temperature`。Agent 默认模型可能因机器或时间而变化,所以
|
|
2644
2661
|
`temperature: 0` 只对 API Judge 提供稳定作用,不能保证本地 Judge 可复现。被测 Agent
|
|
2645
2662
|
的 API 单次 attempt 默认 transport timeout 为 180 秒;Judge API 单次 attempt 与本地
|
|
@@ -92,10 +92,11 @@ timeout/connection error,以及 HTTP `408`、`409`、`429` 和所有 `5xx`;
|
|
|
92
92
|
Step deadline:`execution.timeout_seconds_per_step` 默认仍为 300 秒。
|
|
93
93
|
|
|
94
94
|
普通非 CI 的 Judge 使用解析后的 `judge.model.name` 决定路由:OpenAI/GPT/o 系列走
|
|
95
|
-
Codex,Claude/Anthropic 系列走 Claude Code,Grok/xAI 系列走 Cursor
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
Codex,Claude/Anthropic 系列走 Claude Code,Grok/xAI 系列走 Cursor。没有精确映射时,
|
|
96
|
+
三个已识别系列都会先把原始 Judge 模型名原样作为 `--model`。该显式模型尝试发生任何错误
|
|
97
|
+
时,都会省略 `--model` 使用对应 Agent 的默认模型重试。其他系列(例如 `kimi.k3`)只有命中下面的精确、
|
|
98
|
+
大小写敏感映射时才走本地;
|
|
99
|
+
`openrouter/gpt-4.1` 等未命中模型保持 API-first。
|
|
99
100
|
|
|
100
101
|
```toml
|
|
101
102
|
[defaults.judge.local.models.codex]
|
|
@@ -114,13 +115,12 @@ Agent、跨 Agent 重复、跨系列映射、空值和首尾空白都会在 Work
|
|
|
114
115
|
|
|
115
116
|
每次本地 Judge 均在新建的隔离目录中以无会话、只读的受限调用执行,并要求严格的结构化
|
|
116
117
|
输出;Yama 会再次校验其 JSON 和每个 Judge 维度的协议。可选 usage 只有在本地 Agent
|
|
117
|
-
实际返回有效 token 计数时才写入,Yama 不会编造 usage。本地调用只传入映射命中的模型 slug
|
|
118
|
-
|
|
119
|
-
或其他 endpoint
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
fallback Agent。
|
|
118
|
+
实际返回有效 token 计数时才写入,Yama 不会编造 usage。本地调用只传入映射命中的模型 slug、
|
|
119
|
+
无映射时的原始 Judge 模型名和该 CLI 支持的 `reasoning_effort`;不会传入 `temperature`、
|
|
120
|
+
凭据、`base_url`/`api_base` 或其他 endpoint 设置。映射模型或原始模型名的本地尝试发生
|
|
121
|
+
任何错误时,Yama 都会写一条已脱敏警告,并省略 `--model` 使用同一 Agent 的默认模型重试
|
|
122
|
+
一次。默认模型重试失败时,用**未改写的完整原始 model 对象**调用 API。该
|
|
123
|
+
local-first 链到此结束,不会进入 Workspace fallback Agent。
|
|
124
124
|
|
|
125
125
|
对于 `openrouter/gpt-4.1` 等不能路由到本地 Agent 的模型,原始 API 只有在可重试错误
|
|
126
126
|
耗尽 `max_retries` 后,才可能启用以下可选 Workspace 兜底;不可重试错误会直接抛出:
|
|
@@ -131,9 +131,9 @@ name = "claude" # 支持 "claude"、"codex" 或 "cursor"
|
|
|
131
131
|
model = "claude-sonnet-4-5"
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
配置存在时,Yama 先以指定 Agent 和模型执行本地 Judge
|
|
135
|
-
`--model` 使用该 Agent
|
|
136
|
-
|
|
134
|
+
配置存在时,Yama 先以指定 Agent 和模型执行本地 Judge;该次尝试发生任何错误时,省略
|
|
135
|
+
`--model` 使用该 Agent 默认模型重试。默认模型仍失败时直接结束,不会再用配置模型名调用
|
|
136
|
+
API。外部取消立即终止,不触发重试。整个配置表缺失时不会启用这条行为;`name` 不是 `claude`/`codex`/
|
|
137
137
|
`cursor`、`model` 为空或层级不是 TOML table 时,加载 Workspace 即报配置错误。
|
|
138
138
|
|
|
139
139
|
Codex 与 Claude Code 接收一份本地兼容的 Judge Schema 副本:数组使用对象型
|
|
@@ -49,7 +49,7 @@ yama eval。接到自然语言请求时,先把意图归到下面一类,再
|
|
|
49
49
|
├── config.json # 可用 skill_refs 显式引用版本化公共 Skill
|
|
50
50
|
├── skills/<skill-name>/SKILL.md # 可被模型按需查阅的 Skill
|
|
51
51
|
└── __evals__/
|
|
52
|
-
├── cases/ #
|
|
52
|
+
├── cases/ # 默认 glob __evals__/cases/**/*.yaml;忽略 macOS ._* 边车
|
|
53
53
|
├── tools/ # Tool Schema YAML(推荐)
|
|
54
54
|
├── mocks/ # Python Handler(推荐)
|
|
55
55
|
├── fixtures/ # 图片 / 音频等多模态附件
|
|
@@ -264,12 +264,13 @@ yama dashboard # 默认 http://127.0.0.1:8765/
|
|
|
264
264
|
```
|
|
265
265
|
|
|
266
266
|
普通非 CI 运行中,被测 Agent 始终走 API;Judge 的 GPT/o、Claude、Grok 系列分别本地
|
|
267
|
-
优先使用 Codex、Claude Code、Cursor
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
优先使用 Codex、Claude Code、Cursor。未配置精确映射时,三个 Agent 都先使用原始 Judge
|
|
268
|
+
模型名;凡显式模型尝试发生任何错误,都再试对应 Agent 默认模型。
|
|
269
|
+
其他模型(如 `kimi.k3`)只有命中 `[defaults.judge.local.models.<agent>]` 的精确 API→本地
|
|
270
|
+
slug 映射才会 local-first。该链最终以原始 Judge API 兜底。
|
|
270
271
|
API-first 只有可重试错误耗尽且配置 `[defaults.judge.local.agent]`(`name` 支持
|
|
271
|
-
`claude`/`codex`/`cursor`)时才尝试 fallback Agent
|
|
272
|
-
|
|
272
|
+
`claude`/`codex`/`cursor`)时才尝试 fallback Agent;显式本地模型失败后再试 Agent 默认,
|
|
273
|
+
默认模型仍失败后直接结束,不再调用 fallback-model API。外部取消始终立即终止。CI/`pr-run` 始终 API-only,HTML
|
|
273
274
|
会展示完整 Judge 尝试链和 Agent 能上报的实际模型。
|
|
274
275
|
Cursor Judge 只为每次隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互,仍不
|
|
275
276
|
使用 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。
|
|
@@ -283,6 +284,9 @@ Judge 默认超时均为 120 秒,整 Step 默认超时仍为 300 秒。
|
|
|
283
284
|
设 `repeat_concurrency: 1` 可让指定 Case 串行。只要 Case 或 run 存在并发,终端底部就
|
|
284
285
|
显示逐 Case 状态面板,并在 Case 完成后把 Run/Step 明细整块打印到面板上方;需要逐 Step
|
|
285
286
|
流式输出时,同时使用 `--concurrency 1 --run-concurrency 1`,或让目标 Case 显式串行。
|
|
287
|
+
macOS 在 exFAT 等卷上生成的 AppleDouble `._*.yaml` 会在解析前被忽略;启动前清理旧
|
|
288
|
+
`fs-runs`/产物时,目录项已经消失产生的 ENOENT 视为清理成功,权限和其他 I/O 错误仍作为
|
|
289
|
+
对应 Case 的 Framework ERROR 进入报告,其他 Case 继续运行。
|
|
286
290
|
|
|
287
291
|
退出码:`0` 全部通过;`1` 有 Case 失败;`2` Collection error、顶层 LLM error、
|
|
288
292
|
没有收集到任何 Case,或运行后只有/存在 ERROR(LLM 调用异常、Step 超时)且没有
|
{python_yama-0.10.3 → python_yama-0.10.5}/skills/eval-plugin-with-yama/references/case-schema.md
RENAMED
|
@@ -473,12 +473,13 @@ judge:
|
|
|
473
473
|
Judge API 单次 attempt 与本地 Judge 进程默认 timeout 均为 120 秒;整 Step timeout 仍由
|
|
474
474
|
`execution.timeout_seconds_per_step` 独立控制,默认 300 秒。
|
|
475
475
|
- 普通非 CI 运行的 Judge 会把 OpenAI/GPT/o 系列交给 Codex、Claude/Anthropic 系列交给
|
|
476
|
-
Claude Code、Grok/xAI 系列交给 Cursor
|
|
477
|
-
|
|
478
|
-
API→本地 slug 映射时才走本地。
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
476
|
+
Claude Code、Grok/xAI 系列交给 Cursor。未配置精确映射时三个 Agent 都先使用原始
|
|
477
|
+
Judge 模型名。其他模型只有命中
|
|
478
|
+
`[defaults.judge.local.models.<agent>]` 的大小写敏感精确 API→本地 slug 映射时才走本地。
|
|
479
|
+
CI 和 `yama pr-run` 的 Judge 只走 API。
|
|
480
|
+
- 映射 slug 或原始模型名的本地尝试发生任何错误时,Yama 都会向 stderr 警告并省略
|
|
481
|
+
`--model`,使用同一 Agent 默认模型重试一次。默认模型失败时,以原始完整 model 对象回退
|
|
482
|
+
API;外部取消立即终止,不触发重试。本地 Agent 不接收 `temperature`;
|
|
482
483
|
`temperature: 0` 的稳定作用仅限 API Judge。local-first 固定为“主 Agent → 原始 API →
|
|
483
484
|
结束”,不会进入 Workspace fallback Agent。
|
|
484
485
|
- 对未命中内置系列或映射的 Case Judge 模型,只有原始 API 因可重试错误耗尽
|
|
@@ -495,11 +496,11 @@ judge:
|
|
|
495
496
|
model = "claude-sonnet-4-5"
|
|
496
497
|
```
|
|
497
498
|
|
|
498
|
-
顺序是:配置的本地 Agent + 模型 →
|
|
499
|
-
Agent 默认模型 →
|
|
499
|
+
顺序是:配置的本地 Agent + 模型 → 该次尝试发生任何错误时省略 `--model` 使用同一
|
|
500
|
+
Agent 默认模型 → 结束。默认模型失败后不再调用 fallback-model API。`name` 非
|
|
500
501
|
`claude`/`codex`/`cursor`、映射冲突、`model` 为空或 table 层级错误会在 Workspace
|
|
501
502
|
加载时直接报配置错误。
|
|
502
|
-
- HTML 报告会按顺序展示完整 Judge
|
|
503
|
+
- HTML 报告会按顺序展示完整 Judge 尝试链、映射/原始配置/默认/兜底来源、API retry 和脱敏失败;
|
|
503
504
|
Claude Code/Cursor 会显示 init 事件上报的实际模型,Codex 默认未上报时明确标注。
|
|
504
505
|
- Cursor Judge 只为当前隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互;不带
|
|
505
506
|
`--force`/`--yolo`,也不修改 Cursor 全局信任配置。
|
{python_yama-0.10.3 → python_yama-0.10.5}/skills/eval-plugin-with-yama/references/debugging.md
RENAMED
|
@@ -89,6 +89,7 @@ CI 若开启 `yama pr-run --report --upload-report --commit-id <sha>`,上传
|
|
|
89
89
|
| Python handler/checker 相关 | 引用缺 `:callable`、目标不存在/不可调用/签名不兼容、路径逃出 Plugin Root |
|
|
90
90
|
| `No eval cases collected.` | glob 没命中任何文件;用 `--list` 验证收集范围,确认文件在 `__evals__/cases/**/*.yaml` 下 |
|
|
91
91
|
| `No eval cases matched the case filter.` | 收集到了 Case 但全部被 `-k/--filter` 筛掉;PATTERN 匹配的是相对 Plugin Root 的 case key(如 `__evals__/cases/foo.yaml`),子串匹配大小写敏感,含 `*`/`?`/`[` 时整个 key 要能被通配符匹配上;用 `--list`(不带 `-k`)核对完整 key |
|
|
92
|
+
| `UnicodeDecodeError` / YAML 错误指向 `._*.yaml` | 这是 macOS 在 exFAT 等卷上生成的 AppleDouble 二进制边车文件,不是真正 Case;当前 Yama 会在解析前忽略 `._*`。若仍出现,先确认实际运行的是包含该兼容修复的 Yama 版本 |
|
|
92
93
|
|
|
93
94
|
注意两个**不会**在 collection 阶段报错的陷阱:
|
|
94
95
|
`context.builders` 的 `position` 拼错会静默失效(不报错不生效);
|
|
@@ -188,8 +189,8 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
|
|
|
188
189
|
偏了——criteria 应描述可观察的判分标准,而不是抽象形容词。
|
|
189
190
|
- 被测 Agent 调用始终走 API。普通非 CI 运行的 Judge 才会本地优先:OpenAI/GPT/o
|
|
190
191
|
系列交给 Codex,Claude/Anthropic 系列交给 Claude Code,Grok/xAI 系列交给 Cursor;
|
|
191
|
-
|
|
192
|
-
和 `yama pr-run` 的 Judge 只走 API。被测 Agent 的 API 单次
|
|
192
|
+
无精确映射时三个 Agent 都先用原始 Judge 模型名,
|
|
193
|
+
其他模型只有精确映射命中才走本地。CI 和 `yama pr-run` 的 Judge 只走 API。被测 Agent 的 API 单次
|
|
193
194
|
attempt 默认 timeout 为 180 秒;Judge API 单次 attempt 与本地 Judge 进程默认均为
|
|
194
195
|
120 秒,整 Step timeout 仍独立默认为 300 秒。
|
|
195
196
|
- Judge 模型配置报错或与预期不同时,先确认所有权:省略 `judge.model` 才会深拷贝
|
|
@@ -206,10 +207,10 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
|
|
|
206
207
|
|
|
207
208
|
旧版同级 `judge.temperature` 会覆盖选中模型的 `temperature`;两处都省略时,Yama
|
|
208
209
|
不会补充 temperature 值(does not synthesize a temperature value)。
|
|
209
|
-
- 普通运行中,精确映射的本地 slug
|
|
210
|
-
`--model`,使用同一 Agent
|
|
211
|
-
|
|
212
|
-
用原始完整 model 对象回退 API。
|
|
210
|
+
- 普通运行中,精确映射的本地 slug 或原始 Judge 模型名的本地尝试发生任何错误时,Yama
|
|
211
|
+
都会先警告并省略 `--model`,使用同一 Agent 默认模型重试一次。这个决定不依赖 Agent
|
|
212
|
+
错误文案;例如 `Cannot use this model: grok.4.5`、超时或输出校验失败都会重试。默认模型
|
|
213
|
+
可能因机器或时间而变化;这次重试失败时,Yama 用原始完整 model 对象回退 API。
|
|
213
214
|
本地两次尝试只使用兼容的 `reasoning_effort`,不接收 `temperature`;因此 Judge
|
|
214
215
|
波动大时仍应用 `execution.repeat` 观察 `pass_rate`,`temperature: 0` 只能稳定 API
|
|
215
216
|
Judge,不能保证本地 Judge 可复现。Case Judge 模型已走这条本地优先路径时,不会再
|
|
@@ -228,8 +229,8 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
|
|
|
228
229
|
model = "claude-sonnet-4-5"
|
|
229
230
|
```
|
|
230
231
|
|
|
231
|
-
触发后依次使用配置的本地 Agent +
|
|
232
|
-
同一 Agent
|
|
232
|
+
触发后依次使用配置的本地 Agent + 模型;该次尝试发生任何错误时省略 `--model` 使用
|
|
233
|
+
同一 Agent 默认模型;默认模型仍失败就直接结束,不再调用 fallback-model API。若观察不到
|
|
233
234
|
预期兜底,先检查错误是否确实可重试、重试是否已经耗尽、配置 table 是否存在,以及
|
|
234
235
|
`name`/`model` 是否有效。
|
|
235
236
|
- 本地 Codex/Claude 会收到兼容其严格模式的 Judge Schema 副本,返回后仍由 Yama 按原始
|
|
@@ -238,8 +239,9 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
|
|
|
238
239
|
警告会同时摘要 stdout 和 stderr;其中 `invalid_json_schema`、模型拒绝等真实错误通常在
|
|
239
240
|
stdout,插件启动 warning 通常在 stderr。Cursor 使用 `agent`(兼容 `cursor-agent`)的
|
|
240
241
|
stream-json 模式,只为本次隔离空临时目录传入 `--trust` 以跳过 Workspace Trust 交互,
|
|
241
|
-
不带 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。HTML 的 Judge attempts
|
|
242
|
-
|
|
242
|
+
不带 `--force`/`--yolo`,也不修改 Cursor 全局信任配置。HTML 的 Judge attempts 会显示
|
|
243
|
+
完整调用链、retry、映射/原始配置/默认来源及可获得的实际模型;Codex 默认模型未上报时
|
|
244
|
+
会明确标注。
|
|
243
245
|
- `AssertionConfigurationError: judge returned invalid JSON: ...` 表示 Judge 违反了输出协议,
|
|
244
246
|
常见表现是用 `「」`、`“”` 或单引号给 `reason`/`evidence` 定界。Judge 的系统提示词已
|
|
245
247
|
明确要求所有 key 和字符串值使用 ASCII 双引号;错误仍出现时应保留原始输出用于定位,
|
|
@@ -256,6 +258,9 @@ Judge:被 tag 容忍的 hard check 失败依然会让该 Step 的 `hard_pass`
|
|
|
256
258
|
不清理——直接进去看模型写了什么文件、`.mockbin/` 里编译出了哪些假命令。
|
|
257
259
|
该目录在**下一次执行同一 Case 时**才被整体清掉重建,因此排查时看到的内容
|
|
258
260
|
总是最近一次执行的;改了 `mocks.cli`/`mocks.fs` 配置后重跑不会复用旧脚本。
|
|
261
|
+
macOS + exFAT 上 `._*` 在删除中途消失产生的 ENOENT 会被视为已删除并继续清理;
|
|
262
|
+
权限和其他 I/O 错误不会静默忽略,而会作为当前 Case 的 Framework ERROR 进入报告,
|
|
263
|
+
其余 Case 继续运行,suite 最终返回退出码 2。
|
|
259
264
|
- `command not found`(exit 127)三种可能:命令没在 `mocks.cli` 声明;模型用了
|
|
260
265
|
绝对路径/带 `/` 的调用(绕过 PATH shadow,Mock 不生效,要求模型用裸命令名);
|
|
261
266
|
命令名拼错。
|
|
@@ -18,6 +18,7 @@ from yama.cli import (
|
|
|
18
18
|
DEFAULT_REPORT,
|
|
19
19
|
ParallelProgressPrinter,
|
|
20
20
|
ProgressPrinter,
|
|
21
|
+
_case_results_from_outcomes,
|
|
21
22
|
_create_runner,
|
|
22
23
|
_dashboard_parser,
|
|
23
24
|
_parser,
|
|
@@ -33,6 +34,37 @@ from yama.runner import CaseResult, RunResult
|
|
|
33
34
|
from yama.thread_case import ThreadCaseError
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
class CaseOutcomeNormalizationTests(unittest.TestCase):
|
|
38
|
+
def test_exception_becomes_case_framework_error(self) -> None:
|
|
39
|
+
case = SimpleNamespace(case_key="cases/a.yaml", description="a")
|
|
40
|
+
error = PermissionError("denied")
|
|
41
|
+
|
|
42
|
+
[result] = _case_results_from_outcomes([case], [error])
|
|
43
|
+
|
|
44
|
+
self.assertEqual(result.status, "error")
|
|
45
|
+
self.assertEqual(result.description, "a")
|
|
46
|
+
self.assertEqual(len(result.runs), 1)
|
|
47
|
+
self.assertEqual(result.runs[0].run_index, 1)
|
|
48
|
+
self.assertEqual(result.runs[0].error_kind, "framework")
|
|
49
|
+
self.assertEqual(result.runs[0].error, "PermissionError: denied")
|
|
50
|
+
self.assertIn("PermissionError: denied", result.runs[0].traceback)
|
|
51
|
+
|
|
52
|
+
def test_cancelled_error_is_reraised(self) -> None:
|
|
53
|
+
case = SimpleNamespace(case_key="cases/a.yaml", description="a")
|
|
54
|
+
|
|
55
|
+
with self.assertRaises(asyncio.CancelledError):
|
|
56
|
+
_case_results_from_outcomes([case], [asyncio.CancelledError()])
|
|
57
|
+
|
|
58
|
+
def test_llm_error_keeps_the_top_level_llm_error_path(self) -> None:
|
|
59
|
+
case = SimpleNamespace(case_key="cases/a.yaml", description="a")
|
|
60
|
+
|
|
61
|
+
with self.assertRaisesRegex(LLMError, "provider unavailable"):
|
|
62
|
+
_case_results_from_outcomes(
|
|
63
|
+
[case],
|
|
64
|
+
[LLMError("provider unavailable")],
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
36
68
|
def write_plugin(
|
|
37
69
|
root: Path,
|
|
38
70
|
*,
|
|
@@ -696,6 +728,60 @@ class RunnerFactoryTests(unittest.TestCase):
|
|
|
696
728
|
|
|
697
729
|
|
|
698
730
|
class MainEndToEndTests(unittest.TestCase):
|
|
731
|
+
def test_case_framework_error_does_not_abort_remaining_cases(self) -> None:
|
|
732
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
733
|
+
plugin_root = write_plugin(
|
|
734
|
+
Path(tmp) / "plugin",
|
|
735
|
+
case_names=["a", "b"],
|
|
736
|
+
)
|
|
737
|
+
report_path = Path(tmp) / "report.html"
|
|
738
|
+
|
|
739
|
+
class StubRunner:
|
|
740
|
+
def __init__(self, *args, **kwargs):
|
|
741
|
+
pass
|
|
742
|
+
|
|
743
|
+
async def run_case(self, case):
|
|
744
|
+
if case.case_key.endswith("a.yaml"):
|
|
745
|
+
raise PermissionError("denied")
|
|
746
|
+
return CaseResult(
|
|
747
|
+
case_key=case.case_key,
|
|
748
|
+
description=case.description,
|
|
749
|
+
passed=True,
|
|
750
|
+
status="pass",
|
|
751
|
+
runs=[RunResult(run_index=1, passed=True, status="pass")],
|
|
752
|
+
pass_rate=1.0,
|
|
753
|
+
)
|
|
754
|
+
|
|
755
|
+
stdout = io.StringIO()
|
|
756
|
+
stderr = io.StringIO()
|
|
757
|
+
with patch("yama.cli.YamaRunner", StubRunner), \
|
|
758
|
+
contextlib.redirect_stdout(stdout), \
|
|
759
|
+
contextlib.redirect_stderr(stderr):
|
|
760
|
+
code = main(
|
|
761
|
+
[
|
|
762
|
+
"--plugin-root",
|
|
763
|
+
str(plugin_root),
|
|
764
|
+
"--no-artifacts",
|
|
765
|
+
"--json",
|
|
766
|
+
"--concurrency",
|
|
767
|
+
"1",
|
|
768
|
+
"--report",
|
|
769
|
+
str(report_path),
|
|
770
|
+
]
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
payload = json.loads(stdout.getvalue())
|
|
774
|
+
self.assertEqual(code, 2)
|
|
775
|
+
self.assertEqual(len(payload), 2)
|
|
776
|
+
self.assertEqual(payload[0]["status"], "error")
|
|
777
|
+
self.assertEqual(payload[0]["runs"][0]["error_kind"], "framework")
|
|
778
|
+
self.assertEqual(payload[1]["status"], "pass")
|
|
779
|
+
self.assertTrue(report_path.is_file())
|
|
780
|
+
self.assertIn(
|
|
781
|
+
"PermissionError: denied",
|
|
782
|
+
report_path.read_text(encoding="utf-8"),
|
|
783
|
+
)
|
|
784
|
+
|
|
699
785
|
def test_list_flag_prints_case_keys_without_running(self) -> None:
|
|
700
786
|
with tempfile.TemporaryDirectory() as tmp:
|
|
701
787
|
plugin_root = write_plugin(Path(tmp) / "plugin")
|
|
@@ -1799,6 +1885,131 @@ class PrRunCliTests(unittest.TestCase):
|
|
|
1799
1885
|
(plugin_root / ".yama" / "reports" / "latest.html").exists()
|
|
1800
1886
|
)
|
|
1801
1887
|
|
|
1888
|
+
def test_pr_run_case_framework_error_stays_attached_to_case(self) -> None:
|
|
1889
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
1890
|
+
root = Path(tmp)
|
|
1891
|
+
plugin_root = write_plugin(
|
|
1892
|
+
root / "plugin-a",
|
|
1893
|
+
case_names=["a", "b"],
|
|
1894
|
+
)
|
|
1895
|
+
(root / "yama.toml").write_text(
|
|
1896
|
+
'[plugins.plugin-a]\npath = "plugin-a"\n',
|
|
1897
|
+
encoding="utf-8",
|
|
1898
|
+
)
|
|
1899
|
+
changed = root / "changed.txt"
|
|
1900
|
+
changed.write_text(
|
|
1901
|
+
"plugin-a/__evals__/cases/a.yaml\n"
|
|
1902
|
+
"plugin-a/__evals__/cases/b.yaml\n",
|
|
1903
|
+
encoding="utf-8",
|
|
1904
|
+
)
|
|
1905
|
+
summary = root / "summary.json"
|
|
1906
|
+
|
|
1907
|
+
class StubRunner:
|
|
1908
|
+
def __init__(self, *args, **kwargs):
|
|
1909
|
+
pass
|
|
1910
|
+
|
|
1911
|
+
async def run_case(self, case):
|
|
1912
|
+
if case.case_key.endswith("a.yaml"):
|
|
1913
|
+
raise PermissionError("denied")
|
|
1914
|
+
return CaseResult(
|
|
1915
|
+
case_key=case.case_key,
|
|
1916
|
+
description=case.description,
|
|
1917
|
+
passed=True,
|
|
1918
|
+
status="pass",
|
|
1919
|
+
runs=[RunResult(run_index=1, passed=True, status="pass")],
|
|
1920
|
+
pass_rate=1.0,
|
|
1921
|
+
)
|
|
1922
|
+
|
|
1923
|
+
with chdir(root), patch("yama.cli.YamaRunner", StubRunner):
|
|
1924
|
+
code = main(
|
|
1925
|
+
[
|
|
1926
|
+
"pr-run",
|
|
1927
|
+
"--changed-files",
|
|
1928
|
+
str(changed),
|
|
1929
|
+
"--report",
|
|
1930
|
+
"--json-summary",
|
|
1931
|
+
str(summary),
|
|
1932
|
+
"--concurrency",
|
|
1933
|
+
"1",
|
|
1934
|
+
]
|
|
1935
|
+
)
|
|
1936
|
+
|
|
1937
|
+
payload = json.loads(summary.read_text(encoding="utf-8"))
|
|
1938
|
+
plugin = payload["plugins"][0]
|
|
1939
|
+
report_path = plugin_root / ".yama" / "reports" / "latest.html"
|
|
1940
|
+
self.assertEqual(code, 2)
|
|
1941
|
+
self.assertEqual(plugin["status"], "error")
|
|
1942
|
+
self.assertEqual(plugin["counts"]["pass"], 1)
|
|
1943
|
+
self.assertEqual(plugin["counts"]["error"], 1)
|
|
1944
|
+
self.assertEqual(plugin["errors"], [])
|
|
1945
|
+
self.assertTrue(report_path.is_file())
|
|
1946
|
+
self.assertIn(
|
|
1947
|
+
"PermissionError: denied",
|
|
1948
|
+
report_path.read_text(encoding="utf-8"),
|
|
1949
|
+
)
|
|
1950
|
+
|
|
1951
|
+
def test_pr_run_case_llm_error_stays_attached_to_case(self) -> None:
|
|
1952
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
1953
|
+
root = Path(tmp)
|
|
1954
|
+
plugin_root = write_plugin(
|
|
1955
|
+
root / "plugin-a",
|
|
1956
|
+
case_names=["a", "b"],
|
|
1957
|
+
)
|
|
1958
|
+
(root / "yama.toml").write_text(
|
|
1959
|
+
'[plugins.plugin-a]\npath = "plugin-a"\n',
|
|
1960
|
+
encoding="utf-8",
|
|
1961
|
+
)
|
|
1962
|
+
changed = root / "changed.txt"
|
|
1963
|
+
changed.write_text(
|
|
1964
|
+
"plugin-a/__evals__/cases/a.yaml\n"
|
|
1965
|
+
"plugin-a/__evals__/cases/b.yaml\n",
|
|
1966
|
+
encoding="utf-8",
|
|
1967
|
+
)
|
|
1968
|
+
summary = root / "summary.json"
|
|
1969
|
+
|
|
1970
|
+
class StubRunner:
|
|
1971
|
+
def __init__(self, *args, **kwargs):
|
|
1972
|
+
pass
|
|
1973
|
+
|
|
1974
|
+
async def run_case(self, case):
|
|
1975
|
+
if case.case_key.endswith("a.yaml"):
|
|
1976
|
+
raise LLMError("provider unavailable")
|
|
1977
|
+
return CaseResult(
|
|
1978
|
+
case_key=case.case_key,
|
|
1979
|
+
description=case.description,
|
|
1980
|
+
passed=True,
|
|
1981
|
+
status="pass",
|
|
1982
|
+
runs=[RunResult(run_index=1, passed=True, status="pass")],
|
|
1983
|
+
pass_rate=1.0,
|
|
1984
|
+
)
|
|
1985
|
+
|
|
1986
|
+
with chdir(root), patch("yama.cli.YamaRunner", StubRunner):
|
|
1987
|
+
code = main(
|
|
1988
|
+
[
|
|
1989
|
+
"pr-run",
|
|
1990
|
+
"--changed-files",
|
|
1991
|
+
str(changed),
|
|
1992
|
+
"--report",
|
|
1993
|
+
"--json-summary",
|
|
1994
|
+
str(summary),
|
|
1995
|
+
"--concurrency",
|
|
1996
|
+
"1",
|
|
1997
|
+
]
|
|
1998
|
+
)
|
|
1999
|
+
|
|
2000
|
+
payload = json.loads(summary.read_text(encoding="utf-8"))
|
|
2001
|
+
plugin = payload["plugins"][0]
|
|
2002
|
+
report_path = plugin_root / ".yama" / "reports" / "latest.html"
|
|
2003
|
+
self.assertEqual(code, 2)
|
|
2004
|
+
self.assertEqual(plugin["status"], "error")
|
|
2005
|
+
self.assertEqual(plugin["counts"]["pass"], 1)
|
|
2006
|
+
self.assertEqual(plugin["counts"]["error"], 1)
|
|
2007
|
+
self.assertEqual(plugin["errors"], [])
|
|
2008
|
+
self.assertTrue(report_path.is_file())
|
|
2009
|
+
report = report_path.read_text(encoding="utf-8")
|
|
2010
|
+
self.assertIn("LLM error", report)
|
|
2011
|
+
self.assertIn("LLMError: provider unavailable", report)
|
|
2012
|
+
|
|
1802
2013
|
def test_pr_run_upload_requires_report(self) -> None:
|
|
1803
2014
|
with tempfile.TemporaryDirectory() as tmp:
|
|
1804
2015
|
root = Path(tmp)
|