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
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 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.22  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None
**Version:** v1.16.23  ·  **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.
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.
Expand Down Expand Up @@ -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.*
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.22 · FinLens</footer>
<footer class="appfoot">v1.16.23 · 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
26 changes: 19 additions & 7 deletions js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,14 +1137,30 @@ 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)
? State.transferKeywords
: 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;i<cands.length;i++) {
Expand All @@ -1159,19 +1175,15 @@ function detectTransfers() {
if (days>2) 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;
}
}
// 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');
}
}

Expand Down
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.22</span></div>
<div class="set-row"><span class="t">Version</span><span class="v">FinLens v1.16.23</span></div>
</section>`);

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