Skip to content

fix(classification): deduplicate risk categories and expand regression tests (#1977) - #2002

Draft
s6pa1rta3n-lab wants to merge 1 commit into
Commitlabs-Org:masterfrom
s6pa1rta3n-lab:fix-issue-1977
Draft

s6pa1rta3n-lab wants to merge 1 commit into
Commitlabs-Org:masterfrom
s6pa1rta3n-lab:fix-issue-1977

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Closes #1977.

Resolves an issue where classifyAtRiskCommitments could push duplicate 'action_required' entries when a commitment was both marked as Violated and exceeded 80% of its maxLoss drawdown threshold.

Changes Made

  • Ensured riskCategories is strictly deduplicated via Array.from(new Set(riskCategories)) prior to returning from classifyAtRiskCommitments.
  • Added JSDoc documentation to classifyAtRiskCommitments specifying the classification contract, risk categories, and deduplication guarantees.
  • Removed inline comments in compliance with repository clean code standards.
  • Converted ProtocolConstants import to type-only import (import type { ProtocolConstants }).
  • Added regression tests in both src/utils/__tests__/classification.test.ts and src/utils/tests/classification.test.ts verifying that a commitment satisfying both Violated status and drawdown >= 80% of maxLoss has action_required appear exactly once.
  • Added comprehensive coverage for simultaneous multi-risk conditions and custom classification thresholds.
  • Verified 100% test and branch coverage across src/utils/classification.ts.

Payout Stipulations Checklist

  • Deduplicate riskCategories via Set before returning in classifyAtRiskCommitments
  • Add regression test with a commitment that is both Violated and past the 80% drawdown threshold
  • Assert 'action_required' appears exactly once in riskCategories
  • Test suite present in src/utils/tests/classification.test.ts and src/utils/__tests__/classification.test.ts
  • Zero mock assertions used; actual domain evaluation logic verified
  • All 28 tests passing with 100% statements, branches, functions, and line coverage
  • Prettier code formatting verified without warnings
  • ESLint validation passed with zero errors

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

@vercel

vercel Bot commented Sep 29, 2026

Copy link
Copy Markdown

@s6pa1rta3n-lab is attempting to deploy a commit to the 1nonly's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

classifyAtRiskCommitments can push a duplicate 'action_required' risk category entry

1 participant