StringKe (#4532): `magpie accounts switch claude work` failed when "work"
was the alias; accountNamed matched the email only.
provider.AccountByName resolves a name (magpie accounts alias) among an
agent's accounts. It refuses a name two accounts share, and a name that
is another account's email or email part, so a name never picks the wrong
account. It is used by:
- accountNamed: accounts switch/on/off/remove/alias/cap and the rest
that take <email>;
- provider pool --accounts;
- accountRef (GUI and account-cap): the exact email first, then a name,
so another account's alias never shadows an email;
- account-cap's display, through AccountRefOf (it filtered by email).
Run (mote, at this commit):
- go test -timeout 45m -count=1 ./internal/provider ./internal/cli: ok
(104.9s, 33.2s).
- TestAccountsAliasPicksTheAccount, new: switch, alias, pool --accounts
and account-cap by name; a shared name and another account's email
refused. Red with each part removed by hand: the accountNamed call,
pool's resolution, the clash check, the shared-name check, accountRef's
name step.
Not run: the GUI suite (no GUI file changed); real accounts.