Skip to content

Commit 4afb772

Browse files
committed
fix(issue-1239): [bug]
1 parent d6e4699 commit 4afb772

3 files changed

Lines changed: 170 additions & 65 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Bug 报告 / Bug Report
2+
description: 报告一个可复现的问题 / Report a reproducible problem
3+
title: "[Bug] "
4+
labels:
5+
- bug
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
请先同步到最新代码再提交,避免重复报告已修复的问题。
11+
Please sync to the latest version before filing, to avoid duplicate reports of already-fixed issues.
12+
- type: checkboxes
13+
id: latest_code
14+
attributes:
15+
label: 版本确认 / Version Check
16+
description: Fork 用户请先同步 fork,再重新运行 Actions。 / Fork users should sync their fork before rerunning Actions.
17+
options:
18+
- label: 我已同步最新代码 / I am on the latest commit
19+
required: true
20+
- type: input
21+
id: local_commit
22+
attributes:
23+
label: 本地代码版本 / Local commit hash
24+
description: 运行 `git rev-parse --short HEAD` 后填写结果。 / Run `git rev-parse --short HEAD` and paste the result.
25+
placeholder: e.g. a1b2c3d
26+
validations:
27+
required: true
28+
- type: input
29+
id: actions_commit
30+
attributes:
31+
label: GitHub Actions 代码版本 / GitHub Actions commit hash
32+
description: 填写工作流日志顶部显示的 commit hash;如未使用 Actions,请填写 N/A。 / Use the commit hash shown at the top of the workflow log, or N/A if Actions was not used.
33+
placeholder: e.g. a1b2c3d or N/A
34+
validations:
35+
required: true
36+
- type: textarea
37+
id: problem
38+
attributes:
39+
label: 问题描述 / Problem Description
40+
description: 简明扼要地描述遇到的问题。 / Briefly describe the problem.
41+
placeholder: 发生了什么问题? / What went wrong?
42+
validations:
43+
required: true
44+
- type: textarea
45+
id: steps
46+
attributes:
47+
label: 复现步骤 / Reproduction Steps
48+
description: 请写出可复现的命令、配置和操作步骤。 / Include the command, config, and actions needed to reproduce.
49+
placeholder: |
50+
1. 执行命令 / Run command: ...
51+
2. 配置 / Config: ...
52+
3. 查看 / View: ...
53+
4. 出现错误 / Error occurs: ...
54+
validations:
55+
required: true
56+
- type: textarea
57+
id: expected
58+
attributes:
59+
label: 期望行为 / Expected Behavior
60+
description: 描述你期望发生的情况。 / Describe what you expected to happen.
61+
validations:
62+
required: true
63+
- type: textarea
64+
id: actual
65+
attributes:
66+
label: 实际行为 / Actual Behavior
67+
description: 描述实际发生的情况。 / Describe what actually happened.
68+
validations:
69+
required: true
70+
- type: textarea
71+
id: logs
72+
attributes:
73+
label: 错误日志 / Error Logs
74+
description: 粘贴完整相关日志;如没有日志,请填写 N/A。 / Paste complete relevant logs, or N/A if none are available.
75+
render: shell
76+
validations:
77+
required: true
78+
- type: input
79+
id: os
80+
attributes:
81+
label: 操作系统 / OS
82+
placeholder: e.g. Ubuntu 22.04 / Windows 11 / macOS 14
83+
validations:
84+
required: true
85+
- type: input
86+
id: python_version
87+
attributes:
88+
label: Python 版本 / Python version
89+
placeholder: e.g. 3.11.8
90+
validations:
91+
required: true
92+
- type: dropdown
93+
id: run_mode
94+
attributes:
95+
label: 运行方式 / Run mode
96+
options:
97+
- Local
98+
- Docker
99+
- GitHub Actions
100+
- Other
101+
validations:
102+
required: true
103+
- type: textarea
104+
id: config
105+
attributes:
106+
label: 相关配置 / Relevant config
107+
description: 请至少说明 GEMINI_MODEL/AI model 和数据源;如不适用,请填写 N/A。 / Include at least GEMINI_MODEL/AI model and data source, or N/A if not applicable.
108+
placeholder: |
109+
GEMINI_MODEL / AI model:
110+
数据源 / Data source:
111+
validations:
112+
required: true
113+
- type: textarea
114+
id: additional_context
115+
attributes:
116+
label: 其他信息 / Additional Context
117+
description: 添加任何其他有关问题的信息或截图。 / Add any other context or screenshots about the problem.

tests/test_issue_templates.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from pathlib import Path
2+
3+
import yaml
4+
5+
6+
ROOT = Path(__file__).resolve().parents[1]
7+
ISSUE_TEMPLATE_DIR = ROOT / ".github" / "ISSUE_TEMPLATE"
8+
BUG_REPORT_FORM = ISSUE_TEMPLATE_DIR / "bug_report.yml"
9+
BUG_REPORT_MARKDOWN = ISSUE_TEMPLATE_DIR / "bug_report.md"
10+
11+
12+
def _body_item(form, item_id):
13+
for item in form["body"]:
14+
if item.get("id") == item_id:
15+
return item
16+
raise AssertionError(f"Missing issue form item: {item_id}")
17+
18+
19+
def test_bug_report_uses_single_required_issue_form():
20+
assert BUG_REPORT_FORM.exists()
21+
assert not BUG_REPORT_MARKDOWN.exists()
22+
23+
form = yaml.safe_load(BUG_REPORT_FORM.read_text(encoding="utf-8"))
24+
25+
assert form["title"] == "[Bug] "
26+
assert "bug" in form["labels"]
27+
assert isinstance(form["body"], list)
28+
29+
30+
def test_bug_report_requires_reproducible_bug_context():
31+
form = yaml.safe_load(BUG_REPORT_FORM.read_text(encoding="utf-8"))
32+
33+
required_text_fields = {
34+
"local_commit",
35+
"actions_commit",
36+
"problem",
37+
"steps",
38+
"expected",
39+
"actual",
40+
"logs",
41+
"os",
42+
"python_version",
43+
"run_mode",
44+
"config",
45+
}
46+
47+
for item_id in required_text_fields:
48+
item = _body_item(form, item_id)
49+
assert item.get("validations", {}).get("required") is True
50+
51+
latest_code = _body_item(form, "latest_code")
52+
assert latest_code["type"] == "checkboxes"
53+
assert latest_code["attributes"]["options"][0]["required"] is True

0 commit comments

Comments
 (0)