Skip to content

feat(transactions): exclude investment-account activity from spending/income - #157

Merged
KenTaniguchi-R merged 1 commit into
mainfrom
feat/exclude-investment-activity-from-spending
Sep 5, 2026
Merged

feat(transactions): exclude investment-account activity from spending/income#157
KenTaniguchi-R merged 1 commit into
mainfrom
feat/exclude-investment-activity-from-spending

Conversation

@KenTaniguchi-R

Copy link
Copy Markdown
Owner

Summary

  • Alpaca (and other Plaid brokerage) buy/sell fills and clearing fees were landing in the Transactions tab miscategorized as "Investment Income," inflating spending/income totals in Transactions, Reports, Budgets, and the Dashboard.
  • Reuses the isTransfer/transferSource mechanism from Flag transfers that only touch one Ledgr account #156: any transaction on an account.type === "investment" account is deterministically tagged transferSource="investment_account" at sync time — no ambiguity, no review queue needed. Every spend/income aggregator already excludes isTransfer=true rows, so totals correct themselves with no query changes.
  • Rows still show up in the Transactions list (not hidden), now labeled "Investment" instead of the wrong category.
  • pnpm backfill-investment-activity retags already-synced history; respects manual/manual_rejected user corrections, same as the transfer tiers.

Test plan

  • pnpm typecheck / pnpm lint clean
  • New unit tests: category-pill-label.test.ts (Investment label branch)
  • New integration tests: transaction-sync.test.ts (tags investment fills, leaves other accounts alone, never overwrites manual_rejected), backfill-investment-activity.test.ts (tags historical rows, idempotent, skips manual_rejected)
  • Full test:changed run green aside from a pre-existing unrelated flake (investment-queries.test.ts date rot)
  • Run pnpm backfill-investment-activity against a real dev DB to confirm existing Alpaca history relabels correctly

🤖 Generated with Claude Code

…/income

Alpaca (and other Plaid-linked brokerage) fills and clearing fees were
landing in the Transactions tab miscategorized as "Investment Income"
and inflating spending/income totals across Transactions, Reports,
Budgets, and the Dashboard.

Reuses the existing isTransfer/transferSource mechanism from the
transfer-detection feature (#156): any transaction on an
account.type === "investment" account is deterministically tagged
transferSource="investment_account" at sync time, which every
spend/income aggregator already excludes via isTransfer=false. Rows
still appear in the Transactions list, labeled "Investment" instead of
the wrong category. A backfill job retags already-synced history
(pnpm backfill-investment-activity) and, like the transfer tiers,
never overwrites a manual/manual_rejected user correction.
@KenTaniguchi-R
KenTaniguchi-R merged commit 4ffdb95 into main Sep 5, 2026
4 of 5 checks passed
@KenTaniguchi-R
KenTaniguchi-R deleted the feat/exclude-investment-activity-from-spending branch September 5, 2026 08:53
KenTaniguchi-R added a commit that referenced this pull request Sep 6, 2026
Ship #157 (exclude investment-account activity from spending/income) and
#159 (dashboard number clipping), which have sat on main since v0.3.0
without a published image — :latest only moves on a v* tag.

Also bumps package.json, which v0.3.0 forgot: /api/health reads its
version from here via APP_VERSION, so the deployed app has been
reporting 0.2.0 while running 0.3.0 code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant