Skip to content

fix: clamp completionRate and onTimeDeliveryRate in adaptReputation using coerceFraction (#91) - #168

Open
rafaio1 wants to merge 1 commit into
MergeFi:mainfrom
rafaio1:fix/91-adapt-reputation-clamp
Open

fix: clamp completionRate and onTimeDeliveryRate in adaptReputation using coerceFraction (#91)#168
rafaio1 wants to merge 1 commit into
MergeFi:mainfrom
rafaio1:fix/91-adapt-reputation-clamp

Conversation

@rafaio1

@rafaio1 rafaio1 commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #91.

  • Import coerceFraction in adapters.ts and use it to clamp both completionRate and onTimeDeliveryRate after dividing by 100, preventing out-of-range backend values (e.g. "150" or negative) from producing impossible displayed percentages like "150%" or "-20%".
  • A raw value of "150" now correctly produces 1 (clamped), a negative value produces 0, and a normal in-range value like "94" continues to produce 0.94 with no regression.
  • Adapter-layer audit: Reviewed adaptBounty, adaptMilestone, and adaptMaintenancePool for similar unclamped fraction derivations — none found; these two fields in adaptReputation were the only instances where a percentage string was divided by 100 without subsequent clamping.
  • TypeScript compiles cleanly with npx tsc --noEmit.

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

adaptReputation computes completionRate/onTimeDeliveryRate without clamping, despite an unused coerceFraction helper built for exactly this

1 participant