Skip to content

Build a deterministic contribution score normalisation engine #387

Description

@Lakes41

Difficulty: Expert
Type: Feature
Recommended labels (if available in this repo): contributions, backend, consistency, expert

Background

GuildPass communities may eventually combine different contribution metrics, such as code contributions, participation or completed tasks, into comparable scoring dimensions.

Raw metrics can operate on incompatible scales. A standalone normalisation engine provides a mathematical primitive for later contribution systems without implementing the entire contribution engine.

Problem

There is currently no shared Core utility for converting heterogeneous weighted metrics into a deterministic bounded score.

Floating-point calculations, undefined missing-value behaviour and inconsistent clamping rules can make scoring difficult to reproduce.

Expected Outcome

Implement a pure contribution score normalisation engine using exact or explicitly controlled arithmetic and a documented scoring model.

Suggested Implementation

Inputs may resemble:

interface ContributionMetric {
  key: string;
  value: bigint;
  minimum: bigint;
  target: bigint;
  weightBps: number;
}

The engine should:

  • validate metric ranges;
  • use integer basis points or another exact weighting representation;
  • avoid ordinary floating-point threshold calculations;
  • normalise each metric into a bounded range;
  • combine weighted metrics deterministically;
  • define behaviour when a value exceeds its target;
  • define behaviour for zero-range metrics;
  • validate total configured weights;
  • expose per-metric intermediate results for explainability;
  • support large bigint input values;
  • produce one documented final score scale, such as 0-10,000 basis points;
  • remain storage-independent.

Acceptance Criteria

  • Individual metrics are normalised deterministically.
  • Weighted combination uses exact or controlled integer arithmetic.
  • Final scores remain inside the documented range.
  • Inputs below minimum and above target have explicitly defined behaviour.
  • Invalid ranges are rejected.
  • Invalid weights are rejected.
  • Large bigint metrics are supported.
  • Equivalent metrics supplied in different array order produce the same result if metric keys are unique.
  • Per-metric calculation details are returned.
  • Unit tests cover boundary values, weighting, clamping and large numbers.
  • pnpm typecheck passes.
  • pnpm build passes.
  • pnpm test passes.
  • No contribution persistence, badge or reward integration is included.

Likely Affected Files/Directories

packages/contribution-normalisation/ or equivalent isolated package
unit tests

Independence Requirement

This task must remain a pure scoring primitive and must not depend on the reward engine, contribution persistence or another campaign issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesThird CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsbackendBackend services, application logic, persistence integration, and server-side functionalityconsistencyPattern and convention standardization across the codebase for uniformitycontributionsContribution tracking, participation signals, scoring, and member contribution logicexpertExpert difficulty tasks requiring deep expertise and architectural decision-making

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions