Repository navigation
Conversation
… (v1.16.24) reapplyTransferKeywords() (views-main.js), run on every keyword change, put each transfer without a stored type back as a debit or credit by its sign, with the categories it had besides Transfer out / Transfer in, or Other / Income when it had none (the usual case). It used neither the CSV's type and category (_originalType, _originalCategories, recorded since v1.16.1) nor the categories the user set. So an "uber" keyword added and removed left the UBER TRIP card rows as Other (their file says Travel), the AMAZON MKTPL return as Income, T-MOBILE AUTOPAY as Other; a card's Payment whose autopay leg was set to Expense became Income / refund and counted as income; and a ZELLE row given Transfer out + Housing kept only Housing. A reload from browser storage put them right, but finlens-state.json is saved after the keyword change, so a boot from it kept them wrong. master's Re-apply to All Transactions runs the same code. - reapplyTransferKeywords() puts each transfer back with undoTransferDetection(), which the import already uses for kept transfers, then runs detectTransfers(). - undoTransferDetection() takes the type and the categories separately. Type: the edit's, _originalType, the IndexedDB row's, then by sign. Categories: the edit's; the ones besides Transfer out / in (what Re-categorize all gives a transfer); _originalCategories; the row's; then autoCategory(). Taking Re-categorize all's category first is new; it keeps what the old keyword code kept in that case. - ZELLE rows go back to their own category, Transfer (DEFAULT_RULES), which the sums count as a transfer: as a reload already showed. - Version bumped to v1.16.24 (CHANGELOG, footer, README, Settings, CLAUDE.md); CLAUDE.md §8, §11 and §11.1, README Transfers updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
….0) into fix-untransfer-category 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
A transaction that stops being a transfer now gets its own type and category back. This happens when you remove the keyword that matched it, or when the leg it was paired with is retyped. Before, it became a debit or credit with the category Other or Income.
Cause
reapplyTransferKeywords()(views-main.js) runs on every keyword change. It put each transfer without a stored type back as a debit or credit by its sign, with the categories it had besides Transfer out / Transfer in._originalTypeand_originalCategoriessince v1.16.1 (v1.16.1: Fix "Clear transaction edits" wiping every transaction when the browser database is empty #24).origin/master(e8e18e7): an "uber" keyword added and removed turned UBER TRIP fromdebit:Travelintodebit:Other. master's transactions don't record their CSV values, so this fix can't be applied to master as it is.undoTransferDetection()(core.js, v1.16.3) didn't have the bug. An import uses it for the transfers it keeps, and it already restored_originalType/_originalCategoriesand the categories you set.What changed
reapplyTransferKeywords()callsundoTransferDetection()for each transaction, thendetectTransfers(). The keyword path and the import path now put transfers back the same way.undoTransferDetection()works out the type and the categories separately:_originalCategories: the card file's own Category, otherwise what the import'sautoCategory()gave, category rules first); else the row's; elseautoCategory().undoTransferDetection()(my call): it now takes "the ones it has besides Transfer out / in" before the CSV's category.recategorizeAll()overwrites every transaction without a category edit, transfers included.undoTransferDetection()), §11 (a new block on what a transfer that stops being one gets back, and the built-in Transfer category) and §11.1 (a card payment that stops being a transfer); "Last updated" line.Not verified
_originalType/_originalCategories) going through a keyword change: not tested. That path keeps the old fallback (IndexedDB row when there is one; else by sign andautoCategory()), and can't recover a card's own Category.Automated checks: earlier run, not re-run · ce93e93
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
ce93e93(chained on #46) 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>.ce93e93boot.jsrace.jstest-untransfer-category.js(new in this PR)test-finances.js(edited in this PR)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.test-untransfer-category.jsalso runs on the parent commit: 11/11[bug]checks fail there, as expected.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/, desktop viewport only, one suite at a time.run-tip.sh 15:renderImportLogrenderImportLograceerrors are expected noise. Every one isrenderImportLog(v1.10.5: fix Import Logs throwing when the view is left before it loads #18's fix isn't in this stack yet). None comes from this change.Keywords: removing one re-runs detection (Zelle becomes spending).sumExpense()leaves that category out.debit:Transferand Spending doesn't change, which is what a reload already showed.debit:Other, Spending up by $230). The transfer counts in test-finances are unchanged.[bug]checks fail there.test-untransfer-category.jsruns its checks on this branch, then on a temporarygit worktreeof ed1d2a4 (removed afterwards):[bug]fail there, and nothing else.undoTransferDetection()inmergeImported()) gives the CSV category.How to reproduce the bug
Run this on the base branch,
fix-transfer-detection-user-type. Master has the bug too.fix-transfer-detection-user-typeinstead offix-untransfer-category.uberin Add keyword and click Add.UBERon Transactions. Every UBER row shows Transfer out.uberwith its ×.UBER TRIP, thenUBER EATS, and read the Category column.What goes wrong: the UBER TRIP rows show Other, not Travel, and the UBER EATS rows show Other, not Food & Drink. They stay that way until a reload, and a boot from
finlens-state.jsonkeeps Other.Manual QA steps
Setup
git checkout fix-untransfer-category.index.htmlfrom the repo.samples/and click Import 3 files. The range is set to All time.1. Card rows get their own category back (UBER)
uber.UBERon Transactions: every UBER row shows Transfer out.uber(its ×).UBER TRIP, thenUBER EATS.Expected:
Before this fix: both went to Other until a reload.
2. A card Return goes back to Shopping and stays a credit
amazon, then remove it.AMAZON MKTPL. Find the Jul 22 row of +$42.17 and open it.Expected:
Before this fix: the return got Income, the sales Other.
3. A checking row gets its rule category back
t-mobile, then remove it.T-MOBILE.Expected:
Before this fix: Other.
4. A card payment stays a card payment when its partner is retyped
CREDIT CARD AUTOPAYand open the Oct 6 row (−$836.91).xyz(any keyword: it re-runs detection).Payment Thank Youand open the Oct 6 row (+$836.91).Expected:
Before this fix: Type Income / refund, Money in +$33,361.79, Payments listed 5.
5. Categories you set are kept whole
ZELLEand open the Sep 23 row (−$25.00). Leave Type as Transfer.zelle.zelleback and look again.Expected:
Before this fix: Sep 23 kept only Housing; the other ZELLE rows got Other and Money out jumped by about $230.
6. Re-categorize all while a row is a transfer
liberty. The LIBERTY INTERNET AUTOPAY rows become Transfer out.LIBERTY INTERNETin Description contains, choose Health in Category, click Add rule.liberty.LIBERTYon Transactions.Expected:
Note: in the other order (rule and Re-categorize all first, then add and remove
liberty), the rows come back as Bills & Utilities, the category from the import: detection replaced Health with Transfer out, so there's nothing besides it to keep.7. Reload keeps it all
Expected:
8. The state file keeps the right values
Use a copy of
samples/in a scratch folder for this one (it writesfinlens-state.json).index.html.uber, then remove it.finlens-state.json). F12 → Console should sayBoot: Loaded state from finlens-state.json.UBER TRIP.Expected:
Before this fix: Other: the file was saved after the keyword change, and a boot from it kept the wrong value.
9. Version
Expected:
Please check before merging
undoTransferDetection()).fix-recategorize-all-not-saved, v1.16.25), done in this chain by v1.16.26: Fix a transaction changed away from Transfer still counting as a transfer #49: that change stopsrecategorizeAll()writing a category onto detected transfers, and keeps the result inState.ruleCategories. Once both are in,undoTransferDetection()should takeState.ruleCategories[t.id]at the "besides Transfer out / in" step, asmkTx()andreconstituteTx()do there. Otherwise a transfer that stops being one shows its import category until the next reload.https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
Generated by Claude Code