Skip to content

v1.16.12: Fix clearing an account name not bringing the default name back - #35

Open
gitluis wants to merge 3 commits into
fix-ai-summary-period-balancesfrom
fix-account-name-reset
Open

gitluis wants to merge 3 commits into
fix-ai-summary-period-balancesfrom
fix-account-name-reset

Conversation

@gitluis

@gitluis gitluis commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #34 (fix-ai-summary-period-balances), in a chain of fixes on top of the Clarity redesign (#16 → #17 → #19 → #20 → #21). Merge in order: #16, #17, #19, #20, #21, then the fixes #24–#38 and #39–#50 in order, then #10, then #23. #18 is a separate patch on master (already merged).
This fix doesn't need earlier fixes' code, but its chained commit adapts to #25's import restructure and removes a loop #29 added (see What changed).

Summary

Clearing a name you gave an account now brings back its default name: Bank Checking, Bank Savings, Bank Credit Card (<file>), or the file name. This works in Settings → Accounts and on the Overview cards, and it lasts after a reload and a re-import. Before, the old name kept showing.

Cause

What changed

  • An account's name is always its default. importParsedCsv() writes the default back, including to the browser database. DB.loadAll() no longer copies the label in. A name you type lives only in State.accountLabels.
  • A JSON import no longer copies names into the accounts. The loop in v1.16.6: Fix JSON export leaving out account names, order, flag rules, transfer keywords, Read as choices and theme #29's _applyImportedSettings() that set State.accounts[id].name from the imported labels is removed, so account.name stays the default there too. Imported names still show at once: acctName() reads State.accountLabels, and the accounts filter is still rebuilt. The CHANGELOG entry and commit message say so.
  • Chained onto the restructured import (v1.16.2: Fix Rebuild from your folder clearing everything when the folder has no CSV it can read #25, v1.16.3: Fix importing some CSV files losing the other loaded transactions #26): the set-up block this fix changes moved from parseCsvFile() into importParsedCsv(), so the cherry-pick conflicted there. The chained commit keeps v1.16.2: Fix Rebuild from your folder clearing everything when the folder has no CSV it can read #25's structure and re-applies the change: parseCsvFile() gets the default name from defaultAccountName(), and importParsedCsv() sets name to it instead of copying the label. Two more conflicts: the Last import card keeps v1.16.2: Fix Rebuild from your folder clearing everything when the folder has no CSV it can read #25's "Not imported" line and shows acctName(); the AI summary's Accounts line keeps v1.16.11: Fix the AI summary sending today's balances for a past date range #34's period-end note and lists acctName().
  • defaultAccountName(a) (new, core.js) works out the default from the account's kind and file. parseCsvFile() uses it.
  • acctName() shows the name you typed, else defaultAccountName(). Data saved by older versions, where name can still hold a cleared name, shows the default too.
  • Both rename paths use setAccountName(): Settings → Accounts and the Overview cards (double-click, or Enter on a focused name). An empty name, or the default name itself, removes the label.
  • Behavior change: on the Overview, opening the rename and pressing Enter without changes saves nothing. Before, it saved the current name as a label.
  • Settings → Accounts says "Using the default name …" when the label goes, and puts the default back in the field.
  • Every place that shows a name uses acctName(): the accounts filter and its tooltip, the import log, the Last import card, and the account list in the AI summary (buildFinancialSummary()).
  • The AI summary is unchanged for accounts with no typed name. The AI Eval sandbox sets accountLabels to {}, so its requests are byte-identical.
  • Docs: CHANGELOG, version in all four places, README (one clause on clearing a name), CLAUDE.md §1, §4.1, §4.3, §8, §9, §13, §18 and the Last updated line.

Not verified

  • Real browsers. Only headless Chromium. Not checked in Edge, Chrome, Safari or Firefox by hand.
  • A real data folder. finlens-state.json was loaded through a stubbed folder handle, not the File System Access API.
  • Phone layout. Not checked. FinLens targets desktop browsers for now.
  • The AI eval. It wasn't re-run (no API key here). Only the summary bytes were compared.
  • Data saved before v1.12.0 (old bank-named codes and default names) wasn't tested with this change. migrate.js is unchanged.
  • Two card files with the same account id (file names that differ only in case or punctuation): the default name now follows the most recent file. Before, it kept the first one. Not tested.
  • Together with the JSON export PR (v1.16.6: Fix JSON export leaving out account names, order, flag rules, transfer keywords, Read as choices and theme #29): its label-copy loop is removed here (above). test-json-export.js passes on this branch's commit; a JSON import with names wasn't checked beyond it.
Automated checks: earlier run, not re-run · 85db2d4

Moved unchanged from this PR's "Test results" comment on 2026-11-04; not re-run, so not in the new table format. Originally a description section titled "How it was tested".

Headless Chromium (Playwright) at 1280×900 against samples/ (257 transactions), with the pinned CDN libraries served from npm, on this branch's final commit 85db2d4, chained on #34. Each script ran as NODE_PATH=$(npm root -g) node <script> <repo> <outdir>, from one harness shared by every branch in the stack: the base suites, plus every test added by this PR or by a PR below it (cumulative regression).

Script Result on 85db2d4
test-clarity.js 55/55
test-insights.js 137/137
test-finances.js 126/126
test-plan.js 127/127
boot.js 257 transactions, 24 views, 0 errors
race.js 7 errors, all renderImportLog (the race #18 fixes on master; not in this stack)
test-clear-edits.js (from #24) 47/47
test-rebuild-folder.js (from #25) 57/57
test-partial-import.js (from #26) 47/47
test-json-import.js (from #27) 28/28
test-new-browser-copy.js (from #28) 10/10
test-json-export.js (from #29) 31/31
test-plan-links.js (from #30) 60/60
test-rule-flags.js (from #31, as updated by #32) 67/67
test-drawer-flags.js (from #32) 36/36
test-start-balance.js (from #33, as updated by #34) 193/193
test-ai-summary-period.js (from #34) 78/78
test-account-names.js (new in this PR) 40/40

Measured before the chain

By the agent that wrote the fix, on be87cd8 (built on 70c7125, v1.16.0; then numbered v1.16.8), before the label-copy loop and the conflicts above.

Headless Chromium (Playwright) at 1280px, against samples/, in light and dark. CDNs are blocked in the sandbox, so the harness serves the pinned libraries from npm.

New test, test-account-names.js (40 checks):

  • What it covers: Settings → Accounts and the Overview (double-click and Enter), clearing with an empty name and with spaces only, typing the default name, Escape, a re-import, two reloads, and data saved by older versions (in the browser database and in finlens-state.json, through a stubbed folder handle). It reads the name from the Overview card, the Settings field, the accounts filter, Settings → Credit cards and the AI summary.
  • On 70c7125 (base): 18/40. The 22 failures (11 per theme) are the bug:
    • clearing in Settings or on the Overview leaves the old name everywhere;
    • it's still there after a re-import and a reload;
    • the browser database keeps the typed name;
    • an old stored name shows when no label is left.
    • Two of the 11 per theme are the behavior change above: an unchanged Overview rename, or typing the default, stores a label on base.
  • On this branch: 40/40.

Existing suites on this branch (run-all.sh), the same counts as on base:

Suite Base 70c7125 This branch
test-clarity.js 55/55 55/55
test-finances.js 126/126 126/126
test-plan.js 127/127 127/127
test-insights.js 137/137 137/137
boot.js 0 errors 0 errors
race.js 7 errors 6 errors

AI summary: probe-evalsum.js hashes the AI Eval sandbox summary and the live summary after importing the samples. Both hashes are identical on base and on this branch.

How to reproduce the bug

Run this on the base branch, fix-ai-summary-period-balances (#34). Master has it in its own form: there an empty name keeps the current name, so a typed name can't be cleared at all.

  1. Do the Setup from the testing steps below (scratch folder with the samples only), but check out fix-ai-summary-period-balances instead of fix-account-name-reset.
  2. Go to Settings → Accounts.
  3. In Bank Checking's Display name field, type Main checking. Press Tab.
  4. Click back into the field, delete all the text, and press Tab.
  5. Go to Overview and read the checking card's name.
  6. Open the Accounts button (bank icon, top bar) and read the list.

What goes wrong: the field goes blank, but the Overview card and the Accounts list still show Main checking instead of Bank Checking. It comes back after F5 and Reload CSVs too.

Manual QA steps

Setup

  1. Copy the three CSVs from samples/ into a new scratch folder (for example FinLens-test-35). Do not use your real folder: this PR changes what import and reload save for account names.
  2. git checkout fix-account-name-reset, then open index.html in Edge.
  3. If FinLens already has data in this browser, go to Settings → Data & reset → Start over, type RESET and click Erase and start over.
  4. Click Pick your CSV folder and choose the scratch folder. Allow read and write access.
  5. Set the date range (calendar icon, top bar) to All time.

The default names on the samples are Bank Checking, Bank Savings and Bank Credit Card (credit_card_sample).

1. Clearing a name in Settings → Accounts brings the default back (the main fix)

  1. Go to Settings → Accounts.
  2. In Bank Checking's Display name field, type Main checking. Press Tab.
  3. Click back into the field, delete all the text, and press Tab.
  4. Go to Overview and read the checking card's name.
  5. Open the Accounts button (bank icon, top bar) and read the list.

Expected:

  • After step 2 the status line says Saved the name “Main checking”.
  • After step 3 it says Using the default name “Bank Checking”., and the field shows Bank Checking.
  • The Overview card and the Accounts list both show Bank Checking.

Before this fix: the field went blank and every screen kept showing Main checking.

2. Clearing a name on the Overview card

  1. On Overview, double-click the Bank Savings card's name.
  2. Type Rainy day and press Enter.
  3. Double-click the name again, delete all the text, and press Enter.

Expected:

  • After step 2 the card shows Rainy day.
  • After step 3 the card shows Bank Savings.

Before this fix: an empty name kept Rainy day.

3. A typed name you keep survives a reload and a re-import (regression)

  1. In Settings → Accounts, rename Bank Credit Card (credit_card_sample) to Visa. Press Tab.
  2. Press F5. Check the Overview card, the Accounts list in the top bar and Settings → Credit cards.
  3. Go to Settings → Import and click Reload CSVs.
  4. Check the same three places.

Expected:

  • Visa shows everywhere, after the reload and after the re-import.

4. A cleared name stays cleared after a reload and a re-import

  1. In Settings → Accounts, clear the Visa field and press Tab.
  2. Press F5.
  3. Click Reload CSVs in Settings → Import.
  4. Close the tab, open index.html in a new tab, and click Reconnect folder in Settings → Import if asked.

Expected:

  • Bank Credit Card (credit_card_sample) shows after each step.
  • F12 → Application → IndexedDB → finlens_db → accounts: the card's name is Bank Credit Card (credit_card_sample).

Before this fix: Visa came back after a reload or re-import, and the IndexedDB accounts row kept Visa.

5. Small cases in the rename

  1. In Settings → Accounts, type only spaces in Bank Checking's field and press Tab.
  2. Type Bank Checking exactly (the default) and press Tab.
  3. On Overview, double-click the checking name and press Enter without changing it.
  4. Double-click it again, type Test, press Escape.
  5. Check F12 → Application → Local storage → file:// → finlens_accountLabels.

Expected:

  • Steps 1 and 2 both say Using the default name “Bank Checking”.
  • Step 4 leaves the name as Bank Checking.
  • finlens_accountLabels has no bank_checking entry.

6. The AI summary uses the shown name

  1. Rename Bank Savings to Rainy day.
  2. F12 → Console, run buildFinancialSummary(). Read line 2.
  3. Clear the name and run it again.

Expected:

  • Line 2 lists Rainy day (…), then Bank Savings (…) after clearing.

7. Data saved by an older version shows the default

  1. git checkout fix-ai-summary-period-balances (the base branch). Press F5.
  2. In Settings → Accounts, rename Bank Checking to Old name, press Tab. Then clear it and press Tab. It still shows Old name (the bug).
  3. Wait about 5 seconds so finlens-state.json is saved.
  4. git checkout fix-account-name-reset. Press F5.

Expected:

  • Bank Checking shows on the Overview, in Settings → Accounts and in the Accounts list.
  • The footer and Settings → General show v1.16.12.

8. JSON import with names

  1. Rename Bank Savings to Rainy day. Go to Settings → Data & reset and click Export JSON.
  2. Clear the name (it shows Bank Savings).
  3. Click Import JSON… and choose the export.
  4. Check the Overview card and the Accounts list without reloading.
  5. Clear the name in Settings → Accounts.

Expected:

  • After the import, Rainy day shows at once.
  • After clearing, Bank Savings shows, and stays after F5.

Please check before merging

  • In Settings → Accounts, type a name, leave the field, then clear it and leave it again: the default name comes back and the status line says "Using the default name …".
  • On the Overview, double-click an account name, clear it and press Enter: the default name comes back.
  • Reload: the default name stays. A name you typed and kept still survives a reload and a re-import.
  • You're happy with the design: account.name always holds the default, and typed names live only in State.accountLabels.
  • You're happy with the behavior change: an unchanged Overview rename, or typing the default name, stores no label.
  • Dropping v1.16.6: Fix JSON export leaving out account names, order, flag rules, transfer keywords, Read as choices and theme #29's loop that copied imported labels into State.accounts[id].name, done here as part of this fix, is what you want.
  • Manual QA passed in Edge/Chrome with a real folder

https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft


Generated by Claude Code

Clearing a name typed in Settings -> Accounts removed the label, but the
old name kept showing: the typed name had also been copied into the
account's own name (on rename, CSV import and reload), and acctName()
fell back to that copy. On the Overview an empty name kept the old one.

- An account's name is always its default; typed names live only in
  State.accountLabels. importParsedCsv() writes the default back;
  DB.loadAll() no longer copies the label in, and neither does a JSON
  import (the copy loop in _applyImportedSettings(), v1.16.6, is removed).
- acctName() shows the typed name, else defaultAccountName() (new, in
  core.js), worked out from kind + file, so data saved by older versions
  shows the default too.
- Settings -> Accounts and the Overview cards both save through
  setAccountName(): an empty name, or the default itself, removes the
  label; an unchanged name on the Overview saves nothing.
- The accounts filter, its tooltip, the import log, the Last import card
  and the AI summary's account list use acctName(). The summary is
  unchanged for accounts with no typed name (eval requests identical).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
…-account-name-reset

Carries master's v1.10.3-v1.10.5 up the stack: declined answers (#14),
literal single "~" (#15) and the Import Logs race fix (#18), with
clarity-insights' port of #14 to the rebuilt AI tab.

One conflict: CLAUDE.md's "Last updated" line. Kept this branch's
line and added the v1.10.3-v1.10.5 history. The CHANGELOG merged cleanly.
Versions stay 1.16.12. renderImportLog() keeps #18's guards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
@gitluis gitluis added the bug Something isn't working label Nov 3, 2026 — with Claude
@gitluis gitluis added this to the Clarity stack (v1.12.0 → v1.18.1) milestone Nov 3, 2026 — with Claude
…) into fix-account-name-reset

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Z8iBUZo6LRYpLthSp2PRi

# Conflicts:
#	js/views-settings.js
@gitluis gitluis changed the title v1.16.12: fix clearing an account name not bringing the default name back v1.16.12: Fix clearing an account name not bringing the default name back Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants