Repository navigation
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
Conversation
…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
Open
v1.16.2: Fix Rebuild from your folder clearing everything when the folder has no CSV it can read
#25
Open
Open
Open
Open
….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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()injs/views-main.jswrote four fields intotxOverrideson every Save, from whatever the form showed:What each stored value blocks:
reapplyTransferKeywords()only resets a transfer with no storedtype, andundoTransferDetection()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 hadtype: '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.recategorizeAll()) skips any row with storedcategories. An import builds rows withmkTx(), 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.The bug is also on
master(v1.10.5). ItsshowTxDrawer()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 onlytype, 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.unlinkPlanItems()already did. Saving without changing anything stores nothing.storeChangedText(t, o, was, now)handles Description and Notes for both drawers.showTransferDrawer()reads each leg's description and notes on opening and stores only what changed, throughstoreChangedText(). An edit left empty is removed.CHANGELOG.md, theindex.htmlfooter,README.md(badge, footer, a sentence under Transactions) andjs/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
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, storedtype: '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 onmaster.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 (nolsSet()). 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) onlyboot.js,race.jsand this PR's own tests ran. Headless Chromium at 1280×900 againstsamples/, with the pinned CDN libraries served from npm; each script ran asNODE_PATH=$(npm root -g) node <script> <repo> <outdir>.f4a3495boot.jsrace.jstest-drawer-fields.js(new in this PR)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.js55/55,test-insights.js137/137,test-finances.js126/126,test-plan.js127/127,boot.js257 transactions and 0 errors,race.js0 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.js73/73,test-save-status.js64/64,test-master-port.js16/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:finlens-state.jsonin a new browser.test-drawer-fields.jsonecfcab2(temporary worktree, since removed)test-drawer-fields.json this branch (36d0095)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, plusbootandrace:ecfcab2renderImportLogrenderImportLogThe
raceerrors are the expectedrenderImportLogones: #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.edhelper in the Console), but check outcleanup-stale-docs-and-dead-codeinstead offix-drawer-saves-unchanged-fields.ZELLEin Search description or notes.rent split. Click Save changes.ed('ZELLE').ed('ZELLE')again.What goes wrong:
editholdsdescription,categories: ["Transfer out"]andtype: "transfer", not only{"notes":"rent split"}.debit, but the noted row stays atransfer/Transfer out.Manual QA steps
Setup
git checkout fix-drawer-saves-unchanged-fields.samples/to a new scratch folder. Don't use your real folder: this PR changes what gets saved.index.html, so there are no edits yet.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
ZELLEin Search description or notes.rent split. Click Save changes.ed('ZELLE').Expected:
editis{"notes":"rent split"}, with notype,categoriesordescription.transferand categoryTransfer out.Before this fix: the edit also held
description,categories: ["Transfer out"]andtype: "transfer".2. That transfer follows the keyword when you remove it
ed('ZELLE').zellein Add keyword and click Add.ed('ZELLE')again.Expected:
debit(Expense) and no longer Transfer out.transfer/Transfer outagain. 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
T-MOBILE. Open the newest T-MOBILE AUTOPAY row.phone. Click Save changes.t-mobilein Add keyword and click Add.ed('T-MOBILE').ed('T-MOBILE')again.Expected:
transfer.debit. The noted row'seditis 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
WALMART. Open one WALMART SUPERCENTER 2251 row and add a note. Click Save changes.WALMART. Set Category to Housing. Click Add rule.ed('WALMART').Expected:
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
ed('WALMART')anded('PUEBLO').ed('PUEBLO')again.Expected:
Shoppingafter Re-categorize all, and its edit holds"categories":["Shopping"].{"type":"transfer","categories":["Transfer out"]}, and it's listed on the Transfers screen.transfer(the keyword re-run doesn't undo a type you set).6. Description and notes edge cases
Paycheck. Save. Runed('ACME').ACME CORP PAYROLL DIRECT DEP. Save. Runed('ACME').ed('ZELLE').Expected:
editisnull.editis{"description":"Paycheck"}; the list shows Paycheck.editis back tonull.editstaysnull.editisnull, and the count drops by one.7. Flags and plan links still save as before
ed('NETFLIX').ed('CHIPOTLE').ed('CHIPOTLE').Expected:
isBill.link.null(an empty edit is removed).8. The transfer drawer stores only the leg you change
ed('ONLINE TRANSFER').Expected:
{"notes":"…"}. The savings leg'seditisnull.Before this fix: both legs got an edit with
descriptionandnotes.9. Edits survive a reload and a new browser
edhelper again.ed('T-MOBILE'),ed('WALMART')anded('PUEBLO').index.html, click Pick your CSV folder and choose the same scratch folder.Expected:
{"notes":"phone"}, the Shopping WALMART row still hascategories, and the PUEBLO row still hastypeandcategories.10. Regression: bulk edits
edfor one of them (use part of its description).Expected:
categories.Please check before merging
detectTransfers()bug should be fixed first.https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code