Repository navigation
v1.9.0: Settings → Data & Reset tab (clean up data, DB, logs; start over) - #3
Conversation
handleFilePick() showed the non-existent 'db-import' view, so showView() fell back to Overview and the file-assignment card was never seen. Open Settings -> Import instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
- DB: STORES, counts(), clearStores(), destroy(); release the connection on versionchange so another tab can't block a reset. - core.js: lsClearAll(), deleteIndexedDB(), folderWithWriteAccess(), saveStateNow(), retireStateFile() (archive with key stripped, or delete), forgetDataFolder(); saveStateToFile() is a no-op while a reset is running. - idbGet/idbSet/idbDel close their connections so finlens_fs can be deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
New views-cleanup.js (DataCleanup namespace): - Clear imported transactions & accounts, the import log, or transaction edits; clear budgets, bills, buckets, debts or AI history individually. - Rebuild from folder: clear imported data + log, then re-import every CSV. - Disconnect the CSV folder (nothing on disk changes). - Start over (type RESET): retire finlens-state.json (rename to a backup or delete), delete both IndexedDB databases and all finlens_* keys, reload. - After clearing, finlens-state.json is rewritten immediately so a reload can't restore the cleared data. - Two-step confirm buttons keep a fresh user gesture for permission prompts. The Danger Zone moves out of General. clearAllData() now runs the full reset; before, it only cleared localStorage and IndexedDB restored everything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
…anup-and-reset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
Requested in review. A second reset on the same day gets -2, -3, … so an earlier copy is never overwritten. Updated .gitignore, the radio label (now shows the real name), CLAUDE.md, README and CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
Review feedback on #3: gray-on-white text was hard to read. - --text-3 #94A3B8 -> #5B6B80 (light) and #64748B -> #8190A6 (dark). Was 2.3-2.6:1 on light surfaces and 3.3-3.9:1 on dark; now at least 4.7:1 everywhere (WCAG AA). Used by .muted, .footnote and ~20 inline styles, so the fix reaches every tab. - Sidebar group headers, brand subtitle and footer: hard-coded #475569/#64748b (2.3-3.6:1) -> new --sidebar-muted token (6.7:1). - applyTheme() sets Chart.defaults.color to --text-2, replacing Chart.js's #666 (hard to read in dark mode). - CHANGELOG (1.9.0) and CLAUDE.md §6 contrast rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoR1wxcaDjVVk3xmd5rRCt
Review feedback on #3 (Test 5): with a folder connected, F5 brought all 257 transactions back. The state file was correctly rewritten with 0, but init.js re-imports the folder's CSVs whenever it boots with no transactions and still has read access, which Edge/Chrome keep across a reload while the tab is open. - clearImported() sets State.csvAutoImportPaused when a folder is connected; init.js skips the boot re-import while it's set. - loadFiles() clears it, so any import the user starts ends the pause (Reload/Reconnect, Rebuild, Pick a Folder, Pick CSV Files). forgetDataFolder() clears it; Start over removes it with the rest. - Browser storage only (localStorage + app_state), not finlens-state.json: a debounced, older backup file must not be able to re-pause after the user imported again. - The banner, the Data & Reset note and the Import tab say when automatic import is paused and how to end it. - CHANGELOG (1.9.0), CLAUDE.md §4.1, §14, §20. Tested headless with a simulated folder (permission kept across reloads, and reset to prompt): 25/25 new checks, plus every view in both themes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoR1wxcaDjVVk3xmd5rRCt
…lder-permission Conflict in forgetDataFolder(): kept both resets (#7's folder-access banner and #3's csvAutoImportPaused). Also makes #7's Reconnect respect the pause: reconnectDataFolder() no longer re-imports the CSVs, and _restoreStateIfBrowserEmpty() no longer loads finlens-state.json over a browser that was cleared on purpose. The Import tab's paused text matches the Reconnect button. CHANGELOG 1.9.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QoR1wxcaDjVVk3xmd5rRCt
Review: manual test of
|
| # | Test | Expected | Result |
|---|---|---|---|
| 1 | Settings → Import → Pick CSV Files | Stays on Import with the file-assignment card (used to jump to Overview) | ✅ Pass |
| 2 | Pick a Folder → samples |
257 transactions loaded | ✅ Pass |
| 3 | Data & Reset counts | 257 loaded · 257 in database · 3 accounts; import log 3 entries | ✅ Pass |
| 4 | Click-again-to-confirm on Import log | First click arms the button, second clears it to 0 | ✅ Pass |
| 5 | Clear transactions & accounts, then F5 (×3) | Banner says they stay cleared; yellow "paused" note; 0 · 0 · 0 accounts after every reload; Import tab says automatic import is paused | ✅ Pass |
| 5b | Settings → Import → Reload, then F5 | 257 transactions, and still 257 after F5 | ✅ Pass |
| 6 | Clear again, then Rebuild | "Rebuilt from 'samples': 257 transactions re-imported. Backup file updated."; import log 3 entries; note back to teal | ✅ Pass |
| 7 | Disconnect | Rebuild row and note gone; "No CSV folder is connected"; files on disk unchanged | ✅ Pass |
| 8 | Pick the folder again → type RESET → Start over (Keep a copy) |
Alert names finlens-state-backup-24102026.json (API key removed); app reloads empty; finlens-state.json gone; CSVs untouched |
✅ Pass |
| 10 | Readability in light and dark | Descriptions, counts, sidebar headers and chart labels clearly readable | ✅ Pass |
Note on Test 8:
- First run: the alert only said the app was reset, with no rename line. That's the expected message when the folder has no
finlens-state.jsonat that moment, since there's nothing to archive. - Second run: after a backup was saved (11:16 PM), the alert named the renamed file.
- Folder afterward:
finlens-state-backup-24102026.json(117 KB), nofinlens-state.json, and the three CSVs and README with their original dates.
Screenshots
Test 1: Pick CSV Files opens the assignment card
Test 2: 257 transactions loaded from the folder
Test 3: Data & Reset counts
Test 4: click again to confirm, then Import log cleared
Test 5: cleared, with the new banner and the paused note
Test 5: after F5, still 0 · 0 · 0 accounts
Test 5: Import tab explains the pause
Test 5b: Reload brings back 257
Test 6: Rebuild from folder
Test 7: Disconnect
Test 8: Start over, first run (no finlens-state.json in the folder yet)
Test 8: Start over, second run (backup renamed)
Test 8: the folder afterward
Found along the way (not caused by this PR, fixed separately)
- v1.9.4: fix Changelog view crashing on Windows (CRLF) checkouts #8: the red
TypeError … views-db.js:734at startup (visible in the console in my first test run). The developer Changelog view breaks when Git for Windows checks files out with Windows line endings. - v1.9.5: fix "Canvas is already in use" errors and leaked charts #9: "Canvas is already in use" console errors when a view renders twice in a row, plus charts leaking on every render.
Not tested
- Test 9: a second Start over on the same day (the
-2backup name). The run above didn't produce a second archive, so the-2file wasn't observed here. It's covered by the headless tests. - Start over → Delete option: headless-tested only.
- Real data: clearing data with my real CSV folder connected.
Verdict
Approved for 47e24f4. Every test passed, and the earlier feedback is addressed.




Summary
Adds Settings → 🧹 Data & Reset, one place to clean up imported data, the database and logs, or start over from scratch. Building it uncovered why resets didn't stick, and those bugs are fixed here.
Why "start over" didn't work before
FinLens keeps data in four places:
localStorage, two IndexedDB databases (finlens_db,finlens_fs), andfinlens-state.jsonin your CSV folder. Each one could undo a reset:localStoragekeys, so on reloadDB.loadAll()restored every transaction, budget and setting. I reproduced this: 257 transactions and the budget came back.accountsstore was never cleared.The new tab
RESET. Erases both IndexedDB databases, everyfinlens_*key (including the API key) and the folder connection, then reloads.finlens-state.jsonis renamed tofinlens-state-backup-DDMMYYYY.jsonwith the API key stripped (a second reset the same day gets-2,-3, … so no copy is overwritten), or deleted, your choice. CSV files are never touched.Design notes:
finlens-state.jsonis rewritten right away. If write access is refused, the tab warns that a reload may restore the data.csvAutoImportPaused, browser storage only). Any import you start ends the pause: Reload or Reconnect, Rebuild, picking a folder or files. Disconnect and Start over end it too. The banner, the tab and Settings → Import say when it's paused.confirm()dialogs. Browsers only show file-permission prompts within about 5 seconds of a click, and a dialog can outlast that.clearAllData()now runs the full reset.Commits
2bcf358Fix "Pick CSV Files" landing on Overview. It showed a view that doesn't exist, hiding the file-assignment card. It now opens Settings → Import.f7e52a9Primitives:DB.counts/clearStores/destroy, andonversionchangeso other tabs release the database.idbGet/idbSet/idbDelnow close their connections.a2ee30cThe tab (js/views-cleanup.js,DataCleanupnamespace), plus the Danger Zone move and theclearAllData()fix.4b59df6Release v1.9.0:Review revisions:
724c0b2Backup name: the backup file is nowfinlens-state-backup-DDMMYYYY.json, as requested.b01fd0eReadable gray text across all tabs:--text-3was about 2.5:1 on white and is now at least 4.7:1 in both themes. Sidebar grays and chart labels are fixed too.47e24f4Clear sticks after a reload: in Luis's Edge test, F5 brought all 257 transactions back. The state file was correct, but boot re-imported the folder's CSVs because Edge keeps folder access across a reload while the tab is open. Clearing now pauses that re-import until you import again.How it was tested
A headless Chromium run with the sample CSVs and a fake folder handle, so permissions can be granted or denied and file writes are captured. 33/33 new checks pass, and the earlier suites still pass (27/27, 18/18, 5/5).
Per-item cleanup:
Start over:
RESETis typed.finlens-state-backup-DDMMYYYY.json, the copy keeps old data but not the API key, and CSVs are untouched.-2copy and leaves the first untouched.finlens_*keys. A second reload is still empty.clearAllData()still erases everything else, and the alert says the file couldn't be renamed.Screenshots were checked in light and dark themes.
Review-revision tests: 25/25 checks with a simulated folder whose access either survives a reload (Edge or Chrome with the tab open) or drops back to a prompt (after a browser restart):
Please check before merging
samples/folder, not your real data.https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
https://claude.ai/code/session_01QoR1wxcaDjVVk3xmd5rRCt
Generated by Claude Code