Skip to content

feat: implement contribution scoring engine (#270) - #314

Open
mayborn005 wants to merge 3 commits into
Adamantine-guild:mainfrom
mayborn005:feat/contribution-scoring-engine
Open

feat: implement contribution scoring engine (#270)#314
mayborn005 wants to merge 3 commits into
Adamantine-guild:mainfrom
mayborn005:feat/contribution-scoring-engine

Conversation

@mayborn005

Copy link
Copy Markdown

Summary

closes #270
Implements a pluggable contribution scoring engine as described in issue #270.

Changes

New: with time-decay ()

  • Third reference scoring strategy with exponential time-decay (half-life 30 days)
  • Awards 10 pts/attendance event, decaying older events exponentially
  • Prevents score inflation from stale activity while rewarding sustained engagement

New: audit log ()

  • Append-only event log for every score recomputation
  • Links to triggering outbox event via
  • Enables debugging, dispute resolution, and trend analysis

New:

  • Returns current score, per-signal breakdown, and recent recomputation history
  • Documented in OpenAPI spec

Updated:

  • now accepts optional and writes audit log entries
  • New function for retrieving recomputation history

Updated:

  • Passes outbox event ID to for audit traceability

Scoring Signals (pluggable)

Signal Type Default Description
Tenure tenure 1 pt/week, 52w cap Membership duration
Badge Count badge_count 5 pts/badge Badges held
Activity activity 10 pts/event, 30d half-life Decay-weighted attendance

Acceptance Criteria

  • Scoring strategy interface is pluggable (3 signals, new ones without touching call sites)
  • Scores update correctly in response to domain events via outbox handler
  • New read endpoint documented in OpenAPI spec
  • Design documented in docs/CONTRIBUTION_SCORING_DESIGN.md

Tests

  • 29 tests pass in packages/contribution-engine (including 6 new activity signal tests)
  • 18 tests pass in apps/access-api contribution-related test suites
  • Typecheck passes (pre-existing contractEventHelpers.ts error excluded)

…ntine-guild#270)

- Add ActivitySignal with exponential time-decay to contribution-engine
- Add ContributionEvent audit log model for score recomputation traceability
- Add GET /v1/communities/:communityId/members/:wallet/score endpoint
- Wire audit logging into contributionService recomputeAndPersist
- Update OpenAPI spec with new score endpoint
- Add design documentation in docs/CONTRIBUTION_SCORING_DESIGN.md
- Fix pre-existing test mock issues in contributionService.test.ts
- Fix handler test to pass triggerEventId to recomputeAndPersist

Acceptance criteria:
- Scoring strategy interface is pluggable (3 signals: tenure, badge, activity)
- Scores update correctly in response to domain events via outbox handler
- New read endpoint documented in OpenAPI spec
- Design documented in docs/CONTRIBUTION_SCORING_DESIGN.md
@Lakes41

Lakes41 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because one or more workflow checks failed.

Please review the failed checks, push a fix, and wait for the workflows to pass.

After the checks pass and there are no merge conflicts, the automation can review it again.

@zeemscript

Copy link
Copy Markdown

Fixed boss, check now

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.

Design and implement a contribution scoring engine (deferred area)

3 participants