fix: detect space-separated AI model names in co-author trailers - #506
Conversation
✅ Deploy Preview for commit-check ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe change expands AI signature detection for Anthropic co-author trailers and space-separated Claude, GPT, and Gemini model names. Tests cover supported variants and reject a human-name false positive. ChangesAI signature detection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/ai_signatures_test.py (1)
60-69: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMake the Claude case exercise the
Generic AIpattern.
has_ai_signatureonly checks whether any pattern matches. The Claude fixture usesnoreply@anthropic.com, so the Claude Code pattern makes this test pass even if the new space-separatedGeneric AIpattern is broken.Use a non-Anthropic address for this case and assert that
detect_ai_signaturesreturnstool == "Generic AI".Proposed test adjustment
- "Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>", + "Co-authored-by: Claude Sonnet 4.5 <claude@example.com>", ... - assert has_ai_signature(message), trailer + result = detect_ai_signatures(message) + assert any(s["tool"] == "Generic AI" for s in result), trailer🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/ai_signatures_test.py` around lines 60 - 69, Update test_space_separated_model_name_detected to use a non-Anthropic address for the Claude fixture, then call detect_ai_signatures and assert the matching result has tool == "Generic AI"; keep the existing coverage for the other space-separated model names.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@commit_check/ai_signatures_data.py`:
- Around line 240-241: Update the regex used by _trailer() so AI model
signatures cannot span lines: replace newline-capable whitespace with horizontal
whitespace and exclude newline characters from the model value, parenthesized
metadata, and angle-bracket email portions. Preserve existing matching for valid
single-line trailers such as GPT 4, optional annotations, and email values.
---
Nitpick comments:
In `@tests/ai_signatures_test.py`:
- Around line 60-69: Update test_space_separated_model_name_detected to use a
non-Anthropic address for the Claude fixture, then call detect_ai_signatures and
assert the matching result has tool == "Generic AI"; keep the existing coverage
for the other space-separated model names.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5215b8df-8ba5-47d2-9c69-26df560d670f
📒 Files selected for processing (2)
commit_check/ai_signatures_data.pytests/ai_signatures_test.py
8fd6c1a to
94c2a23
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #506 +/- ##
=======================================
Coverage 97.36% 97.36%
=======================================
Files 12 12
Lines 1175 1175
=======================================
Hits 1144 1144
Misses 31 31 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|



With
ai_attribution = "forbid", trailers using space-separated model names pass undetected:The Claude pattern only matches
Claude/Claude Codeverbatim, and the generic pattern requires hyphenated ids (claude-sonnet-4). Claude Code emits such trailers in the wild (observed in our org).Two new patterns:
noreply@anthropic.comemail, regardless of display name;Claude Dubois 3rd— stay unflagged.Tests added for both, plus the ordinal false-positive case.
Summary by CodeRabbit