-
Notifications
You must be signed in to change notification settings - Fork 27
Hotness tweaks: reduce open boost, add cp reveal boost #4150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Reduced question open hotness boost from 20 to 10 - Added hotness boost of 20 for cp_reveal_time (community prediction reveal) Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
📝 WalkthroughWalkthroughThe hotness scoring system for posts and questions has been refactored: the Approval score component was removed from POST_HOTNESS_COMPONENTS, and a new CP Reveal Time Score component was added to QUESTION_HOTNESS_COMPONENTS. Tests were updated to reflect the removal of the approval score contribution. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
🚀 Preview EnvironmentYour preview environment is ready!
Details
ℹ️ Preview Environment InfoIsolation:
Limitations:
Cleanup:
|
|
@claude let's remove the approval hotness boost completely. |
|
Claude finished @SylvainChevalier's task in 55s —— View job Task: Remove approval hotness boost ✓
SummaryRemoved the approval hotness boost completely from
The PR now includes three hotness adjustments:
Changes pushed to --- • |
Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
|
@claude can you see the failed unit tests in the github actions? |
|
Claude finished @SylvainChevalier's task —— View job GitHub Actions Test Failures - RESOLVED ✓
SummaryYes, I can see the failed unit tests in GitHub Actions! The issue was that the test file was trying to import Changes MadeCommit
Commit
CI Status✅ Run Unit Tests - PASSING All unit tests are now passing! |
- Remove import of deleted _compute_hotness_approval_score function - Remove test_compute_hotness_approval_score test - Update test_handle_post_boost expected values to reflect removal of approval boost - Update test_compute_post_hotness expected value Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
Adjust expected values in question and post hotness tests to reflect: - Reduced question open hotness boost from 20 to 10 - Removed approval hotness boost Test expectation updates: - test_compute_question_hotness active question: 13.0 → 10.5 - test_compute_question_hotness resolved question: 6.25 → 5.625 - test_compute_question_hotness annulled question: 1.25 → 0.625 - test_compute_post_hotness: 110.9 → 109.025 Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/unit/test_posts/test_services/test_hotness.py (1)
166-207:⚠️ Potential issue | 🟡 MinorVerify the expected total hotness calculation.
The expected value of
109.025should be verified. The comment on line 185 says the second question "Will be scored as 18" but let me verify:
- Question 2 open time (2025-04-11, 7 days ago):
decay(10, open_time)=2.5- No resolution, no movement specified → Total for Q2:
2.5The inline comment says "scored as 18" but with the reduced open boost (10 instead of 20), this should now be ~2.5, not 18.
Components breakdown:
- Max subquestions score:
2.5(Q2 is the max)- Total Boosts Score:
100- Posted comments score:
2- Net post votes score:
1- Relevant ITN news:
decay(0.4, ...) = 0.1 * (7/3.5)^-2 = 0.025(within 7 days, distance 0.1 → 0.5-0.1=0.4 → decayed)Wait, let me recalculate. The article was created at freeze_time context (2025-04-18), so no decay:
- Relevant ITN news:
0.5 - 0.1 = 0.4(no decay since same day)Total:
2.5 + 100 + 2 + 1 + 0.4 = 105.9But expected is
109.025. Let me re-examine...Actually Q1 has resolution_set_time on 2025-04-11 (7 days ago):
- Q1:
decay(10, 2025-04-04)+decay(20, 2025-04-11)=0.625 + 5 = 5.625- Q2:
decay(10, 2025-04-11)=2.5Max is Q1 with 5.625. But comments say Q2 "Will be scored as 18" which is outdated.
Total:
5.625 + 100 + 2 + 1 + 0.4 = 109.025✓The test value is correct but the inline comments are stale.
📝 Proposed fix to update stale comments
The inline comments on lines 177 and 185 are outdated after the open boost reduction. Consider updating them:
group_of_questions=factory_group_of_questions( questions=[ - # Will be scored as 15 + # Will be scored as 5.625 (max) create_question( question_type=Question.QuestionType.BINARY, open_time=make_aware(datetime.datetime(2025, 4, 4)), scheduled_close_time=make_aware(datetime.datetime(2025, 4, 10)), resolution_set_time=make_aware(datetime.datetime(2025, 4, 11)), resolution="yes", ), - # Will be scored as 18 + # Will be scored as 2.5 create_question( question_type=Question.QuestionType.BINARY, open_time=make_aware(datetime.datetime(2025, 4, 11)), scheduled_close_time=make_aware(datetime.datetime(2025, 4, 25)), ), ] ),
🧹 Nitpick comments (1)
tests/unit/test_posts/test_services/test_hotness.py (1)
11-20: Consider adding test coverage for the new CP reveal time score.The new
_compute_question_hotness_cp_reveal_timefunction was added but there are no dedicated tests for it. Consider adding a test case that exercises the CP reveal time hotness component.Would you like me to generate a test case for the CP reveal time score component?
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
posts/services/hotness.pytests/unit/test_posts/test_services/test_hotness.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/hotness.pytests/unit/test_posts/test_services/test_hotness.py
🧬 Code graph analysis (1)
tests/unit/test_posts/test_services/test_hotness.py (3)
posts/services/hotness.py (2)
compute_post_hotness(160-161)handle_post_boost(210-227)tests/unit/conftest.py (1)
user1(46-48)posts/models.py (2)
Vote(1063-1077)VoteDirection(1064-1066)
🔇 Additional comments (8)
posts/services/hotness.py (4)
53-58: LGTM! Open time decay value reduced from 20 to 10.The change aligns with the PR objective to reduce the question open hotness boost.
80-85: LGTM! Component registry updated correctly.The new "CP Reveal Time Score" component is properly added to
QUESTION_HOTNESS_COMPONENTS.
151-157: LGTM! Approval score removed from POST_HOTNESS_COMPONENTS.The removal aligns with the PR comments requesting complete removal of the approval hotness boost.
61-67: LGTM! New CP reveal time score component follows established patterns.The implementation correctly mirrors
_compute_question_hotness_open_timewith appropriate null/time checks before applying decay.tests/unit/test_posts/test_services/test_hotness.py (4)
59-68: Verify the expected hotness calculation for active question.The expected value of
10.5should be verified:
- Open time (2025-04-11, 7 days ago):
decay(10, open_time)=10 * (7/3.5)^-2=10 * 0.25=2.5- Movement score:
20 * 0.4=8(question is OPEN status)- Total:
2.5 + 8=10.5✓The calculation appears correct.
69-81: Verify the expected hotness calculation for resolved question.The expected value of
5.625should be verified:
- Open time (2025-04-04, 14 days ago):
decay(10, open_time)=10 * (14/3.5)^-2=10 * 0.0625=0.625- Movement:
0(question is not OPEN, so movement is ignored)- Resolution time (2025-04-11, 7 days ago):
decay(20, resolution_set_time)=20 * (7/3.5)^-2=20 * 0.25=5- Total:
0.625 + 0 + 5=5.625✓The calculation appears correct.
82-92: Verify the expected hotness calculation for unsuccessfully resolved question.The expected value of
0.625should be verified:
- Open time (2025-04-04, 14 days ago):
decay(10, open_time)=10 * (14/3.5)^-2=0.625- Movement:
0(no movement specified, and question not OPEN)- Resolution time:
0(resolution is "annulled" which is inUnsuccessfulResolutionType, so ignored)- Total:
0.625✓The calculation appears correct.
210-228: Verify the boost/bury hotness calculations.
- Line 220: Initial hotness is
0(no components contribute) ✓- Line 224: After UP boost, score =
(0/4) + 20 = 20, so hotness =20✓- Line 228: After DOWN bury, score =
-(20/2) - 20 = -30, total boosts =20 + (-30) = -10, so hotness =-10✓The calculations are correct.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Implements changes requested in #4146
Changes
Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Changes