Repository navigation
Conversation
….16.11) buildFinancialSummary() took the Accounts, Total Cash, Total Debt and Net Worth figures from currentBalances() in every range, while its "Period:" line names the selected range. On a past range (Last year, a custom range ending in August) the model read today's balances as that period's. The Overview shows periodEndBalance(). With the samples and Jul 1 - Aug 15, 2026, the Overview showed a net worth of $10,602.37 and the summary sent $16,750.31. - views-ai.js: a new summaryBalanceEnd() gives the range end when it is before the last transaction. Then the summary sends each account's periodEndBalance() and states the date: "Accounts at the end of the period (Aug 15, 2026): ..." and "... Net Worth: $X (all on Aug 15, 2026)". The Debts heading says they're current balances. - All time, This month and any range reaching the last transaction are byte-identical to v1.16.10: their period-end balances are today's. - The AI Eval's sandbox uses All time, so its summary is byte-identical and the published results still hold. parseSummary() reads the new notes unchanged (it matches the lines by how they start). - CHANGELOG; version in index.html, README and Settings -> General; CLAUDE.md §1, §13, §21 and Last 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
…summary-period-balances 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.11. 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
Open
Open
…to fix-ai-summary-period-balances 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
The AI summary always sent today's balances, even for a past date range. Its "Period:" line names the selected range, so the model read today's balances as that period's. Now a range that ends before the last transaction sends the balances at the end of that range, the numbers the Overview shows, and says their date. Every other range sends exactly what it sent before.
Cause
buildFinancialSummary()(js/views-ai.js) took the Accounts, Total Cash, Total Debt and Net Worth figures fromcurrentBalances()in every range. The Overview usesperiodEndBalance().origin/master(v1.10.4),buildFinancialSummary()also usescurrentBalances()while the Overview usesperiodEndBalance(). The code there predates the Clarity stack (old account kinds, no starting-balance fix), so this commit doesn't apply to it as is.What changed
summaryBalanceEnd()(views-ai.js) gives the range end when it is before the last transaction, and null otherwise. It uses the same end asperiodEndBalance(): the range end, or today when a custom range has no end.periodEndBalance()and states the date on both balance lines.currentBalances(). There it gives the same numbers asperiodEndBalance(), and the summary is byte-identical to v1.16.10.index.html, README (both places) and Settings → General; CLAUDE.md §1, §13, §21 and Last updated.Before and after, samples with starting balances and two debts, range Jul 1 – Aug 15, 2026:
AI Eval
The published results still hold. The eval's summary didn't change.
6231659below is #33's commit before the chain (the starting-balance fix, built on v1.16.0). The comparisons with it were repeated on this branch's chained commit bytest-ai-summary-period.jsand pass (see testing)._withSampleState()setsrange: { mode: 'all', start: null, end: null }andmanualBalances: {}.summaryBalanceEnd()returns null for All time, so the eval's summary takes the old path.parseSummary()gives the same facts, values and derivations for it as on 6231659.docs/eval-results.json, byte for byte, once the v1.12.0 account renames are applied.views-eval.js,AI_PROMPTS, the system prompt, the model andmax_tokensare unchanged. Withfetchstubbed, every All-time request (8 quick analyses and a custom question) is byte-identical to 6231659.test-insights.jsalso still matches its clarity-plan baseline.parseSummary()finds the balance lines by how they start (Total Cash:,Debts), and its Total Cash regex isn't anchored at the end. The notes keep those starts and hold no amounts._candidates()leaves out "Debt ÷ cash" when cash is $0, which a range before the first transaction can produce. The eval never scores such a summary.Not verified
periodEndBalance(), not changed: a range that ends within 7 days of today shows a balance override (a card's amount owed) as it is. So if card rows fall between the range end and today, the dated card figure is today's. The Overview does the same (CLAUDE.md §18).Automated checks: earlier run, not re-run · 1bbcea5
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 commit1bbcea5, chained on #33. 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).1bbcea5test-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(from #31, as updated by #32)test-drawer-flags.js(from #32)test-start-balance.js(updated in this PR)test-ai-summary-period.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-ai-summary-period.jscompares with a baseline captured on6231659(v1.16.10: Fix starting balance ignored by "All time", the AI summary, Buckets and Forecast #33's commit before the chain);test-start-balance.jswith the one captured onddc8a5f. Both baselines are unchanged and both pass on this commit, so no earlier fix in the stack changed the summaries they compare.Measured before the chain
By the agent that wrote the fix, on
12f4874(built on6231659, #33's commit before the chain, then v1.16.3). The originaltest-start-balance.jsit mentions is the one #33 added; in this stack's harness it is kept astest-start-balance.v10.jsand runs only on #33's branch.Headless Chromium (Playwright 1.63) at 1280×900, against
samples/. Each command was run from the harness folder asNODE_PATH=$(npm root -g) node <script> <repo> <outdir>.test-clarity.jstest-finances.jstest-plan.jstest-insights.js(AI request bodies byte-identical for All time)test-start-balance.js, as on the base branchtest-start-balance.js, updated for this ruletest-ai-summary-period.js(new)boot.jsrace.jsrace.js: every error isrenderImportLog(views-data.js:262), fixed separately in PR v1.10.5: fix Import Logs throwing when the view is left before it loads #18. None come from this change.test-start-balance.js, the 10 expected failures. Two checks encoded the old rule:test-start-balance.v1163.js.test-ai-summary-period.jsfixes the clock so the presets mean the same thing on any day:periodEndBalance().parseSummary()reads every summary.fetchstubbed, the All-time request bodies are identical to 6231659, and a past range's differ only in those lines.fetchtoapi.anthropic.comis stubbed.How to reproduce the bug
Run this on the base branch,
fix-all-time-start-balance(#33). Master has the same bug too: itsbuildFinancialSummary()also uses today's balances in every range.fix-all-time-start-balanceinstead offix-ai-summary-period-balances. You end with the samples, both starting balances, two debts, and the Console open.07/01/2026and To to08/15/2026.buildFinancialSummary(). Read lines 2 and 3 and the Debts heading.What goes wrong:
Period: Jul 1, 2026 – Aug 15, 2026line, the summary sends today's balances:Bank Checking ($14,321.43)…Net Worth: $16,750.31, not the Overview's $10,602.37.Debts:.Manual QA steps
Setup
git checkout fix-ai-summary-period-balances, then openindex.htmlin Edge.RESETand click Erase and start over. (This PR doesn't change saving, so no scratch folder is needed.)samples/.1000and Bank Savings's to250.50(press Tab after each).24.99and minimum35, click Save debt.Car loan, type Auto loan, balance8400, APR6.9, minimum310. Click Save debt.buildFinancialSummary()there; it returns the exact text the AI Analysis tab sends. No API key is needed.1. A past range sends that period's balances (the main fix)
07/01/2026and To to08/15/2026.buildFinancialSummary(). Read lines 2 and 3 and the Debts section.Expected:
Accounts at the end of the period (Aug 15, 2026): Bank Checking ($8,923.11), Bank Credit Card (credit_card_sample) (-$333.92), Bank Savings ($2,013.18).Total Cash: $10,936.29, Total Debt: $333.92, Net Worth: $10,602.37 (all on Aug 15, 2026).Debts (current balances, not at the end of the period):, with the card at $617.33 and Car loan at $8,400.00.Before this fix: lines 2–3 showed today's balances (
Bank Checking ($14,321.43)…Net Worth: $16,750.31) under the Jul 1 – Aug 15 period, and the heading was plainDebts:.2. All time is unchanged (regression)
buildFinancialSummary().Expected:
Accounts: Bank Checking ($14,321.43)with no date note.Total Cash: $17,367.64, Total Debt: $617.33, Net Worth: $16,750.31, no(all on …).Debts:.3. Ranges that reach the last transaction are unchanged
The samples end Oct 20, 2026.
buildFinancialSummary().05/01/2026and To10/20/2026. Run it again.Expected:
at the end of the periodor(all on …)note.Net Worth: $16,750.31, the same as Overview for that range.4. Last year (before any data)
buildFinancialSummary().Expected:
(Dec 31, 2025)in its note, and checking and savings show only their starting balances, $1,000.00 and $250.50.5. A card balance override (edge case)
500.07/01/2026–08/15/2026.buildFinancialSummary().500afterwards.Expected:
periodEndBalance()), on both the Overview card and the summary's Accounts line.6. The AI tab still works on a past range
Only if you have an API key saved in Settings → General.
Expected:
Please check before merging
periodEndBalance()is fine, so the summary always matches the Overview.index.htmlfooter, README (two places), Settings → General, CLAUDE.md §1 and Last updated.buildFinancialSummary()in DevTools, and compare its Net Worth with the Overview's.https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code