Skip to content

v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category - #32

Open
gitluis wants to merge 3 commits into
fix-rule-flags-lost-on-reloadfrom
fix-drawer-flag-overrides
Open

gitluis wants to merge 3 commits into
fix-rule-flags-lost-on-reloadfrom
fix-drawer-flag-overrides

Conversation

@gitluis

@gitluis gitluis commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #31 (fix-rule-flags-lost-on-reload), 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).
Depends on #31's code: the drawer works the flags out with its txFlags().

Summary

Saving the transaction drawer stored all three flags (Bill, Recurring, Subscription) as the checkboxes showed them, even when you only changed the category. That transaction then ignored later rule changes. Now the drawer stores a flag only when you change its box. A flag you leave alone keeps following the transaction rules, or keeps the edit already stored for it.

Cause

  • Where: the drawer's Save handler in showTxDrawer() (js/views-main.js) set o.isBill, o.isRecurring and o.isSubscription from the three checkboxes on every save.
  • Why it matters: an edit in txOverrides wins over the rules (txFlags() in core.js, from v1.16.8). So a row saved for its category kept the flags it had at that moment.
  • Example on the samples: with LIBERTY INTERNET → Bill, save one LIBERTY INTERNET row with category Housing, then remove the rule. The other 5 rows stop being bills; the saved row stays a bill. A LIBERTY INTERNET → Subscription rule added later reaches 5 rows, not 6.
  • Master has it too. origin/master (js/views-main.js, lines 596–598) writes all three flags the same way. There, applyTxRulesToAll() also skips any flag key present in the override.
  • Bulk edit doesn't have it. Mark as bill and Mark as subscription store only the flag they set. No other code writes flags into txOverrides. Deleting a category, the transfer drawer and migrate.js don't touch flags.

What changed

  • showTxDrawer() (js/views-main.js):
    • On opening, it keeps the three flags it shows (shown). The checkboxes render from that object.
    • On Save, it stores a flag only if its box differs from shown, ticked or unticked. An untouched box adds nothing and leaves any stored edit as it is.
    • After saving, the row's flags come from txFlags(), the same function a reload uses. Memory and the next reload agree.
  • No migration. Flags already stored by earlier saves stay, including those that match what the rules give. A stored flag can be a deliberate "keep this a bill" or an accident of the old Save. Nothing in the data tells them apart. Removing them would silently change rows the user meant to pin. Users who want them gone can use Clear transaction edits (Settings → Data & reset), which removes all edits. A migration would also have to rewrite txOverrides in localStorage, IndexedDB and finlens-state.json, the storage handling other PRs are changing.
  • Version v1.16.9: CHANGELOG.md, index.html footer, README.md (badge and footer), js/views-settings.js, CLAUDE.md §1 and "Last updated".
  • Docs:
    • CLAUDE.md §4.2: the "drawer stores all three flags" bullet is replaced by the new rule.
    • CLAUDE.md §12: one line under state mutations.
    • README.md: one sentence under Transactions.

Not verified

Automated checks: earlier run, not re-run · 09d2125

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 09d2125, chained on #31. 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 09d2125
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 6 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 (updated in this PR) 67/67
test-drawer-flags.js (new in this PR) 36/36

Measured before the chain

By the agent that wrote the fix, on 0af0ff6 (built on 650ec68, the rule-flags fix before the chain, then v1.16.6). Its "Before" column is 650ec68.

Headless Chromium (Playwright) against samples/, desktop viewport 1280×900. The scripts live in the test harness, not the repo.

