Skip to content

fix: leave the AI declaration (CC501) out under --ai-attribution ignore - #755

Merged
shenxianpeng merged 2 commits into
mainfrom
fix/ci-declaration-waits-for-ai-switch
Dec 4, 2026
Merged

shenxianpeng merged 2 commits into
mainfrom
fix/ci-declaration-waits-for-ai-switch

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

What

On GitLab and Bitbucket, commit-check-ci checks a description with --pr-body --ai-attribution ignore when pr-body-ai-attribution is off. CC501 still ran in that case. A project that sets both ai_declaration_checkboxes and require_issue_reference therefore failed a description that named its issue, only because it had no declaration boxes.

Now an explicit --ai-attribution ignore on the command line, together with --pr-body or --ai-attribution-only, leaves CC501 out along with the other AI rules. ai_attribution = "ignore" in the config is the default, so it keeps CC501 as before.

The Action (pr-body-ai-attribution) and the App (body_ai_attribution) already behave this way. The docs already say CC501 waits for the AI switch, so no doc change is needed.

Before / after

cchk.toml:

[pull_request]
require_issue_reference = true
ai_declaration_checkboxes = ["No AI tools were used", "AI tools were used"]
$ printf 'Fixes #412\n' | commit-check --pr-body --ai-attribution ignore

Before:

✖ CC501 ai-declaration failed: (none)
  The pull request description has no AI declaration

After: passes. Without --ai-attribution ignore, CC501 still runs and fails, as before.

Tests

  • New tests in main_test.py: the flag drops CC501 on --pr-body and on --ai-attribution-only, and "ignore" in the config keeps it.
  • New test in ci_test.py: CC501 runs only with pr-body-ai-attribution.
  • pytest tests: 2211 passed. The one failure, test_load_config_file_permission_error, also fails on main when run as root.
  • ruff and mypy are clean.
  • No README pin change: v2.26.0 is already pinned.

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • AI-attribution checks now consistently respect the ignore setting, including when checking pull request descriptions or attribution-only text.
    • For truncated GitLab descriptions, attribution checks can still run while rules that cannot be evaluated from the available text remain undecided.
    • Updated validation behavior distinguishes between the command-line ignore option and the configured policy, so declaration checks run or are skipped accordingly.

commit-check-ci checks a description with --pr-body --ai-attribution
ignore when pr-body-ai-attribution is off, but CC501 still ran, so a
project with ai_declaration_checkboxes and require_issue_reference
failed descriptions for want of the boxes. The flag now leaves CC501
out with the other AI rules on --pr-body and --ai-attribution-only;
ai_attribution = "ignore" in the config, the default, keeps it.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner December 4, 2026 12:00
@shenxianpeng shenxianpeng added the bug Something isn't working label Dec 4, 2026 — with Claude
@shenxianpeng shenxianpeng self-assigned this Dec 4, 2026
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates CLI check selection so the AI declaration check is omitted when the applicable attribution policy is ignore. It also updates CI comments and adds tests for the pr-body-ai-attribution switch.

Changes: AI declaration check gating

Layer / File(s) Summary
Declaration check behavior
commit_check/main.py, tests/main_test.py
The CLI help text documents that ignore excludes the AI declaration check. Message-check selection omits ai_declaration under the applicable policy. Tests cover CLI flags and config-only behavior.
CI attribution option behavior
commit_check/ci.py, tests/ci_test.py
Comments describe how pr-body-ai-attribution affects CC501. A GitLab test checks description results with the switch disabled and enabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • commit-check/commit-check#750: Changes CC501 selection in the --pr-body path and covers related attribution checkbox and issue-reference settings.
Merge Risk: Minimal · up to ae39d

This change stops the AI declaration check from running when AI attribution is explicitly ignored on the command line for PR body checks. The behavior is covered by new tests and is easy to revert. No remaining merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: under an explicit --ai-attribution ignore, the AI declaration check (CC501) is left out. It matches the objectives, which describe CC501 dropping out with --pr-body or…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: under an explicit --ai-attribution ignore, the AI declaration check (CC501) is left out. It matches the objectives, which describe CC501 dropping out with --pr-body or --ai-attribution-only. The title is a single, specific sentence that a teammate scanning history can use.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7f179ce-3173-44fc-b094-27814a528b80
Commits

Reviewing files that changed from the base of the PR and between 98fb612 and ae39d9a.

Files selected for processing: 4

  • commit_check/ci.py
  • commit_check/main.py
  • tests/ci_test.py
  • tests/main_test.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Keeps _get_requested_checks within the cognitive complexity limit.
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (98fb612) to head (ae39d9a).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #755   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines         3821      3826    +5     
  Branches       766       767    +1     
=========================================
+ Hits          3821      3826    +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shenxianpeng
shenxianpeng merged commit 6449518 into main Dec 4, 2026
33 checks passed
@shenxianpeng
shenxianpeng deleted the fix/ci-declaration-waits-for-ai-switch branch December 4, 2026 12:09
@codspeed

codspeed Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 133 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 685 untouched benchmarks
⏩ 132 skipped benchmarks1


Comparing fix/ci-declaration-waits-for-ai-switch (9aa63e9) with main (9dc3829)2

Open in CodSpeed

Footnotes

  1. 132 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (98fb612) during the generation of this report, so 9dc3829 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant