Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

---

## [1.16.24] — 2026-11-02

### Fixed
- **A transaction that stopped being a transfer got the category Other or Income, not its own.**
- **Symptom:** add an "uber" keyword and remove it again, and the UBER TRIP card rows showed Other instead of Travel (their Category in the card's file). The AMAZON MKTPL return showed Income instead of Shopping, and T-MOBILE AUTOPAY showed Other instead of Bills & Utilities. With CREDIT CARD AUTOPAY set to Expense, the next keyword change made the card's Payment Thank You-Mobile an Income / refund with category Income, counted in Money in. A ZELLE row you gave Transfer out + Housing showed only Housing once "zelle" was removed.
- **It stayed wrong.** A reload from browser storage put the categories right, but finlens-state.json is saved after a keyword change, so a boot from it kept Other and Income.
- **Cause:** `reapplyTransferKeywords()` (`views-main.js`) put every transfer without a stored type back as a debit or credit by its sign, with the categories it had besides Transfer out / Transfer in, or Other / Income when it had none (the usual case). It used neither the CSV's type and category (`_originalType`, `_originalCategories`, recorded since v1.16.1) nor the categories you set.
- **The bug is also on `master`.** Its **Re-apply to All Transactions** runs the same code. master's transactions don't record their CSV category or type, so this fix doesn't apply to it as is.
- **Fix:** `reapplyTransferKeywords()` puts each transfer back with `undoTransferDetection()`, which an import already uses for the transfers it keeps.

### Details
- **What a transaction gets back:** its type: the one you set, else the CSV's (a card's Sale, Return or Payment; a bank's Withdrawal or Deposit). Its categories: the ones you set; else the category Re-categorize all gave it while it was a transfer; else the CSV's: the card file's own Category, otherwise the category the import worked out (your category rules first, then the built-in ones). That is what a reload from browser storage already showed.
- **`undoTransferDetection()` now takes the category Re-categorize all gave a transfer before the CSV's** (from v1.16.3 to v1.16.23 it took the CSV's). Re-categorize all gives every transaction without a category edit its rule's category, transfers included, so a transfer that stops being one now matches the others. Without Re-categorize all nothing changes.
- **ZELLE rows go back to the category Transfer.** The built-in category rules give ZELLE (and TRANSFER, ACH, VENMO, PAYPAL, COINBASE) the category Transfer, and the totals and the Transfers screen count that category as a transfer, whatever the type. So with "zelle" removed, the ZELLE rows are expenses with the category Transfer: they stay out of Spending and on the Transfers screen. That's what a reload already showed; before, they were Other, in Spending, until the next reload. To count them as spending, add a category rule (ZELLE → a category) and click **Re-categorize all**.
- **A category rule added after the import** reaches a transaction that stops being a transfer through Re-categorize all (above) or the next import, as for every other transaction.

### Unchanged
- **Transactions an earlier version already put back wrong** keep Other or Income: they aren't transfers any more, so nothing puts them back. **Reload CSVs** (Settings → Import) or **Rebuild from your folder** gives them their CSV values again.
- **Without a keyword change nothing changes.** The import path (`mergeImported()`) gives the same result as before unless Re-categorize all ran.
- **A transaction from a finlens-state.json written by v1.16.0 or earlier** doesn't record its CSV values. As before, its IndexedDB row gives them; without a row its type goes by its sign and its category is worked out from its description.

### Technical
- **`views-main.js`:** `reapplyTransferKeywords()` calls `undoTransferDetection()` for each transaction, then `detectTransfers()`.
- **`core.js`:** `undoTransferDetection()` takes the type and the categories separately: the type from the edit, `_originalType`, the row, then the sign; the categories from the edit, the categories besides Transfer out / in, `_originalCategories`, the row, then `autoCategory()`.

### Docs
- **CLAUDE.md** — §1 version; §8 `undoTransferDetection()`; §11 a transfer that stops being one, the built-in Transfer category; §11.1 a card payment that stops being a transfer.
- **README.md** — Transfers: a transaction that stops being a transfer gets its own type and category back.

---

## [1.16.23] — 2026-11-02

### Fixed
Expand Down
15 changes: 11 additions & 4 deletions CLAUDE.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.23  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None
**Version:** v1.16.24  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None

---

Expand Down Expand Up @@ -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. 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.
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. A transaction that stops being a transfer (say, you remove its keyword) gets its own type and category back: a card's Category and Sale, Return or Payment from its file, otherwise the category it was imported with (your category rules first, then the built-in ones).

### 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.
Expand Down Expand Up @@ -261,4 +261,4 @@ See [CHANGELOG.md](CHANGELOG.md) for the full release history.

---

*FinLens v1.16.23 — Built for one person's finances, designed to be useful for anyone's.*
*FinLens v1.16.24 — Built for one person's finances, designed to be useful for anyone's.*
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@
<div class="folder-banner-wrap" id="folderBanner" hidden></div>
<div class="content" id="content"></div>
</main>
<footer class="appfoot">v1.16.23 · FinLens</footer>
<footer class="appfoot">v1.16.24 · FinLens</footer>

<!-- side drawer: transaction detail, bill and plan forms (ui.js openDrawer) -->
<div class="drawer-scrim" id="drawerScrim" onclick="closeDrawer()" hidden></div>
Expand Down
39 changes: 22 additions & 17 deletions js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,27 +1015,32 @@ async function mergeImported(loaded, fresh) {
return kept.concat(fresh);
}

// Puts a transfer found by detectTransfers() back to what an import makes before detection
// (v1.16.3): its CSV type and category (_originalType, _originalCategories), with its edit.
// Detection only pairs transactions that aren't transfers yet, so a leg kept by
// mergeImported() must go back first or its partner, re-read from a file, stays unpaired.
// A type the user set to transfer stays. Without the CSV values (a transaction from a
// ≤v1.16.0 finlens-state.json), its IndexedDB `row` gives them; without a row, the type
// goes back to debit or credit by its sign and the category is worked out from the
// description, as Clear transaction edits does. Changes `t` in place, as detection does.
// Puts a transfer found by detectTransfers() back to what it was before detection (v1.16.3),
// with its edit. mergeImported() does it for the transfers an import keeps: detection only
// pairs transactions that aren't transfers yet, so a kept leg must go back first or its
// partner, re-read from a file, stays unpaired. reapplyTransferKeywords() does it for every
// transfer before detection runs again (v1.16.24), so one that no longer matches is itself again.
// A type the user set to transfer stays (detection leaves any other type the user set alone).
// - Type: the user's; else the CSV's (_originalType: a card's Sale, Return or Payment, a bank's
// Withdrawal or Deposit); else its IndexedDB `row`'s; else debit or credit by its sign.
// - Categories: the user's; else the ones it has besides Transfer out / Transfer in (Re-categorize
// all gives a transfer its rule's category too); else the CSV's (_originalCategories: a card
// file's own Category, otherwise the one the import worked out from the category rules and
// the built-in ones); else the row's; else worked out from the description now.
// Only a transaction from a ≤v1.16.0 finlens-state.json lacks the CSV values; without a row,
// its type and category are worked out as Clear transaction edits does. Changes `t` in place.
function undoTransferDetection(t, row) {
const ov = State.txOverrides[t.id] || {};
if (t.type !== 'transfer' || ov.type === 'transfer') return;
const has = (c, ty) => Array.isArray(c) && c.length > 0 && !!ty;
let cats = t._originalCategories, type = t._originalType;
if (!has(cats, type) && row) { cats = row.categories; type = row.type; }
if (!has(cats, type)) {
const keep = (t.categories || []).filter(c => c !== 'Transfer out' && c !== 'Transfer in');
cats = keep.length ? keep : [autoCategory(t._originalDesc || t.description)];
type = t.amount < 0 ? 'debit' : 'credit';
}
const has = (c) => Array.isArray(c) && c.length > 0;
const keep = (t.categories || []).filter(c => c !== 'Transfer out' && c !== 'Transfer in');
const cats = has(keep) ? keep
: has(t._originalCategories) ? t._originalCategories
: row && has(row.categories) ? row.categories
: [autoCategory(t._originalDesc || t.description)];
const type = t._originalType || (row && row.type) || (t.amount < 0 ? 'debit' : 'credit');
t.type = ov.type || type;
t.categories = ov.categories && ov.categories.length ? [...ov.categories] : (ov.category ? [ov.category] : [...cats]);
t.categories = has(ov.categories) ? [...ov.categories] : (ov.category ? [ov.category] : [...cats]);
}

// A file's earlier rows under another account (v1.16.17, for loadFiles(), before anything is
Expand Down
18 changes: 8 additions & 10 deletions js/views-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1424,17 +1424,15 @@ function removeTransferKeyword(i) {
lsSet('transferKeywords',State.transferKeywords);
reapplyTransferKeywords();
}
// Re-run transfer detection on every transaction. Transfers without a type set by the user
// go back to income/expense first, so a removed keyword stops counting.
// Re-run transfer detection on every transaction. Each transfer goes back first to what it
// was before detection, with its edit (undoTransferDetection(), core.js), so one that a removed
// keyword no longer matches is itself again: its CSV type and category, or the ones you set.
// A type you set to Transfer stays. Before v1.16.24 a transfer went back as a debit or credit
// by its sign, with Other or Income when it had no category besides Transfer out / in (the
// usual case): a card's Payment became Income / refund, its Travel or Shopping became Other,
// a checking row lost the category its rules gave it, and categories you set lost Transfer out / in.
function reapplyTransferKeywords() {
for (const t of State.transactions) {
const ov=State.txOverrides[t.id]||{};
if (!ov.type && t.type==='transfer') {
t.type=t.amount<0?'debit':'credit';
const keep=t.categories.filter(c=>c!=='Transfer out'&&c!=='Transfer in');
t.categories=keep.length?keep:[t.amount<0?'Other':'Income'];
}
}
for (const t of State.transactions) undoTransferDetection(t);
detectTransfers();
renderActive();
}
2 changes: 1 addition & 1 deletion js/views-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function _renderGeneralSettings(root) {
/* ---- About (the Theme row is gone: light only for now) ---- */
appendHtml(root,`<section class="panel" aria-labelledby="dispH">
<h2 id="dispH">About</h2>
<div class="set-row"><span class="t">Version</span><span class="v">FinLens v1.16.23</span></div>
<div class="set-row"><span class="t">Version</span><span class="v">FinLens v1.16.24</span></div>
</section>`);

/* ---- Anthropic API key ---- */
Expand Down