feat(mcp): let update_transaction mark a transaction one-time #6180
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6180"
general
weight: 0.35
jjmata
Problem
MCP clients can find a transaction and change its name, notes, category, merchant and tags, but they can't mark it one-time. An assistant that has spotted a trip, a hospital bill or a large one-off purchase skewing the user's budgets has to send them to the web UI and walk them through the toggle on each transaction.
The one-time kind already exists (
Transactionkindone_time, set by the toggle on the transaction page): the transaction stays in the history and in the Reports list of biggest expenses, and is left out of budget, income and spending totals.get_transactionsand the transactions API already exposekind(#4422). Only the write path for assistants is missing.Related: #1994 (excluded versus one-time transactions). This PR doesn't depend on #1995 and keeps whatever one-time means in reports.
Change
update_transactiontakes an optionalone_timeboolean:truesets the kind toone_time,falsesets it back tostandard.entryable_attributespath the web toggle uses, soentry.lock_saved_attributes!locks it against provider syncs like the other edits, and immediate rules see the change.funds_movement,cc_payment,loan_payment,investment_contribution) are rejected withnot_one_time_eligibleinstead of being reset tostandard. Those kinds belong to aTransferrecord and are changed through the transfer tools.read_writeshares can't change it, matchingTransactionsController#permitted_entry_params(annotate only).invalid_one_time.kind, so the client can confirm the change.The tool description explains when to use it, so assistants pick it for unusual expenses rather than excluding them (
exclude_transactionremoves them from reports entirely).Tests
Added to
test/models/assistant/function/update_transaction_test.rb:Validation
bin/rails test test/models/assistant/function/update_transaction_test.rb: 12 runs, 0 failures.bin/rails test(full suite): 21063 runs, 11 failures/errors, none in code this PR touches. All are from the local environment, not the change: 9 pass once this machine's proxy andANTHROPIC_BASE_URLvariables are unset, 1 (AiNetworkPolicyTest) passes with a UTF-8 locale, and 1 (Provider::OpenaiTestRuby-style inspect) expects Ruby 3.4'sHash#inspect. The suite ran on Ruby 3.3.6 because 3.4.13 wasn't available here; CI covers 3.4.13.bin/rubocopon the changed files: no offenses.bin/brakeman --no-pager: no warnings.Not in this PR
A rule action "Set as one-time". It would need a new
Rule::ActionExecutorand is a separate change.<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Lets MCP clients mark a transaction as one-time through the
update_transactiontool, so assistants can flag unusual expenses like trips or hospital bills without sending users to the web UI.update_transactionnow takes an optionalone_timeboolean.truesets the kind toone_time(kept in transaction history and the Reports biggest-expenses list, but left out of budget, income, and spending totals);falseresets it tostandard. The change goes through the same nested entry path as the web toggle: the kind is locked, the entry is marked user-modified so provider syncs keep it, and the kind is re-checked under a row lock so a concurrent transfer or split committed since the first check is seen. Split parents and transfer kinds are rejected (split_parent,not_one_time_eligible),read_writeshares can't change it, and non-boolean values returninvalid_one_time. The response now includeskind.<sup>Written for commit d585a2055555747d2814ce14f790affa87c9cf2a. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/we-promise/sure/pull/6180?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
You can now mark eligible transactions as one-time or change them back to standard. Categories, notes, and tags are preserved when changing a transaction’s kind, and the updated kind is included in the response.
Bug Fixes
One-time status changes are limited to supported transactions, and invalid values are rejected. Read-write collaborators cannot change a transaction’s name or one-time status. Changes are also rejected if a transaction is no longer eligible.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->