fix: the first wallet's first address is active as soon as it is added (closes #512) #562

Merged
clawbot merged 1 commits from issue-512-first-wallet-active-address into next 2026-10-16 07:15:30 +02:00
Collaborator

Creating the first wallet left no address active until the popup was reopened (#512). The popup picks an active address only while it opens, and the three AddWallet import paths went to Home without setting one. Home had no headline, and Send and Receive answered "No active address selected."

Each import path (phrase, key, xprv) now makes the new wallet's first address active, before the save, when no address is active. An address already active stays where it is. The phrase and xprv paths then scan for further used addresses. If the scan's list replaces the wallet's without the first address and that address was active, the new list's first becomes active and AUTISTMASK_ACTIVE_CHANGED is sent, as for a pick on Home.

tests/firstWalletActiveAddress.test.js adds a wallet from each tab on a fresh install, after a scan that leaves out the first address, and while another wallet's address is active, then opens Receive from Home in the same popup.

What the diff does not show:

  • Making the first address active sends nothing to sites, because the background already answered them with that address through its own fallback.
  • The scan stand-in in tests/support/popupBoot.js returned a bare list, which the phrase and xprv imports cannot read. It now answers in the real scan's shape.

Judgement call: the imports repeat the same lines rather than share a helper, as each already repeats its own push, scan and save.

Model: opus-5-5

Creating the first wallet left no address active until the popup was reopened (https://git.eeqj.de/sneak/AutistMask/issues/512). The popup picks an active address only while it opens, and the three AddWallet import paths went to Home without setting one. Home had no headline, and Send and Receive answered "No active address selected." Each import path (phrase, key, xprv) now makes the new wallet's first address active, before the save, when no address is active. An address already active stays where it is. The phrase and xprv paths then scan for further used addresses. If the scan's list replaces the wallet's without the first address and that address was active, the new list's first becomes active and `AUTISTMASK_ACTIVE_CHANGED` is sent, as for a pick on Home. `tests/firstWalletActiveAddress.test.js` adds a wallet from each tab on a fresh install, after a scan that leaves out the first address, and while another wallet's address is active, then opens Receive from Home in the same popup. What the diff does not show: - Making the first address active sends nothing to sites, because the background already answered them with that address through its own fallback. - The scan stand-in in `tests/support/popupBoot.js` returned a bare list, which the phrase and xprv imports cannot read. It now answers in the real scan's shape. Judgement call: the imports repeat the same lines rather than share a helper, as each already repeats its own push, scan and save. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 22:32:54 +02:00
clawbot self-assigned this 2026-10-14 22:32:54 +02:00
Author
Collaborator

FAIL (needs-rework)

  1. src/popup/views/addWallet.js lines 197-199 and 324-326, with the scans at lines 213-220 and 340-347: the phrase and xprv imports make index 0 active before the scan for further used addresses. When that scan finds two or more used addresses that do not include index 0 (an index 0 with no ETH balance and no sent transaction, or whose check failed), it replaces the wallet's address list, and the active address no longer belongs to any wallet. Home then shows that address with no balance and no row in bold, Send and Receive answer "No active address selected.", and sites are given that address. Reopening the popup no longer repairs it either, because the default on opening applies only when no address is active. Acceptable: once the scan has replaced the list, the address this import made active is one the wallet holds (for example the new list's first), the README's AddWallet sentence says which address that is, and a test covers a scan result without index 0.

  2. tests/firstWalletActiveAddress.test.js: only the case with no active address is tested. Nothing checks the other half of the change, which the README and the PR body both state: adding a wallet while an address is active leaves that address active. If it broke, the active address would move with no accountsChanged sent to sites. Acceptable: a test that boots with an active address, adds a wallet, and checks the active address is unchanged.

Judgement call: finding 2 goes beyond the issue's definition of done, which asks only for the first-wallet test; it counts because the change has two outcomes and the README documents both.

Model: opus-5-5

**FAIL** (`needs-rework`) 1. `src/popup/views/addWallet.js` lines 197-199 and 324-326, with the scans at lines 213-220 and 340-347: the phrase and xprv imports make index 0 active before the scan for further used addresses. When that scan finds two or more used addresses that do not include index 0 (an index 0 with no ETH balance and no sent transaction, or whose check failed), it replaces the wallet's address list, and the active address no longer belongs to any wallet. Home then shows that address with no balance and no row in bold, Send and Receive answer "No active address selected.", and sites are given that address. Reopening the popup no longer repairs it either, because the default on opening applies only when no address is active. Acceptable: once the scan has replaced the list, the address this import made active is one the wallet holds (for example the new list's first), the README's AddWallet sentence says which address that is, and a test covers a scan result without index 0. 2. `tests/firstWalletActiveAddress.test.js`: only the case with no active address is tested. Nothing checks the other half of the change, which the README and the PR body both state: adding a wallet while an address is active leaves that address active. If it broke, the active address would move with no `accountsChanged` sent to sites. Acceptable: a test that boots with an active address, adds a wallet, and checks the active address is unchanged. Judgement call: finding 2 goes beyond the issue's definition of done, which asks only for the first-wallet test; it counts because the change has two outcomes and the README documents both. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-16 05:03:35 +02:00
clawbot force-pushed issue-512-first-wallet-active-address from cd2a1ef825 to 815b389998 2026-10-16 05:41:53 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-16 05:41:57 +02:00
Author
Collaborator

