@@ -1735,11 +1735,22 @@ def test_groups_scopes_by_category(self):
17351735 fail_scope ("Branch" ),
17361736 ]
17371737 output = self ._run (results )
1738- # One group for commit-message scopes, one for the branch scope.
1739- self .assertEqual (output .count ("::group::" ), 2 )
1738+ # One group each for the pull request, the commits and the branch.
1739+ self .assertEqual (output .count ("::group::" ), 3 )
1740+ self .assertIn ("::group::Pull request" , output )
17401741 self .assertIn ("::group::Commit message" , output )
17411742 self .assertIn ("::group::Branch" , output )
17421743
1744+ def test_title_and_description_share_one_group (self ):
1745+ """The commits come after both, so the commit group is not split."""
1746+ results = [
1747+ pass_scope ("PR title" ),
1748+ pass_scope ("PR description" ),
1749+ pass_scope ("Commit 1/1" ),
1750+ ]
1751+ groups = [name for name , _ in main ._grouped (results )]
1752+ self .assertEqual (groups , ["Pull request" , "Commit message" ])
1753+
17431754 def test_raw_text_fallback_is_printed (self ):
17441755 scope = main .ScopeResult (label = "Branch" , raw_text = "unexpected output" )
17451756 output = self ._run ([scope ])
@@ -1801,8 +1812,9 @@ def test_success_golden_output(self):
18011812 "<summary>Show all 4 checks</summary>\n "
18021813 "\n "
18031814 "```text\n "
1804- "Commit message \n "
1815+ "Pull request \n "
18051816 " ✔ PR title (feat: add login page)\n "
1817+ "Commit message\n "
18061818 " ✔ Commit 1/2 (feat: add user auth)\n "
18071819 " ✔ Commit 2/2 (fix: resolve timeout)\n "
18081820 "Branch\n "
@@ -1839,8 +1851,9 @@ def test_failure_golden_output(self):
18391851 "<summary>Show all 3 checks</summary>\n "
18401852 "\n "
18411853 "```text\n "
1842- "Commit message \n "
1854+ "Pull request \n "
18431855 " ✔ PR title (feat: add login page)\n "
1856+ "Commit message\n "
18441857 " ✖ Commit 2/2 (1 failure)\n "
18451858 " CC001 message\n "
18461859 " value: bad message\n "
@@ -1890,8 +1903,9 @@ def test_failure_golden_output_with_commits(self):
18901903 "<summary>Show all 5 checks</summary>\n "
18911904 "\n "
18921905 "```text\n "
1893- "Commit message \n "
1906+ "Pull request \n "
18941907 " ✔ PR title (feat: Add login page)\n "
1908+ "Commit message\n "
18951909 " ✖ Commit 1/3 (d87faca) (1 failure)\n "
18961910 " CC001 message\n "
18971911 " value: bad message\n "
@@ -2950,8 +2964,9 @@ def test_all_skipped_golden_output(self):
29502964 "<summary>Show all 2 checks</summary>\n "
29512965 "\n "
29522966 "```text\n "
2953- "Commit message \n "
2967+ "Pull request \n "
29542968 " ⊘ PR title (skipped)\n "
2969+ "Commit message\n "
29552970 " ⊘ Commit 1/1 (skipped)\n "
29562971 "```\n "
29572972 "\n "
@@ -3198,7 +3213,7 @@ def test_warning_only_golden_output(self):
31983213 "<summary>Show all 2 checks</summary>\n "
31993214 "\n "
32003215 "```text\n "
3201- "Commit message \n "
3216+ "Pull request \n "
32023217 " ✔ PR title (feat: add login page)\n "
32033218 "Branch\n "
32043219 " ⚠ Branch (1 warning)\n "
@@ -3720,6 +3735,21 @@ def test_pr_body_is_a_scope_checked_with_the_ai_rules_only(self):
37203735 )
37213736 self .assertEqual ([r .label for r in results ], ["PR description" ])
37223737
3738+ def test_no_ai_rule_ran_reads_as_skipped_not_passed (self ):
3739+ """Under ai_attribution = "ignore" the CLI runs no rule on the description."""
3740+ results , _ = self ._run (True , "false" )
3741+ self .assertEqual (results [0 ].status , "skip" )
3742+ self .assertEqual (results [0 ].skip_reason , main .AI_POLICY_IGNORED )
3743+
3744+ def test_a_rule_that_ran_keeps_its_verdict (self ):
3745+ checks = [{"rule_id" : "CC013" , "check" : "ai_attribution" , "status" : "pass" }]
3746+ scope = main .ScopeResult (label = "PR description" , checks = list (checks ))
3747+ self .assertEqual (main .skip_when_no_ai_rule_ran (scope ).checks , checks )
3748+
3749+ def test_unparsable_output_still_fails (self ):
3750+ scope = main .ScopeResult (label = "PR description" , raw_text = "Error: bad config" )
3751+ self .assertEqual (main .skip_when_no_ai_rule_ran (scope ).status , "fail" )
3752+
37233753 def test_ai_label_alone_reads_it_but_reports_no_scope (self ):
37243754 results , mock_scope = self ._run (False , "true" )
37253755 mock_scope .assert_called_once ()
0 commit comments