Skip to content

Conversation

@lsabor
Copy link
Contributor

@lsabor lsabor commented Jan 21, 2026

The update_global_leaderboard_tags function now removes any existing global leaderboard tags before returning early when a post has no eligible projects with NORMAL visibility.

Fixes #4121

Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Leaderboard tags are now properly removed from posts when they're no longer applicable.

✏️ Tip: You can customize this high-level summary in your review settings.

The update_global_leaderboard_tags function now removes any existing
global leaderboard tags before returning early when a post has no
eligible projects with NORMAL visibility.

Fixes #4121

Co-authored-by: Luke Sabor <lsabor@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Modified the update_global_leaderboard_tags function to remove existing leaderboard tags from posts when no eligible normal-visibility projects are found, instead of returning without cleanup.

Changes

Cohort / File(s) Summary
Leaderboard Tag Cleanup
posts/services/common.py
Added logic to filter out and remove LEADERBOARD_TAG-type projects from posts when no eligible normal-visibility projects exist, ensuring stale leaderboard tags are properly cleaned up

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 Tags that linger with no worthy place,
Are swept away with grace,
When leaderboards don't qualify,
The cleanup makes things fly,
A tidy post, a rabbit's delight! ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing global leaderboard tags when a post is ineligible.
Linked Issues check ✅ Passed The code changes directly implement the requirement from issue #4121 to remove existing global leaderboard tags when posts are ineligible.
Out of Scope Changes check ✅ Passed All changes are scoped to the update_global_leaderboard_tags function and directly address the requirement to remove ineligible leaderboard tags.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1d6a1 and a7dd76d.

📒 Files selected for processing (1)
  • posts/services/common.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-15T19:29:58.940Z
Learnt from: hlbmtc
Repo: Metaculus/metaculus PR: 4075
File: authentication/urls.py:24-26
Timestamp: 2026-01-15T19:29:58.940Z
Learning: In this codebase, DRF is configured to use IsAuthenticated as the default in REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] within metaculus_web/settings.py. Therefore, explicit permission_classes([IsAuthenticated]) decorators are unnecessary on DRF views unless a view needs to override the default. When reviewing Python files, verify that views relying on the default are not redundantly decorated, and flag cases where permissions are being over-specified or when a non-default permission is explicitly required.

Applied to files:

  • posts/services/common.py
🧬 Code graph analysis (1)
posts/services/common.py (2)
front_end/src/types/projects.ts (1)
  • Project (10-16)
projects/models.py (2)
  • Project (212-495)
  • ProjectTypes (213-223)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Docker Image
  • GitHub Check: Backend Checks
  • GitHub Check: Frontend Checks
  • GitHub Check: integration-tests
🔇 Additional comments (1)
posts/services/common.py (1)

67-81: LGTM! Correctly removes leaderboard tags when post is no longer eligible.

The implementation properly addresses the issue by removing existing LEADERBOARD_TAG projects before the early return. The approach is consistent with the pattern used later in the function (lines 110-114) and safely handles edge cases (no existing tags, empty projects).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@lsabor lsabor marked this pull request as ready for review January 21, 2026 15:54
@lsabor lsabor merged commit 1e1e996 into main Jan 21, 2026
11 of 12 checks passed
@lsabor lsabor deleted the claude/issue-4121-20260120-2330 branch January 21, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global Leaderboard tagging algorithm should remove tags if not eligible

2 participants