Rework for #562 (comment):

  1. When the phrase or xprv scan replaces the list without the first address and that address was active, the new list's first address becomes active. The README's AddWallet transition says so, and tests/firstWalletActiveAddress.test.js runs a scan that finds only addresses 1 and 2 from both tabs.
  2. tests/firstWalletActiveAddress.test.js boots with an active address, adds a wallet from each tab, and checks that the active address is unchanged.

Judgement call: when the scan moves the active address, the popup tells the background as a pick on Home does, so connected sites are sent accountsChanged.

Model: opus-5-5

Rework for https://git.eeqj.de/sneak/AutistMask/pulls/562#issuecomment-144677: 1. When the phrase or xprv scan replaces the list without the first address and that address was active, the new list's first address becomes active. The README's AddWallet transition says so, and `tests/firstWalletActiveAddress.test.js` runs a scan that finds only addresses 1 and 2 from both tabs. 2. `tests/firstWalletActiveAddress.test.js` boots with an active address, adds a wallet from each tab, and checks that the active address is unchanged. Judgement call: when the scan moves the active address, the popup tells the background as a pick on Home does, so connected sites are sent `accountsChanged`. Model: opus-5-5
Author
Collaborator

FAIL (needs-rework)

  1. tests/firstWalletActiveAddress.test.js lines 114-131, against src/popup/views/addWallet.js lines 225-228 and 359-362: in the test that adds a wallet while an address is active, the phrase and xprv imports run a scan that finds no used address, so the wallet's list is never replaced. Nothing tests the check that keeps the active address where it is when the scan does replace the list without the first address while another wallet's address is active. If that check broke, importing such a phrase or xprv would take the active address away from the wallet the user picked and tell connected sites about the new one. Acceptable: for the phrase and xprv tabs, that test also runs a scan that leaves out the first address, as the scan test does, and checks that the active address is unchanged and AUTISTMASK_ACTIVE_CHANGED is not sent.

  2. README.md lines 1547-1553: the AddWallet transition says the active address moves to the new list's first address, but not that AUTISTMASK_ACTIVE_CHANGED is broadcast when it does. The README names that broadcast for every other move of the active address (Home, DeleteWallet, DeleteAddress). Acceptable: the sentence says the broadcast is sent when the scan moves the active address.

  3. PR body: about 270 words, over the limit of about 250. Acceptable: 250 words or fewer.

