diff --git a/CHANGELOG.md b/CHANGELOG.md index 254a08e..737f5f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,35 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). --- +## [1.16.23] — 2026-11-02 + +### Fixed +- **Transfer detection overrode a type or category you set on a transaction.** + - **Symptom:** a ZELLE TO M TORRES transfer you set to Expense in the drawer (or with bulk **Set type**) became a transfer again at the next keyword change, import or reload. A category you added to a detected transfer (Transfer out + Housing in the drawer, or bulk **Set category**) was stored, but the next reload showed only Transfer out. + - **Cause:** `detectTransfers()` (`core.js`) marked every pair and every keyword match as a transfer and set its categories to Transfer out / Transfer in, without looking at `txOverrides`. Every import (`loadFiles()`), keyword change (`reapplyTransferKeywords()`) and reload from browser storage (`DB.loadAll()`) runs it. Up to v1.16.15 the drawer stored the type with every save: that kept a saved transfer out of detection's way, so the category half only showed after v1.16.16. A saved Expense or Income type was overridden all along. + - **The bug is also on `master`.** Its `detectTransfers()` is the same code: a transaction saved as Expense becomes a transfer again at the next reload or **Re-apply to All Transactions**, and a bulk category on a detected transfer is replaced at the next reload. + - **Fix:** detection leaves out a transaction with a type you set: it isn't marked and isn't paired. When it marks a transaction with categories you set, it keeps them. + +### Details +- **A paired leg you set to another type isn't paired any more.** The transaction it was paired with is checked on its own, as if the typed one weren't there: it can pair with another transaction, count as a transfer by a keyword (one-sided), or stay as imported. Example: set the Oct 6 CREDIT CARD AUTOPAY to Expense, and after a reload the card's Payment Thank You-Mobile is a card payment again (its CSV Payment type), not a transfer. Keeping the pair would make the other leg a transfer because of a transaction you said isn't one. +- **When the other leg changes:** at the next detection run (a keyword change, an import, a reload from browser storage). Changing a type in the drawer doesn't run detection, as before. A boot from finlens-state.json doesn't either: the file holds the result of the last run. +- **A type you set to Transfer** works as before: the transaction is a transfer, and detection doesn't pair it. +- **Without categories of your own,** a detected transfer still gets Transfer out or Transfer in. + +### Unchanged +- **Without edits, detection gives the same result.** On the samples: 30 transfers and 12 pairs after an import, a keyword change, a reload and a boot from finlens-state.json, every transaction's type and categories the same as before. +- **Edits stored by v1.16.15 and earlier.** Those drawer saves stored the type every time. A stored Expense or Income type is now kept by detection too; a stored Transfer type already was. **Clear transaction edits** removes them. +- **The category of a transaction you set to Expense** is what the drawer left (Transfer out) until a reload, then its own category: Transfer for ZELLE rows (the built-in category rules). The totals and the Transfers screen still count those categories as transfers. That isn't changed here. + +### Technical +- **`core.js`:** `detectTransfers()` skips transactions whose edit has a `type`, and marks through `mark()`, which keeps the edit's `categories` (or an older single `category`). No caller changed: `loadFiles()`, `reapplyTransferKeywords()`, `DB.loadAll()` and Clear transaction edits (which empties the edits before it runs detection) get it through `detectTransfers()`. `undoTransferDetection()` already kept a type you set. The AI Eval's sandbox has no edits, so its summary is unchanged. + +### Docs +- **CLAUDE.md** — §1 version; §4.1 the drawers note (a stored type and categories win over detection); §11 the user's edit wins over both passes. +- **README.md** — Transfers: a type you set wins; categories you add to a detected transfer are kept. + +--- + ## [1.16.22] — 2026-11-02 ### AI Analysis diff --git a/CLAUDE.md b/CLAUDE.md index 488455d..177536b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -59,7 +59,7 @@ Until then, this section is the rule. FinLens is a **single-origin, zero-build, vanilla JavaScript personal finance dashboard** that runs entirely in the browser. There is no server, no npm, no bundler, no framework, and no TypeScript. The entry point is `index.html`; everything else is a plain `.js` file in the `js/` folder. -**Current version:** v1.16.22 (updated in `index.html` footer, `README.md`, and `CHANGELOG.md` on every release). +**Current version:** v1.16.23 (updated in `index.html` footer, `README.md`, and `CHANGELOG.md` on every release). **What it does:** Imports CSV exports from a bank (checking + savings) and credit cards, parses and normalizes them into a unified transaction model, and renders a multi-tab financial dashboard with budgeting, debt tracking, savings forecasting, investment planning, and Claude-powered AI analysis. @@ -234,7 +234,7 @@ The optional fields live inside `bills`, so they're saved, loaded, exported and - **Links point at an item's `id`, never its position.** Up to v1.16.6 a link was `{ type, idx }`, so deleting an item left the links of the items after it pointing at the wrong one. `PLAN_LINK_TYPES` (core.js) maps a link type to its State key and id prefix. - **Read links through the helpers** (ui.js, §9): `planItem(type, id)` finds the item; `linkedTransactions(type, id)` lists its transactions. A link whose item is gone matches nothing, and the drawer shows it as None. - **Deleting an item removes the links to it** (`unlinkPlanItems(type, id)`, saved as `txOverrides`). So does clearing its list in Data & reset (§20). An edit left with nothing else in it is removed. -- **The drawers store only what the user changes (v1.16.16).** `showTxDrawer()` reads its fields back from the form when it opens. On save, a description, category list, type or note that differs from that is stored; an untouched one stores nothing. That matters because a stored `type` wins over the transfer keywords (`reapplyTransferKeywords()` doesn't reset it and `undoTransferDetection()` keeps it, §11), and stored `categories` win over the category rules (Re-categorize all, `recategorizeAll()`, skips them; an import's `mkTx()` uses them). The flags follow the same rule (§4.2); the link is stored as the drawer shows it. +- **The drawers store only what the user changes (v1.16.16).** `showTxDrawer()` reads its fields back from the form when it opens. On save, a description, category list, type or note that differs from that is stored; an untouched one stores nothing. That matters because a stored `type` wins over transfer detection (`detectTransfers()` leaves the row out, `reapplyTransferKeywords()` doesn't reset it and `undoTransferDetection()` keeps it, §11), and stored `categories` win over the category rules (Re-categorize all, `recategorizeAll()`, skips them; an import's `mkTx()` uses them) and over detection's `Transfer out` / `Transfer in` (v1.16.23). The flags follow the same rule (§4.2); the link is stored as the drawer shows it. - **Changing the type to Transfer** also stores its direction (`Transfer out` / `Transfer in`) as the category, when the categories don't have one. - **A description changed back to the original, or a note emptied,** is removed from the edit: it would show the same as no edit. An edit left empty is removed, so a save that changes nothing stores nothing. - **`showTransferDrawer()`** stores each leg's description and note the same way (`storeChangedText()`, shared with `showTxDrawer()`). Bulk edits store only the field they set. @@ -799,6 +799,12 @@ The account id comes last on purpose: `migrate.js` relies on it to rename accoun 1. **Paired match:** Finds transactions across different accounts with equal-and-opposite amounts within 2 days. Sets `type='transfer'`, `categories=['Transfer out']` (negative) or `categories=['Transfer in']` (positive). 2. **Keyword match:** Marks unmatched transactions whose description matches `/transfer|zelle|ach|venmo|paypal|coinbase|savings booster/i` by direction. +**The user's edit wins over both passes (v1.16.23):** +- **A stored `type`** (`txOverrides[id].type`, whatever its value) keeps the row out of detection. It isn't marked and doesn't pair. The row it would have paired with is checked on its own, as if the typed row weren't there: it can pair with another row, match a keyword (a one-sided transfer), or stay as imported. A type set to Transfer already made the row a transfer that detection skips; that's unchanged. +- **Stored `categories`** (or an older single `category`) are kept when a row is marked. Only rows without them get `Transfer out` / `Transfer in`. +- **Where it applies:** every run of `detectTransfers()`: `loadFiles()`, `reapplyTransferKeywords()`, `DB.loadAll()` (a boot from browser storage) and Clear transaction edits (which empties the edits first). A boot from `finlens-state.json` doesn't run detection: the file holds its results. Changing a type in the drawer or with bulk Set type doesn't run it either, so the partner of a leg you retype changes at the next run. +- **Before v1.16.23** detection ignored edits. A row typed as Expense became a transfer again at the next keyword change, import or reload, and categories added to a detected transfer were replaced at the next reload. Up to v1.16.15 the drawer stored the type with every save, which kept a saved Transfer out of detection's way and hid the category half. + **Both legs of a transfer are kept.** There is no deduplication. The `Transfers` view pairs them visually. **Transfer keywords** are edited on the Transfers screen. Adding or removing one re-runs detection right away (`addTransferKeyword()` / `removeTransferKeyword()` → `reapplyTransferKeywords()`, which puts transfers without a stored `type` back to income/expense and calls `detectTransfers()`). The drawer stores a type only when the user changes it (§4.1), so a transaction saved for its note or category still follows the keywords. There's no separate Re-apply button any more (v1.14.0). @@ -1087,7 +1093,7 @@ Multiple credit card files can be loaded simultaneously. Each gets a unique `acc --- -*Last updated: v1.16.22 — 2026-11-02 (§13 the AI summary's trend stops at a past period's end, subscriptions labelled current; §21 the parser finds sections by their heading's start; v1.16.21: §8 `overrideBalanceAt()`, `balanceAt()`; §18 a card's amount owed is taken back plus the later transactions, a bank balance minus them; the sign of a card's balance; v1.16.20: §18 a balance override at the end of every range is the override less the later transactions, no 7-day exception; v1.16.19: overlapping exports of one account count each shared row once: §4.5 one transaction per id; §8 `mergeImported()`, `importParsedCsv()`; §10 overlapping exports of one account; §19 the leftover-copy check keeps the import's ids; v1.16.18: a JSON import's transaction edits show at once: §9 `applyImportedEdits()`; §20 what takes effect without a reload; v1.16.17: a file read into another account takes its rows with it: §4.3 the account's `files`, `accountFiles()`; §4.5 the exception to an import never dropping rows; §8 `accountFiles()`, `earlierCopies()`, `moveEarlierCopies()`; §10 Read as changes the ids; §19 `DB.removeTransactions()`, `DB.patchAccount()`; §22 `_rekey()` is also used by imports; v1.16.16: the transaction and transfer drawers store only the fields you change: §4.1 TxOverride, §11 transfer keywords, §12 state mutations; v1.16.15: §1 desktop only; §3 `views-database.js` removed, the Changelog view reads CHANGELOG.md; §6, §18, §19 point to the current screens; v1.16.14: §9 the drawer is a modal dialog: inert page, Tab wraps, first field focused, focus returns after a re-render; v1.16.13: account order: §4.1 `accountOrder` keeps ids not loaded; §8 `orderedAccounts()`; §18 display order; v1.16.12: account names: §4.1 `accountLabels`; §4.3 an account's `name` is its default; §8 `defaultAccountName()`; §9 `acctName()`; §13 the summary lists accounts by `acctName()`; §18 names you type, and clearing them; v1.16.11: AI summary balances at the end of the selected period: §13 `summaryBalanceEnd()` and the date notes; §21 the parser reads the balance lines by how they start; v1.16.10: starting balance counted in every range: §8 `startingBalance()`, `currentBalances()`; §13 summary balances; §18 one balance rule; v1.16.9: the transaction drawer stores only the flags you change: §4.2 flags, §12 state mutations; v1.16.8: flags from transaction rules are worked out on load, never read from storage: §4.2 flags, §8 `txRuleFlag()` / `txFlags()` / `applyTxRulesToAll()`, §19 flags in the transactions store; v1.16.7: transaction links to budgets, buckets and debts by id: §1 version; §3 migrate.js role; §4.1 the `id` fields, TxOverride and its `link` shape; §8 `PLAN_LINK_TYPES`, `newPlanId()`; §9 `planItem()`, `linkedTransactions()`, `unlinkPlanItems()`, `ensurePlanIds()`; §20 clearing budgets, buckets or debts removes their links; §22 the plan-link migration; v1.16.6: JSON export carries account names and order, Read as, flag rules, transfer keywords and theme: §9 `JSON_EXPORT_KEYS`; §12 adding a persisted field; §20 what the export holds; v1.16.5: a new database copies every saved setting: §4.5 the keys that go through `storageKey()`; §12 adding a persisted field; §19 `DB.APP_STATE_KEYS`; v1.16.4: JSON import saves under the storage keys: §4.5 `STORAGE_KEYS` / `storageKey()`; §8 `storageKey()`; §12 adding a persisted field uses the State name; v1.16.3: An import keeps the loaded transactions it doesn't replace: §4.5 an import never drops loaded transactions; §8 `mergeImported()`, `undoTransferDetection()`; §10 memory follows the same re-upload rules; §11 kept transfers are detected again; v1.16.2: Imports read every file before changing anything: §8 `loadFiles()` options and result, `parseCsvFile()` reads only, `importParsedCsv()`, `importProblemText()`, `reloadFromDirHandle()`; §20 Rebuild from your folder reads before it clears, read before clearing; v1.16.1: Clear transaction edits works from memory: §4.2 `_originalCategories`, `_originalType` and what a transaction keeps of its row; §4.5 IndexedDB may not hold the loaded transactions; §10 a stored row holds the CSV's values; §20 Clear transaction edits; v1.16.0: Trends, AI Analysis, Settings and the Welcome rebuilt: §3 file roles; §4.1 `cardDetails`, `sampleData`, AI history `model`; §6 tile tokens and Insights/Settings/Welcome components; §7 rule 7 covers Trends; §8 `loadFiles()` sample option; §9 `shellHero()`, `NO_RANGE_VIEWS`, ☰ → ×, JSON export/import buttons; §12 Settings tabs renamed, the Welcome, range label hidden on Trends and Settings; §13 quick analyses, tab state, history; §20 new fields, Use my own files, Export/Import JSON; §21 quick analyses send `AI_PROMPTS`; v1.15.0: Plan screens rebuilt: §3 file roles; §4.1 `debtPlan` and the Budget / Bucket / Debt / Scenario shapes; §6 `--teal-text` and Plan components; §7 rule 7 covers the Plan charts; §8 plan helpers (`payoffPlan()`, `growthByYear()` …); §9 plan form helpers, `simulatePayoff()` kept unused; §12 Plan titles, Forecast tabs, range label hidden on Plan screens; §13 debt balances in the summary; §20 Clear forecast scenarios / investment mix, Clear debts resets `debtPlan`; v1.14.0: Finances screens rebuilt: §4.1 Bill shape and `recurringConfirmed`; §6 new tokens and Finances components; §7 rule 7 inline SVG charts; §8 new aggregation helpers; §9 drawer, `TX_VIEWS`, SVG/heatmap/format helpers, bill helpers, removed renderers; §11 keywords re-run detection, `transferPairs()`, card payments; §12 page actions and Transactions pills; §20 Clear bills also clears spotted-charge choices; v1.13.0: Clarity redesign — §6 tokens and components; §9 theme, chart colors and app bar helpers; §12 app bar navigation replaces the sidebar and the emoji rule; §17 footer; §20 Data & Reset; v1.12.0: bank-neutral account codes, names, samples and docs; §22 `migrate.js` added; §3, §4, §5, §10, §18, §21 updated; v1.10.5: no section changes: Import Logs race fix; v1.10.4: §8, §13 single `~` is literal; §21 excerpts escape `~`; v1.10.3: §13 refusals; §21 declined runs; v1.10.2: §13 summary states its dates; §21 per-month derivations; v1.10.1: §13 `AI_MAX_TOKENS`, thinking and cut-off answers; v1.10.0: §21 AI Eval added; §13 `callClaude()` raw mode; v1.9.6: §14 folder access lasts until the last tab closes, not one page load; v1.9.5: §7 chart guard; v1.9.4: views-db.js changelog reads CRLF checkouts; v1.9.3: §14 folder permission: re-request on click, Reconnect banner, browser copy wins; v1.9.2: §0 branch, PR and approval workflow added; v1.9.1: §4.5 rehydrate transactions loaded from JSON; v1.9.0: §20 Data & Reset added; v1.8.1: §10 re-upload dedup rewritten for the occurrence-suffix fix; v1.8.0: AI Analysis restored with API-key and output hardening; `renderMarkdown()` added; `samples/` added; §1–3, §13, §14, §17 corrected to match the code)* +*Last updated: v1.16.23 — 2026-11-02 (transfer detection respects the user's type and categories: §1 version, §4.1 the drawers note, §11 the user's edit wins; v1.16.22: §13 the AI summary's trend stops at a past period's end, subscriptions labelled current; §21 the parser finds sections by their heading's start; v1.16.21: §8 `overrideBalanceAt()`, `balanceAt()`; §18 a card's amount owed is taken back plus the later transactions, a bank balance minus them; the sign of a card's balance; v1.16.20: §18 a balance override at the end of every range is the override less the later transactions, no 7-day exception; v1.16.19: overlapping exports of one account count each shared row once: §4.5 one transaction per id; §8 `mergeImported()`, `importParsedCsv()`; §10 overlapping exports of one account; §19 the leftover-copy check keeps the import's ids; v1.16.18: a JSON import's transaction edits show at once: §9 `applyImportedEdits()`; §20 what takes effect without a reload; v1.16.17: a file read into another account takes its rows with it: §4.3 the account's `files`, `accountFiles()`; §4.5 the exception to an import never dropping rows; §8 `accountFiles()`, `earlierCopies()`, `moveEarlierCopies()`; §10 Read as changes the ids; §19 `DB.removeTransactions()`, `DB.patchAccount()`; §22 `_rekey()` is also used by imports; v1.16.16: the transaction and transfer drawers store only the fields you change: §4.1 TxOverride, §11 transfer keywords, §12 state mutations; v1.16.15: §1 desktop only; §3 `views-database.js` removed, the Changelog view reads CHANGELOG.md; §6, §18, §19 point to the current screens; v1.16.14: §9 the drawer is a modal dialog: inert page, Tab wraps, first field focused, focus returns after a re-render; v1.16.13: account order: §4.1 `accountOrder` keeps ids not loaded; §8 `orderedAccounts()`; §18 display order; v1.16.12: account names: §4.1 `accountLabels`; §4.3 an account's `name` is its default; §8 `defaultAccountName()`; §9 `acctName()`; §13 the summary lists accounts by `acctName()`; §18 names you type, and clearing them; v1.16.11: AI summary balances at the end of the selected period: §13 `summaryBalanceEnd()` and the date notes; §21 the parser reads the balance lines by how they start; v1.16.10: starting balance counted in every range: §8 `startingBalance()`, `currentBalances()`; §13 summary balances; §18 one balance rule; v1.16.9: the transaction drawer stores only the flags you change: §4.2 flags, §12 state mutations; v1.16.8: flags from transaction rules are worked out on load, never read from storage: §4.2 flags, §8 `txRuleFlag()` / `txFlags()` / `applyTxRulesToAll()`, §19 flags in the transactions store; v1.16.7: transaction links to budgets, buckets and debts by id: §1 version; §3 migrate.js role; §4.1 the `id` fields, TxOverride and its `link` shape; §8 `PLAN_LINK_TYPES`, `newPlanId()`; §9 `planItem()`, `linkedTransactions()`, `unlinkPlanItems()`, `ensurePlanIds()`; §20 clearing budgets, buckets or debts removes their links; §22 the plan-link migration; v1.16.6: JSON export carries account names and order, Read as, flag rules, transfer keywords and theme: §9 `JSON_EXPORT_KEYS`; §12 adding a persisted field; §20 what the export holds; v1.16.5: a new database copies every saved setting: §4.5 the keys that go through `storageKey()`; §12 adding a persisted field; §19 `DB.APP_STATE_KEYS`; v1.16.4: JSON import saves under the storage keys: §4.5 `STORAGE_KEYS` / `storageKey()`; §8 `storageKey()`; §12 adding a persisted field uses the State name; v1.16.3: An import keeps the loaded transactions it doesn't replace: §4.5 an import never drops loaded transactions; §8 `mergeImported()`, `undoTransferDetection()`; §10 memory follows the same re-upload rules; §11 kept transfers are detected again; v1.16.2: Imports read every file before changing anything: §8 `loadFiles()` options and result, `parseCsvFile()` reads only, `importParsedCsv()`, `importProblemText()`, `reloadFromDirHandle()`; §20 Rebuild from your folder reads before it clears, read before clearing; v1.16.1: Clear transaction edits works from memory: §4.2 `_originalCategories`, `_originalType` and what a transaction keeps of its row; §4.5 IndexedDB may not hold the loaded transactions; §10 a stored row holds the CSV's values; §20 Clear transaction edits; v1.16.0: Trends, AI Analysis, Settings and the Welcome rebuilt: §3 file roles; §4.1 `cardDetails`, `sampleData`, AI history `model`; §6 tile tokens and Insights/Settings/Welcome components; §7 rule 7 covers Trends; §8 `loadFiles()` sample option; §9 `shellHero()`, `NO_RANGE_VIEWS`, ☰ → ×, JSON export/import buttons; §12 Settings tabs renamed, the Welcome, range label hidden on Trends and Settings; §13 quick analyses, tab state, history; §20 new fields, Use my own files, Export/Import JSON; §21 quick analyses send `AI_PROMPTS`; v1.15.0: Plan screens rebuilt: §3 file roles; §4.1 `debtPlan` and the Budget / Bucket / Debt / Scenario shapes; §6 `--teal-text` and Plan components; §7 rule 7 covers the Plan charts; §8 plan helpers (`payoffPlan()`, `growthByYear()` …); §9 plan form helpers, `simulatePayoff()` kept unused; §12 Plan titles, Forecast tabs, range label hidden on Plan screens; §13 debt balances in the summary; §20 Clear forecast scenarios / investment mix, Clear debts resets `debtPlan`; v1.14.0: Finances screens rebuilt: §4.1 Bill shape and `recurringConfirmed`; §6 new tokens and Finances components; §7 rule 7 inline SVG charts; §8 new aggregation helpers; §9 drawer, `TX_VIEWS`, SVG/heatmap/format helpers, bill helpers, removed renderers; §11 keywords re-run detection, `transferPairs()`, card payments; §12 page actions and Transactions pills; §20 Clear bills also clears spotted-charge choices; v1.13.0: Clarity redesign — §6 tokens and components; §9 theme, chart colors and app bar helpers; §12 app bar navigation replaces the sidebar and the emoji rule; §17 footer; §20 Data & Reset; v1.12.0: bank-neutral account codes, names, samples and docs; §22 `migrate.js` added; §3, §4, §5, §10, §18, §21 updated; v1.10.5: no section changes: Import Logs race fix; v1.10.4: §8, §13 single `~` is literal; §21 excerpts escape `~`; v1.10.3: §13 refusals; §21 declined runs; v1.10.2: §13 summary states its dates; §21 per-month derivations; v1.10.1: §13 `AI_MAX_TOKENS`, thinking and cut-off answers; v1.10.0: §21 AI Eval added; §13 `callClaude()` raw mode; v1.9.6: §14 folder access lasts until the last tab closes, not one page load; v1.9.5: §7 chart guard; v1.9.4: views-db.js changelog reads CRLF checkouts; v1.9.3: §14 folder permission: re-request on click, Reconnect banner, browser copy wins; v1.9.2: §0 branch, PR and approval workflow added; v1.9.1: §4.5 rehydrate transactions loaded from JSON; v1.9.0: §20 Data & Reset added; v1.8.1: §10 re-upload dedup rewritten for the occurrence-suffix fix; v1.8.0: AI Analysis restored with API-key and output hardening; `renderMarkdown()` added; `samples/` added; §1–3, §13, §14, §17 corrected to match the code)* --- diff --git a/README.md b/README.md index 167f356..3c6396a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > A zero-install, browser-native finance dashboard. Drop in your bank CSVs, get instant clarity on your money. -**Version:** v1.16.22  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None +**Version:** v1.16.23  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None --- @@ -119,7 +119,7 @@ Total income, average per month, interest earned and refunds. Income by source a Total spent, average per day, top category and highest month. Categories ranked by spend: pick one to see its transactions. A daily spending heatmap, the monthly trend, top merchants, and **category rules** (keyword → category). ### Transfers -Both legs of a transfer are paired automatically. A diagram shows where money moved between your accounts, and what left FinLens (e.g. Zelle payments). Filter the list by From and To account. **Transfer keywords** decide which unpaired transactions count as transfers; changing them re-runs detection right away. +Both legs of a transfer are paired automatically. A diagram shows where money moved between your accounts, and what left FinLens (e.g. Zelle payments). Filter the list by From and To account. **Transfer keywords** decide which unpaired transactions count as transfers; changing them re-runs detection right away. A type you set on a transaction wins: detection leaves that transaction alone, so one you set to Expense stays an expense and isn't paired. Categories you add to a detected transfer are kept. ### Budget Pick a month with ‹ and ›. Each category shows a progress bar, what you spent, its budget and what's left; the pencil changes the amount right in the row, and the name opens the full edit (name, categories, delete). Alerts flag categories over budget or at 90% and up. A chart compares 6 months of spending with the total budget. **Use starter budget** fills in a budget per category from what you usually spend (the average of up to 3 recent complete months, rounded up to $10) and never replaces one you have. @@ -261,4 +261,4 @@ See [CHANGELOG.md](CHANGELOG.md) for the full release history. --- -*FinLens v1.16.22 — Built for one person's finances, designed to be useful for anyone's.* +*FinLens v1.16.23 — Built for one person's finances, designed to be useful for anyone's.* diff --git a/index.html b/index.html index 4c64e1d..c893bbe 100644 --- a/index.html +++ b/index.html @@ -1164,7 +1164,7 @@
- + diff --git a/js/core.js b/js/core.js index 8ec7d0c..9c3d0aa 100644 --- a/js/core.js +++ b/js/core.js @@ -1137,6 +1137,16 @@ async function moveEarlierCopies(moves, read, fresh) { console.log(`[FinLens] Import: ${moves.size} transaction${moves.size === 1 ? '' : 's'} moved to the account ${perFile.size === 1 ? 'its file is' : 'their files are'} read as now (${edited.size} with edits)`); } +// Marks transfers: legs paired across accounts (pass 1), then keyword matches (pass 2). +// The user's edit wins over both (v1.16.23, CLAUDE.md §11): +// - A type the user set (txOverrides[id].type) keeps the row out of detection. It isn't +// marked and doesn't pair, so the row it would have paired with pairs with another one, +// or is checked against the keywords on its own, as if the typed row weren't there. +// - Categories the user set are kept when the row is marked; without them it gets its +// direction (Transfer out / Transfer in). +// Before v1.16.23 both passes marked every match and set its categories, whatever its edit, +// so a ZELLE row typed as Expense became a transfer again at the next keyword change, import +// or reload, and a category added to a detected transfer dropped at the next reload. function detectTransfers() { // Build keyword regex from user-editable list (falls back to defaults if empty) const kws = (State.transferKeywords && State.transferKeywords.length) @@ -1144,7 +1154,13 @@ function detectTransfers() { : DEFAULT_TRANSFER_KEYWORDS; const escapedKws = kws.map(k => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); const key = new RegExp(escapedKws.join('|'), 'i'); - const cands = State.transactions.filter(t=>t.type!=='transfer'); + const ovs = State.txOverrides || {}; + const mark = (t, dir) => { + const ov = ovs[t.id] || {}; + t.type = 'transfer'; + t.categories = ov.categories && ov.categories.length ? [...ov.categories] : ov.category ? [ov.category] : [dir]; + }; + const cands = State.transactions.filter(t => t.type !== 'transfer' && !(ovs[t.id] && ovs[t.id].type)); const used = new Set(); // Pass 1: match paired transfers across accounts for (let i=0;i2) continue; if (!key.test(a.description) && !key.test(b.description) && days>1) continue; const outTx=a.amount<0?a:b, inTx=a.amount<0?b:a; - outTx.type='transfer'; inTx.type='transfer'; - outTx.categories=['Transfer out']; inTx.categories=['Transfer in']; + mark(outTx, 'Transfer out'); mark(inTx, 'Transfer in'); used.add(a.id); used.add(b.id); break; } @@ -1168,10 +1183,7 @@ function detectTransfers() { // Pass 2: mark unmatched transactions whose description screams "transfer" for (const t of cands) { if (used.has(t.id)) continue; - if (key.test(t.description)) { - t.type='transfer'; - t.categories=[t.amount<0?'Transfer out':'Transfer in']; - } + if (key.test(t.description)) mark(t, t.amount<0?'Transfer out':'Transfer in'); } } diff --git a/js/views-settings.js b/js/views-settings.js index 1ee2cc6..128db19 100644 --- a/js/views-settings.js +++ b/js/views-settings.js @@ -60,7 +60,7 @@ function _renderGeneralSettings(root) { /* ---- About (the Theme row is gone: light only for now) ---- */ appendHtml(root,`

About

-
VersionFinLens v1.16.22
+
VersionFinLens v1.16.23
`); /* ---- Anthropic API key ---- */