diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c6dfbc..a6a7437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,29 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). --- +## [1.16.9] — 2026-11-02 + +### Fixed +- **Saving the transaction drawer froze the transaction's flags, even when you only changed its category.** + - **Symptom:** a LIBERTY INTERNET row flagged Bill by a rule, saved in the drawer with a new category, stayed a bill after the rule was removed. The other 5 LIBERTY INTERNET rows lost it. A rule added later didn't reach that row either. + - **Cause:** the drawer's Save (`showTxDrawer()` in `views-main.js`) wrote all three checkboxes (Bill, Recurring, Subscription) into `txOverrides`, whatever you had touched. An edit there wins over the rules (`txFlags()`), so the row kept the flags it had when it was saved. + - **The bug is also on `master`.** Its drawer stores all three flags the same way. + - **Fix:** the drawer remembers what its boxes showed when it opened. Save stores a flag only if you changed its box, ticked or unticked. A box you didn't touch stores nothing and keeps following the rules, or keeps the edit already stored for it. After saving, the row's flags are worked out with `txFlags()`, as a reload does. + +### Unchanged +- **Your own flag edits still win.** Ticking a box stores the flag on; unticking one a rule set stores it off. Both hold whatever the rules say later. +- **Bulk Mark as bill / Mark as subscription** already stored only the flag they set. They aren't changed. +- **Flags stored by earlier versions stay.** A transaction saved in the drawer before v1.16.9 has all three flags stored and keeps them. FinLens can't tell them apart from flags you set on purpose, so it doesn't remove them. **Clear transaction edits** (Settings → Data & reset) removes them, with your other edits. + +### Technical +- **`views-main.js`:** `showTxDrawer()` keeps the flags shown on opening (`shown`). Its Save stores only a changed box, then sets the row's flags from `txFlags()`. + +### Docs +- **CLAUDE.md** — §1 version; §4.2 storing a flag only when it changes; §12 state mutations. +- **README.md** — Transactions: a flag you leave alone keeps following the rules. + +--- + ## [1.16.8] — 2026-11-02 ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index a551969..d29f752 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.8 (updated in `index.html` footer, `README.md`, and `CHANGELOG.md` on every release). +**Current version:** v1.16.9 (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. @@ -266,7 +266,7 @@ Transactions are created by `mkTx()` in `core.js` and never mutated directly — - **They are worked out whenever a transaction is built or loaded:** `mkTx()` (CSV import), `reconstituteTx()` (`DB.loadAll()`, `loadStateFromFile()`, Clear transaction edits) and `applyTxRulesToAll()` (after a rule is added or removed). - **Never read them from storage.** The IndexedDB row and the state file hold the flags as they were when written. Before v1.16.8 `reconstituteTx()` read them from there, so a rule added after the import was lost on reload and a removed one came back. - **`loadStateFromFile()` passes the file's own `txRules`** to `reconstituteTx()`, because State gets them only after it returns. -- **Saving the transaction drawer stores all three flags** as its checkboxes show them, so that transaction keeps them whatever the rules say later. +- **Store a flag only when the user changes it (v1.16.9).** `showTxDrawer()` remembers what its three boxes showed on opening. On save, a box changed from that is stored, ticked or unticked. An untouched box stores nothing, so it keeps following the rules, or keeps an edit already stored. Bulk **Mark as bill / subscription** stores only that one flag. Up to v1.16.8 every drawer save stored all three, so a transaction saved for its category alone stopped following the rules. Those stored flags are kept: they can't be told apart from deliberate ones. ### 4.3 The Account Model @@ -808,7 +808,7 @@ el.innerHTML = ``; - **Always** call `lsSet(key, value)` after mutating a State array or object — State is in-memory and not a proxy. - **Always** call `renderActive()` after mutations that should update the UI. - Do not mutate transaction `amount` or `date` — these are immutable source-of-truth values. -- Edits to transaction fields (description, categories, type, notes, flags) go into `State.txOverrides[tx.id]`. +- Edits to transaction fields (description, categories, type, notes, flags) go into `State.txOverrides[tx.id]`. A flag goes in only when the user changes it (§4.2). ### Adding a new persisted field @@ -1021,7 +1021,7 @@ Multiple credit card files can be loaded simultaneously. Each gets a unique `acc --- -*Last updated: v1.16.8 — 2026-11-02 (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.9 — 2026-11-02 (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 dc52a23..a52391d 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.8  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None +**Version:** v1.16.9  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None --- @@ -107,7 +107,7 @@ FinLens stores all your data — budgets, bills, transaction edits, settings, AI Net worth with a trend chart (1M, 3M or all of your history) and the change since the end of last month. The latest month's money in, money out, net and savings rate, next to your 6-month average. A card per account with a balance sparkline (or, for a credit card, how much of the limit you're using). Six months of cash flow with the net for each month, bills due in the next three weeks, and the largest card purchases of the latest month. Double-click an account name to rename it. ### Transactions -Filter pills across the top: **All**, **Income**, **Spending**, **Bills**, **Payments** and **Transfers**. All and Payments filter the list; the other four open their own screens. The list has search, a category filter, sorting, an amount filter, bulk edits and 50 rows per page. Click a transaction to edit its description, categories, type, notes and flags (Bill, Recurring, Subscription). Edits are kept separately from the imported row, so re-importing never overwrites them. **Transaction rules** flag matching transactions automatically (e.g. "NETFLIX → Subscription"). **Payments** lists the payments made to your credit cards. +Filter pills across the top: **All**, **Income**, **Spending**, **Bills**, **Payments** and **Transfers**. All and Payments filter the list; the other four open their own screens. The list has search, a category filter, sorting, an amount filter, bulk edits and 50 rows per page. Click a transaction to edit its description, categories, type, notes and flags (Bill, Recurring, Subscription). Edits are kept separately from the imported row, so re-importing never overwrites them. **Transaction rules** flag matching transactions automatically (e.g. "NETFLIX → Subscription"). A flag you tick or untick yourself wins over the rules; one you leave alone keeps following them. **Payments** lists the payments made to your credit cards. ### Income Total income, average per month, interest earned and refunds. Income by source as a stacked bar, monthly income (an unfinished month is shaded lighter), recurring deposits with their rhythm, next expected date and confidence, and every deposit. @@ -261,4 +261,4 @@ See [CHANGELOG.md](CHANGELOG.md) for the full release history. --- -*FinLens v1.16.8 — Built for one person's finances, designed to be useful for anyone's.* +*FinLens v1.16.9 — Built for one person's finances, designed to be useful for anyone's.* diff --git a/index.html b/index.html index 46c0ae0..f0ea441 100644 --- a/index.html +++ b/index.html @@ -1164,7 +1164,7 @@
- + diff --git a/js/views-main.js b/js/views-main.js index 95aad7f..1fa2491 100644 --- a/js/views-main.js +++ b/js/views-main.js @@ -754,6 +754,11 @@ function showTxDrawer(id) { const canLink=State.budgets.length||State.buckets.length||State.debts.length; const linkItems=(type)=>PLAN_LINK_TYPES[type]?State[PLAN_LINK_TYPES[type][0]]||[]:[]; const linkOpts=(type,sel)=>linkItems(type).map((item,i)=>``).join(''); + // The flags as the boxes show them on opening: the edit, else the rules (txFlags()). Saving + // stores only a box changed from this, so the others keep following the rules, or keep an + // edit already stored (CLAUDE.md §4.2). Until v1.16.9 every save stored all three. + const flagBoxes=[['isBill','dBill'],['isRecurring','dRec'],['isSubscription','dSub']]; + const shown={ isBill:!!t.isBill, isRecurring:!!t.isRecurring, isSubscription:!!t.isSubscription }; openDrawer(`
${fmtSigned(t.amount)} @@ -772,9 +777,9 @@ function showTxDrawer(id) {
${opts.map(c=>``).join('')}
Flags - - - + + +
${canLink?`
Link to a budget, bucket or debt @@ -806,9 +811,7 @@ function showTxDrawer(id) { // A transfer needs its direction as a category so the Transfers screen picks it up if (o.type==='transfer'&&!o.categories.includes('Transfer in')&&!o.categories.includes('Transfer out')) o.categories=[t.amount<0?'Transfer out':'Transfer in']; o.notes=$('#dNotes').value; - o.isBill=$('#dBill').checked; - o.isRecurring=$('#dRec').checked; - o.isSubscription=$('#dSub').checked; + for (const [key,box] of flagBoxes) { const v=$('#'+box).checked; if (v!==shown[key]) o[key]=v; } const linkType=lt?lt.value:''; const linkId=linkType?$('#dLinkTarget').value:''; if (linkType&&planItem(linkType,linkId)) o.link={ type:linkType, id:linkId }; @@ -816,7 +819,7 @@ function showTxDrawer(id) { State.txOverrides[t.id]=o; lsSet('txOverrides',State.txOverrides); t.description=o.description; t.categories=o.categories; t.type=o.type; t.notes=o.notes; - t.isBill=o.isBill; t.isRecurring=o.isRecurring; t.isSubscription=o.isSubscription; + Object.assign(t, txFlags(t._originalDesc||t.description, o)); closeDrawer(); renderActive(); }; } diff --git a/js/views-settings.js b/js/views-settings.js index 9e623e9..3eac57e 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.8
+
VersionFinLens v1.16.9
`); /* ---- Anthropic API key ---- */