← Back to Pull requests

feat: investment contribution as a transfer switch is added #6029

Open
unknown opened this pull request with 559 lines diff across 6 files
View on GitHub
unknown unknown commented on Dec 01, 2026 15:07 UTC
Author

Problem

A transfer into an investment or crypto account becomes an investment contribution by default: it counts as spending in budgets and reports. Since #4177, users can switch a single transfer to a plain transfer, for example when a brokerage or crypto account only converts money into another currency. Users whose investment transfers are mostly currency conversions have to flip that switch on every transfer.

The existing Count investing as spending preference doesn't cover this. It's all-or-nothing: it stops every contribution from counting as spending and leaves no way to opt individual transfers back in.

What changes

A new admin-only preference under Settings → Preferences → Budget: Mark new investment transfers as contributions. It is on by default, so nothing changes for existing families.

When it's off, a new confirmed transfer into an investment or crypto account from a non-investment account starts as a plain transfer:

  • the outflow is funds_movement, not investment_contribution

  • the Investment Contributions category is dropped

  • the kind is locked
  • This is the same state Transfer#update_investment_contribution!(false) produces when a user flips the switch, so users can still turn individual transfers back into contributions.

    Behaviour

  • Only new transfers are affected. Flipping the setting doesn't touch existing transfers. Because the default is stored as a locked choice, Transfer::InvestmentKindReconciler and provider re-syncs through Account::ProviderImportAdapter keep it too.

  • Where the default applies: in Transfer::Creator (transfer form and trades), and in Transfer#confirm!, which covers manual matches, auto-match confirmations, rules (SetAsTransferOrPayment), the assistant's match and review tools, and Sharesight.

  • Imports are unaffected. Family::DataImporter doesn't call either path, so imported transfers keep the kinds and choices they were exported with.

  • Investment-to-investment transfers and liability payments are unchanged.
  • <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Adds an admin-only preference for marking new investment transfers as contributions, so users who mostly convert currency in brokerage or crypto accounts don't have to flip the switch on every transfer.

  • New Mark new investment transfers as contributions setting is on by default, so nothing changes for existing families.

  • When off, new transfers into investment or crypto accounts start as plain transfers: kind locked to funds_movement, no investment contributions category.

  • The default applies only the first time a transfer is confirmed; re-confirms, provider re-syncs, and imports keep existing kinds, and flipping the setting back doesn't touch existing transfers.

  • A user's locked contribution choice always wins; other locked kinds (like one_time) are replaced by the default.

  • Match previews report the kind the transfer will confirm with.

  • Individual transfers can still be switched back to contributions at any time.
  • <sup>Written for commit 1ce63da77d73fa9e6175cfb8aaf51e444ff1e4b3. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/we-promise/sure/pull/6029?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Administrators can choose whether new transfers into brokerage or crypto accounts count as spending. By default, they do; when disabled, these transfers are treated as funds movements.
    This preference is available only to administrators and applies to new transfers. Existing transfers retain their current classification and can still be changed individually.
    Transfer previews show the applicable classification for investment-account transfers, including when a transfer’s classification has been locked.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 559 lines (+419 / -140) across 6 files Reviewer: imcvampire Review duration: 2108m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.48) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 559 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.379
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #6029"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.2% (MEDIUM) · Higher = larger blast radius
    48.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.7% · Safe to merge
    25.7%