diff --git a/CHANGELOG.md b/CHANGELOG.md index bd78634..7ec7f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,27 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). --- +## [1.16.27] — 2026-11-02 + +Minor fixes, grouped in one release (CLAUDE.md §0). + +### Settings → Data & reset +- **After Rebuild from your folder, the button read "Rebuild", not "Rebuilt".** The import (`loadFiles()`, then `reloadFromDirHandle()`) renders the tab partway through the rebuild. That render used up `DataCleanup.lastDone`, so the render at the end showed the button as if nothing had run. The other actions don't render partway, so they already showed "Cleared". +- **Fix (`views-cleanup.js`):** `DataCleanup.running` names the action under way; `_done()` ends it. A render meanwhile shows that button as "Working…", disabled, and leaves `lastDone` for the render `_done()` makes. Before, the first of those renders showed "Rebuilt" before the import had finished, and the next one put the button back to "Rebuild", enabled, while the backup file was still being written. +- **Unchanged:** what Rebuild does, its messages, and every other action. + +### Settings → Accounts +- **The ▲▼ arrows kept the old name after a rename.** Their `aria-label` ("Move Bank Checking up") was set when the tab rendered, and renaming an account doesn't re-render it, so a screen reader heard the old name until the next render. Saving a name now updates the row's two arrows. + +### Developer views +- **The date-range label no longer shows under their title.** DB Inspector, DB Schema, Changelog, AI Eval and Import Logs (`db-inspector`, `db-schema`, `changelog`, `ai-eval`, `db-logs`) don't use the date range. They are in `NO_RANGE_VIEWS` (`ui.js`) now, with the Plan screens, Trends and Settings. + +### Docs +- **Stale wording in code comments:** "data tab" in `init.js` (the file pickers lead to Settings → Import, and Reconnect is offered there), and "Data & Reset" in `core.js`, `db.js`, `migrate.js`, `views-cleanup.js`, `views-data.js` and `init.js`: the tab is **Data & reset**. +- **CLAUDE.md:** §9 and §12 list the developer views in `NO_RANGE_VIEWS`; §14 says Data & reset; §20 describes `DataCleanup.running`. + +--- + ## [1.16.26] — 2026-11-02 ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index aaec3d7..0e88fdd 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.26 (updated in `index.html` footer, `README.md`, and `CHANGELOG.md` on every release). +**Current version:** v1.16.27 (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. @@ -652,7 +652,8 @@ showView(id) // Navigate to a view — re-renders from s renderActive() // Re-render current view (call after state mutations) shellHero(title, firstRun) // The Welcome: rewords the shell's title as a centered headline; firstRun hides the app bar's // nav and tools (body.first-run). showView() undoes both (v1.16.0) -NO_RANGE_VIEWS // PLAN_VIEWS + trends + settings: showView() hides #rangeLabel there +NO_RANGE_VIEWS // PLAN_VIEWS + trends + settings + the developer views (db-inspector, db-schema, + // changelog, ai-eval, db-logs; v1.16.27): showView() hides #rangeLabel there // Drawer (single shared drawer #txDrawer: title row, scrolling body, optional pinned footer, scrim) // A modal dialog (v1.16.14): role="dialog", aria-modal, named by #drawerTitle. While open, every other @@ -912,7 +913,7 @@ Gear → Settings, with tabs: General · Import · Accounts · Credit cards · C - **Below 1000px** the nav moves into the **☰** menu (`#mobileMenu`), with the same grouping. **Below 720px** the gear moves into it too. - **Links** are ``; `init.js` wires every `.appbar [data-view]`, and `showView()` marks the current one (`.active` + `aria-current`). -- **Page title:** the shell renders it (`#pageTitle` from the registered title, `#rangeLabel` the range). Views never render their own H1. On screens that ignore the date range (`NO_RANGE_VIEWS`: the five Plan screens, Trends and Settings) `showView()` hides `#rangeLabel` (v1.15.0, v1.16.0). The Welcome rewords the title with `shellHero()` instead of adding an H1. +- **Page title:** the shell renders it (`#pageTitle` from the registered title, `#rangeLabel` the range). Views never render their own H1. On screens that ignore the date range (`NO_RANGE_VIEWS`: the five Plan screens, Trends, Settings and the developer views) `showView()` hides `#rangeLabel` (v1.15.0, v1.16.0, v1.16.27). A new view that ignores the range goes in that list. The Welcome rewords the title with `shellHero()` instead of adding an H1. - **The Welcome (v1.16.0)** is the Overview with no transactions (`renderWelcome()` in views-main.js). On a true first run (`isFirstRun()`: no folder, plans, AI history or key) the app bar shows only the brand. Its buttons call the existing import paths from their click: `pickDataFolder()` (`reloadDataFiles()` when a folder is connected), `loadSampleData()`, and `#filePick`. - **Settings (v1.16.0)** is a `role="tablist"` (arrow keys, Home, End) and one `role="tabpanel"`; each tab is a registered view rendered into it. Fields save when you leave them (`change`) and report in a `.status-line`; destructive buttons ask for a second click. A screen's buttons and one-line note go in a `.page-actions` row at the top (`pageActions()` in views-main.js). @@ -1002,7 +1003,7 @@ The handle lives in a separate `finlens_fs` database (distinct from `finlens_db` - **It lasts until the last FinLens tab closes, not one page load** (Chromium: Edge, Chrome). A reload keeps access; closing the browser drops it, and a stored handle's permission goes back to `prompt` (confirmed in Edge, v1.9.6). Chromium can also revoke it after a tab sits in the background for a while, and since Chrome 122 the prompt can offer **Allow on every visit**, which keeps access until the user revokes it. Only a click can ask again — `requestPermission()` throws without user activation. Don't rely on any of these: check permission every time (next bullet). - **Check before touching files.** `loadStateFromFile()` and `saveStateToFile()` call `folderPermission(dir, mode)` (wraps `queryPermission`, never prompts) and skip quietly instead of throwing `NotAllowedError`. When access is missing they set `State._folderNeedsAccess`, which shows the **Reconnect folder** banner (`#folderBanner`, `updateFolderBanner()` in `views-data.js`). A successful save clears it. - **Always ask for `readwrite`**, not `read`: the folder picker, Reload and Reconnect all do, because the same folder holds `finlens-state.json`. -- **Prompting code runs only in click handlers:** `saveNowClick()`, `reconnectFolderClick()`, `reloadDataFiles()`, and the Data & Reset actions via `folderWithWriteAccess()` / `saveStateNow()`. +- **Prompting code runs only in click handlers:** `saveNowClick()`, `reconnectFolderClick()`, `reloadDataFiles()`, and the Data & reset actions via `folderWithWriteAccess()` / `saveStateNow()`. - **After reconnecting, the browser copy wins** (Luis's decision, 2026-10-24): `reconnectDataFolder()` writes the browser's state to the file and does not load the file over it. **Exception:** a browser with no transactions (new browser, cleared site data) restores from the file instead (`_restoreStateIfBrowserEmpty()`), so an empty state never overwrites the only backup. Picking a folder follows the same rule. --- @@ -1120,7 +1121,7 @@ Multiple credit card files can be loaded simultaneously. Each gets a unique `acc --- -*Last updated: v1.16.26 — 2026-11-02 (the type decides whether a transaction is a transfer: §4.1 the drawers note, a type changed away from Transfer; §8 the sums go by type, `ownCategories()`, `withoutDirection()`, `redetectTransfers()`; §11 the type decides, Transfer out / in only on transfers, a type change re-runs detection; §11.1 a retyped autopay's card payment; §13 the summary's totals go by type; v1.16.25: Re-categorize all is saved: §1 version; §4.1 `ruleCategories`; §4.2 categories; §8 `categoryFromRules()`; §9 `recategorizeAll()`; §20 where `ruleCategories` is kept, what clears it, left out of the JSON export; v1.16.24: a transfer that stops being one gets its own type and category back: §8 `undoTransferDetection()`, §11 un-transferring; v1.16.23: 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)* +*Last updated: v1.16.27 — 2026-11-02 (§9 and §12 the developer views are in `NO_RANGE_VIEWS`; §14 the tab's name is Data & reset; §20 a render partway through an action keeps its button's done label (`DataCleanup.running`); v1.16.26: the type decides whether a transaction is a transfer: §4.1 the drawers note, a type changed away from Transfer; §8 the sums go by type, `ownCategories()`, `withoutDirection()`, `redetectTransfers()`; §11 the type decides, Transfer out / in only on transfers, a type change re-runs detection; §11.1 a retyped autopay's card payment; §13 the summary's totals go by type; v1.16.25: Re-categorize all is saved: §1 version; §4.1 `ruleCategories`; §4.2 categories; §8 `categoryFromRules()`; §9 `recategorizeAll()`; §20 where `ruleCategories` is kept, what clears it, left out of the JSON export; v1.16.24: a transfer that stops being one gets its own type and category back: §8 `undoTransferDetection()`, §11 un-transferring; v1.16.23: 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)* --- @@ -1186,6 +1187,7 @@ CSV files on disk are **never** modified. - **Ending the pause:** `loadFiles()` clears it, so any import the user starts ends it: Reload or Reconnect, Rebuild, picking a folder or files. `forgetDataFolder()` (Disconnect) clears it too, and Start over removes it with the other keys. - **Browser storage only:** it lives in localStorage and IndexedDB `app_state`, never in `finlens-state.json`. Saves are debounced, so a backup file written before the pause ended could otherwise switch it back on. If browser storage is wiped, the folder re-imports as a recovery. - **Permission prompts need a fresh user gesture.** Destructive buttons use click-again-to-confirm (no `confirm()` dialog, which can outlast the ~5 s activation window), and actions ask for folder access before doing slow work. +- **A button's done label survives a render partway through** (v1.16.27). `DataCleanup.running` names the action under way, and `_done()` ends it. A render meanwhile (Rebuild's import renders the tab) shows that button as Working… and leaves `lastDone` for `_done()`'s render. Every action ends in `_done()`, directly or through `_finish()`. - **Clear transaction edits works from the loaded transactions, never from IndexedDB** (v1.16.1). The `transactions` store can be empty after a restore from `finlens-state.json` (§4.5); up to v1.16.0 the action replaced the loaded transactions with its rows, so every transaction vanished and `_finish()` saved the empty list to the file. - **The originals:** `_originalDesc`, `_originalCategories` and `_originalType` on the transaction (§4.2), flags from the rules. A store row only fills in the category and type when the transaction doesn't record them. - **A file from ≤v1.16.0 with no row:** if a transaction's category or type was edited, or it was marked as a transfer, they are worked out again from the description and amount (`autoCategory()`, debit/credit by sign), as an import of a file without Category and Type columns does. That is exact for checking and savings; a card's own Category and Type (Sale/Payment/Return) can't be recovered. Rebuild from your folder gets them back. Worked-out values aren't recorded as `_original*`. diff --git a/README.md b/README.md index f4382ca..0158a93 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.26  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None +**Version:** v1.16.27  ·  **Stack:** Vanilla JS, HTML, CSS  ·  **Install:** None --- @@ -261,4 +261,4 @@ See [CHANGELOG.md](CHANGELOG.md) for the full release history. --- -*FinLens v1.16.26 — Built for one person's finances, designed to be useful for anyone's.* +*FinLens v1.16.27 — Built for one person's finances, designed to be useful for anyone's.* diff --git a/index.html b/index.html index 52e1e9b..f6b272f 100644 --- a/index.html +++ b/index.html @@ -1164,7 +1164,7 @@
- + diff --git a/js/core.js b/js/core.js index d0e56a1..a16c8c4 100644 --- a/js/core.js +++ b/js/core.js @@ -285,7 +285,7 @@ const _saveStateDebounced = debounce(async (state) => { await saveStateToFile(state); }, 5000); -/* ---------- Folder + state-file maintenance (Settings → Data & Reset) ---------- */ +/* ---------- Folder + state-file maintenance (Settings → Data & reset) ---------- */ // Browsers only show a file-permission prompt during a user gesture, so the // functions that may need write access must be called from a click handler. diff --git a/js/db.js b/js/db.js index c71f45b..a5b0366 100644 --- a/js/db.js +++ b/js/db.js @@ -580,7 +580,7 @@ const DB = { }); }, - /* ── Cleanup & reset (used by Settings → Data & Reset, views-cleanup.js) ── */ + /* ── Cleanup & reset (used by Settings → Data & reset, views-cleanup.js) ── */ /** Every object store in finlens_db. Keep in sync with open() → onupgradeneeded. */ STORES: ['transactions', 'tx_overrides', 'accounts', 'import_log', 'app_state'], diff --git a/js/init.js b/js/init.js index c294a0a..fe223fc 100644 --- a/js/init.js +++ b/js/init.js @@ -81,7 +81,7 @@ renderActive(); }); - /* ---- File pickers → data tab ---- */ + /* ---- File pickers → Settings → Import (handleFilePick(), views-data.js) ---- */ const folderPick = $('#folderPick'); const filePick = $('#filePick'); if (folderPick) folderPick.addEventListener('change', e => { if (e.target.files.length) handleFilePick(e.target.files); folderPick.value=''; }); @@ -135,7 +135,7 @@ // Only needed if IndexedDB has no transactions (fresh install or DB cleared). // If DB already has transactions, we skip the CSV reload — data is already loaded. // Skipped while csvAutoImportPaused: the user cleared their transactions on purpose - // (Settings → Data & Reset), so they stay cleared until the user imports again. + // (Settings → Data & reset), so they stay cleared until the user imports again. if (!State.transactions.length && !State.csvAutoImportPaused) { try { const csvHandle = await idbGet('csvDirHandle'); @@ -144,7 +144,7 @@ if (perm === 'granted') { await reloadFromDirHandle(csvHandle); } else { - // Permission needs a user gesture — mark so Data tab can show reconnect UI + // Permission needs a user gesture: Settings → Import shows Reconnect (views-data.js) State._csvNeedsReconnect = true; } } diff --git a/js/migrate.js b/js/migrate.js index a6b28cc..13a3444 100644 --- a/js/migrate.js +++ b/js/migrate.js @@ -365,7 +365,7 @@ const IdMigration = { if (typeof DB !== 'undefined' && DB._db) { const [ovs, accounts, logs, appState] = await Promise.all( ['tx_overrides', 'accounts', 'import_log', 'app_state'].map((s) => this._all(s))); - // An import stores the account before its transactions, Data & Reset clears the two + // An import stores the account before its transactions, Data & reset clears the two // together, and this migration rewrites every store in one IndexedDB transaction, so // transactions with old codes always come with an account that has one. const txs = accounts.some((a) => this.isOld(a.id)) ? await this._all('transactions') : []; diff --git a/js/ui.js b/js/ui.js index 05ca9d1..cc7dd6b 100644 --- a/js/ui.js +++ b/js/ui.js @@ -33,7 +33,7 @@ function showView(id) { const pt=$('#pageTitle'); if (pt) pt.textContent=VIEWS[id].title; const bar=$('.pagebar'); if (bar) bar.classList.remove('hero'); // Screens that don't use the date range hide its label: the Plan screens (Budget has its - // own month), Trends (always the latest six months) and Settings. + // own month), Trends (always the latest six months), Settings and the developer views. const rl=$('#rangeLabel'); if (rl) rl.hidden=NO_RANGE_VIEWS.includes(id); // body[data-view] lets CSS size the page per screen (Settings is narrower); first-run is // set again by the Welcome if it shows. @@ -213,7 +213,9 @@ function chartColor(name, alpha) { /* ---------- APP BAR: Plan menu, filter popovers, ☰ menu ---------- */ const PLAN_VIEWS = ['budgets','buckets','debt','investments','forecast']; // Screens that ignore the date range: the shell hides its label there (v1.15.0, v1.16.0). -const NO_RANGE_VIEWS = [...PLAN_VIEWS, 'trends', 'settings']; +// The developer views (not in the nav: showView() from DevTools) show stored records, the +// changelog or the eval's samples, never the range (v1.16.27). +const NO_RANGE_VIEWS = [...PLAN_VIEWS, 'trends', 'settings', 'db-inspector', 'db-schema', 'changelog', 'ai-eval', 'db-logs']; let _appBarOpen = null; // { btn, panel } of the menu or popover that's open function openAppBarPopup(btn, panel) { diff --git a/js/views-cleanup.js b/js/views-cleanup.js index edd7335..9b6a039 100644 --- a/js/views-cleanup.js +++ b/js/views-cleanup.js @@ -1,6 +1,6 @@ /* ================================================================ FINLENS — views-cleanup.js - Settings → Data & Reset: clean up imported data, the database and + Settings → Data & reset: clean up imported data, the database and logs, clear plans, disconnect the CSV folder, or start over. Loaded after views-settings.js, before views-db.js. @@ -15,6 +15,7 @@ const DataCleanup = { lastMessage: null, // { kind: 'good'|'warn'|'bad', text } shown once at the top of the tab lastDone: null, // 'action|arg' of the action that just ran: its button shows "Cleared" once + running: null, // 'action|arg' of the action running now; _done() ends it // Plans and history the user created: [State key, label, empty value (default [])]. // Saved under storageKey(State key) (core.js). @@ -286,6 +287,7 @@ const DataCleanup = { _done(kind, text) { this.lastMessage = { kind, text }; + this.running = null; if (kind === 'bad') this.lastDone = null; renderActive(); }, @@ -297,8 +299,12 @@ registerView('data-cleanup', 'Data & reset', (root) => { wireLinks(root); const msg = DataCleanup.lastMessage; DataCleanup.lastMessage = null; - const done = DataCleanup.lastDone; - DataCleanup.lastDone = null; + // A render while an action runs (Rebuild's import renders the tab partway through) keeps + // that button at "Working…" and leaves lastDone for the render _done() makes. Up to + // v1.16.26 it used lastDone up, so a finished Rebuild read "Rebuild", not "Rebuilt". + const running = DataCleanup.running; + const done = running ? null : DataCleanup.lastDone; + if (!running) DataCleanup.lastDone = null; if (msg) appendHtml(root, callout(msg.kind === 'good' ? 'good' : msg.kind, escapeHtml(msg.text))); const folder = State.lastFolderName; @@ -344,10 +350,10 @@ registerView('data-cleanup', 'Data & reset', (root) => { appendHtml(root, `