Suite Before (650ec68) After (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
test-rule-flags.js (one check updated, see below) 67/67 with the old check · 66/67 with the updated one 67/67
test-drawer-flags.js (new) 17/36 36/36
boot.js 0 errors 0 errors
race.js 7 errors, all renderImportLog 6 errors, all renderImportLog
  • race.js: every error is the renderImportLog / innerHTML null that PR v1.10.5: fix Import Logs throwing when the view is left before it loads #18 fixes. None comes from this change. The count varies per run.
  • test-rule-flags.js: the check that documented the old behaviour ("Unchanged: a row saved in the drawer (category only) stores its flags…") now checks the new one: no flag keys are stored, and the row stops being a bill when the rule goes. The name of the following Clear transaction edits check was reworded; its logic is unchanged. The header comment was updated.
  • test-drawer-flags.js (new):
    • A, category-only save: no flag stored; removing the rule unflags the row; a rule added later reaches it; both hold after a reload; the drawer shows the rule's flags afterwards.
    • B, a ticked flag: only that flag is stored; it outlasts a rule added and removed; the row's untouched boxes follow other rules.
    • C, unticking a rule flag: stored as a manual "off", only that flag; it holds through reloads and through the rule being removed and added back.
    • D, existing edits: a stored manual flag is kept on a category-only save. A row with all three flags stored, as v1.16.8 saved them, keeps all three (no silent clean-up).
    • E, a box ticked and unticked again: stores nothing.
    • F, bulk Mark as bill / subscription: stores only that flag; the other flags follow the rules; holds after a reload.
    • G, boot from finlens-state.json in a new browser: the edited rows come back the same, and the category-only row follows the file's rules.
    • On 650ec68, the 17 passes are checks of behaviour that was already right: bulk edit, manual flags beating rules, and the D check that three stored flags are kept.
How to reproduce the bug

Run this on the base branch, fix-rule-flags-lost-on-reload. master has the same bug.

  1. Do the Setup from the testing steps below, but check out fix-rule-flags-lost-on-reload instead of fix-drawer-flag-overrides. Use the scratch folder with the three sample CSVs, never your real folder. Setup ends with the LIBERTY INTERNET → Bill rule at 6 matches.
  2. Search LIBERTY. All 6 rows show Bill.
  3. Click the description of the newest LIBERTY INTERNET AUTOPAY row. Change Category to Housing. Don't touch the Flags boxes. Click Save changes.
  4. In DevTools, open Application → Local storage → the file:// entry → finlens_txOverrides, and find that row's entry.
  5. Click Transaction rules and click × on the LIBERTY INTERNET row.
  6. Search LIBERTY again.

What goes wrong:

  • The stored entry has isBill, isRecurring and isSubscription keys, though only the category changed.
  • After the rule is removed, 5 rows lose Bill but the saved row still shows it. A LIBERTY INTERNET → Subscription rule added afterwards reaches only 5 rows, not 6.
Manual QA steps

Setup

  1. Copy the three CSVs from samples/ into a new scratch folder (for example FinLens-test-32). Do not use your real folder.
  2. git checkout fix-drawer-flag-overrides, 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. Open the date range button (calendar icon, top bar) and choose All time.
  6. Go to Transactions, click Transaction rules, type LIBERTY INTERNET in When description contains, leave Flag as on Bill, and click Add rule. The row should say 6 matches.

To see what a save stored: F12 → Application → Local storage → the file:// entry → finlens_txOverrides. Find the transaction's entry and look for isBill, isRecurring, isSubscription keys.

1. Category-only save no longer pins the flags (the main fix)

  1. Type LIBERTY in Search description or notes. All 6 rows show Bill.
  2. Click the description of the newest LIBERTY INTERNET AUTOPAY row.
  3. Change Category to Housing. Don't touch the Flags boxes. Click Save changes.
  4. In DevTools, check that row's entry in finlens_txOverrides.
  5. Click Transaction rules and click × on the LIBERTY INTERNET row.
  6. Search LIBERTY again.

Expected:

  • The stored entry has categories but no isBill, isRecurring or isSubscription key.
  • After the rule is removed, none of the 6 rows show Bill, including the one you saved. It still shows Housing.

Before this fix: the saved row kept its Bill chip after the rule was removed (5 rows unflagged, 1 still a bill).

2. A rule added later reaches the saved row

  1. Add the rule LIBERTY INTERNET → Subscription.
  2. Search LIBERTY.
  3. Press F5 and search again.
  4. Open the Housing row and look at Flags. Click Cancel.

Expected:

  • All 6 rows show Sub, before and after F5.
  • The drawer shows Subscription ticked, Bill unticked.

Before this fix: only 5 rows got Sub.

3. Unticking a rule flag is stored as a manual "off"

  1. Remove the Subscription rule and add LIBERTY INTERNET → Bill again.
  2. Open a different LIBERTY INTERNET AUTOPAY row. Untick Bill. Click Save changes.
  3. Check its finlens_txOverrides entry.
  4. Press F5 and search LIBERTY.
  5. Remove the rule, then add LIBERTY INTERNET → Bill again. Search LIBERTY.

Expected:

  • The entry has "isBill":false and no isRecurring / isSubscription key.
  • That row shows no Bill chip after F5 and after the rule is re-added. The other 5 do.

4. Ticking a flag stores only that flag

  1. Search NETFLIX. Open one NETFLIX.COM row.
  2. Tick Recurring. Click Save changes.
  3. Check its finlens_txOverrides entry.
  4. Add a rule NETFLIX → Subscription. Search NETFLIX.
  5. Remove the NETFLIX rule.

Expected:

  • The entry has "isRecurring":true and no isBill / isSubscription key.
  • With the rule, every NETFLIX row shows Sub, and the edited one shows Recurring and Sub.
  • Without the rule, the edited row still shows Recurring; Sub is gone from all.

5. Ticking and unticking the same box stores nothing

  1. Open an untouched LUMA ELECTRIC BILL PAY row.
  2. Tick Bill, then untick it. Change nothing else. Click Save changes.
  3. Check its finlens_txOverrides entry.

Expected:

  • The entry has no flag keys (only description, categories, type, notes).

6. An existing stored flag is kept on a later category-only save

  1. Open the NETFLIX row from test 4 (stored isRecurring:true).
  2. Change only its Category. Click Save changes.
  3. Check its entry.

Expected:

  • "isRecurring":true is still there. Recurring still shows in the Flags column.

7. Bulk Mark as bill / Mark as subscription (should not change)

  1. Search T-MOBILE. Tick the checkboxes on two rows.
  2. In the bar that appears, click Mark as bill.
  3. Check one of their finlens_txOverrides entries.
  4. Add a rule T-MOBILE → Recurring.

Expected:

  • The entry has "isBill":true only.
  • Both rows show Bill and Recurring; the other T-MOBILE rows show Recurring only.

8. Survives closing the browser (boot from finlens-state.json)

  1. Wait about 5 seconds after your last change.
  2. Close the tab. Open index.html again in a new tab.
  3. If asked, go to Settings → Import and click Reconnect folder, then allow. Set All time.
  4. Search LIBERTY, then NETFLIX, then T-MOBILE.

Expected:

  • Each row shows the same flags as before you closed the tab.
  • The footer and Settings → General show v1.16.9.

Please check before merging

  • Open a transaction a rule flags, change only its category, save, then remove the rule: the flag goes.
  • Untick a rule-set flag in the drawer and save: it stays off after a reload and after the rule is removed and added back.
  • Agree with not migrating: rows saved in the drawer before v1.16.9 keep their three stored flags until Clear transaction edits.
  • The version is v1.16.9 in the footer, README, Settings → General and CHANGELOG.
  • Known, not fixed here: Save also always stores type, so reapplyTransferKeywords() skips that row when a transfer keyword is removed. That is a separate bug for its own PR.
  • Manual QA passed in Edge/Chrome with a real folder

https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft


Generated by Claude Code

…ge its category (v1.16.9)

Saving the transaction drawer (showTxDrawer() in views-main.js) wrote all
three flag checkboxes (Bill, Recurring, Subscription) into txOverrides,
whatever the user had touched. An edit there wins over the transaction
rules (txFlags()), so a row saved only for its category kept the flags it
had then: a removed rule didn't unflag it and a new rule didn't reach it.
The bug is also on master.

The drawer now remembers what its boxes showed when it opened, and Save
stores a flag only if its box was changed from that, ticked or unticked.
An untouched box stores nothing, so it keeps following the rules or keeps
an edit already stored. The row's flags are then set from txFlags(), as a
reload does. Bulk Mark as bill / subscription already stored only their
own flag and are unchanged.

Flags stored by earlier versions are not removed: they can't be told
apart from flags set on purpose. Clear transaction edits removes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
…drawer-flag-overrides

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.9. renderImportLog() keeps #18's guards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
… into fix-drawer-flag-overrides

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.9: fix the edit drawer freezing a transaction's flags when you only change its category v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category 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