Repository navigation
Conversation
….16.22) buildFinancialSummary() built "Recent monthly trend" from all transactions, whatever the range, and listed the subscriptions under a plain heading. On a past range (Last year, a custom range ending in August, Last month with transactions from this month) the model saw the latest three months, after the period it was asked about. v1.16.11 dated the balances on such ranges but left these two sections alone. - views-ai.js: when summaryBalanceEnd() gives a date, the trend lists up to three months of the transactions up to it, under "Recent monthly trend, up to the end of the period (Aug 15, 2026):". partialMonthNote() takes the end and marks its month "(through Aug 15)" unless the end is the month's last day. Fewer months when the data starts later; none when the range ends before the first transaction. - Subscriptions stay the current ones (all transactions, as on the Bills screen: what you'd cancel now). On a past range the heading says so: "Subscriptions (current, found in all transactions, not just the period):". - All time, This month and any range reaching the last transaction are byte-identical to v1.16.21. The AI Eval's sandbox uses All time, so its summary is byte-identical and the published results still hold. parseSummary() reads the new headings unchanged (it matches section headings by their start). - CHANGELOG; version in index.html, README and Settings -> General; README AI Analysis wording; 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
…nto fix-ai-summary-trend-range 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
On a past date range, the AI summary's "Recent monthly trend" now stops at the end of the period. Before, it was always the latest three months of all your transactions, so the model saw months after the period it was asked about.
The subscriptions stay the current ones, and on a past range their heading now says so. All time, This month and every range that reaches the last transaction send the same summary as before, byte for byte.
Cause
buildFinancialSummary()(js/views-ai.js) built it frombyMonth(State.transactions).slice(-3), whatever the range.detectRecurring()), under a plain "Subscriptions:" heading.summaryBalanceEnd()) and noted that these two sections still came from all transactions.origin/master(v1.10.5) builds the trend frombyMonth(State.transactions)the same way, and lists the subscriptions under "Subscriptions:".What changed
The trend on a past range (
summaryBalanceEnd()gives a date):partialMonthNote()takes an optionalendfor this. Without it, it works as before.Subscriptions: labelled as current, not detected as of the end. On a past range the heading is "Subscriptions (current, found in all transactions, not just the period):". The list itself is unchanged. Why:
detectRecurring()readsState.transactionsdirectly and is shared with Bills.Range null (All time, This month, any range reaching the last transaction): the code takes the old path, and the summary is byte-identical.
Not changed: the trend and subscriptions still cover every account, whatever the account filter, as before.
Before / after, Jul 1 – Aug 15, 2026 (samples, today Nov 2, 2026):
Before:
After:
Last month on Oct 25 (September) now lists July, August and September, with no note: the period ends on Sep 30.
Docs: CHANGELOG 1.16.22; version in
index.html, README (badge and footer) and Settings → General; README's AI Analysis paragraph (the trend runs up to the end of the dates on screen; debts and subscriptions are current); CLAUDE.md §1, §13 (trend and subscriptions on a past range), §21 (the parser finds sections by their heading's start) and Last updated.AI Eval
summaryBalanceEnd()returns null there, sobuildFinancialSummary()takes exactly the old path.test-ai-summary-trend.jsbuilds the sandbox summary on the parent and on this branch, under three clocks, with the user's range on Jul 1 – Aug 15 and balances and debts set. All six are the same string (sha256df5557eab27fcfeb51e2953f92653ca69afcd651030f81d847056050cd2ed98d, the same as on v1.16.15 and the previous PR). It is the summary in the publisheddocs/eval-results.jsononce the v1.12.0 account renames are applied.parseSummary()gives the same result for it.parseSummary()needed no change (js/views-eval.js). It finds a section by a heading that ends with:and starts withRecent monthly,SubscriptionsorDebts. Both new headings keep those starts and hold no amounts. A trend with fewer than three months, or none, parses as it is:_candidates()already guards every month-based derivation by the month count. Checked on every summary below.Not verified
samples/, at desktop width.Automated checks: earlier run, not re-run · 5cb828b
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
5cb828b(chained on #44) 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>.5cb828bboot.jsrace.jstest-ai-summary-trend.js(new in this PR; one chain edit, below)test-ai-summary-period.js(#34's, edited in this PR)test-start-balance.js(#33's, as updated by #34, #43, #44 and #45)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.Chain edit to
test-ai-summary-trend.js: its baseline was captured on this fix's original parent, without v1.16.21: Fix past balances for a credit card with a balance you entered moving the wrong way #44. In its card-override scenario, v1.16.21: Fix past balances for a credit card with a balance you entered moving the wrong way #44 moves the card's past balance, so the first run on this commit gave 83/91: past ranges' Accounts and Total Cash lines (and the parsed cash, debt and net worth) differed from the baseline. Those lines are now set aside in that scenario only;test-card-override.js(v1.16.21: Fix past balances for a credit card with a balance you entered moving the wrong way #44) checks them by rule. Rerun: 91/91.test-start-balance.jshere combines v1.16.20: Fix a balance override ignoring recent transactions on a range ending within 7 days #43's, v1.16.21: Fix past balances for a credit card with a balance you entered moving the wrong way #44's and this PR's edits (one file, as run on v1.16.21: Fix past balances for a credit card with a balance you entered moving the wrong way #44 and above).No phone checks (desktop only).
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 against
samples/, CDNs served from npm, no request to Anthropic (fetch stubbed).New:
test-ai-summary-trend.js. Three fixed clocks (Nov 2, Oct 25 and Sep 10, 2026) × 16 ranges × 2 scenarios (none; starting balances, card override and debts). Expectations are worked out in Node from the CSV rows. FinLens's transfer rules are written out there and checked against the app row by row (257 rows, 30 transfers). It checks:parseSummary()on every summary;ed74702): 58/91. Branch: 91/91.run-tip.sh 15(the base suites plus every fix test of v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24–v1.16.15: Cleanup — remove unused views-database.js, fix the in-app changelog, update stale wording #38), one suite at a time:ed74702a1717cbrenderImportLog(v1.10.5: fix Import Logs throwing when the view is left before it loads #18 isn't in the stack)renderImportLogSuite edit:
test-ai-summary-period.js(from v1.16.11: Fix the AI summary sending today's balances for a past date range #34; the original is kept astest-ai-summary-period.v11.js). Three of its checks compare past-range summaries line by line with v1.16.11: Fix the AI summary sending today's balances for a past date range #34's baseline, so they now set aside the trend section and the Subscriptions heading:This branch: the original fails 8 of 78 (those three checks under three clocks, minus the request check under the clock that sends none); the edited suite passes 78/78. On the parent the original passes 78/78, and the edited one fails only check 7 twice (76/78), because it now expects the trend lines to change.
Suite edit:
test-start-balance.js. Two of its checks compare past-range summaries line by line with the baseline from before v1.16.10: Fix starting balance ignored by "All time", the AI summary, Buckets and Forecast #33:They now set aside the trend section and Subscriptions heading of the ranges ending before the last transaction (Last year and Jul 1 – Aug 15, under today's clock). Before the edit this branch failed those 7 (186/193). After it: 193/193 here, on the parent and on
ecfcab2.test-override-balance.js(previous PR) compares its summaries with the trend section and Subscriptions heading set aside, so it holds on both branches: 159/159 here.How to reproduce the bug
Run this on the base branch,
fix-card-override-direction. Master has the bug too.fix-card-override-directioninstead offix-ai-summary-trend-range. Paste thes()helper into the Console as Setup step 4 says.s().What goes wrong:
Manual QA steps
Setup
git checkout fix-ai-summary-trend-range.index.htmlfrom the repo. Nothing here is saved to a folder, so the unmodifiedsamples/files are fine.samples/and click Import 3 files.s()in the Console.1. A past range: the trend stops at the period's end
s().Expected:
Before this fix: "Recent monthly trend:" listed 2026-08, 2026-09 and 2026-10 (through Oct 20), after the period. The subscriptions heading was plain "Subscriptions:".
2. A period ending on a month's last day has no "through" note
s().Expected:
3. Fewer months when the data starts late
s().Expected:
4. A range before the first transaction
s().Expected:
5. Regression: All time and current ranges are unchanged
s().s().s().copy(buildFinancialSummary())for each range on this branch and onfix-card-override-direction, paste them into two files and compare.Expected:
6. The AI Analysis page itself
Expected:
7. Version
Expected:
Please check before merging
buildFinancialSummary()in DevTools lists trend months up to the range end only.https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code