refactor: remove always-on code fences#40318
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (1 files, +22 -38)
✅ @MetaMask/confirmations (1 files, +0 -4)
👨🔧 @MetaMask/core-extension-ux (5 files, +115 -243)
🫰 @MetaMask/core-platform (6 files, +0 -16)
|
Builds ready [cb38216]
⚡ Performance Benchmarks (1331 ± 92 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
…k, but that might be a mistake)
cb38216 to
5d4bac7
Compare
| let enabled = false; | ||
| ///: BEGIN:ONLY_INCLUDE_IF(bitcoin) | ||
| enabled = isMultichainFeatureEnabled(bitcoinAccounts); | ||
| ///: END:ONLY_INCLUDE_IF |
There was a problem hiding this comment.
Dead code pattern left from fence removal
Low Severity
After removing the bitcoin and tron code fences, getIsBitcoinSupportEnabled and getIsTronSupportEnabled retain a let enabled = false; enabled = ... pattern with a now-stale comment "When bitcoin is not enabled, always return false." The initial false assignment is dead code since the next line always overwrites it. Compare with getIsSolanaSupportEnabled which cleanly returns the result directly. These selectors can be simplified to match that pattern.
Additional Locations (1)
There was a problem hiding this comment.
This is a much larger issue to be resolved later, I put it in a TODO
Builds ready [5d4bac7]
⚡ Performance Benchmarks (1405 ± 106 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
Builds ready [5359478]
⚡ Performance Benchmarks (1433 ± 107 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
|
|
||
| ///: END:ONLY_INCLUDE_IF | ||
|
|
||
| UnifiedTransactionList.propTypes = { |
There was a problem hiding this comment.
This file will be retired soon-ish but no harm cleaning it up now
Other changes for extension UX LGTM
|
Looks like these instances are missing from the diff: |
@MajorLift Oy, these aren't a hard merge conflict but basically a soft merge conflict. Someone added these new ones. How do we deal with this? |
|
We should aim to have the codebase free of all targeted code fences at the time this merges, no? If so, incoming regressions from the main branch will need to be resolved here. This unfortunately makes gathering CO approvals really tedious since they can be dismissed at any time. That said I'm not opposed to cleaning these up in a follow-up PR. I think the only thing to keep in mind would be that if |
|
@MajorLift even once this merges, it doesn't contain a mechanism to stop people from putting new code fences in. I also don't know the alternative to this block in builds.yml |
6895948 to
f20c3e6
Compare
f20c3e6 to
371c87f
Compare
|
Builds ready [371c87f]
⚡ Performance Benchmarks (1409 ± 114 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|




Description
Q: Why is this a single PR and not 6 PRs?
A: It might be easier to review, but they all touch overlapping files in overlapping areas, and if this were 6 PRs you would get a whole bunch of merge conflicts. I did separate it into 6 commits though, if you want to review it per commit.
Removed the following 6 code fence classes:
Changelog
CHANGELOG entry: null
Note
Medium Risk
Broad, cross-cutting removal of build-time guards can change what code ships/executes per build flavor and may surface previously-uncompiled paths or missing dependencies, especially around multichain/Snap-keyring flows.
Overview
Removes the
ONLY_INCLUDE_IFcode-fence gating for features that were effectively always enabled (keyring-snaps,multichain,bitcoin,tron, plusbitcoin-swapsand apetnamestest-only fence), making the previously conditional code paths compile and run consistently across standard builds.This simplifies build configuration (
builds.ymldropsmultichain/bitcoin-swapsfeature entries and converts bitcoin/tron/keyring-snaps into plain asset sections) and updates both background + UI code to treat Snap-keyring account management, multichain account providers, and non-EVM transaction/activity UI as always present (while still respecting runtime remote feature flags for enabling/disabling providers).Written by Cursor Bugbot for commit 371c87f. This will update automatically on new commits. Configure here.