Add more levels and change XP algorithm#2
Conversation
Added more levels and changed the XP algorithm for earning XP points in a commit.
Reviewer's GuideExtends the gamification level table up to level 100 and makes XP per-commit more generous and more strongly influenced by multi-file changes via updated weighting, scaling, and caps in calculate_commit_xp. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The extended levels list is now a very large hard-coded structure with many repeated titles; consider generating thresholds and titles programmatically (e.g., via formulas and ranges) to reduce maintenance cost and potential for inconsistencies.
- The XP calculation now hard-codes much larger weights, a more aggressive scaling formula, and a much higher level-dependent cap; it would be safer to move these magic numbers into configuration so they can be tuned without code changes and to avoid unexpected XP inflation.
- The new max_xp formula
100 + (current_level * 10)grows without a fixed upper bound and removes the previous safety cap of 50; you may want to reintroduce an absolute ceiling to prevent very high-level users from gaining extremely large XP from a single commit.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The extended levels list is now a very large hard-coded structure with many repeated titles; consider generating thresholds and titles programmatically (e.g., via formulas and ranges) to reduce maintenance cost and potential for inconsistencies.
- The XP calculation now hard-codes much larger weights, a more aggressive scaling formula, and a much higher level-dependent cap; it would be safer to move these magic numbers into configuration so they can be tuned without code changes and to avoid unexpected XP inflation.
- The new max_xp formula `100 + (current_level * 10)` grows without a fixed upper bound and removes the previous safety cap of 50; you may want to reintroduce an absolute ceiling to prevent very high-level users from gaining extremely large XP from a single commit.
## Individual Comments
### Comment 1
<location> `commit_checker/gamification.py:626` </location>
<code_context>
if base_xp > 0:
import math
- scaled_xp = math.log(1 + base_xp) * 8 # Logarithmic scaling
+ scaled_xp = math.log(1 + base_xp) * (1 + math.log(1 + base_xp) / 5) * 10 # Logarithmic scaling
else:
scaled_xp = get_base_commit_xp(config)
</code_context>
<issue_to_address>
**question (bug_risk):** The new scaling formula is closer to quadratic in log(base_xp), which may significantly increase XP at higher ranges.
This new term `(1 + log(1 + base_xp)/5) * 10` makes XP growth roughly proportional to `log(base_xp)^2` at large values, which may actually accelerate XP gain for very large commits rather than dampening it. Consider plotting old vs new XP over a realistic `base_xp` range to confirm it matches the intended progression and doesn’t introduce large jumps for big refactors.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if base_xp > 0: | ||
| import math | ||
| scaled_xp = math.log(1 + base_xp) * 8 # Logarithmic scaling | ||
| scaled_xp = math.log(1 + base_xp) * (1 + math.log(1 + base_xp) / 5) * 10 # Logarithmic scaling |
There was a problem hiding this comment.
question (bug_risk): The new scaling formula is closer to quadratic in log(base_xp), which may significantly increase XP at higher ranges.
This new term (1 + log(1 + base_xp)/5) * 10 makes XP growth roughly proportional to log(base_xp)^2 at large values, which may actually accelerate XP gain for very large commits rather than dampening it. Consider plotting old vs new XP over a realistic base_xp range to confirm it matches the intended progression and doesn’t introduce large jumps for big refactors.
Added more levels and changed the XP algorithm for earning XP points in a commit.
Summary by Sourcery
Extend the gamification system with higher-level progression and adjust commit XP calculations to reward multi-file changes more strongly and allow higher per-commit XP.
New Features:
Enhancements: