fix(multichain-account-service): prevent spurious alignment logs + smaller map state updates#8136
Open
fix(multichain-account-service): prevent spurious alignment logs + smaller map state updates#8136
Conversation
5fe9be0 to
db3a2cc
Compare
ccharly
commented
Mar 6, 2026
| return { wrapper, innerProvider }; | ||
| } | ||
|
|
||
| describe('AccountProviderWrapper', () => { |
Contributor
Author
There was a problem hiding this comment.
I've added some more tests for the wrapper, since we skip the alignAccounts call from the wrapper entirely now in case it's disabled.
So, with this new file, we can actually get better coverage in a more "unit-tests-like way" for this class.
ccharly
commented
Mar 6, 2026
| displayName, | ||
|
|
||
| // Exclude test helpers from coverage collection | ||
| coveragePathIgnorePatterns: ['.*/src/tests/.*'], |
Contributor
Author
There was a problem hiding this comment.
Some of the mock providers are not covered/used anymore by our tests.
The src/tests/providers.ts file is pretty messy right now, and instead of removing/moving things around, I prefer to not have it in the coverage at all for the time being.
I do plan to make a small refactor around that to avoid the .prototype hacks we're using there.
…maller map updates
db3a2cc to
875cf51
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
The current condition was ALWAYS logging the
Found missing accounts for account provider...line, since all alignments always returns the full list of accounts (even existing ones).To avoid triggering this, we now make a proper diff-set between the old accounts and new ones.
There's another benefit with doing this. Instead of clearing the entire state map, we now make smaller state update, which should be slightly faster when we have a tons of groups with a lot of accounts.
References
N/A
Checklist
Note
Medium Risk
Touches
MultichainAccountGroup.alignAccountsstate-mapping logic, including removing accounts when providers return fewer IDs, which could impact account visibility if the diffing is incorrect. Changes are scoped and covered by new unit tests, lowering the likelihood of regressions.Overview
Improves
MultichainAccountGroup.alignAccountsby diffing old vs new account IDs per provider instead of clearing and rebuilding all provider/account maps on every alignment. This prevents the “missing accounts” log from firing on no-op alignments and reduces state churn by only updating mappings when accounts were actually added/removed (and deleting mappings when a provider becomes disabled).Adds tests to ensure alignment removes accounts that providers stop returning, and introduces
AccountProviderWrapperalignment tests for enabled/disabled behavior. Updates Jest config to ignoresrc/testshelpers for coverage, and records the change/fix in the package changelog.Written by Cursor Bugbot for commit 875cf51. This will update automatically on new commits. Configure here.