Honor user's manual category override (trackingCategory)#1
Open
ItzikEzra wants to merge 1 commit into
Open
Conversation
When a user manually reclassifies a transaction in the RiseUp app (e.g., moves "גן הפקאן" from "פנאי" to "אוכל בחוץ"), the override is stored on `Transaction.trackingCategory.name`. The auto-classification remains on `Transaction.expense`. Before this change the CLI read only `tx.expense`, so manual overrides were invisible. `riseup spending`, `riseup transactions`, `riseup trends`, and `riseup income` all showed numbers that disagreed with the app. This adds a shared `getEffectiveCategory(tx)` helper that returns `tx.trackingCategory.name` when set, falling back to `tx.expense`. All category-reading call sites now route through the helper. `manage.ts rename` is left alone — it forwards the auto category to the rename API on purpose; only the display side is updated.
a7755f3 to
f9b5f96
Compare
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.
Problem
When a user manually re-classifies a transaction inside the RiseUp app (via the "Change category" action), the override is persisted by RiseUp on
Transaction.trackingCategory. The auto-classification stays onTransaction.expense.Today the CLI only reads
tx.expense, so any manual override is invisible to the CLI. Users see one set of numbers in the app and a different set from:riseup spendingriseup transactionsriseup trendsriseup income --salary-onlyThis makes the CLI unreliable for anyone who curates their own categorization in the app.
Example (hypothetical)
A user moves a restaurant from the default "Leisure" category to "Eating Out" inside the RiseUp app. Afterwards:
For a month with several re-classifications, the discrepancy can be hundreds of shekels.
Second wrinkle: internal tracking flags
trackingCategoryis also used by RiseUp for internal flags that are not user-chosen categories. The most common one is"blacklist", which RiseUp applies to transactions it wants to exclude from the budget total (typically peer-to-peer BIT transfers matched by amatchingPredicatesrule keyed onbusinessName).Those aren't categories the user picked — showing
"blacklist"inriseup spendingoutput is confusing. So the helper treats that (and any future internal flag added to a small allowlist) as a signal to fall back toexpense.Fix
New shared helper
src/client/categories.ts:All category-reading call sites now route through the helper:
src/commands/transactions.ts—--categoryfilter, JSON output, table rowsrc/commands/spending.ts—--categoryfilter and group-by-category keysrc/commands/trends.ts— per-month category aggregationsrc/commands/income.ts—--salary-onlyfilter and outputssrc/commands/manage.tsis intentionally left usingtx.expensefor therenameAPI call, since the backend rename endpoint expects the auto category. Theunclassifiedcommand's display output does use the effective category for consistency.Why this shape
trackingCategoryis absent, behavior is identical.trackingCategoryis already modeled inclient/types.ts.