Skip to content

Implement basic contribution scoring logic #4

Description

@AbdulSnk

Overview

StreamForge Core needs a scoring module that takes ingested contribution events and produces a deterministic score for each contributor. This score will later feed into the reward calculation pipeline.

What needs to be done

  • Create a scoring module under src/
  • Implement a score_event function that accepts an Event struct and returns a numeric score
  • Apply basic scoring rules:
    • pull_request event = 10 points
    • commit event = 5 points
    • review event = 3 points
    • unknown event types = 0 points
  • Implement a aggregate_scores function that takes a list of events and returns total score per contributor

Acceptance Criteria

  • src/scoring.rs module exists and is wired into main.rs
  • score_event correctly returns points based on event type
  • aggregate_scores correctly totals scores per contributor
  • Unit tests cover all event types including unknown types
  • Edge cases handled: empty list, single event, multiple contributors

Pre-Submission Checklist

  • I have run cargo build locally and it succeeds
  • I have run cargo test locally and all tests pass
  • I have run cargo fmt to format my code
  • I have run cargo clippy and fixed all warnings

Notes

Scoring rules are intentionally simple for now. The goal is a clean, testable foundation that can be extended later with weighted scoring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions