Keep a hidden account's name out of transfer names
Sure names each leg of a transfer after the account on the other side: Transfer::Creator writes "Transfer to Savings" on the outflow and "Transfer from Checking" on the inflow, the transfer matcher and the manual match name the leg it creates the same way, and fees read "Transfer fee ā Transfer to Savings". When one of the two accounts is shared with a family member and the other is not, that member reads the other account's name in the leg on the shared account: in the transactions list, the transaction drawer, name in GET /api/v1/transactions, and the assistant and MCP tools. The list subtitle and the API's transfer.other_account (#5699) already leave that account out.
The stored name stays as it is, so the owner, anyone who can open both accounts and existing data keep the descriptive name, and a later change in sharing applies at once. Names are adjusted when they are shown. Transaction#name_for(accessible_account_ids) (and Entry#name_for) returns the entry's name, except on a transfer leg or fee whose other account the reader cannot open. There it replaces that account's name with "another account", and when the account was renamed after the transfer, it replaces the tail of a name in the shape Sure generates. A name a user wrote that does not contain the account's name is kept. Which accounts the reader can open comes from Account.accessible_by, as in the list subtitle and #5699: Current.accessible_account_ids on the web, api_accessible_account_ids in the API (from #5699) and an accessible_account_ids helper on Assistant::Function (moved up from TransferMatchSupport).
Where it applies:
- Web: the transaction row (its cache key now notes whether the name was adjusted, which covers fee rows), the transaction drawer's name field, the budget category page, Reports' biggest expenses (contributions to an investment account count as expenses), goal withdrawals, the recurring picker and candidate rows, the printed report, bill history and payment review, the split editor, the transfer match and duplicate-merge forms, and the names prefilled when duplicating a transaction or starting a bill from one. The transfer drawer shows a side the user cannot open as "Another account", without a link or logo.
- API:
namein the transactions endpoints./api/v1/transfersalready needs access to both accounts. The OpenAPI description ofnamesays so. - Assistant and MCP:
get_transactions(also itsclean_name),get_uncategorized_transactionspayee labels,update_transaction,delete_transaction, rule previews and the transfer match tools.get_transactionsnow usesTransaction#counterpart_accountfortransfer_accountin place of its own lookup. - Name suggestions and Quick Categorize work on stored names: suggestions are filled from them, and the wizard groups, titles and builds rules from them. Both leave out the legs and fees of transfers with an account the user cannot open (
Transaction.with_counterpart_hidden_from). The uncategorized count on the transactions page uses the same set, so it matches the wizard. Those transactions can still be categorized from the list or the drawer.
Left as they are: the family export, which only admins can run and which includes every account; transaction search, which matches stored names but returns only rows the user can already see; recurring transfers, which store their own name and are created only by someone who can write to both accounts; and provider mirrors (Sharesight, Trade Republic) that write an account's name into a transaction outside any transfer.
Tests use synthetic accounts ("Shared Checking", "Hidden Savings", "Hidden Mortgage"): model tests for name_for (outflow, inflow, payment, renamed account, user-written name, fee, plain transaction) and for the scope, plus controller, view-cache, API and assistant tests for the places above. The tests of the hidden case fail without the change; those for a reader who can open both accounts pass before and after.
Stacked on #5699: both change Api::V1::BaseController and the transaction jbuilder, and this branch reuses its accessible-account helper.
Summary by cubic
Keeps a hidden account's name out of transfer leg and fee names for readers who cannot open that account, replacing it with a localized "another account" while leaving the stored name unchanged for owners.
- Applied wherever entry names are shown: transaction row and drawer, budget category page, reports, goal withdrawals, recurring picker, bill history, split editor, transfer match and duplicate-merge forms, prefilled duplicate/bill names, the API's
namefield, weekly cleanup samples, and assistant/MCP tools. - Name suggestions and Quick Categorize exclude legs and fees of transfers with an account the reader cannot open (
Transaction.with_counterpart_hidden_from), so the uncategorized count matches the wizard's set. - The transfer drawer shows an unreadable side as "Another account" with no link or logo.
- Assistant tools reread account access on every call, so a share revoked mid-conversation stops naming that account; tools that name many entries read it once per call to keep one query.
- Left as-is: family export, transaction search, recurring transfers, and provider mirrors.
- Stacked on the API transfer-counterparty-access branch and reuses its accessible-account helper.