[moz] impl(§17): CI/部署失败 steps 分支指引 + 基础设施 Issue 转交流程
改动 1: ci_failure steps 增加分支指引(代码问题自己修/基础设施问题提Issue给姜维) 改动 2: deploy_failure steps 同上分支指引(2处定义都改) 改动 3: issue_assigned handler 按 type/infrastructure label 分流 - infrastructure label → infrastructure_failure event_type(运维排查 steps) - 其他 → 原有编码 steps 改动 4: ToolchainApiSection 新增「需要创建 Issue 时」API 指引段落 改动 5: Red Flags 新增「不是我代码的问题」条目 测试: 8 个新测试,463 passed
This commit is contained in:
@@ -523,3 +523,73 @@ class TestFullPromptBuild:
|
||||
# Must have constraints with Red Flags
|
||||
assert "Red Flags" in prompt
|
||||
assert "强制要求" in prompt
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# §17 v2: CI/deploy failure branching + issue label routing + Issue API guidance
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestCiFailureBranching:
|
||||
"""ci_failure steps should include a/b branching guidance."""
|
||||
|
||||
def test_ci_failure_steps_contain_branching(self):
|
||||
source_file = PROJECT_ROOT / "src" / "api" / "toolchain_routes.py"
|
||||
source = source_file.read_text()
|
||||
assert '基础设施问题' in source
|
||||
assert 'type/infrastructure' in source
|
||||
assert 'jiangwei-infra' in source
|
||||
|
||||
|
||||
class TestDeployFailureBranching:
|
||||
"""deploy_failure steps should include a/b branching guidance."""
|
||||
|
||||
def test_deploy_failure_steps_contain_branching(self):
|
||||
source_file = PROJECT_ROOT / "src" / "api" / "toolchain_routes.py"
|
||||
source = source_file.read_text()
|
||||
count = source.count('基础设施问题(Gitea 不可用')
|
||||
assert count >= 2, f'Expected >=2 deploy_failure branching, found {count}'
|
||||
|
||||
|
||||
class TestIssueAssignedLabelRouting:
|
||||
"""issue_assigned handler should route by type/infrastructure label."""
|
||||
|
||||
def test_label_check_in_source(self):
|
||||
source_file = PROJECT_ROOT / "src" / "api" / "toolchain_routes.py"
|
||||
source = source_file.read_text()
|
||||
assert 'is_infrastructure' in source
|
||||
assert 'infrastructure_failure' in source
|
||||
assert '基础设施 Issue' in source
|
||||
|
||||
def test_normal_issue_keeps_coding_steps(self):
|
||||
source_file = PROJECT_ROOT / "src" / "api" / "toolchain_routes.py"
|
||||
source = source_file.read_text()
|
||||
assert '创建分支 fix/' in source
|
||||
assert 'issue_assigned' in source
|
||||
|
||||
|
||||
class TestToolchainApiIssueGuidance:
|
||||
"""ToolchainApiSection should include Issue creation guidance."""
|
||||
|
||||
def test_has_issue_creation_section(self):
|
||||
source_file = PROJECT_ROOT / "src" / "daemon" / "toolchain_handler.py"
|
||||
source = source_file.read_text()
|
||||
assert "需要创建 Issue 时" in source
|
||||
assert "/issues" in source
|
||||
assert "jiangwei-infra" in source
|
||||
assert "type/infrastructure" in source
|
||||
|
||||
def test_issue_body_template_mentions_required_fields(self):
|
||||
source_file = PROJECT_ROOT / "src" / "daemon" / "toolchain_handler.py"
|
||||
source = source_file.read_text()
|
||||
assert "错误来源" in source
|
||||
assert "判断依据" in source
|
||||
|
||||
|
||||
class TestRedFlagsInfrastructure:
|
||||
"""Red Flags should include the 'not my code' entry."""
|
||||
|
||||
def test_has_infrastructure_red_flag(self):
|
||||
source_file = PROJECT_ROOT / "src" / "daemon" / "toolchain_handler.py"
|
||||
source = source_file.read_text()
|
||||
assert "不是我代码的问题" in source
|
||||
assert "基础设施问题" in source
|
||||
|
||||
Reference in New Issue
Block a user