Warn at submit if a review may be hidden for toxicity (#1110)#1265
Warn at submit if a review may be hidden for toxicity (#1110)#1265IshanA2007 wants to merge 2 commits into
Conversation
Add a pre-submission toxicity warning matching the existing preflight/modal
pattern (duplicate + zero-hours checks).
- Add score_review_toxicity/review_will_be_hidden_for_toxicity services that
reuse the original detoxify scoring (round(100 * toxicity)) and the same
TOXICITY_THRESHOLD display filter. Detoxify is optional and lazily loaded;
when unavailable, scoring returns not-flagged so submission is never blocked.
- Add check_toxicity preflight endpoint + URL returning {"toxic": bool},
mirroring check_zero_hours_per_week.
- Add a 'Review may be hidden' modal with 'Submit anyway' / 'Continue editing',
wired into the review submit handler after the duplicate/zero-hours checks.
Submission is never blocked -- moderation here is display-only.
- Add endpoint + service unit tests.
Note: the review is still saved on 'Submit anyway'; toxicity only affects
whether it is displayed.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ 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 |
Closes #1110
Problem
There was no pre-submission feedback when a review would be hidden by the toxicity display filter — users had no idea their review wouldn't show up.
Fix
Adds a pre-submit toxicity check mirroring the existing preflight/modal pattern (duplicate-review, zero-hours):
check_toxicityXHR endpoint (reviews/check_toxicity/) returning{"toxic": bool}.evaluate_review_toxicitycommand + the sharedsettings.TOXICITY_THRESHOLD(74), so the warning matches what actually gets hidden.detoxifywas removed from the project entirely (commit32623d53, "remove detoxify ENTIRELY");toxicity_ratingis now populated out-of-band. The new service lazily importsdetoxifyand fails open (returns not-toxic) when it's unavailable — so with the current dependencies the modal never triggers and submission is never blocked. Re-addingdetoxifyto dependencies (local model, no API key, but heavyweight) activates the warning automatically. This PR wires the mechanism; enabling it is a deploy decision.Verification (run in the docker stack)
manage.py test tcf_website.tests.test_review— 28 pass (incl. 7 new).manage.py checkclean; ruff + djlint clean.Follow-ups
detoxify(or another local scorer) to make the warning live.duplicate-warningmodal markup is dead (alert()-based) — left untouched; could be cleaned up separately.🤖 Implemented with Claude Code.