feat: Community & User Reputation System (Issue #15) #21
Open
gurhar1133 wants to merge 2 commits into
Open
Conversation
- Prisma schema: Review, Comment, Contribution, Endorsement, Badge, ReputationSnapshot - 14-route REST API with Zod validation, auth guards, and visibility enforcement - Reputation engine with log1p smoothing and append-only snapshot history - UI: leaderboard, user profile, project page with inline review + comment forms - 46 tests (25 unit + 21 integration), GitHub Actions CI - dev.sh one-command setup; --docker flag for zero-Node-install demo
Author
I see you retracted your comment, do you have other feedback/requests/changes for this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15
/claim 15
What this builds
Full implementation of the Community & User Reputation system: structured peer reviews, inline comments,
CRediT contributor credits, transparent reputation scoring, leaderboards, and badges — as a self-contained
community-reputation/ module.
How to run the demo
Only Docker Desktop required — no Node.js needed:
./community-reputation/dev.sh --demo --docker
With Node.js ≥ 18:
./community-reputation/dev.sh --demo
Opens at http://localhost:3000. A Demo login bar appears at the top — click Alice Chen ★ to sign in as the
admin user and try posting reviews, comments, and endorsements from the UI.
Quick API smoke-test
curl -s 'http://localhost:3000/api/leaderboards' | jq .
curl -s 'http://localhost:3000/api/leaderboards?domain=biology' | jq .
curl -s 'http://localhost:3000/api/reviews?projectId=demo-project-alice' | jq .
What's included
14 API routes covering the full spec:
cell), threaded replies
Reputation engine — composite score using log1p smoothing per component to prevent power-user dominance.
Weights sum to 100 for easy auditing. Every API response includes a breakdown array so scores are fully
explainable.
Visibility enforcement — serializeReview() in src/lib/visibility.ts is the single enforcement point for all
four modes (PUBLIC / SEMI_PRIVATE / ANONYMOUS / DOUBLE_BLIND) across every read path.
UI pages:
export link
form, threaded comment panel per review
Tests & CI — 46 tests total: 25 unit (reputation scorer, visibility rules, badge thresholds) and 21
integration (anonymity enforcement, endorsement guards, leaderboard ordering, review lifecycle, soft-delete
behaviour). GitHub Actions CI runs typecheck + unit + integration with a Postgres service container on every
push and PR.
Known limitations (documented in README)
registry, project fork counter, BountyCompletion table) that are out of scope for this issue
bypass for one-click demo login
Demo
community-page-demo_MCJkkNDB.mp4