python-yama 0.8.0__tar.gz → 0.9.0__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.
Files changed (65) hide show
  1. {python_yama-0.8.0 → python_yama-0.9.0}/PKG-INFO +8 -1
  2. {python_yama-0.8.0 → python_yama-0.9.0}/README.md +7 -0
  3. {python_yama-0.8.0 → python_yama-0.9.0}/README.zh-CN.md +6 -0
  4. {python_yama-0.8.0 → python_yama-0.9.0}/docs/agent-skill-test-framework-design.md +16 -0
  5. {python_yama-0.8.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/SKILL.md +5 -0
  6. {python_yama-0.8.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/case-schema.md +3 -0
  7. {python_yama-0.8.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/debugging.md +5 -0
  8. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_cli.py +213 -0
  9. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_pr.py +97 -0
  10. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_report.py +91 -0
  11. python_yama-0.9.0/tests/test_report_bundle.py +224 -0
  12. python_yama-0.9.0/tests/test_report_upload.py +297 -0
  13. {python_yama-0.8.0 → python_yama-0.9.0}/yama/cli.py +58 -1
  14. {python_yama-0.8.0 → python_yama-0.9.0}/yama/pr.py +12 -1
  15. {python_yama-0.8.0 → python_yama-0.9.0}/yama/report.py +288 -14
  16. python_yama-0.9.0/yama/report_bundle.py +237 -0
  17. python_yama-0.9.0/yama/report_upload.py +323 -0
  18. {python_yama-0.8.0 → python_yama-0.9.0}/.github/workflows/publish.yml +0 -0
  19. {python_yama-0.8.0 → python_yama-0.9.0}/.gitignore +0 -0
  20. {python_yama-0.8.0 → python_yama-0.9.0}/CLAUDE.md +0 -0
  21. {python_yama-0.8.0 → python_yama-0.9.0}/LICENSE +0 -0
  22. {python_yama-0.8.0 → python_yama-0.9.0}/docs/case-schema-reference.md +0 -0
  23. {python_yama-0.8.0 → python_yama-0.9.0}/docs/yama-intro.html +0 -0
  24. {python_yama-0.8.0 → python_yama-0.9.0}/pyproject.toml +0 -0
  25. {python_yama-0.8.0 → python_yama-0.9.0}/skills/eval-plugin-with-yama/references/install-upgrade.md +0 -0
  26. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_assertions.py +0 -0
  27. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_cli_shim.py +0 -0
  28. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_dashboard.py +0 -0
  29. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_framework.py +0 -0
  30. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_llm.py +0 -0
  31. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_main_entrypoint.py +0 -0
  32. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_mocks.py +0 -0
  33. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_preview.py +0 -0
  34. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_public_api.py +0 -0
  35. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_run_plan.py +0 -0
  36. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_runner.py +0 -0
  37. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_skill_tool.py +0 -0
  38. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_thread_case.py +0 -0
  39. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_tool_loader.py +0 -0
  40. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_usage.py +0 -0
  41. {python_yama-0.8.0 → python_yama-0.9.0}/tests/test_workspace.py +0 -0
  42. {python_yama-0.8.0 → python_yama-0.9.0}/uv.lock +0 -0
  43. {python_yama-0.8.0 → python_yama-0.9.0}/yama/__init__.py +0 -0
  44. {python_yama-0.8.0 → python_yama-0.9.0}/yama/__main__.py +0 -0
  45. {python_yama-0.8.0 → python_yama-0.9.0}/yama/assertions.py +0 -0
  46. {python_yama-0.8.0 → python_yama-0.9.0}/yama/dashboard.py +0 -0
  47. {python_yama-0.8.0 → python_yama-0.9.0}/yama/llm.py +0 -0
  48. {python_yama-0.8.0 → python_yama-0.9.0}/yama/loaders/__init__.py +0 -0
  49. {python_yama-0.8.0 → python_yama-0.9.0}/yama/loaders/case.py +0 -0
  50. {python_yama-0.8.0 → python_yama-0.9.0}/yama/loaders/common.py +0 -0
  51. {python_yama-0.8.0 → python_yama-0.9.0}/yama/loaders/tool_loader.py +0 -0
  52. {python_yama-0.8.0 → python_yama-0.9.0}/yama/mocks.py +0 -0
  53. {python_yama-0.8.0 → python_yama-0.9.0}/yama/models.py +0 -0
  54. {python_yama-0.8.0 → python_yama-0.9.0}/yama/preview.py +0 -0
  55. {python_yama-0.8.0 → python_yama-0.9.0}/yama/runner.py +0 -0
  56. {python_yama-0.8.0 → python_yama-0.9.0}/yama/thread_case.py +0 -0
  57. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/__init__.py +0 -0
  58. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/base.py +0 -0
  59. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/bash/__init__.py +0 -0
  60. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/bash/_cli_shim.py +0 -0
  61. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/bash/bash.py +0 -0
  62. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/bash/fs.py +0 -0
  63. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/skill/__init__.py +0 -0
  64. {python_yama-0.8.0 → python_yama-0.9.0}/yama/tools/skill/skill.py +0 -0
  65. {python_yama-0.8.0 → python_yama-0.9.0}/yama/workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-yama
3
- Version: 0.8.0
3
+ Version: 0.9.0
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
@@ -103,6 +103,7 @@ uv run --project yama yama --plugin dingding-simple --report
103
103
  | `--list` | Only print the collected Cases, without running them |
104
104
  | `--no-artifacts` | Write no artifact files at all |
105
105
  | `--json` | Emit machine-readable JSON instead of Rich tables |
106
+ | `pr-run --upload-report --commit-id SHA` | With `--report`, upload the push report and merge/upload affected Plugin latest reports; requires `ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` |
106
107
 
107
108
  `--plugin`, `--all-plugins`, and `--plugin-root` are mutually exclusive. When none of them is given, yama walks up from the current directory to the nearest directory containing `yama.toml` and uses it as the workspace root (falling back to the cwd), running it as a single plugin root.
108
109
 
@@ -123,6 +124,12 @@ OPENAI_API_KEY=... uv run --project yama yama pr-run --base origin/main --report
123
124
 
124
125
  `yama pr-plan` selects PR-scoped eval cases without model calls. `yama pr-run` executes the same selection and writes a JSON summary for external CI jobs to render or upload; credentials stay in environment variables or `.env`, not CLI flags. `pr-run` always forces builtin bash execution to the Linux `linux-bubblewrap` sandbox, regardless of Case backend settings, so the runner must be Linux with `bwrap`/`bubblewrap` installed. See the [CI integration guide](https://github.com/world-sim-dev/yama/blob/main/docs/pr-evals-ci-integration.zh-CN.md) for workflow examples and the summary JSON contract.
125
126
 
127
+ For CI environments that publish reports to the Yama Eval Report service, add
128
+ `--upload-report --commit-id <sha>` together with `--report`. The command reads
129
+ `ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` from the environment, uploads the
130
+ current commit report, then updates each affected Plugin latest report by merging
131
+ the just-run cases into the previous remote Plugin report.
132
+
126
133
  ### Output
127
134
 
128
135
  Cases run in parallel, up to 10 at a time by default (`--concurrency` changes the cap); runs within one case stay sequential, and results keep collection order regardless of completion order. While several cases run concurrently, a transient dashboard at the bottom of the terminal shows one row per case, updated in place — waiting, then a spinner with the run/step currently executing, then its ✓/✗ verdict — and each case's full run/step detail is printed above the dashboard as one block the moment it finishes, so blocks of different cases never interleave. With `--concurrency 1` (or a single collected case) it streams instead — a spinner marks the step currently executing (on a terminal), and each case, run, and assertion result is printed the moment it completes. Either way a per-case summary table closes the output, and with `--json` the progress stream goes to stderr so stdout stays valid JSON.
@@ -77,6 +77,7 @@ uv run --project yama yama --plugin dingding-simple --report
77
77
  | `--list` | Only print the collected Cases, without running them |
78
78
  | `--no-artifacts` | Write no artifact files at all |
79
79
  | `--json` | Emit machine-readable JSON instead of Rich tables |
80
+ | `pr-run --upload-report --commit-id SHA` | With `--report`, upload the push report and merge/upload affected Plugin latest reports; requires `ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` |
80
81
 
81
82
  `--plugin`, `--all-plugins`, and `--plugin-root` are mutually exclusive. When none of them is given, yama walks up from the current directory to the nearest directory containing `yama.toml` and uses it as the workspace root (falling back to the cwd), running it as a single plugin root.
82
83
 
@@ -97,6 +98,12 @@ OPENAI_API_KEY=... uv run --project yama yama pr-run --base origin/main --report
97
98
 
98
99
  `yama pr-plan` selects PR-scoped eval cases without model calls. `yama pr-run` executes the same selection and writes a JSON summary for external CI jobs to render or upload; credentials stay in environment variables or `.env`, not CLI flags. `pr-run` always forces builtin bash execution to the Linux `linux-bubblewrap` sandbox, regardless of Case backend settings, so the runner must be Linux with `bwrap`/`bubblewrap` installed. See the [CI integration guide](https://github.com/world-sim-dev/yama/blob/main/docs/pr-evals-ci-integration.zh-CN.md) for workflow examples and the summary JSON contract.
99
100
 
101
+ For CI environments that publish reports to the Yama Eval Report service, add
102
+ `--upload-report --commit-id <sha>` together with `--report`. The command reads
103
+ `ADMIN_HOST` and `YAMA_EVAL_REPORT_API_TOKEN` from the environment, uploads the
104
+ current commit report, then updates each affected Plugin latest report by merging
105
+ the just-run cases into the previous remote Plugin report.
106
+
100
107
  ### Output
101
108
 
102
109
  Cases run in parallel, up to 10 at a time by default (`--concurrency` changes the cap); runs within one case stay sequential, and results keep collection order regardless of completion order. While several cases run concurrently, a transient dashboard at the bottom of the terminal shows one row per case, updated in place — waiting, then a spinner with the run/step currently executing, then its ✓/✗ verdict — and each case's full run/step detail is printed above the dashboard as one block the moment it finishes, so blocks of different cases never interleave. With `--concurrency 1` (or a single collected case) it streams instead — a spinner marks the step currently executing (on a terminal), and each case, run, and assertion result is printed the moment it completes. Either way a per-case summary table closes the output, and with `--json` the progress stream goes to stderr so stdout stays valid JSON.
@@ -77,6 +77,7 @@ uv run --project yama yama --plugin dingding-simple --report
77
77
  | `--list` | 只打印匹配到的 Case,不运行 |
78
78
  | `--no-artifacts` | 不写任何产物文件 |
79
79
  | `--json` | 输出机器可读 JSON 而不是 Rich 表格 |
80
+ | `pr-run --upload-report --commit-id SHA` | 与 `--report` 一起使用:上传 push 报告,并合并/上传受影响 Plugin 的 latest 报告;需要 `ADMIN_HOST` 和 `YAMA_EVAL_REPORT_API_TOKEN` |
80
81
 
81
82
  `--plugin`/`--all-plugins`/`--plugin-root` 三者互斥;都不提供时默认用当前目录向上搜索到的 `yama.toml` 所在目录作为 Workspace Root(找不到则用 cwd),把该目录当作单一 Plugin Root 运行。
82
83
 
@@ -97,6 +98,11 @@ OPENAI_API_KEY=... uv run --project yama yama pr-run --base origin/main --report
97
98
 
98
99
  `yama pr-plan` 只计算 PR 范围内要跑的 eval,不发起模型调用。`yama pr-run` 执行同一套选择逻辑,并写出供外部 CI 渲染或上传的 JSON summary;凭据继续通过环境变量或 `.env` 提供,不增加 CLI 参数。`pr-run` 会忽略 Case 里的 backend 设置,固定把内置 bash 执行强制为 Linux `linux-bubblewrap` 沙箱,因此 runner 必须是 Linux 且安装 `bwrap`/`bubblewrap`。CI workflow 示例和 summary JSON 契约见 [CI 接入指南](docs/pr-evals-ci-integration.zh-CN.md)。
99
100
 
101
+ CI 需要把报告发布到 Yama Eval Report 服务时,在 `--report` 之外加
102
+ `--upload-report --commit-id <sha>`。命令从环境变量读取 `ADMIN_HOST` 和
103
+ `YAMA_EVAL_REPORT_API_TOKEN`,先上传当前 commit 报告,再把本次运行到的 Case 合并进
104
+ 对应 Plugin 的远端 latest 报告并上传。
105
+
100
106
  ### 输出
101
107
 
102
108
  Case 之间并行执行,默认最多同时 10 个(用 `--concurrency` 调整上限);同一 Case 内的多个 run 仍顺序执行,结果始终保持收集顺序,与完成先后无关。多个 Case 并发运行时,终端底部会有一张原地刷新的状态面板,每个 Case 固定占一行——排队等待、转圈显示当前执行到的 Run/Step、完成后原地翻成 ✓/✗——任何一个 Case 一完成,它的完整 Run/Step 明细就作为一个整块打印到面板上方,不同 Case 的块不会交错。使用 `--concurrency 1`(或只收集到一个 Case)时则实时流式输出——正在执行的 Step 会显示转圈的 loading 状态(终端下),每个 Case、Run、断言一完成就立即打印结果。两种模式最后都以逐 Case 的汇总表格收尾;使用 `--json` 时进度流打印到 stderr,stdout 保持为纯 JSON。
@@ -284,6 +284,12 @@ runner;环境必须提供 `bwrap`/`bubblewrap`。普通 `yama` 运行仍按 Ca
284
284
  可能调用 LLM,凭据沿用既有模式:`main()` 先加载 `.env`,LiteLLM 从环境变量读取 provider
285
285
  key;yama 不提供 `--api-key` 等命令行凭据参数。
286
286
 
287
+ `pr-run --report --upload-report --commit-id <sha>` 会额外上传远端报告;缺少
288
+ `ADMIN_HOST`、`YAMA_EVAL_REPORT_API_TOKEN`、`--report` 或合法 commit id 都是配置错误。
289
+ 上传失败会写入 summary 的 `upload_errors` 或 `plugins[].upload_error`,并在没有 eval
290
+ fail 时让命令以退出码 2 结束;若同时存在 eval fail,退出码仍为 1。上传成功时 summary
291
+ 写入 `remote_push_report_url` 和 `plugins[].remote_report_url`。
292
+
287
293
  **Case 筛选(`-k/--filter`,`workspace.py:matches_case_filter`)。** 收集阶段
288
294
  (`collect_case_paths`)在 glob/显式路径展开之后、YAML 解析之前,用 case key
289
295
  (`case_key_for_path`:Case 路径相对 Plugin Root 的 POSIX 形式,Plugin Root 之外
@@ -2774,6 +2780,16 @@ PASS)。`error_kind="llm"` 对应 LLM 请求异常和 Step 超时;`error_kin
2774
2780
  统计,而不必解析报告正文标记。这里保留机器可读的 run/error 细分统计;报告正文顶部
2775
2781
  只保留上面三张人工浏览用汇总卡片。
2776
2782
 
2783
+ 远端报告上传由 `yama pr-run --report --upload-report --commit-id <sha>` 触发。命令从
2784
+ 环境变量读取 `ADMIN_HOST` 和 `YAMA_EVAL_REPORT_API_TOKEN`,先上传当前 commit 的
2785
+ push HTML 报告,再对本次涉及的每个 Plugin 查询远端 latest 报告、读取其中的
2786
+ `<script type="application/json" id="yama-report-bundle">`,按 `case_key` 把本次运行到的
2787
+ Case 新增或覆盖进去,最后上传新的 Plugin latest HTML。`yama-report-meta` 继续服务本地
2788
+ dashboard;`yama-report-bundle` 是远端 Plugin latest 合并用的机器可读数据,包含
2789
+ Plugin、Case、最小渲染字段和 `CaseResult.to_dict()` 兼容结果。每个被本次 CI 新增或更新的
2790
+ Case 都写入 `updated_at_beijing`,格式为 `YYYY-MM-DD HH:MM:SS`,HTML 页面标明这是
2791
+ Beijing time;本次未运行的旧 Case 在 Plugin latest 中保留原 entry。
2792
+
2777
2793
  **用例预览页(`preview.py`,`--preview` 与 dashboard `/preview` 共用)。**
2778
2794
  `render_preview_html` 复用报告的页面外壳与版式(`report.py:render_page` +
2779
2795
  `_PAGE_CSS`),渲染"这个 Case 将发送什么、期望什么",但不含任何执行数据——
@@ -273,6 +273,11 @@ FAIL;`130` 手动中断。HTML 报告顶部显示 `CASES PASSED`(pass Case
273
273
  message(含 tool_calls);Case/Run/Step 层级仍展示 tool-loop LLM Request
274
274
  耗时总和。
275
275
 
276
+ 当仓库 CI 使用 `yama pr-run --report --upload-report --commit-id <sha>` 时,yama 会上传当前
277
+ commit 报告,并更新受影响 Plugin 的远端 latest 报告。Plugin latest 会保留旧 Case,并按
278
+ `case_key` 替换本次运行到的 Case;每个被更新的条目显示 `updated_at_beijing`,该时间是
279
+ 北京时间。
280
+
276
281
  ## 排查不通过的用例
277
282
 
278
283
  先分层,再看证据;详细现象、产物文件和专项排查见
@@ -304,6 +304,9 @@ mocks:
304
304
  - `yama pr-run` 面向 Linux CI runner:它会忽略 Case 里的 backend 设置,统一强制内置
305
305
  bash 使用 `linux-bubblewrap`。因此 PR CI 环境必须安装 `bwrap`/`bubblewrap`;普通
306
306
  `yama` 运行仍按这里声明的 `backend` / `auto` 规则执行。
307
+ - 远端 Plugin latest 报告里的 Case 身份就是 `case_key`(相对 Plugin Root 的 Case 路径)。
308
+ `yama pr-run --report --upload-report --commit-id <sha>` 合并远端报告时,会用相同
309
+ `case_key` 的本次运行结果替换旧条目,未运行到的旧 Case 保留。
307
310
 
308
311
  ## execution
309
312
 
@@ -55,6 +55,11 @@ Step 超时)的具体 `LLM error` / `Framework error` 文本显示在对应 Ca
55
55
  还没有运行结果、只想人工确认 Case 配置本身时,用 `yama --preview`(或 dashboard
56
56
  的 `/preview` 页,刷新即重新解析)生成不含执行数据的用例预览。
57
57
 
58
+ CI 若开启 `yama pr-run --report --upload-report --commit-id <sha>`,上传失败也是 CI 失败。
59
+ 先看 `yama-pr-summary.json`:`upload_errors` 表示 push 报告上传失败,
60
+ `plugins[].upload_error` 表示 Plugin latest 查询、合并或上传失败;上传成功时对应 URL 在
61
+ `remote_push_report_url` 和 `plugins[].remote_report_url`。
62
+
58
63
  ## 第 1 层:Collection error(退出码 2)
59
64
 
60
65
  用例在收集/解析阶段就被拒绝,一条也没运行。若 stderr 打印的是
@@ -20,6 +20,7 @@ from yama.cli import (
20
20
  ProgressPrinter,
21
21
  _dashboard_parser,
22
22
  _parser,
23
+ _pr_run_parser,
23
24
  _thread_case_parser,
24
25
  format_text_results,
25
26
  main,
@@ -178,6 +179,23 @@ class ParserTests(unittest.TestCase):
178
179
  args = _parser().parse_args(["--report"])
179
180
  self.assertEqual(args.report, DEFAULT_REPORT)
180
181
 
182
+ def test_pr_run_parser_accepts_upload_flags(self) -> None:
183
+ args = _pr_run_parser().parse_args(
184
+ [
185
+ "--changed-files",
186
+ "changed.txt",
187
+ "--report",
188
+ "--upload-report",
189
+ "--commit-id",
190
+ "146bdae",
191
+ "--json-summary",
192
+ "summary.json",
193
+ ]
194
+ )
195
+
196
+ self.assertTrue(args.upload_report)
197
+ self.assertEqual(args.commit_id, "146bdae")
198
+
181
199
  def test_report_flag_accepts_explicit_path(self) -> None:
182
200
  args = _parser().parse_args(["--report", "out/custom.html"])
183
201
  self.assertEqual(args.report, Path("out/custom.html"))
@@ -1583,6 +1601,201 @@ class PrRunCliTests(unittest.TestCase):
1583
1601
  (plugin_root / ".yama" / "reports" / "latest.html").exists()
1584
1602
  )
1585
1603
 
1604
+ def test_pr_run_upload_requires_report(self) -> None:
1605
+ with tempfile.TemporaryDirectory() as tmp:
1606
+ root = Path(tmp)
1607
+ write_plugin(root / "plugin-a")
1608
+ (root / "yama.toml").write_text(
1609
+ '[plugins.plugin-a]\npath = "plugin-a"\n',
1610
+ encoding="utf-8",
1611
+ )
1612
+ changed = root / "changed.txt"
1613
+ changed.write_text("README.md\n", encoding="utf-8")
1614
+ summary = root / "summary.json"
1615
+
1616
+ with chdir(root):
1617
+ code = main(
1618
+ [
1619
+ "pr-run",
1620
+ "--changed-files",
1621
+ str(changed),
1622
+ "--json-summary",
1623
+ str(summary),
1624
+ "--upload-report",
1625
+ "--commit-id",
1626
+ "146bdae",
1627
+ ]
1628
+ )
1629
+
1630
+ self.assertEqual(code, 2)
1631
+
1632
+ def test_pr_run_upload_requires_valid_commit_id(self) -> None:
1633
+ with tempfile.TemporaryDirectory() as tmp:
1634
+ root = Path(tmp)
1635
+ write_plugin(root / "plugin-a")
1636
+ (root / "yama.toml").write_text(
1637
+ '[plugins.plugin-a]\npath = "plugin-a"\n',
1638
+ encoding="utf-8",
1639
+ )
1640
+ changed = root / "changed.txt"
1641
+ changed.write_text("README.md\n", encoding="utf-8")
1642
+ summary = root / "summary.json"
1643
+
1644
+ with chdir(root):
1645
+ code = main(
1646
+ [
1647
+ "pr-run",
1648
+ "--changed-files",
1649
+ str(changed),
1650
+ "--json-summary",
1651
+ str(summary),
1652
+ "--report",
1653
+ "--upload-report",
1654
+ "--commit-id",
1655
+ "abc123",
1656
+ ]
1657
+ )
1658
+
1659
+ self.assertEqual(code, 2)
1660
+
1661
+ def test_pr_run_upload_success_writes_remote_urls(self) -> None:
1662
+ with tempfile.TemporaryDirectory() as tmp:
1663
+ root = Path(tmp)
1664
+ write_plugin(root / "plugin-a", case_names=["greet"])
1665
+ (root / "yama.toml").write_text(
1666
+ '[plugins.plugin-a]\npath = "plugin-a"\n',
1667
+ encoding="utf-8",
1668
+ )
1669
+ changed = root / "changed.txt"
1670
+ changed.write_text(
1671
+ "plugin-a/__evals__/cases/greet.yaml\n", encoding="utf-8"
1672
+ )
1673
+ summary = root / "summary.json"
1674
+
1675
+ class StubRunner:
1676
+ def __init__(self, llm, *, result_root, write_artifacts, on_event):
1677
+ pass
1678
+
1679
+ async def run_case(self, case):
1680
+ return CaseResult(
1681
+ case_key=case.case_key,
1682
+ description=case.description,
1683
+ passed=True,
1684
+ runs=[RunResult(run_index=1, passed=True)],
1685
+ pass_rate=1.0,
1686
+ )
1687
+
1688
+ def fake_upload_pr_reports(**kwargs):
1689
+ plugin_results = kwargs["plugin_results"]
1690
+ plugin_results["plugin-a"]["remote_report_url"] = (
1691
+ "https://oss/plugin/latest.html"
1692
+ )
1693
+ plugin_results["plugin-a"]["upload_error"] = None
1694
+ return {
1695
+ "remote_push_report_url": "https://oss/push/146bdae.html",
1696
+ "upload_errors": [],
1697
+ }
1698
+
1699
+ with chdir(root), patch("yama.cli.YamaRunner", StubRunner), patch.dict(
1700
+ os.environ,
1701
+ {
1702
+ "ADMIN_HOST": "https://admin.example",
1703
+ "YAMA_EVAL_REPORT_API_TOKEN": "secret",
1704
+ },
1705
+ ), patch("yama.cli.upload_pr_reports", fake_upload_pr_reports):
1706
+ code = main(
1707
+ [
1708
+ "pr-run",
1709
+ "--changed-files",
1710
+ str(changed),
1711
+ "--report",
1712
+ "--upload-report",
1713
+ "--commit-id",
1714
+ "146bdae",
1715
+ "--json-summary",
1716
+ str(summary),
1717
+ "--concurrency",
1718
+ "1",
1719
+ ]
1720
+ )
1721
+
1722
+ self.assertEqual(code, 0)
1723
+ payload = json.loads(summary.read_text(encoding="utf-8"))
1724
+ self.assertEqual(
1725
+ payload["remote_push_report_url"],
1726
+ "https://oss/push/146bdae.html",
1727
+ )
1728
+ self.assertEqual(
1729
+ payload["plugins"][0]["remote_report_url"],
1730
+ "https://oss/plugin/latest.html",
1731
+ )
1732
+
1733
+ def test_pr_run_upload_failure_returns_error_and_writes_summary(self) -> None:
1734
+ with tempfile.TemporaryDirectory() as tmp:
1735
+ root = Path(tmp)
1736
+ write_plugin(root / "plugin-a", case_names=["greet"])
1737
+ (root / "yama.toml").write_text(
1738
+ '[plugins.plugin-a]\npath = "plugin-a"\n',
1739
+ encoding="utf-8",
1740
+ )
1741
+ changed = root / "changed.txt"
1742
+ changed.write_text(
1743
+ "plugin-a/__evals__/cases/greet.yaml\n", encoding="utf-8"
1744
+ )
1745
+ summary = root / "summary.json"
1746
+
1747
+ class StubRunner:
1748
+ def __init__(self, llm, *, result_root, write_artifacts, on_event):
1749
+ pass
1750
+
1751
+ async def run_case(self, case):
1752
+ return CaseResult(
1753
+ case_key=case.case_key,
1754
+ description=case.description,
1755
+ passed=True,
1756
+ runs=[RunResult(run_index=1, passed=True)],
1757
+ pass_rate=1.0,
1758
+ )
1759
+
1760
+ def fake_upload_pr_reports(**kwargs):
1761
+ plugin_results = kwargs["plugin_results"]
1762
+ plugin_results["plugin-a"]["remote_report_url"] = None
1763
+ plugin_results["plugin-a"]["upload_error"] = "plugin upload failed"
1764
+ return {
1765
+ "remote_push_report_url": None,
1766
+ "upload_errors": ["push upload failed"],
1767
+ }
1768
+
1769
+ with chdir(root), patch("yama.cli.YamaRunner", StubRunner), patch.dict(
1770
+ os.environ,
1771
+ {
1772
+ "ADMIN_HOST": "https://admin.example",
1773
+ "YAMA_EVAL_REPORT_API_TOKEN": "secret",
1774
+ },
1775
+ ), patch("yama.cli.upload_pr_reports", fake_upload_pr_reports):
1776
+ code = main(
1777
+ [
1778
+ "pr-run",
1779
+ "--changed-files",
1780
+ str(changed),
1781
+ "--report",
1782
+ "--upload-report",
1783
+ "--commit-id",
1784
+ "146bdae",
1785
+ "--json-summary",
1786
+ str(summary),
1787
+ "--concurrency",
1788
+ "1",
1789
+ ]
1790
+ )
1791
+
1792
+ self.assertEqual(code, 2)
1793
+ payload = json.loads(summary.read_text(encoding="utf-8"))
1794
+ self.assertEqual(payload["upload_errors"], ["push upload failed"])
1795
+ self.assertEqual(
1796
+ payload["plugins"][0]["upload_error"], "plugin upload failed"
1797
+ )
1798
+
1586
1799
  def test_pr_run_forces_linux_fs_backend(self) -> None:
1587
1800
  with tempfile.TemporaryDirectory() as tmp:
1588
1801
  root = Path(tmp)
@@ -394,6 +394,80 @@ class PrSummaryTests(unittest.TestCase):
394
394
  [{"phase": "collection", "message": "steps must be a list"}],
395
395
  )
396
396
 
397
+ def test_summary_includes_remote_upload_fields(self) -> None:
398
+ with tempfile.TemporaryDirectory() as tmp:
399
+ root = Path(tmp)
400
+ plugin = _write_plugin(root, "plugin-a")
401
+ _write_case(plugin, "cases/smoke.yaml")
402
+ workspace = WorkspaceConfig(
403
+ root=root, plugins={"plugin-a": {"path": "plugin-a"}}
404
+ )
405
+ plan = build_pr_plan(
406
+ workspace,
407
+ [ChangedFile("plugin-a/__evals__/cases/smoke.yaml", "M")],
408
+ )
409
+ result = CaseResult(
410
+ case_key="__evals__/cases/smoke.yaml",
411
+ passed=True,
412
+ runs=[RunResult(run_index=1, passed=True)],
413
+ pass_rate=1.0,
414
+ )
415
+
416
+ payload = pr_summary_to_dict(
417
+ plan,
418
+ workspace_root=root,
419
+ plugin_results={
420
+ "plugin-a": {
421
+ "results": [result],
422
+ "remote_report_url": "https://oss/plugin/latest.html",
423
+ "upload_error": None,
424
+ }
425
+ },
426
+ remote_push_report_url="https://oss/push/146bdae.html",
427
+ upload_errors=[],
428
+ )
429
+
430
+ self.assertEqual(
431
+ payload["remote_push_report_url"],
432
+ "https://oss/push/146bdae.html",
433
+ )
434
+ self.assertEqual(payload["upload_errors"], [])
435
+ self.assertEqual(
436
+ payload["plugins"][0]["remote_report_url"],
437
+ "https://oss/plugin/latest.html",
438
+ )
439
+ self.assertIsNone(payload["plugins"][0]["upload_error"])
440
+
441
+ def test_upload_error_is_reported_in_summary(self) -> None:
442
+ with tempfile.TemporaryDirectory() as tmp:
443
+ root = Path(tmp)
444
+ plugin = _write_plugin(root, "plugin-a")
445
+ _write_case(plugin, "cases/smoke.yaml")
446
+ workspace = WorkspaceConfig(
447
+ root=root, plugins={"plugin-a": {"path": "plugin-a"}}
448
+ )
449
+ plan = build_pr_plan(
450
+ workspace,
451
+ [ChangedFile("plugin-a/__evals__/cases/smoke.yaml", "M")],
452
+ )
453
+
454
+ payload = pr_summary_to_dict(
455
+ plan,
456
+ workspace_root=root,
457
+ plugin_results={
458
+ "plugin-a": {
459
+ "results": [],
460
+ "remote_report_url": None,
461
+ "upload_error": "upload failed",
462
+ }
463
+ },
464
+ remote_push_report_url=None,
465
+ upload_errors=["push upload failed"],
466
+ )
467
+
468
+ self.assertEqual(payload["upload_errors"], ["push upload failed"])
469
+ self.assertEqual(payload["plugins"][0]["upload_error"], "upload failed")
470
+
397
471
 
398
472
  class PrRunExitStatusTests(unittest.TestCase):
399
473
  def test_fail_outranks_error_regardless_of_plugin_processing_order(self) -> None:
@@ -472,3 +546,26 @@ class PrRunExitStatusTests(unittest.TestCase):
472
546
  self.assertEqual(
473
547
  pr_run_exit_status({"plugin-a": {"results": [pass_result]}}), 0
474
548
  )
549
+
550
+ def test_upload_error_is_framework_error_exit(self) -> None:
551
+ self.assertEqual(
552
+ pr_run_exit_status(
553
+ {"plugin-a": {"results": [], "upload_error": "failed"}}
554
+ ),
555
+ 2,
556
+ )
557
+
558
+ def test_eval_fail_still_outranks_upload_error(self) -> None:
559
+ fail_result = CaseResult(
560
+ case_key="b",
561
+ passed=False,
562
+ runs=[RunResult(run_index=1, passed=False)],
563
+ pass_rate=0.0,
564
+ )
565
+
566
+ self.assertEqual(
567
+ pr_run_exit_status(
568
+ {"plugin-a": {"results": [fail_result], "upload_error": "failed"}}
569
+ ),
570
+ 1,
571
+ )
@@ -18,6 +18,7 @@ from yama.report import (
18
18
  _render_tool_result,
19
19
  _title_for_role,
20
20
  render_html_report,
21
+ render_html_report_from_bundle,
21
22
  write_timestamped_report,
22
23
  )
23
24
  from yama.runner import CaseResult, RunResult
@@ -875,6 +876,96 @@ class TimestampedReportTests(unittest.TestCase):
875
876
  self.assertIn('<script type="application/json" id="yama-report-meta">', html)
876
877
 
877
878
 
879
+ class ReportBundleRenderingTests(unittest.TestCase):
880
+ def test_report_embeds_bundle_and_labels_beijing_case_update_time(self) -> None:
881
+ case = _make_case("bundle")
882
+ result = CaseResult(
883
+ case_key=case.case_key,
884
+ description=case.description,
885
+ passed=True,
886
+ runs=[RunResult(run_index=1, passed=True)],
887
+ pass_rate=1.0,
888
+ )
889
+ bundle = {
890
+ "schema_version": 1,
891
+ "kind": "push",
892
+ "generated_at": "2026-08-01T20:34:56+08:00",
893
+ "plugins": [
894
+ {
895
+ "name": "plugin",
896
+ "root": "plugin",
897
+ "cases": [
898
+ {
899
+ "case_key": case.case_key,
900
+ "updated_at_beijing": "2026-08-01 20:34:56",
901
+ }
902
+ ],
903
+ }
904
+ ],
905
+ }
906
+
907
+ html = render_html_report([case], [result], bundle=bundle)
908
+
909
+ self.assertIn('id="yama-report-meta"', html)
910
+ self.assertIn('id="yama-report-bundle"', html)
911
+ self.assertIn("Case update times are Beijing time.", html)
912
+ self.assertIn("Updated at (Beijing time)", html)
913
+ self.assertIn("2026-08-01 20:34:56", html)
914
+
915
+ def test_bundle_renderer_handles_historical_case_without_update_time(self) -> None:
916
+ bundle = {
917
+ "schema_version": 1,
918
+ "kind": "plugin",
919
+ "generated_at": "2026-08-01T20:34:56+08:00",
920
+ "plugins": [
921
+ {
922
+ "name": "plugin-a",
923
+ "root": "plugin-a",
924
+ "cases": [
925
+ {
926
+ "case_key": "__evals__/cases/old.yaml",
927
+ "path": "plugin-a/__evals__/cases/old.yaml",
928
+ "description": "Old case",
929
+ "status": "pass",
930
+ "pass_rate": 1.0,
931
+ "counts": {
932
+ "runs_passed": 1,
933
+ "runs_total": 1,
934
+ "runs_error": 0,
935
+ },
936
+ "case": {
937
+ "case_key": "__evals__/cases/old.yaml",
938
+ "path": "plugin-a/__evals__/cases/old.yaml",
939
+ "description": "Old case",
940
+ "model": {"name": "test-model"},
941
+ "execution": {},
942
+ "tools": [],
943
+ "skills": [],
944
+ },
945
+ "result": {
946
+ "case_key": "__evals__/cases/old.yaml",
947
+ "description": "Old case",
948
+ "passed": True,
949
+ "status": "pass",
950
+ "pass_rate": 1.0,
951
+ "usage": None,
952
+ "request_duration_ms": None,
953
+ "runs": [],
954
+ },
955
+ }
956
+ ],
957
+ }
958
+ ],
959
+ }
960
+
961
+ html = render_html_report_from_bundle(bundle)
962
+
963
+ self.assertIn("<h1>Yama Eval Report</h1>", html)
964
+ self.assertIn("Old case", html)
965
+ self.assertIn("Updated at (Beijing time)", html)
966
+ self.assertIn("<strong>-</strong>", html)
967
+
968
+
878
969
  class RenderToolResultTests(unittest.TestCase):
879
970
  """The Result panel should show what the model actually saw -- raw
880
971
  text, not the report re-encoding it as JSON."""