render_report: severities are case-sensitive and unknown values silently become 'low' ('Critical' renders as Low, critical count 0)

未关闭 适合新手
#151 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
tooling

调研方向

从 scripts/render_report.py 和 assets/report-shell.html 开始,issue 在这两处指出了严重程度的处理方式;然后追踪 validate() 如何检查 grade。检查是否已有覆盖严重程度验证和两种报告输出的测试。当大小写混杂的已知严重程度被一致地规范化、未知值产生清晰的验证错误,并且复现出的计数和分组正确时,工作即告完成。

由索引模型根据 Issue 内容生成。

描述

Describe the bug

scripts/render_report.py and assets/report-shell.html are identical in both builders. Neither validates finding.severity. Any value other than exactly critical|high|medium|low is silently mapped to low: by severity_counts() for the CLI summary and markdown, and by the shell's normalize() for the HTML. The findings JSON is written by LLM lenses, so "Critical", "HIGH" or "major" are realistic. The report then shows a critical problem as Low and reports 0 critical.

grade, by contrast, is validated strictly and case-sensitively ("Poor" is rejected), so the two fields are inconsistent.

Steps to reproduce

cat > f.json <<'EOF'
{"subject":"demo-skill","grade":"poor","findings":[
 {"id":"F1","lens":"security","severity":"Critical","title":"Deletes live config"},
 {"id":"F2","lens":"structure","severity":"HIGH","title":"Missing activation"},
 {"id":"F3","lens":"style","severity":"low","title":"Wordy"}]}
EOF
cd skills/bmad-workflow-builder
python3 scripts/render_report.py f.json --shell assets/report-shell.html -o r.html --md r.md
# {"counts": {"critical": 0, "high": 0, "medium": 0, "low": 3}, ...}
# r.md: "| Critical | 0 |"; F1/F2 listed under Low; r.html groups all three under Low

Expected behavior

Normalize case (severity.strip().lower()) in both Python and the shell, and reject anything still unknown in validate() with a clear error, the same way grade is handled. Never default an unknown severity to the lowest bucket.

Environment

  • Model(s) used: n/a (deterministic script)
  • Agentic IDE used: n/a (scripts run directly)
  • BMad version: bmad-builder main @ d4a921c (v2.2.2 + #118)
  • Project language: Python 3.13, Linux
主要语言
Python
星标
220
派生
54
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bmad-code-org/bmad-builder 的其他 Issue

查看 bmad-code-org/bmad-builder 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。