Repository navigation
Conversation
A transaction's Bill, Recurring and Subscription flags were worked out from the transaction rules only when its CSV row was first imported, and stored in the IndexedDB row. Adding or removing a rule changed only the transactions in memory. On reload, reconstituteTx() read the flags back from the row (and from finlens-state.json on a file boot), so a rule added later lost its flags and a removed rule's flags came back. The bug is also on master. txFlags() in core.js now works the three flags out from the user's edit in txOverrides, else the current rules. mkTx(), reconstituteTx() and applyTxRulesToAll() all use it; stored flags are no longer read. loadStateFromFile() passes the file's own txRules, which State only gets after the file is read. 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
…ost-on-reload 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.8. renderImportLog() keeps #18's guards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
This was referenced Nov 2, 2026
…le-flags-lost-on-reload 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
A transaction rule (Transactions → Transaction rules, e.g. LIBERTY INTERNET → Bill) flagged its transactions right away, but a reload unflagged them again (6 → 0 on
samples/). The rule itself stayed listed. All three flags a rule can set were affected: Bill, Recurring and Subscription. The reverse also happened: a rule that existed at import time, once removed, came back on the next reload.Now the flags are worked out from your edits and the current rules every time a transaction is built or loaded. Stored flags are no longer read.
Cause
mkTx()set them fromState.txRuleswhen a CSV row was parsed.DB.importTransactions()stored them in the new IndexedDB row.applyTxRulesToAll(), which changed only the transactions in memory. A CSV re-import skips rows already stored, so the stored flags never changed either.DB.loadAll()→reconstituteTx()readisBill,isRecurringandisSubscriptionfrom the stored row. That row held the flags as they were at import.finlens-state.json:loadStateFromFile()→reconstituteTx()read the flags from the file. The file was only right if it was saved while the flags in memory were. After a reload had lost them, the next save wrote the lost flags into the file too.masterhas the bug too. The samereconstituteTx()code is onorigin/master(9ba3e79, v1.10.4).probe-mech.jsgives the same results there as on70c7125. On master the Re-apply rules button brought the flags back until the next reload. v1.14.0 removed that button, so on this stack there was no workaround.What changed
core.js:txFlags(desc, ov, rules?)(new). Returns the three flags: the edit intxOverridesif there is one, otherwise whether a rule matches the original description.core.js:txRuleFlag(desc, flag, rules = State.txRules)takes an optional rule list.core.js:mkTx()andapplyTxRulesToAll()usetxFlags(). Same results as before.db.js:reconstituteTx(raw, ov, rules?)usestxFlags()instead of the row's stored flags. This coversDB.loadAll(),DB.queryTransactions(),loadStateFromFile(),loadFiles()(adopted overrides) andDataCleanup.clearEdits().core.js:loadStateFromFile()passes the file's owntxRules, because State only gets them after the function returns.reconstituteTx()(inDataCleanup._unedited(), from v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24), so it now gets the flags fromtxFlags()too. v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24 already set them from the rules there, so its result is the same.clearEdits()itself is unchanged.samples/the AI summary and the AI Eval's sample summary are byte-identical to v1.16.0's, sodocs/EVAL.mdstays valid.CHANGELOG.md, theindex.htmlfooter,README.md(badge and footer),views-settings.jsand CLAUDE.md §1.txRuleFlag(),txFlags(),applyTxRulesToAll(); §19 the flags in thetransactionsstore; "Last updated".exportAllData(),importJsonFile(), the State-key-to-storage-key handling,DB._migrateSync(),DataCleanup.clearEdits().Found, not fixed
showTxDrawer()→ Save writesisBill,isRecurringandisSubscriptionintotxOverridesas the checkboxes show them, even when only the category changed. That transaction then ignores every later rule change. This is older behavior, unchanged here (the CHANGELOG says so), andtest-rule-flags.jschecks it as unchanged. A possible fix: store a flag only when its checkbox differs from the current value, or when an edit already exists. It belongs in its own PR: v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category #32, stacked on this one, fixes it.fix-clear-edits-wipes-transactions) changes thereconstituteTx()header and the flag lines inDB.importTransactions(). The code merged without a conflict:reconstituteTx()has this PR's header comment andtxFlags()plus v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24's_originalCategories/_originalType, andDB.importTransactions()keeps v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24'stxRuleFlag(src, f)calls, which work with the new optional third argument. v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24's_unedited()still passes rule flags in the record it rebuilds;reconstituteTx()now ignores record flags and works out the same values, so those three lines are redundant but harmless and were left as they are. Only CLAUDE.md §4.2 conflicted (both PRs add a paragraph there; both kept). The CHANGELOG bullet about Clear transaction edits was reworded to say its result doesn't change.Not verified
init.js(idbGet('csvDirHandle')overridden), not the File System Access API in Edge or Chrome.txRulesand callsapplyTxRulesToAll(), which this change keeps working.test-json-export.jspasses on this branch's commit (above); it wasn't checked beyond that suite.reconstituteTx()before renaming ids, so the flags should follow the rules there too.Automated checks: earlier run, not re-run · 7289d64
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 commit7289d64, chained on #30. Each script ran asNODE_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).7289d64test-clarity.jstest-insights.jstest-finances.jstest-plan.jsboot.jsrace.jsrenderImportLog(the race #18 fixes on master; not in this stack)test-clear-edits.js(from #24)test-rebuild-folder.js(from #25)test-partial-import.js(from #26)test-json-import.js(from #27)test-new-browser-copy.js(from #28)test-json-export.js(from #29)test-plan-links.js(from #30)test-rule-flags.js(new in this PR)test-insights.js's "General: version line" check reads the version from theindex.htmlfooter, andtest-plan.js's "Budget: Save adds it" accepts a new budget with or without anid, requiring thebud_+ 10 base-36 format once it has one (v1.16.7: Fix transaction links to budgets, buckets and debts pointing at the wrong item after a delete #30 adds ids). Nothing else in the base suites changed.test-rule-flags.jshere is this PR's version. From v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category #32 up, the stack runs v1.16.9: Fix the edit drawer freezing a transaction's flags when you only change its category #32's update of it.Measured before the chain
By the agent that wrote the fix, on
650ec68(built on70c7125, v1.16.0; then numbered v1.16.6). This branch's run uses that version oftest-rule-flags.js; from #32 up, the stack runs #32's update of it.Headless Chromium (Playwright) against
samples/, desktop viewport 1280×900. Each script is run asNODE_PATH=$(npm root -g) node <script> <repo> <outdir>. CDNs are blocked in the sandbox, so the harness serves the pinned libraries from npm.70c7125)650ec68)test-rule-flags.js(new)test-clarity.jstest-finances.jstest-plan.jstest-insights.jsboot.jsrace.jsrenderImportLogrenderImportLograce.js: every error is the knownrenderImportLograce that PR v1.10.5: fix Import Logs throwing when the view is left before it loads #18 fixes. None come from this change. The count varies between 6 and 8 from run to run.test-rule-flags.jscovers:finlens-state.jsonpayload: a fake connected folder is injected beforeinit.js, in a new browser context with empty storage. Three payloads are booted: the file as written; rules kept with the flags off (what a session wrote after a reload lost them); rules removed with the flags still on. The flags follow the file's rules each time, and again after a reload. Browser storage holding different rules doesn't change that.applyTxRulesToAll(); the panel has no edit control. Two flags on one keyword, then that keyword's rules deleted. A rule removed after a re-import. Rules that existed at import time, then removed. Each is checked before and after a reload.summary-no-rules.txt).probe-mech.jsshows the mechanism onorigin/master,70c7125and this branch. It counts the flags in memory and in the stored rows after each step.probe-eval.js: the AI Eval's sample summary (AIEval.loadSamples()) is byte-identical on base and fix (941 bytes).How to reproduce the bug
Run this on the base branch,
fix-plan-link-ids.masterhas the same bug (there, Re-apply rules hides it until the next reload).fix-plan-link-idsinstead offix-rule-flags-lost-on-reload. Import the three sample CSVs with choose the files, so no folder is connected.LIBERTY INTERNET. Leave Flag as on Bill. Click Add rule.LIBERTY. All 6 LIBERTY INTERNET AUTOPAY rows show a Bill chip.LIBERTYagain. Don't open or save any row's drawer.What goes wrong: the rule is still listed (Contains
LIBERTY INTERNET→ Bill), but 0 of the 6 rows have the Bill chip after the reload.Manual QA steps
Setup
samples/into a new scratch folder (for exampleFinLens-test-31). Do not use your real folder.git checkout fix-rule-flags-lost-on-reload, then openindex.htmlin Edge.RESETand click Erase and start over.Tip: in tests 1–5, do not click Save changes in a transaction's drawer on a rule-matched row. Saving the drawer pins all three flags on that row (a known older behaviour, fixed in #32), which would hide what you're testing.
1. A Bill rule survives a reload (the main fix)
LIBERTY INTERNET. Leave Flag as on Bill. Click Add rule.LIBERTYin Search description or notes at the top of the list.LIBERTYagain.Expected:
LIBERTY INTERNET→ Bill, 6 matches.Before this fix: after F5 the rule was still listed, but 0 of the 6 rows had the Bill chip.
2. Recurring and Subscription rules too
LUMA ELECTRIC→ Recurring, thenT-MOBILE→ Subscription.LUMA, thenT-MOBILE.Expected:
3. Removing a rule keeps its flags off after a reload
LIBERTY INTERNETrow.LIBERTY. The Bill chips are gone.LIBERTYagain.Expected:
4. A rule that existed at import, then removed
LIBERTY INTERNET→ Bill again.LIBERTY INTERNET.LIBERTY.Expected:
Before this fix: the 6 Bill chips came back after F5, because the rows were stored with the flag at import.
5. Bills screen and confirming a subscription
T-MOBILE→ Subscription rule from test 2. Press F5.Expected:
6. A manual flag still beats a rule
LIBERTY INTERNET→ Bill again.LIBERTY, thenNETFLIX.LIBERTY INTERNETrule and add it back. SearchLIBERTYagain.Expected:
7. Boot from finlens-state.json (connected folder)
RESET, click Erase and start over.LIBERTY INTERNET→ Bill. Wait about 5 seconds (the backup saves 5 seconds after a change).index.htmlagain in a new tab.LIBERTYin Transactions.LIBERTY.Expected:
8. No rules: nothing changes
Expected:
Please check before merging
finlens-state.json).https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code