Skip to content

fix: penalize pool/vault tokens in asset search scoring#222

Merged
premiumjibles merged 1 commit into
mainfrom
worktree-sa-qvbh
Mar 23, 2026
Merged

fix: penalize pool/vault tokens in asset search scoring#222
premiumjibles merged 1 commit into
mainfrom
worktree-sa-qvbh

Conversation

@premiumjibles
Copy link
Copy Markdown
Contributor

@premiumjibles premiumjibles commented Mar 23, 2026

Summary

  • Pool/vault tokens (e.g., "Morpho Hadjime USDC Prime Pool") were outscoring real tokens like USD Coin in AssetService.scoreMatch due to name-contains-term bonus
  • Added a -500 score penalty for pool assets, ensuring real tokens always rank first
  • Added e2e test suite validating correct ranking for 20 tokens across multiple networks

Test plan

  • 20 token search scoring tests pass (USDC, USDT, FOX, WETH, WBTC, DAI, GNO, ETH, POL, AAVE, UNI, LINK, XDAI across Ethereum, Gnosis, Arbitrum, Polygon)
  • All 825 existing tests pass
  • Lint clean
  • Type-check clean

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved asset search ranking by adjusting scoring weights, ensuring real tokens appear above pool and vault tokens to prevent incorrect asset selection and pricing data failures.
  • Tests

    • Added extensive test coverage for asset search functionality, validating correct ranking behavior across multiple chains and 20+ token cases.

Pool tokens like "Morpho Hadjime USDC Prime Pool" were outscoring the
real "USD Coin" due to name-contains-term bonus. Add a -500 penalty for
pool assets in scoreMatch so real tokens always rank first.

Includes e2e tests validating 20 tokens across multiple networks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shapeshift-agentic Ready Ready Preview, Comment Mar 23, 2026 0:08am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f0e79430-4787-4f4a-85ac-7e2d12da83b1

📥 Commits

Reviewing files that changed from the base of the PR and between 0670971 and bdb2a31.

📒 Files selected for processing (3)
  • .tickets/sa-qvbh.md
  • packages/utils/src/AssetService.ts
  • packages/utils/src/__tests__/AssetService.test.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

A pool asset penalty (500-point deduction) is implemented in the asset search scoring mechanism to ensure real tokens rank higher than pool tokens in results. A comprehensive test suite validates this behavior across multiple assets and networks.

Changes

Cohort / File(s) Summary
Ticket Documentation
.tickets/sa-qvbh.md
Bug fix specification detailing the issue of pool tokens ranking above real tokens in asset search, root cause analysis, proposed scoring/structural solutions, and e2e test requirements for validation across 20+ token cases.
Scoring Implementation
packages/utils/src/AssetService.ts
Added 500-point penalty when scoreMatch evaluates a pool asset, ensuring pool tokens receive lower search ranking scores.
Test Coverage
packages/utils/src/__tests__/AssetService.test.ts
New table-driven test suite validating search scoring behavior across multiple assets and networks, asserting top-ranked results exclude pool tokens and match expected assets by ID, prefix, or symbol.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A pool once ranked too high and proud,
Now bears a penalty, scoring bowed—
Real tokens shine with clearer might,
While tests ensure the ranking's right! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-sa-qvbh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@premiumjibles premiumjibles marked this pull request as ready for review March 23, 2026 00:21
@premiumjibles premiumjibles merged commit f9133e6 into main Mar 23, 2026
4 checks passed
@premiumjibles premiumjibles deleted the worktree-sa-qvbh branch March 23, 2026 00:21
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.

1 participant