Skip to content

feat: make gamification a moderation feature - #807

Open
ahosker wants to merge 3 commits into
dev-null-sh:productionfrom
ahosker:feat/daemon-reputation-requirement
Open

ahosker wants to merge 3 commits into
dev-null-sh:productionfrom
ahosker:feat/daemon-reputation-requirement

Conversation

@ahosker

@ahosker ahosker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Require daemon rank or higher (50 public XP) alongside existing reputation requirements to skip moderation.

  • Reuse the existing XP calculation; exclude pending, rejected, and deleted activity.
  • Preserve admin bypass and recent-report safeguards.
  • Update documentation and regression tests.

Validation: 133 tests passed; Pint and PHPStan passed.

Summary by CodeRabbit

  • Behavior Changes
    • Reputation-based eligibility now requires at least 50 XP, alongside the existing account-age, approved-commit, and follower requirements.
    • Pending, rejected, and deleted commits do not contribute toward the XP threshold. As a result, users below the threshold may receive AI review, while eligible users can qualify for reputation-based handling.

@ahosker ahosker changed the title Make Gamification a moderation feature feat: make gamification a moderation feature Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dcef526d-bd84-4b6e-bfe9-11ed02c9734c
Commits

Reviewing files that changed from the base of the PR and between d7cf006 and 72f57ae.

Files selected for processing: 3
  • app/Models/User.php
  • tests/Unit/Actions/CreateCommitTest.php
  • tests/Unit/Jobs/ModerateCommitTest.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

User::hasGoodReputation() now requires at least daemon-level XP. Tests cover XP totals, eligible commit history, and AI moderation outcomes.

Changes: Reputation eligibility

Layer / File(s) Summary
Add daemon-level XP requirement
app/Models/User.php
User::hasGoodReputation() now checks that queried XP meets UnixRank::Daemon->minXp(), in addition to the existing conditions.
Test XP and moderation outcomes
tests/Unit/Actions/CreateCommitTest.php, tests/Unit/Jobs/ModerateCommitTest.php
Tests cover moderation at 49, 50, and 155 XP; pending, rejected, and deleted commits; and daemon versus non-daemon reputation cases.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related issues

Possibly related PRs

Suggested reviewers: brendt, sandermuller

Merge Risk: Minimal · up to 72f57

No actionable issue was established with the new reputation threshold or its moderation outcomes. The change is mergeable after normal checks.

Security architecture risk: Low · up to 72f57

The change narrows automatic-approval eligibility without adding a new public endpoint or removing existing reputation requirements. Remaining design uncertainty concerns how mutable XP should affect approval over time. Existing handling of reports is unchanged.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The affected authority is publication without automated moderation within the existing commit system. For the same underlying state, satisfying the new gate necessarily satisfies the previous gate; XP manipulation alone cannot remove the retained age, approved-history, or follower requirements. No additional bypass consumer was identified.

Trust Boundaries and Controls

  • observed — The caller cannot select a privileged viewer for moderation XP: the gate passes null. Commit and streak queries then select approved activity, with normal soft-deletion filtering. Received and given stars are constrained to visible commits and exclude self-stars, preventing the inspected pending or rejected activity from qualifying through those inputs.

Resilience and Maintainability Implications

  • observed — The existing worker skips deleted or terminal commits. Reputation-based approval uses a transactional, pending-only row lock, so repeated execution does not reapply the terminal update. Provider failures follow the existing retry behavior and remain Pending on exhaustion rather than automatically approving content.

Hardening Proposals

  • proposed — Define whether approval uses decision-time XP or requires stronger snapshot and revocation semantics. Treat future changes to XP bonuses, penalties, and rank thresholds as moderation-policy changes because they now affect bypass authority.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately identifies the main change: using gamification status as a moderation eligibility requirement.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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.

1 participant