@@ -1788,11 +1788,22 @@ def test_groups_scopes_by_category(self):
17881788 fail_scope ("Branch" ),
17891789 ]
17901790 output = self ._run (results )
1791- # One group for commit-message scopes, one for the branch scope.
1792- self .assertEqual (output .count ("::group::" ), 2 )
1791+ # One group each for the pull request, the commits and the branch.
1792+ self .assertEqual (output .count ("::group::" ), 3 )
1793+ self .assertIn ("::group::Pull request" , output )
17931794 self .assertIn ("::group::Commit message" , output )
17941795 self .assertIn ("::group::Branch" , output )
17951796
1797+ def test_title_and_description_share_one_group (self ):
1798+ """The commits come after both, so the commit group is not split."""
1799+ results = [
1800+ pass_scope ("PR title" ),
1801+ pass_scope ("PR description" ),
1802+ pass_scope ("Commit 1/1" ),
1803+ ]
1804+ groups = [name for name , _ in main ._grouped (results )]
1805+ self .assertEqual (groups , ["Pull request" , "Commit message" ])
1806+
17961807 def test_raw_text_fallback_is_printed (self ):
17971808 scope = main .ScopeResult (label = "Branch" , raw_text = "unexpected output" )
17981809 output = self ._run ([scope ])
@@ -1854,8 +1865,9 @@ def test_success_golden_output(self):
18541865 "<summary>Show all 4 checks</summary>\n "
18551866 "\n "
18561867 "```text\n "
1857- "Commit message \n "
1868+ "Pull request \n "
18581869 " ✔ PR title (feat: add login page)\n "
1870+ "Commit message\n "
18591871 " ✔ Commit 1/2 (feat: add user auth)\n "
18601872 " ✔ Commit 2/2 (fix: resolve timeout)\n "
18611873 "Branch\n "
@@ -1892,8 +1904,9 @@ def test_failure_golden_output(self):
18921904 "<summary>Show all 3 checks</summary>\n "
18931905 "\n "
18941906 "```text\n "
1895- "Commit message \n "
1907+ "Pull request \n "
18961908 " ✔ PR title (feat: add login page)\n "
1909+ "Commit message\n "
18971910 " ✖ Commit 2/2 (1 failure)\n "
18981911 " CC001 message\n "
18991912 " value: bad message\n "
@@ -1943,8 +1956,9 @@ def test_failure_golden_output_with_commits(self):
19431956 "<summary>Show all 5 checks</summary>\n "
19441957 "\n "
19451958 "```text\n "
1946- "Commit message \n "
1959+ "Pull request \n "
19471960 " ✔ PR title (feat: Add login page)\n "
1961+ "Commit message\n "
19481962 " ✖ Commit 1/3 (d87faca) (1 failure)\n "
19491963 " CC001 message\n "
19501964 " value: bad message\n "
@@ -3003,8 +3017,9 @@ def test_all_skipped_golden_output(self):
30033017 "<summary>Show all 2 checks</summary>\n "
30043018 "\n "
30053019 "```text\n "
3006- "Commit message \n "
3020+ "Pull request \n "
30073021 " ⊘ PR title (skipped)\n "
3022+ "Commit message\n "
30083023 " ⊘ Commit 1/1 (skipped)\n "
30093024 "```\n "
30103025 "\n "
@@ -3251,7 +3266,7 @@ def test_warning_only_golden_output(self):
32513266 "<summary>Show all 2 checks</summary>\n "
32523267 "\n "
32533268 "```text\n "
3254- "Commit message \n "
3269+ "Pull request \n "
32553270 " ✔ PR title (feat: add login page)\n "
32563271 "Branch\n "
32573272 " ⚠ Branch (1 warning)\n "
@@ -3773,6 +3788,21 @@ def test_pr_body_is_a_scope_checked_with_the_ai_rules_only(self):
37733788 )
37743789 self .assertEqual ([r .label for r in results ], ["PR description" ])
37753790
3791+ def test_no_ai_rule_ran_reads_as_skipped_not_passed (self ):
3792+ """Under ai_attribution = "ignore" the CLI runs no rule on the description."""
3793+ results , _ = self ._run (True , "false" )
3794+ self .assertEqual (results [0 ].status , "skip" )
3795+ self .assertEqual (results [0 ].skip_reason , main .AI_POLICY_IGNORED )
3796+
3797+ def test_a_rule_that_ran_keeps_its_verdict (self ):
3798+ checks = [{"rule_id" : "CC013" , "check" : "ai_attribution" , "status" : "pass" }]
3799+ scope = main .ScopeResult (label = "PR description" , checks = list (checks ))
3800+ self .assertEqual (main .skip_when_no_ai_rule_ran (scope ).checks , checks )
3801+
3802+ def test_unparsable_output_still_fails (self ):
3803+ scope = main .ScopeResult (label = "PR description" , raw_text = "Error: bad config" )
3804+ self .assertEqual (main .skip_when_no_ai_rule_ran (scope ).status , "fail" )
3805+
37763806 def test_ai_label_alone_reads_it_but_reports_no_scope (self ):
37773807 results , mock_scope = self ._run (False , "true" )
37783808 mock_scope .assert_called_once ()
0 commit comments