Skip to content

Bug: Reputation tier boundaries don't handle scores above 1000 — no tier displayed #370

@gboigwe

Description

@gboigwe

Description

In frontend/src/app/publisher/page.tsx (lines 299-319), the reputation tier boundaries have ambiguous edge cases:

const tiers = [
  { tier: 'Bronze', min: 0, max: 399, color: 'amber' },
  { tier: 'Silver', min: 400, max: 599, color: 'gray' },
  { tier: 'Gold', min: 600, max: 799, color: 'yellow' },
  { tier: 'Platinum', min: 800, max: 1000, color: 'blue' },
];

With the check: reputationScore >= min && reputationScore <= max

Problem

While the boundaries themselves are technically correct (no gaps or overlaps), there are issues:

  1. Scores above 1000 aren't handled — if the contract returns a score > 1000, no tier matches
  2. Negative scores aren't handled — if the contract returns a negative value, no tier matches
  3. The max: 1000 implies a hard cap, but the smart contract may not enforce this limit
  4. When no tier matches, the UI shows nothing — no fallback or error state

Impact

  • Publishers with scores outside 0-1000 see no tier information
  • Edge case: score of exactly 1000 is Platinum, but 1001 is nothing
  • No visual indication that something went wrong

Suggested Fix

const tiers = [
  { tier: 'Bronze', min: 0, max: 399, color: 'amber' },
  { tier: 'Silver', min: 400, max: 599, color: 'gray' },
  { tier: 'Gold', min: 600, max: 799, color: 'yellow' },
  { tier: 'Platinum', min: 800, max: Infinity, color: 'blue' },  // No upper cap
];

const currentTier = tiers.find(t => score >= t.min && score <= t.max) 
  ?? tiers[0]; // Fallback to Bronze

File

frontend/src/app/publisher/page.tsx — Lines 299-319

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontendNextjs frontend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions