Skip to content

v1.16.16: Fix the edit drawer freezing a transaction's type and category when you change something else - #39

Open
gitluis wants to merge 2 commits into
cleanup-stale-docs-and-dead-codefrom
fix-drawer-saves-unchanged-fields
Open

gitluis wants to merge 2 commits into
cleanup-stale-docs-and-dead-codefrom
fix-drawer-saves-unchanged-fields

Conversation

@gitluis

@gitluis gitluis commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #38 (cleanup-stale-docs-and-dead-code). Merge order: #16, #17, #19, #20, #21, #24–#38, #39–#50, then #10, then #23.
This fix doesn't use any earlier fix's code; it is stacked only so versions and the CHANGELOG merge cleanly.

Summary

Saving the transaction drawer stored the description, categories, type and notes every time, even when you changed none of them. A stored type and stored categories win over the transfer keywords and the category rules, so a transaction saved for a note stopped following both. The drawer now stores a field only when you change it. The transfer drawer had the same habit for description and notes; it's fixed the same way.

v1.16.16. One commit, chained on #38 (cleanup-stale-docs-and-dead-code, v1.16.15).

Cause

showTxDrawer() in js/views-main.js wrote four fields into txOverrides on every Save, from whatever the form showed:

o.description=$('#dDesc').value.trim()||t._originalDesc;
o.categories=[primary,...more];
o.type=$('#dType').value;
o.notes=$('#dNotes').value;

