The Aliases page
The admin's list of aliases: bank words that name a merchant, and the envelope and owner it usually goes to. It is admin only (/aliases) and fits a phone. It is in the admin's "Switch page" menu on every screen width. Anyone else who opens it sees "This page is for the admin" and none of the data.
It reads one thing, the Aliases snapshot (GET /api/aliases/snapshot), and core's view models word it (MR-118). The page decides nothing: the words, the checks and what a Match catches all come from core.
In plain words
The bank words every purchase differently: "PURCHASE AUTHORIZED ON 12/01 GRAVESIDE GROCER #12 NJ" is the corner grocer. An alias says "when you see the words Graveside, the merchant is Graveside Grocer, it usually comes out of Groceries, and it belongs to the household." Reconcile uses the aliases to name each bank line, and to guess the envelope and owner of a line nobody has typed in yet.
This page is where the admin keeps that list. Nothing here moves money. Saving an alias does not rewrite earlier entries: it changes how later bank lines are read.
What is on it
The list. A count ("7 aliases.", or "Showing 2 of 31." when a filter is on) and, when some rows need fixing, "2 need fixing." The count and that line always cover the whole list, so a filter never hides a problem. Each row (a card, so a phone needs no sideways scrolling) shows the Match, the Merchant, the Envelope, the Owner, whether it is a Card payment, any Notes, and how many of the recent bank lines it wins ("Wins 2 of 12 recent lines."). The rows are in Match order. Find an alias narrows the list as you type, by words in the Match, merchant or notes (capital letters and punctuation don't matter).
Rows that need fixing. A row says why, in words, under "Needs fixing": the same words as another row, an envelope that is no longer offered, or a Match that a money movement also uses (the movement wins, so the alias never gets those lines).
The form. Add an alias and each row's Edit open it. Fields: Match, Canonical merchant, Default envelope, Default owner, "This is a payment to a household credit card" and Notes. Each mistake is written on its own field and focus goes to the first one. The form is checked again by the server on its own rows, and a refusal from it is written on the fields it names. A Match that a money movement also uses is allowed, with a "Heads up" notice.
What this would catch. Beside the form (under it on a phone), it updates as you type the Match and merchant. It lists the recent bank lines the words fit and what each becomes once the alias is saved:
- "Becomes Graveside Grocer."
- "Another alias wins: Graveside Fuel." (a longer alias keeps the line)
- "Tied with another alias for a different merchant, so nothing is guessed."
- "A money movement wins: mortgage payback."
A line that reads as something else today says what it reads as now. The one-line summary above the list ("These words fit 3 of 12 recent lines; 2 would become Graveside Grocer.") is announced as it changes; the list is not.
Remove. Each row's Remove asks first ("Yes, remove it" or "No, keep it"). Removing archives the alias: it leaves the list and stops matching anything, and the row is kept in the history, not deleted.
Try a bank line. Paste one line from the bank, say if it was money coming in, and press Try it. The page says what the aliases make of it, the way reconcile reads it: the alias that wins (with its envelope and owner), the money movement, two aliases that tie, or that no alias fits and what reconcile would call it. The answer follows the list: save an alias and the same line reads differently.
What a press says
A status box sits above the list before it has any words, so what a press says is announced: "Saved Graveside Grocer.", "Removed ATM. It no longer matches anything.", or "Nothing changed" with the reason when the server couldn't be reached. After a save or a removal focus moves to the status box; a refused form puts focus on the first field to fix; a failed removal puts it back on that row's Remove button. A retry of the same press writes once, because it reuses the press's request id. If the list can't be read again after a write, the rows stay with "The list may be out of date" and Try again. A row someone else already removed says so, and the list is read again.
What a Member sees
Nothing of the data. A member who opens the address sees "This page is for the admin", the page never asks for its data, and the server refuses their request before it reads anything. The Aliases link is not in their menu.
Where the recent lines come from
"Recent lines" are what the page compares an alias against (how many a Match wins, what a new Match would catch). The Worker never stores the bank's raw text, so it builds them from the notes of the entries that came from the bank in the last 90 days (newest first, at most 200, with the #tags taken out). A note is the bank's words as reconcile kept them, which is what an alias was matched on. A line that belongs to another person's private envelope is left out of the page's data, not masked.
What the server does with a save
A save or a removal is admin only: a Member is refused before the request is read. The Worker reads the table fresh and runs core's form check again on its own rows, so the words are the page's words: a refusal (same words as another row, an envelope or person that isn't offered, text too long) comes back as an answer, with nothing written. An edit or a removal of a row that is already gone says so (gone). A removal archives the row: it leaves the list and stops matching, and stays in the database (an alias is never deleted). Each change writes one audit line (who, before, after), and a repeat of the same request id gets the first answer and writes nothing more; the same id used for other changes is refused as a conflict.
Known limit: the duplicate-words check runs on the rows read a moment before the write, with no database rule behind it. Two admin tabs saving at the same moment can add the same words twice, or one edit can overwrite the other (the last save wins, and both are in the audit lines). The list marks a repeated Match as needing a fix. With one admin this is not worth a rule yet.
| Call | What it does |
|---|---|
GET /api/aliases/snapshot | The page's data (the active rows, the envelopes and people an alias may name, the money movements, the bank words, the recent lines). |
POST /api/aliases | Save a row: a new one, or the one named by id. Answers saved, refused or gone. |
POST /api/aliases/:id/remove | Archive a row. Answers removed or gone. |
In the demo
The public demo keeps the list in the tab only: what you add or remove is in memory, and a reload starts again. The demo's switches are ?aliases=list|empty|problems.