Clean up

Each button asks you to click again to confirm.

${rows.map(([act, arg, title, desc, label, doneLabel, needsHandle]) => { - const isDone = done === act + '|' + arg; + const isDone = done === act + '|' + arg, isRunning = running === act + '|' + arg; return `
${title}
${desc}
- +
`; }).join('')}
`); @@ -390,9 +396,12 @@ registerView('data-cleanup', 'Data & reset', (root) => { b.classList.remove('armed'); b.disabled = true; b.textContent = 'Working…'; - DataCleanup.lastDone = b.dataset.dcAction + '|' + b.dataset.dcArg; + const key = b.dataset.dcAction + '|' + b.dataset.dcArg; + DataCleanup.lastDone = key; + DataCleanup.running = key; try { await DataCleanup[b.dataset.dcAction](b.dataset.dcArg); } catch(e) { console.error('[FinLens] cleanup:', e); DataCleanup._done('bad', 'Something went wrong: ' + (e.message || e)); } + finally { if (DataCleanup.running === key) DataCleanup.running = null; } // every action ends in _done(); in case one doesn't })); $('#dcExport').onclick = () => exportAllData(); diff --git a/js/views-data.js b/js/views-data.js index 65486c9..d6e01c0 100644 --- a/js/views-data.js +++ b/js/views-data.js @@ -531,7 +531,7 @@ async function reconnectDataFolder() { if (!State.transactions.length) { restored = await _restoreStateIfBrowserEmpty(); // Boot skipped the CSV auto-import for lack of access; do it now, unless the user - // cleared their transactions on purpose (Data & Reset) and import is paused. + // cleared their transactions on purpose (Data & reset) and import is paused. if (!State.transactions.length && !State.csvAutoImportPaused) await reloadFromDirHandle(dir); } State._csvNeedsReconnect = false; @@ -749,6 +749,8 @@ registerView('accounts','Accounts',(root)=>{ $$('[data-acct-name]',root).forEach(inp=>inp.addEventListener('change',()=>{ const id=inp.dataset.acctName, shown=setAccountName(id, inp.value); inp.value=shown; + // The row's order arrows name the account: give them the new name now, not at the next render + $$(`[data-move="${CSS.escape(id)}"]`,root).forEach(b=>b.setAttribute('aria-label',`Move ${shown} ${b.dataset.dir==='-1'?'up':'down'}`)); say('good',State.accountLabels[id]?`Saved the name “${shown}”.`:`Using the default name “${shown}”.`); })); $$('[data-acct-money]',root).forEach(inp=>inp.addEventListener('change',()=>{ diff --git a/js/views-settings.js b/js/views-settings.js index f31bc0b..4f34c47 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.26
+
VersionFinLens v1.16.27
`); /* ---- Anthropic API key ---- */