Repository navigation
Conversation
…the next boot (v1.16.3) loadFiles() replaced every loaded transaction with the imported files' ones. On the samples, importing only the card file (Choose CSV files) left 165 of 257 in memory. IndexedDB kept all 257, since DB.importTransactions() only adds rows, but the autosave wrote 165 to finlens-state.json, which boot loads first. The same happened on Reload CSVs when the folder no longer held all of an account's rows (a newer export that starts where the last one ended, an old CSV moved out). master has the same code. - loadFiles() merges (mergeImported()): the files' transactions replace loaded ones with the same id, new ones are added, every other loaded transaction stays. A leftover suffixed copy is removed from memory as importTransactions() removes it from the store. - Kept transfers go back to their CSV type and category, with their edit, before detection (undoTransferDetection()), so they pair as in a full import. A transfer from a <=v1.16.0 state file uses its IndexedDB row, else debit/credit by sign and autoCategory(). - Importing your own files still replaces the sample data (it now empties State.transactions there explicitly). Rebuild from your folder still replaces everything: it drops the loaded data before the import. - Version bumped to v1.16.3 (CHANGELOG, footer, README, Settings, CLAUDE.md); CLAUDE.md §4.5, §8, §10 and §11 updated. 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
…al-file-import 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.3. 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
… fix-partial-file-import 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
Importing only some of your CSV files replaced every loaded transaction with those files' ones. For example, choose just the card file on the Welcome or in Settings → Import. On the samples, 257 became 165. IndexedDB kept all 257, but the autosave wrote 165 to
finlens-state.json, and boot loads that file first. After a reload, the other accounts were gone.Now an import adds the files' new transactions and replaces the ones it already has. Every other loaded transaction stays, as IndexedDB already does.
Cause
Where:
loadFiles()injs/core.js. The import step started withState.transactions = []and then pushed only the imported files' transactions.DB.importTransactions()never removes a row it holds (§10), so after any partial import, memory and IndexedDB disagreed. The state file followed memory, and it wins at boot (§4.5).What else it broke:
Folder reloads had it too. Reload CSVs replaced memory with whatever the folder held. These cases lost rows the same way:
On the samples, an October-only card export left 117 of 257. So folder reloads now keep rows too; see "Please check".
master has the bug.
origin/master(v1.10.4) has the sameState.transactions = []inloadFiles(), and the same file-picker path.What changed
mergeImported()(new,js/core.js) builds the loaded transactions after an import, the wayDB.importTransactions()builds the store:undoTransferDetection()(new) puts a kept transfer back to its CSV type and category, with its edit, beforedetectTransfers()runs again._originalType/_originalCategories. Its IndexedDB row gives them. Without a row, the type goes back to debit or credit by sign and the category comes fromautoCategory(), as v1.16.1's Clear transaction edits does. Then detection pairs it again.loadFiles()now emptiesState.transactionsitself._dropImported()).Not verified
mergeImported()uses sets, and reads IndexedDB once, only when a kept transfer lacks its CSV values. Its speed on thousands of rows wasn't measured.Automated checks: earlier run, not re-run · 9137aa4
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 commit9137aa4, chained on #25. 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).9137aa4test-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(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.Measured before the chain
By the agent that wrote the fix, on
9137aa4(this branch's commit too: it was already built on #25's277ebe2, so it didn't change when the stack was built).Headless Chromium against
samples/, with CDNs served from npm. Each script ran asNODE_PATH=$(npm root -g) node <script> <repo> <outdir>.New:
test-partial-import.js(47 checks). The fake folder is the same onetest-rebuild-folder.jsuses. Every step checks:Cases:
277ebe2)9137aa4)test-partial-import.js(new)test-rebuild-folder.js(previous PR)test-clarity.jstest-finances.jstest-plan.jstest-insights.jstest-clear-edits.jsboot.jsrace.jsrenderImportLogerrorsrenderImportLogerrorsrace.js: these are the known errors PR v1.10.5: fix Import Logs throwing when the view is left before it loads #18 fixes; none come from this change.How to reproduce the bug
Run this on the base branch,
fix-rebuild-empty-folder.masterhas the same bug.fix-rebuild-empty-folderinstead offix-partial-file-import. Use the scratch folder with the three sample CSVs, never your real data folder. You can skip step 3 (the October-only file).credit_card_sample.csvfrom the scratch folder.PAYROLL.What goes wrong:
PAYROLLfinds nothing: checking and savings are gone from every screen.finlens-state.jsonwas written with 165, while This browser's database still shows 257 transactions.Manual QA steps
Setup
git checkout fix-partial-file-import.C:\temp\finlens-26. Copy the three CSVs fromsamples/into it. Never use your real data folder for this PR.samples/credit_card_sample.csvtoC:\temp\card_oct.csv(outside the scratch folder). Open it in Notepad. Keep the header and the first 25 data rows (through2026-10-01,10/02/2026,WHOLE FOODS MKT,…). Delete every line after that, starting at2026-09-26,09/27/2026,CHIPOTLE 2410. Save. Rename it tocredit_card_sample.csvinside a new folderC:\temp\card-oct\(same name as the original, so it maps to the same card account).index.htmlin Edge. Click Pick your CSV folder and choose the scratch folder. Allow access.To count one account: click the bank icon (Accounts) in the top bar and pick that account; pick All accounts to go back.
1. Importing only the card file keeps the other accounts (main fix)
credit_card_sample.csvfrom the scratch folder.Expected:
PAYROLLstill finds the checking deposits, andInterest Paidstill finds the savings rows.Before this fix: the tile read 165, and checking and savings were gone from every screen.
2. Still 257 after the autosave and a reload (persistence)
Expected:
Before this fix:
finlens-state.jsonwas written with 165, and the reload showed 165 while IndexedDB still had 257.3. Card payments stay paired with the checking autopay
credit_card_sample.csvwith Choose CSV files).Payment Thank You.Expected:
Payment Thank You-Mobilerows show Transfer in, not a card payment category.Before this fix: the payments became unpaired (type "payment"), because the checking autopays had been dropped.
4. A newer export that starts where the last one ended keeps the older rows
C:\temp\card-oct\credit_card_sample.csv(the October-only file). Click Import 1 file.Expected:
CHIPOTLEand see dates back to May).Before this fix: the tile read 117 (only the 25 October card rows plus checking and savings).
5. Edits on other accounts survive a partial import
LUMA ELECTRIC, open the Oct 12 row (−$108.81).POWER BILL TESTand addkept?in Notes. Click Save changes.savings_sample.csvfrom the scratch folder, click Import 1 file.POWER BILL TEST.Expected:
Before this fix: only the 11 savings rows were left, and the edited row was gone.
6. Reload CSVs and Rebuild still work (regression)
Expected:
POWER BILL TESTedit from test 5 is still there (Rebuild keeps edits).7. Your own files still replace the sample data
index.html.samples/.C:\temp\card-oct\credit_card_sample.csv. Click Import 1 file.Expected:
Please check before merging
test-insights.jschecks the "from the next reload" wording.fix-rebuild-empty-folder(v1.16.2).https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code