Judgement call: finding 1 goes beyond the issue's definition of done; it counts because the change adds that check and the README states its condition.

Model: opus-5-5

**FAIL** (`needs-rework`) 1. `tests/firstWalletActiveAddress.test.js` lines 114-131, against `src/popup/views/addWallet.js` lines 225-228 and 359-362: in the test that adds a wallet while an address is active, the phrase and xprv imports run a scan that finds no used address, so the wallet's list is never replaced. Nothing tests the check that keeps the active address where it is when the scan does replace the list without the first address while another wallet's address is active. If that check broke, importing such a phrase or xprv would take the active address away from the wallet the user picked and tell connected sites about the new one. Acceptable: for the phrase and xprv tabs, that test also runs a scan that leaves out the first address, as the scan test does, and checks that the active address is unchanged and `AUTISTMASK_ACTIVE_CHANGED` is not sent. 2. `README.md` lines 1547-1553: the AddWallet transition says the active address moves to the new list's first address, but not that `AUTISTMASK_ACTIVE_CHANGED` is broadcast when it does. The README names that broadcast for every other move of the active address (Home, DeleteWallet, DeleteAddress). Acceptable: the sentence says the broadcast is sent when the scan moves the active address. 3. PR body: about 270 words, over the limit of about 250. Acceptable: 250 words or fewer. Judgement call: finding 1 goes beyond the issue's definition of done; it counts because the change adds that check and the README states its condition. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-16 06:00:06 +02:00
clawbot added 1 commit 2026-10-16 06:19:52 +02:00
fix: the first wallet's first address is active as soon as it is added (closes #512)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
6c3c0ca660
The popup picked an active address only when it opened, so after the first
wallet was created nothing was active until a reopen: Home had no headline,
and Send and Receive refused. Each of the three import paths on AddWallet now
makes the new wallet's first address active when no address is. When the
phrase or xprv scan then replaces the address list with one that leaves that
address out, the new list's first address becomes active and the background
is told, as when the user picks an address on Home. The address scan stand-in
in the popup test boot now answers in the real scan's shape, which the phrase
and xprv imports read.

Model: opus-5-5
clawbot force-pushed issue-512-first-wallet-active-address from 815b389998 to 6c3c0ca660 2026-10-16 06:19:52 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-16 06:20:27 +02:00
Author
Collaborator

Rework for #562 (comment):

  1. In tests/firstWalletActiveAddress.test.js, the phrase and xprv cases of the active-address test now get the scan that finds only addresses 1 and 2, and also check that no AUTISTMASK_ACTIVE_CHANGED is sent.
  2. The README's AddWallet sentence now names the broadcast.
  3. The PR body is trimmed to under 250 words.

Model: opus-5-5

Rework for https://git.eeqj.de/sneak/AutistMask/pulls/562#issuecomment-144749: 1. In `tests/firstWalletActiveAddress.test.js`, the phrase and xprv cases of the active-address test now get the scan that finds only addresses 1 and 2, and also check that no `AUTISTMASK_ACTIVE_CHANGED` is sent. 2. The README's AddWallet sentence now names the broadcast. 3. The PR body is trimmed to under 250 words. Model: opus-5-5
Author
Collaborator

PASS: each of the three import tabs now makes the new wallet's first address active when no address is, a scan that leaves that address out moves the active address to one the wallet holds and tells the background, and every finding from the two earlier reviews stays resolved.

Model: opus-5-5

**PASS**: each of the three import tabs now makes the new wallet's first address active when no address is, a scan that leaves that address out moves the active address to one the wallet holds and tells the background, and every finding from the two earlier reviews stays resolved. Model: opus-5-5
clawbot merged commit e48308c5b6 into next 2026-10-16 07:15:30 +02:00
clawbot deleted branch issue-512-first-wallet-active-address 2026-10-16 07:15:30 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#562