What each stored value blocks:

  • Type. reapplyTransferKeywords() only resets a transfer with no stored type, and undoTransferDetection() keeps a stored one. So a ZELLE TO M TORRES transfer saved with only a note stayed a transfer when "zelle" was removed. The other 5 ZELLE rows went back to expenses. A T-MOBILE expense saved with a note had type: 'debit' stored. Adding a "t-mobile" keyword still made it a transfer (detectTransfers() doesn't check edits), but removing the keyword left it one, until a reload.
  • Categories. Re-categorize all on the Spending screen (recategorizeAll()) skips any row with stored categories. An import builds rows with mkTx(), which uses them over the category rules. That matters for checking and savings rows, whose export has no Category column. A WALMART row saved with a note kept Groceries when a WALMART → Housing rule and Re-categorize all changed the other WALMART rows.
  • Description and notes. These block nothing. Nothing else changes a description or a note, and the CSV description is part of the transaction id, so it never changes for that row. A stored unchanged value only makes the row count as an edit.

The bug is also on master (v1.10.5). Its showTxDrawer() stores the same four fields (and the three flags) on every save, and its transfer drawer stores both legs' description and notes.

Bulk edit is not affected. Set category stores only categories. Set type stores only type, plus the direction category for Transfer. Mark as bill / subscription store only their flag (#32).

The transfer drawer (showTransferDrawer()) stored both legs' description and notes on every save. Per the above, that froze nothing, but every leg you saved became an edit. It uses the same rule now.

What changed

  • showTxDrawer() reads its fields back from the form right after it opens (opened): description, notes, type, and the category list as the form builds it. On Save it stores a field only when the form's value differs from that.
  • New storeChangedText(t, o, was, now) handles Description and Notes for both drawers.
    • Description: spaces around it don't count as a change. Emptying it still means the original. A description changed back to the original is removed from the edit, since it would show the same as no edit.
    • Notes: an emptied note is removed from the edit for the same reason.
  • showTransferDrawer() reads each leg's description and notes on opening and stores only what changed, through storeChangedText(). An edit left empty is removed.
  • Not migrated: fields stored by earlier versions stay. They can't be told apart from deliberate edits, the same reasoning as v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category #32. Clear transaction edits removes them.
  • Version and docs: v1.16.16 in CHANGELOG.md, the index.html footer, README.md (badge, footer, a sentence under Transactions) and js/views-settings.js. CLAUDE.md: §1 version; §4.1 a bullet on the drawers storing only what you change; §11 transfer keywords; §12 state mutations; "Last updated".

Not verified

  • Phones and narrow screens. Desktop only, by Luis's decision.
  • A real browser with real data, and Firefox / Safari. Headless Chromium and the samples only.
  • Edits stored by earlier versions in your own data. They are kept by design. How many of your transactions have a stored type or category from a save that changed something else can't be known; Clear transaction edits removes all edits, deliberate ones included.

Found, not fixed (separate bugs):

  • detectTransfers() ignores a type you set. It looks at every transaction that isn't a transfer and marks keyword matches as transfers, stored type: 'debit' included, overwriting their categories with Transfer out / in. So a ZELLE row you set to Expense becomes a transfer again at the next keyword change or reload (DB.loadAll()). The new test logs this as INFO. It's the same on master.
  • Consequence for this fix: adding a second category to a transaction FinLens detected as a transfer (Transfer out + Housing) is stored and shows until the next reload. Then detection puts the category back to Transfer out alone. Before, the drawer also stored type: 'transfer', which kept detection off the row, so the extra category survived. Changing such a row's category to one without a direction is still overruled by the direction rule, as before, and now stores nothing.
  • reapplyTransferKeywords() puts an un-transferred row's category back as Other / Income, not its CSV category. undoTransferDetection() does use the CSV category.
  • recategorizeAll() changes categories in memory only (no lsSet()). A reload from browser storage brings back the imported categories, and the state file gets the new ones only at the next save of something else.
Automated checks: earlier run, not re-run · f4a3495

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".

Light checks, by Luis's call to save usage: on this branch's final commit f4a3495 (chained on #38) only boot.js, race.js and this PR's own tests ran. Headless Chromium at 1280×900 against samples/, with the pinned CDN libraries served from npm; each script ran as NODE_PATH=$(npm root -g) node <script> <repo> <outdir>.

Script Result on f4a3495
boot.js 257 transactions, 24 views, 0 errors
race.js 24 views, 0 errors
test-drawer-fields.js (new in this PR) 44/44

Full set, once, on the top of the stack (#23, 819e809: every PR below it merged in): every base suite and every fix test from #24 to #50, plus #10's and #23's, each in its final variant. All pass: test-clarity.js 55/55, test-insights.js 137/137, test-finances.js 126/126, test-plan.js 127/127, boot.js 257 transactions and 0 errors, race.js 0 errors; #24–#38's tests (clear-edits 48/48, rebuild-folder 57/57, partial-import 47/47, json-import 28/28, new-browser-copy 10/10, json-export 31/31, plan-links 60/60, rule-flags 67/67, drawer-flags 36/36, start-balance 193/193, ai-summary-period 78/78, account-names 40/40, account-order 32/32, drawer-focus 167/167, cleanup 21/21); #39–#50's tests (drawer-fields 45/45, read-as 52/52, json-import-edits 29/29, overlapping-exports 46/46, override-balance 160/160, card-override 277/277, ai-summary-trend 91/91, transfer-user-type 39/39, untransfer-category 27/27, recategorize 55/55, retype-transfer 135/135, minor-fixes 34/34); test-dbtab.js 73/73, test-save-status.js 64/64, test-master-port.js 16/16. Three scripts needed a test-only change on that run, listed in #23 and in the PRs they belong to; the app code wasn't changed.

  • Chain edit to test-drawer-fields.js: from v1.16.25: Fix "Re-categorize all" changes being lost after a reload #48 on, recategorizeAll() is async, and on the top of the stack check B ("a WALMART → Housing rule and Re-categorize all") read the rows before it finished (44/45). The helper now waits 600 ms after the click. Rerun on the top: 45/45.

  • No phone checks (desktop only).

Measured before the chain

The numbers below are the PR author's, on the commit before it was chained (built on the old #38 tip ecfcab2, v1.16.15, or on the fix below it there; version numbers renumbered to the chain's).

Headless Chromium (Playwright) against samples/, desktop viewport (1280×900) only. CDNs are blocked here, so the harness serves the pinned libraries from npm.

New test-drawer-fields.js (in the harness, not in the repo). Its sections:

  • A: a notes-only edit, then transfer keyword changes, both ways ("zelle" removed and added back; "t-mobile" added and removed).
  • B: a category change is stored. An untouched category follows Re-categorize all and a category rule on re-import.
  • C: a type change is stored and beats the keywords.
  • D: an unchanged description isn't stored (no change, spaces only, changed and changed back).
  • E: existing edits are kept, including one in the shape v1.16.15 saved.
  • F: plan links: link only, link then note, link set to None.
  • G: bulk Set category / Set type.
  • H: the transfer drawer.
  • I: reload from browser storage.
  • J: boot from finlens-state.json in a new browser.
Run Result
test-drawer-fields.js on ecfcab2 (temporary worktree, since removed) 17/44 passed: the 27 failures are the bug (A, B, C, D, F, H, I, J)
test-drawer-fields.js on this branch (36d0095) 44/44 passed

Every suite for this base (run-tip.sh 15 <repo> <out> 1: the base suites plus every fix test of #24–#38), one at a time. All 1,359 checks pass on both, plus boot and race:

Suite ecfcab2 this branch
test-clarity 55/55 55/55
test-insights 137/137 137/137
test-finances 126/126 126/126
test-plan 127/127 127/127
boot 257 transactions, 24 views, 0 errors 257 transactions, 24 views, 0 errors
race 8 errors, all renderImportLog 7 errors, all renderImportLog
test-clear-edits 47/47 47/47
test-rebuild-folder 57/57 57/57
test-partial-import 47/47 47/47
test-json-import 28/28 28/28
test-new-browser-copy 10/10 10/10
test-json-export 31/31 31/31
test-plan-links 60/60 60/60
test-rule-flags 67/67 67/67
test-drawer-flags 36/36 36/36
test-start-balance 193/193 193/193
test-ai-summary-period 78/78 78/78
test-account-names 40/40 40/40
test-account-order 32/32 32/32
test-drawer-focus 167/167 167/167
test-cleanup 21/21 21/21

The race errors are the expected renderImportLog ones: #18's fix isn't in this stack yet. None come from this change.

No existing suite was edited.

How to reproduce the bug

Run this on the base branch, cleanup-stale-docs-and-dead-code (#38). Master (v1.10.5) has the same bug.

  1. Do the Setup from the testing steps below (scratch folder with the samples, InPrivate window, the ed helper in the Console), but check out cleanup-stale-docs-and-dead-code instead of fix-drawer-saves-unchanged-fields.
  2. Open Transactions. Type ZELLE in Search description or notes.
  3. Click the newest ZELLE TO M TORRES row (Oct 16, −$60.00).
  4. In Notes, type rent split. Click Save changes.
  5. In the Console, run ed('ZELLE').
  6. Click the Transfers pill. Under Transfer keywords, click × on zelle (Remove keyword zelle).
  7. Run ed('ZELLE') again.

What goes wrong:

  • At step 5, the Oct 16 row's edit holds description, categories: ["Transfer out"] and type: "transfer", not only {"notes":"rent split"}.
  • At step 7, the other 5 ZELLE rows go back to debit, but the noted row stays a transfer / Transfer out.
Manual QA steps

Setup

  1. git checkout fix-drawer-saves-unchanged-fields.
  2. Copy the three CSVs from samples/ to a new scratch folder. Don't use your real folder: this PR changes what gets saved.
  3. Open an Edge InPrivate window (Ctrl+Shift+N) and open index.html, so there are no edits yet.
  4. Click Pick your CSV folder and choose the scratch folder. Allow access.
  5. Set the date range to All time (calendar icon in the app bar).
  6. F12 → Console. Paste this helper and press Enter. It lists the matching rows with their type, categories and stored edit:
    ed=s=>console.table(State.transactions.filter(t=>(t._originalDesc||t.description).includes(s)).map(t=>({date:dayjs(t.date).format('MMM D'),desc:t.description,type:t.type,cats:t.categories.join(', '),edit:JSON.stringify(State.txOverrides[t.id]||null)})))
    After a page reload, paste it again.

The number of stored edits also shows in Settings → Data & reset, on the Clear transaction edits row ("No edits yet", or "N renamed, re-categorized or flagged transactions…").

1. A note on a keyword transfer stores only the note

  1. Open Transactions. Type ZELLE in Search description or notes.
  2. Click the newest ZELLE TO M TORRES row (Oct 16, −$60.00).
  3. In Notes, type rent split. Click Save changes.
  4. In the Console, run ed('ZELLE').

Expected:

  • The Oct 16 row's edit is {"notes":"rent split"}, with no type, categories or description.
  • All six ZELLE rows still have type transfer and category Transfer out.

Before this fix: the edit also held description, categories: ["Transfer out"] and type: "transfer".

2. That transfer follows the keyword when you remove it

  1. Click the Transfers pill.
  2. Under Transfer keywords, click × on zelle (Remove keyword zelle).
  3. Run ed('ZELLE').
  4. Type zelle in Add keyword and click Add.
  5. Run ed('ZELLE') again.

Expected:

  • Step 3: all six ZELLE rows, including the one with the note, are type debit (Expense) and no longer Transfer out.
  • Step 5: all six are transfer / Transfer out again. The Oct 16 row still has its note.

Before this fix: the noted row stayed a transfer when "zelle" was removed.

3. A note on an expense doesn't stop a new keyword

  1. On Transactions, search T-MOBILE. Open the newest T-MOBILE AUTOPAY row.
  2. Type a note, e.g. phone. Click Save changes.
  3. On Transfers, type t-mobile in Add keyword and click Add.
  4. Run ed('T-MOBILE').
  5. Remove the t-mobile keyword (×).
  6. Run ed('T-MOBILE') again.

Expected:

  • Step 4: all six T-MOBILE rows are transfer.
  • Step 6: all six are back to debit. The noted row's edit is only {"notes":"phone"}.

Before this fix: the noted row had type: "debit" stored, and after step 5 it stayed a transfer until a reload.

4. A note doesn't stop a category rule

  1. On Transactions, search WALMART. Open one WALMART SUPERCENTER 2251 row and add a note. Click Save changes.
  2. Click the Spending pill. Scroll to Category rules.
  3. In Description contains, type WALMART. Set Category to Housing. Click Add rule.
  4. Click Re-categorize all.
  5. Run ed('WALMART').

Expected:

  • All 16 WALMART rows show Housing, including the one with the note.

Before this fix: the noted row stayed Groceries.

Note: Re-categorize all changes memory only (a separate known bug), so don't reload before checking.

5. A category or type you change is stored and wins

  1. On Transactions, open another WALMART row. Set Category to Shopping. Click Save changes.
  2. On Spending, click Re-categorize all.
  3. On Transactions, open a PUEBLO SUPERMARKET 0412 row. Set Type to Transfer. Click Save changes.
  4. Run ed('WALMART') and ed('PUEBLO').
  5. On Transfers, remove the zelle keyword, then add it back.
  6. Run ed('PUEBLO') again.

Expected:

  • The Shopping row keeps Shopping after Re-categorize all, and its edit holds "categories":["Shopping"].
  • The PUEBLO row's edit is {"type":"transfer","categories":["Transfer out"]}, and it's listed on the Transfers screen.
  • After step 5 the PUEBLO row is still transfer (the keyword re-run doesn't undo a type you set).

6. Description and notes edge cases

  1. Note the number on Settings → Data & reset → Clear transaction edits.
  2. Open an ACME CORP PAYROLL DIRECT DEP row. Don't change anything. Click Save changes.
  3. Open it again. Add two spaces at the end of Description. Click Save changes.
  4. Check the count in Data & reset.
  5. Open it again. Change Description to Paycheck. Save. Run ed('ACME').
  6. Open it again. Change Description back to ACME CORP PAYROLL DIRECT DEP. Save. Run ed('ACME').
  7. Open it again. Clear Description completely. Save.
  8. Open the row from test 1 (ZELLE, Oct 16). Clear Notes. Save. Run ed('ZELLE').

Expected:

  • Steps 2–4: the edit count doesn't change, and that row's edit is null.
  • Step 5: edit is {"description":"Paycheck"}; the list shows Paycheck.
  • Step 6: edit is back to null.
  • Step 7: the list shows the original description and edit stays null.
  • Step 8: the Oct 16 ZELLE row's edit is null, and the count drops by one.

7. Flags and plan links still save as before

  1. Open a NETFLIX.COM row. Tick or untick Bill only. Save. Run ed('NETFLIX').
  2. If you have a budget (Plan → Budget → Use starter budget makes some), open a CHIPOTLE 2410 row, set Link to a budget, bucket or debt to Budget and pick one. Save. Run ed('CHIPOTLE').
  3. Open it again, set the link to None. Save. Run ed('CHIPOTLE').

Expected:

  • Step 1: the edit holds only isBill.
  • Step 2: the edit holds only link.
  • Step 3: the edit is null (an empty edit is removed).

8. The transfer drawer stores only the leg you change

  1. Note the edit count in Data & reset.
  2. On Transfers, click a Paired row (Bank Checking → Bank Savings).
  3. Change only the outgoing leg's Notes (the first block). Click Save changes.
  4. Run ed('ONLINE TRANSFER').

Expected:

  • Only the checking leg (ONLINE TRANSFER TO SAVINGS) has an edit, {"notes":"…"}. The savings leg's edit is null.
  • The edit count went up by one, not two.

Before this fix: both legs got an edit with description and notes.

9. Edits survive a reload and a new browser

  1. Press F5. Click Reconnect folder if asked. Paste the ed helper again.
  2. Run ed('T-MOBILE'), ed('WALMART') and ed('PUEBLO').
  3. Click Save now in Settings → Import. Close the InPrivate window.
  4. Open a new InPrivate window, open index.html, click Pick your CSV folder and choose the same scratch folder.
  5. Paste the helper and run the same three commands.

Expected:

  • Both times, the T-MOBILE note edit is still only {"notes":"phone"}, the Shopping WALMART row still has categories, and the PUEBLO row still has type and categories.
  • After step 5, the WALMART rows you didn't edit show Housing (the new browser imports the CSVs with the rule).
  • No red errors in the Console.

10. Regression: bulk edits

  1. On Transactions, tick two rows that have no edit.
  2. In the bulk bar, choose Set category… → Fees and click Apply.
  3. Run ed for one of them (use part of its description).

Expected:

  • Both rows show Fees, and each edit holds only categories.

Please check before merging

  • Saving with only a note on a transfer found by a keyword (e.g. a Zelle payment) stores only the note, and the transfer follows the keyword when you remove it.
  • A category or type you change is still stored and wins over rules and keywords.
  • A description changed back to the original, or an emptied note, being removed from the edit rather than stored is what you want.
  • The transfer drawer's change is in this PR (same cause: a drawer storing fields you didn't change). Say if you'd rather have it split out.
  • The extra-category-on-a-detected-transfer case above is acceptable, or the detectTransfers() bug should be fixed first.
  • Edits stored by earlier versions are kept (not migrated), as in v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category #32.
  • Manual QA passed in Edge/Chrome with a real folder

https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft


Generated by Claude Code

…ou change something else (v1.16.16)

Saving the transaction drawer (showTxDrawer() in views-main.js) wrote the
description, categories, type and notes into txOverrides on every save,
changed or not. A stored type wins over the transfer keywords
(reapplyTransferKeywords() doesn't reset it), and stored categories win
over the category rules (Re-categorize all skips them, an import's mkTx()
uses them). So a ZELLE transfer saved with only a note stayed a transfer
when the "zelle" keyword was removed, and a row saved with only a note
kept its category when a category rule and Re-categorize all changed the
others. v1.16.9 fixed the same thing for the flags. The bug is also on
master.

The drawer now reads its fields back when it opens, and Save stores a
field only if it was changed from that. Changing the type to Transfer
still stores the direction category. A description changed back to the
original, or an emptied note, is removed from the edit, and an edit left
empty is removed. The transfer drawer stored both legs' description and
notes on every save; it now stores only what changed, through the same
storeChangedText(). Plan links and bulk edits are unchanged.

Fields stored by earlier versions are not removed: they can't be told
apart from deliberate edits. Clear transaction edits removes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
This was referenced Nov 2, 2026
@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
….0) into fix-drawer-saves-unchanged-fields

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.16: fix the edit drawer freezing a transaction's type and category when you change something else v1.16.16: Fix the edit drawer freezing a transaction's type and category when you change something else 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