Repository navigation
Conversation
…16.18) Settings -> Data & reset -> Import JSON saved the file's transaction edits (txOverrides) but left the loaded transactions as they were: every screen kept the old descriptions, categories, types, flags and notes, and a transaction the file had no edit for kept its old edit. A reload didn't always fix it: the autosave wrote the transactions as shown, and a boot from finlens-state.json keeps a saved category and type where the edit has none. master has the same gap in importJsonFile(), but no button calls it there (Import JSON came in v1.16.0). - applyImportedEdits() (ui.js): with new edits, every loaded transaction is rebuilt from its CSV values (DataCleanup._unedited(), as Clear transaction edits does) with its imported edit on top (reconstituteTx()), then detectTransfers() runs: what an import of the CSVs makes with these edits. Flags an edit doesn't set follow the rules now in State (txFlags()). - _applyImportedSettings() is async and runs it when txOverrides changed; that rebuild also covers new flag rules and transfer keywords, so their own steps run only without new edits. Edits moved by adoptOverrides() count. - Plan links already showed at once (read from txOverrides); unchanged. - An export without edits (1.0, 1.1) changes no transaction. - Version bumped to v1.16.18 (CHANGELOG, footer, README, Settings, CLAUDE.md); CLAUDE.md §9 and §20 updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
26 tasks
… into fix-json-import-edits-not-applied Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBUZo6LRYpLthSp2PRi # Conflicts: # CLAUDE.md # js/ui.js # js/views-settings.js
Owner
Author
|
Dark theme taken out of the stack (Luis, 2026-11-04). #17 is light only for now: no ◐ toggle, no Light / Dark / Match system setting, no dark tokens. It comes back later in its own PR. #17's change was merged forward into this branch (no force push).
🤖 Generated with Claude Code https://claude.ai/code/session_013Z8iBUZo6LRYpLthSp2PRi Generated by Claude Code |
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
Settings → Data & reset → Import JSON saved the file's transaction edits (
txOverrides), but every screen kept the old descriptions, categories, types, flags and notes. A transaction the file had no edit for kept its old edit too.Now every loaded transaction is rebuilt right after the import, the same way an import of the CSVs with those edits would build it.
Cause
importJsonFile()(ui.js) replacedState.txOverridesand rebuilt nothing._applyImportedSettings()re-applied flag rules and transfer keywords only when those keys changed. Its comment said edits apply "once the page reloads".finlens-state.json(loadStateFromFile()→reconstituteTx()) takes the category and type from the saved transaction when the edit has none. So an old edit's category stayed wherever the imported file had no edit for that transaction. Only a boot from IndexedDB rebuilt them from the CSV rows. Seen on the parent: case 2's first check fails for F, which keeps "Travel".importJsonFile(), but no button calls it there: the Import JSON button came in v1.16.0. Checked by calling it directly onorigin/master(e8e18e7): the edit (descriptionFROM BACKUP, a note) is saved, and the transaction still showsUBER TRIPwith no note.What changed
applyImportedEdits(before)(ui.js, new). It rebuilds each loaded transaction:DataCleanup._unedited()(v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24's helper, as Clear transaction edits uses it);reconstituteTx();detectTransfers()once.txFlags(), v1.16.8: Fix flags set by transaction rules disappearing after a reload #31);beforeis the edits map from before the import._unedited()needs it only for a transaction from a ≤v1.16.0 state file, which doesn't record its CSV category and type._applyImportedSettings(changed, before)is now async:applyTxRulesToAll()andreapplyTransferKeywords()don't also run: they would repeat work the rebuild has done.importJsonFile():IdMigration.adoptOverrides()count as changed edits.State.txOverrides, so they already showed at once on the parent too. The test checks they still do.Not verified
#dcImportFileinput through Playwright.categoryfield.reconstituteTx()ignores it, as a reload does;mkTx()reads it. Today's drawer writescategories. I didn't check whether any saved data still holdscategory. Not changed here.Automated checks: earlier run, not re-run · a2063c8
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
a2063c8(chained on #40) 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>.a2063c8boot.jsrace.jstest-json-import-edits.js(new in this PR)test-json-export.js(#29's, with this PR's edit)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.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, desktop 1280×900, with the harness's fake folder. Suites ran one at a time.
test-json-import-edits.js(new). The export is made in one browser with six edits:A second browser has other edits (A changed differently; F, a row the file has no edit for) and imports the file through the real file input.
17cc713): 15/29 passed. Failures: A–G keep their old values, F keeps "Travel", the Transactions list and drawer show the old values, a reload from the state file still shows F as "Travel", and cases 4 and 5 differ from the reference. The passes: setup, links, the IndexedDB boot, the exports without edits (case 3), and no-console-error checks.b4a87e6): 29/29 passed.test-read-as.js(from the bug-1 PR): 52/52 passed onb4a87e6.run-tip.sh 15onb4a87e6: every suite passed except one check, which had to change:renderImportLog(expected on this base until v1.10.5: fix Import Logs throwing when the view is left before it loads #18's fix is in the stack; none from this change).Suite changed:
test-json-export.js(harness copy). That check now depends on whether the fix is present:applyImportedEdits(), it expects the edit to show at once ("transaction edits show at once (v1.16.18)");b4a87e6and 31/31 on17cc713.How to reproduce the bug
Run this on the base branch,
fix-read-as-reload-duplicates(#40). Master's code has the same gap, but no button reaches it there, so it can't be reproduced from master's screens.fix-read-as-reload-duplicatesinstead offix-json-import-edits-not-applied. Use a scratch folder with the samples only.What goes wrong:
Manual QA steps
Setup
git checkout fix-json-import-edits-not-applied.samples/to a new scratch folder. Don't use your real folder: Import JSON replaces your edits and the autosave rewritesfinlens-state.json.index.html.Make the backup (state A). On Transactions, use Search description or notes to find each row, click it, change it, and click Save changes:
Airport ride, Category Transport, Notesbackup note.lunch, and Link to a budget, bucket or debt → Budget → pick one.Then Settings → Data & reset → Export JSON. Keep the downloaded
finlens-export-YYYYMMDD.json.Change things after the backup (state B).
Changed later, Notes tolater note. Save.1. Import JSON applies the backup's edits at once (main fix)
Expected:
Before this fix: every row kept its state-B values until a reload, and F kept Travel even after one.
2. The drawer shows the imported values
Expected:
Airport ride, B's Type is Transfer, C's Bill box matches the backup.3. Reload from the folder agrees
Expected:
4. A fresh browser agrees
index.html, pick the same scratch folder.Expected:
5. An import without edits changes nothing
"txOverrides": { … },block, save asno-edits.json.no-edits.json.Expected:
txOverrideskeeps your edits).6. Edits, flag rules and keywords in one import
LIBERTY INTERNET, Flag as Bill, click Add rule.rentin Add keyword and click Add. The RENT PAYMENT PALM COURT APTS rows become transfers.Expected:
7. Regression: plan links and other settings
Expected:
Please check before merging
https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code