Skip to content

fix: filter active solvers#7367

Open
limitofzero wants to merge 7 commits into
developfrom
fix/allow-only-active-solvers
Open

fix: filter active solvers#7367
limitofzero wants to merge 7 commits into
developfrom
fix/allow-only-active-solvers

Conversation

@limitofzero
Copy link
Copy Markdown
Contributor

@limitofzero limitofzero commented Apr 16, 2026

Summary

Remove inactive resolvers from cms

The bug: https://www.notion.so/cownation/Too-many-solvers-3438da5f04ca8065a06cfacf975ef5ba

Summary by CodeRabbit

  • Bug Fixes
    • Inactive solver networks are now properly filtered and excluded from the application interface, ensuring only active networks are displayed to users.

@limitofzero limitofzero requested a review from elena-zh April 16, 2026 13:03
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

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

Project Deployment Actions Updated (UTC)
cowfi Ready Ready Preview May 12, 2026 6:00pm
explorer-dev Ready Ready Preview May 12, 2026 6:00pm
storybook Ready Ready Preview May 12, 2026 6:00pm
swap-dev Ready Ready Preview May 12, 2026 6:00pm
widget-configurator Ready Ready Preview May 12, 2026 6:00pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
cosmos Ignored Ignored May 12, 2026 6:00pm
sdk-tools Ignored Ignored Preview May 12, 2026 6:00pm

Request Review

@limitofzero limitofzero requested a review from a team April 16, 2026 13:03
@limitofzero limitofzero self-assigned this Apr 16, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1c2ec71b-2841-4028-9e13-eb26f6e5f311

📥 Commits

Reviewing files that changed from the base of the PR and between 1bd9cfe and fb05464.

📒 Files selected for processing (2)
  • libs/core/src/cms/utils/getSolversInfo.ts
  • libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts

Walkthrough

The CMS solvers query now requests a top-level active field; the mapper destructures active and skips processing entries where active === false, preventing inactive solvers from producing solver network entries.

Changes

Solver Network Filtering

Layer / File(s) Summary
Data Shape
libs/core/src/cms/utils/getSolversInfo.ts
CMS /solvers populate now includes the top-level active field for solver items.
Mapping / Filtering
libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts
info.attributes now includes active; reducer returns early when active === false, skipping chain/env extraction and solverNetworks pushes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 I peeked in CMS fields, found active inside,
Hopped past the false ones with a graceful stride.
Solver networks trimmed, neat rows in a line,
The mapper smiles bright — the outputs align! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It lacks required sections from the template including 'To Test' (with verification steps/checklist) and 'Background'. Only a minimal 'Summary' section is provided with a Notion bug link. Add a 'To Test' section with steps and checkboxes for QA verification, and optionally a 'Background' section explaining the implementation details or rationale for the filtering approach.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: filter active solvers' directly and clearly summarizes the main change: implementing filtering to exclude inactive solvers from the solver networks mapping.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/allow-only-active-solvers

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts (2)

8-10: Please remove complexity suppression in this touched mapper

Line 8-9 keeps TODO + eslint-disable scaffolding while adding more branching here. Extract the network-entry mapping/filter into a small helper and drop the suppression.

As per coding guidelines, remove linter scaffolding (// TODO, eslint-disable) and extract helpers instead of disabling complexity checks.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts` around lines 8 -
10, Remove the TODO and the "// eslint-disable-next-line complexity" from
mapCmsSolversInfoToSolversInfo and extract the inner reduce logic that
maps/filter solver_networks.data entries into a new small helper (e.g.,
mapSolverNetworkEntry or filterAndMapSolverNetwork) that returns either a
SolverNetwork or null/undefined for invalid entries; then replace the inline
reduce callback in solverNetworks with a clear usage of the helper (filtering
out falsy results) so the complexity of mapCmsSolversInfoToSolversInfo is
reduced and the linter suppression can be removed.

12-17: Prefer allowlisting active entries (active === true) instead of only skipping false

On Line 15, active === false still passes through entries where active is missing. If the goal is “only active solvers,” use a positive check and return early for everything else.

Suggested change
-          // skip inactive solvers
-          if (active === false) {
+          // allow only active solvers
+          if (!active) {
             return acc
           }

As per coding guidelines, use !!value for explicit boolean conversions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts` around lines 12 -
17, The current filter skips only explicit false values so entries with
missing/undefined active still pass; in mapCmsSolversInfoToSolversInfo replace
the negative check (active === false) with a positive allowlist using an
explicit boolean conversion (e.g., ensure active is strictly true via !!active
or Boolean(active)) and return early for anything else so only entries where
active is true are processed (use the entry.attribute name `active` and
accumulator `acc` to locate the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts`:
- Around line 8-10: Remove the TODO and the "// eslint-disable-next-line
complexity" from mapCmsSolversInfoToSolversInfo and extract the inner reduce
logic that maps/filter solver_networks.data entries into a new small helper
(e.g., mapSolverNetworkEntry or filterAndMapSolverNetwork) that returns either a
SolverNetwork or null/undefined for invalid entries; then replace the inline
reduce callback in solverNetworks with a clear usage of the helper (filtering
out falsy results) so the complexity of mapCmsSolversInfoToSolversInfo is
reduced and the linter suppression can be removed.
- Around line 12-17: The current filter skips only explicit false values so
entries with missing/undefined active still pass; in
mapCmsSolversInfoToSolversInfo replace the negative check (active === false)
with a positive allowlist using an explicit boolean conversion (e.g., ensure
active is strictly true via !!active or Boolean(active)) and return early for
anything else so only entries where active is true are processed (use the
entry.attribute name `active` and accumulator `acc` to locate the change).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a61efcf1-c09b-4a29-9bfe-00cbf2891fdb

📥 Commits

Reviewing files that changed from the base of the PR and between 50434ec and 1bd9cfe.

📒 Files selected for processing (1)
  • libs/core/src/cms/utils/mapCmsSolversInfoToSolversInfo.ts

Copy link
Copy Markdown
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @limitofzero , great!

But this is weird on Arbitrum:

Image

Total number of solvers correspond to the active ones on Explorer, but why then more solvers participated that we have active ones?

Image

Same on Avalanche

Image

Could you please check why?

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 7, 2026

Deploying swap-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1e5fa16
Status:🚫  Build failed.

View logs

@limitofzero
Copy link
Copy Markdown
Contributor Author

@elena-zh I was used the wrong filter and filtered by solver network, changed it

image

@limitofzero limitofzero requested a review from elena-zh May 12, 2026 18:24
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.

2 participants