Open-source personal finance manager. Self-hosted, privacy-first.
feat(mcp): propose updates to goals and budgets, and deleting a budget (#1313)
Pedro Henrique Fernandes8b2360ebc0ee
diff --git a/backend/mcp_server/tools/proposals.py b/backend/mcp_server/tools/proposals.pyindex 6327e919..32721a04 100644--- a/backend/mcp_server/tools/proposals.py+++ b/backend/mcp_server/tools/proposals.py@@ -15,21 +15,25 @@ unchanged for Securo's own UI.from __future__ import annotations+import uuidfrom decimal import Decimalfrom typing import Any+from pydantic import ValidationErrorfrom sqlalchemy import selectfrom sqlalchemy.ext.asyncio import AsyncSessionfrom app.core.app_clock import app_todayfrom app.models.account import Account+from app.models.budget import Budgetfrom app.models.category import Category+from app.models.goal import Goalfrom app.models.group import Group, GroupMemberfrom app.models.recurring_transaction import RecurringTransactionfrom app.models.transaction import Transaction-from app.schemas.budget import BudgetCreate+from app.schemas.budget import BudgetCreate, BudgetUpdatefrom app.schemas.category import CategoryCreate-from app.schemas.goal import GoalCreate+from app.schemas.goal import GoalCreate, GoalUpdatefrom app.schemas.recurring_transaction import (RecurringTransactionCreate,RecurringTransactionUpdate,@@ -331,6 +335,144 @@ async def propose_create_budget(return preview+@tool(+ name="propose_update_budget",+ description=_PROPOSAL_PREFACE+ + (+ "Build a preview for changing the amount of an existing budget "+ "(e.g. 'raise my groceries budget to R$1,500'). Call list_budgets "+ "first to find the budget_id. For a recurring budget the new amount "+ "covers every month that budget applies to, the same as editing it "+ "on the budgets page. Returns the current amount alongside the new "+ "one so the user can compare."+ ),+ parameters={+ "type": "object",+ "properties": {+ "budget_id": {"type": "string", "format": "uuid"},+ "amount": {"type": "number", "exclusiveMinimum": 0},+ "apply": _APPLY_FIELD,+ },+ "required": ["budget_id", "amount"],+ "additionalProperties": False,+ },+ is_proposal=True,+ tags=["propose", "budgets"],+)+async def propose_update_budget(+ *,+ session: AsyncSession,+ ctx: CallContext,+ budget_id: str,+ amount: float,+ apply: bool = False,+) -> dict[str, Any]:+ ws_id = await resolve_workspace_id(session, ctx)+ row = await _budget_with_category_name(session, ws_id, budget_id)+ if row is None:+ return {"error": "budget not found"}+ budget, category_name = row++ if amount <= 0:+ return {"error": "amount must be greater than zero"}+ new_amount = Decimal(str(amount))+ if new_amount == budget.amount:+ return {"error": "the budget already has that amount; nothing to change"}++ preview = {+ "kind": "update_budget",+ "target": _budget_target(budget, category_name),+ "changes": {"amount": float(new_amount)},+ "apply_endpoint": f"PATCH /api/budgets/{budget.id}",+ }++ if _can_apply(ctx, apply):+ updated = await budget_service.update_budget(+ session, budget.id, ws_id, BudgetUpdate(amount=new_amount)+ )+ if updated is None:+ return {**preview, "error": "budget not found"}+ return {**preview, "applied": True, "id": str(updated.id)}++ return preview+++@tool(+ name="propose_delete_budget",+ description=_PROPOSAL_PREFACE+ + (+ "Build a preview for deleting a budget (e.g. 'drop the budget for "+ "streaming'). Call list_budgets first to find the budget_id. "+ "Deleting a recurring budget removes it from every month it covers; "+ "the category and its transactions are untouched."+ ),+ parameters={+ "type": "object",+ "properties": {+ "budget_id": {"type": "string", "format": "uuid"},+ "apply": _APPLY_FIELD,+ },+ "required": ["budget_id"],+ "additionalProperties": False,+ },+ is_proposal=True,+ tags=["propose", "budgets"],+)+async def propose_delete_budget(+ *,+ session: AsyncSession,+ ctx: CallContext,+ budget_id: str,+ apply: bool = False,+) -> dict[str, Any]:+ ws_id = await resolve_workspace_id(session, ctx)+ row = await _budget_with_category_name(session, ws_id, budget_id)+ if row is None:+ return {"error": "budget not found"}+ budget, category_name = row++ preview = {+ "kind": "delete_budget",+ "target": _budget_target(budget, category_name),+ "apply_endpoint": f"DELETE /api/budgets/{budget.id}",+ }++ if _can_apply(ctx, apply):+ ok = await budget_service.delete_budget(session, budget.id, ws_id)+ if not ok:+ return {**preview, "error": "budget not found"}+ return {**preview, "applied": True, "deleted": True}++ return preview+++async def _budget_with_category_name(+ session: AsyncSession, ws_id: uuid.UUID, budget_id: str+) -> tuple[Budget, str | None] | None:+ row = (+ await session.execute(+ select(Budget, Category.name)+ .outerjoin(Category, Category.id == Budget.category_id)+ .where(Budget.id == parse_uuid(budget_id), Budget.workspace_id == ws_id)+ )+ ).first()+ if row is None:+ return None+ return row[0], row[1]+++def _budget_target(budget: Budget, category_name: str | None) -> dict[str, Any]:+ return {+ "id": str(budget.id),+ "category_id": str(budget.category_id),+ "category_name": category_name,+ "month": budget.month.isoformat(),+ "amount": num(budget.amount),+ "currency": budget.currency,+ "is_recurring": bool(budget.is_recurring),+ }++@tool(name="propose_create_transaction",description=_PROPOSAL_PREFACE@@ -1029,6 +1171,145 @@ async def propose_create_goal(return preview+_GOAL_STATUSES = ["active", "completed", "paused", "archived"]+++@tool(+ name="propose_update_goal",+ description=_PROPOSAL_PREFACE+ + (+ "Build a preview for editing an existing goal (e.g. 'I have saved "+ "R$3,000 for the trip now', 'move the deadline to December', "+ "'pause my car goal'). Call list_goals first to find the goal_id, "+ "then pass only the fields that change. `current_amount` is the "+ "progress of a manual goal; a goal that tracks an account, asset or "+ "net worth computes its progress itself, so it is refused there. "+ "`status` pauses, archives, completes or reactivates the goal. "+ "Returns the current values alongside the changes so the user can "+ "compare."+ ),+ parameters={+ "type": "object",+ "properties": {+ "goal_id": {"type": "string", "format": "uuid"},+ "name": {"type": "string", "minLength": 1, "maxLength": 255},+ "target_amount": {"type": "number", "exclusiveMinimum": 0},+ "current_amount": {+ "type": "number",+ "minimum": 0,+ "description": "How much is saved so far (manual goals only)",+ },+ "target_date": {+ "type": "string",+ "format": "date",+ "description": "New deadline (YYYY-MM-DD); an empty string removes it",+ },+ "status": {"type": "string", "enum": _GOAL_STATUSES},+ "apply": _APPLY_FIELD,+ },+ "required": ["goal_id"],+ "additionalProperties": False,+ },+ is_proposal=True,+ tags=["propose", "goals"],+)+async def propose_update_goal(+ *,+ session: AsyncSession,+ ctx: CallContext,+ goal_id: str,+ name: str | None = None,+ target_amount: float | None = None,+ current_amount: float | None = None,+ target_date: str | None = None,+ status: str | None = None,+ apply: bool = False,+) -> dict[str, Any]:+ ws_id = await resolve_workspace_id(session, ctx)+ goal = (+ await session.execute(+ select(Goal).where(Goal.id == parse_uuid(goal_id), Goal.workspace_id == ws_id)+ )+ ).scalar_one_or_none()+ if goal is None:+ return {"error": "goal not found"}++ requested: dict[str, Any] = {}+ if name is not None:+ if not name.strip():+ return {"error": "name cannot be empty"}+ requested["name"] = name.strip()+ if target_amount is not None:+ if target_amount <= 0:+ return {"error": "target_amount must be greater than zero"}+ requested["target_amount"] = Decimal(str(target_amount))+ if current_amount is not None:+ if goal.tracking_type != "manual":+ return {+ "error": (+ f"this goal tracks its {goal.tracking_type.replace('_', ' ')}, "+ "so its progress cannot be set by hand"+ )+ }+ if current_amount < 0:+ return {"error": "current_amount cannot be negative"}+ requested["current_amount"] = Decimal(str(current_amount))+ if target_date is not None:+ try:+ requested["target_date"] = parse_date(target_date)+ except ValueError:+ return {"error": f"invalid target_date {target_date!r}; use YYYY-MM-DD"}+ if status is not None:+ requested["status"] = status+ if not requested:+ return {"error": "no changes provided"}++ # Only what differs from the goal as stored goes into the proposal.+ update_data = {k: v for k, v in requested.items() if getattr(goal, k) != v}+ if not update_data:+ return {"error": "the goal already reads like that; nothing to change"}+ try:+ update = GoalUpdate(**update_data)+ except ValidationError as exc:+ return {"error": "; ".join(str(e["msg"]) for e in exc.errors())}++ changes: dict[str, Any] = {}+ for key, value in update.model_dump(exclude_unset=True).items():+ if isinstance(value, Decimal):+ changes[key] = float(value)+ elif key == "target_date":+ changes[key] = value.isoformat() if value else None+ else:+ changes[key] = value++ preview = {+ "kind": "update_goal",+ "target": {+ "id": str(goal.id),+ "name": goal.name,+ "target_amount": num(goal.target_amount),+ "current_amount": num(goal.current_amount),+ "currency": goal.currency,+ "target_date": goal.target_date.isoformat() if goal.target_date else None,+ "status": goal.status,+ "tracking_type": goal.tracking_type,+ },+ "changes": changes,+ "apply_endpoint": f"PATCH /api/goals/{goal.id}",+ }++ if _can_apply(ctx, apply):+ try:+ updated = await goal_service.update_goal(session, goal.id, ws_id, ctx.user_id, update)+ except ValueError as exc:+ return {**preview, "error": str(exc)}+ if updated is None:+ return {**preview, "error": "goal not found"}+ return {**preview, "applied": True, "id": str(updated.id)}++ return preview++def _today():from datetime import date as _ddiff --git a/backend/tests/test_mcp_goal_and_budget_tools.py b/backend/tests/test_mcp_goal_and_budget_tools.pynew file mode 100644index 00000000..5c479fd9--- /dev/null+++ b/backend/tests/test_mcp_goal_and_budget_tools.py@@ -0,0 +1,601 @@+"""MCP tools for editing goals and for editing or deleting budgets.++Exercises the handlers directly with seeded data (same pattern as+test_mcp_transfer_tools.py): preview without a write, apply only on the+external transport, workspace scoping and the service-layer validation.+The last tests drive the same tools through the /mcp JSON-RPC endpoint.+"""+import uuid+from datetime import date+from decimal import Decimal++import httpx+import pytest_asyncio+from sqlalchemy import select+from sqlalchemy.ext.asyncio import AsyncSession++# Importing this package registers all tools into mcp_server.registry.REGISTRY.+import mcp_server.tools # noqa: F401+from app.agents.mcp.auth import mint_token+from app.models.budget import Budget+from app.models.goal import Goal+from app.models.workspace import Workspace, WorkspaceMember+from mcp_server.auth import CallContext+from mcp_server.registry import REGISTRY+++@pytest_asyncio.fixture+async def ctx(test_user) -> CallContext:+ """Internal runtime context (Securo's own agent): can never apply."""+ return CallContext(user_id=test_user.id, conversation_id=uuid.uuid4())+++@pytest_asyncio.fixture+async def ext_ctx(test_user) -> CallContext:+ """External MCP token context (Claude Desktop, n8n): may apply."""+ return CallContext(user_id=test_user.id, conversation_id=uuid.uuid4(), external=True)+++@pytest_asyncio.fixture+async def other_workspace(session: AsyncSession, test_user) -> Workspace:+ """A second workspace for the same user (newer, so it is NOT the default)."""+ ws = Workspace(+ id=uuid.uuid4(),+ name="Outro Espaco",+ kind="personal",+ created_by_user_id=test_user.id,+ default_currency="BRL",+ locale="pt-BR",+ )+ session.add(ws)+ await session.flush()+ session.add(+ WorkspaceMember(+ id=uuid.uuid4(),+ workspace_id=ws.id,+ user_id=test_user.id,+ role="owner",+ )+ )+ await session.commit()+ await session.refresh(ws)+ return ws+++async def _mk_goal(+ session: AsyncSession,+ *,+ user,+ ws,+ name: str = "Viagem",+ target: str = "10000.00",+ current: str = "2000.00",+ target_date: date | None = date(2027, 6, 30),+ status: str = "active",+ tracking_type: str = "manual",+) -> Goal:+ goal = Goal(+ id=uuid.uuid4(),+ user_id=user.id,+ workspace_id=getattr(ws, "id", ws),+ name=name,+ target_amount=Decimal(target),+ current_amount=Decimal(current),+ currency="BRL",+ target_date=target_date,+ tracking_type=tracking_type,+ status=status,+ )+ session.add(goal)+ await session.commit()+ await session.refresh(goal)+ return goal+++async def _mk_budget(+ session: AsyncSession,+ *,+ user,+ ws,+ category,+ amount: str = "800.00",+ month: date = date(2026, 10, 1),+ is_recurring: bool = False,+) -> Budget:+ budget = Budget(+ id=uuid.uuid4(),+ user_id=user.id,+ workspace_id=getattr(ws, "id", ws),+ category_id=category.id,+ amount=Decimal(amount),+ month=month,+ is_recurring=is_recurring,+ currency="BRL",+ )+ session.add(budget)+ await session.commit()+ await session.refresh(budget)+ return budget+++async def _goal(session: AsyncSession, goal_id) -> Goal:+ session.expire_all()+ return (await session.execute(select(Goal).where(Goal.id == goal_id))).scalar_one()+++async def _budget(session: AsyncSession, budget_id) -> Budget | None:+ session.expire_all()+ return (+ await session.execute(select(Budget).where(Budget.id == budget_id))+ ).scalar_one_or_none()+++async def _budget_amount(session: AsyncSession, budget_id) -> Decimal | None:+ row = await _budget(session, budget_id)+ return row.amount if row is not None else None+++def _call(name: str):+ return REGISTRY[name].handler+++# --- Registry shape ---------------------------------------------------------+++def test_registry_contains_goal_and_budget_tools():+ for name in ("propose_update_goal", "propose_update_budget", "propose_delete_budget"):+ assert name in REGISTRY, f"missing tool: {name}"+ assert REGISTRY[name].is_proposal is True+ assert "apply" in REGISTRY[name].parameters["properties"]+++def test_tool_schemas_reach_only_their_fields():+ """The goal tool cannot relink tracking; the budget tool only moves the amount."""+ goal_props = set(REGISTRY["propose_update_goal"].parameters["properties"])+ assert goal_props == {+ "goal_id", "name", "target_amount", "current_amount", "target_date", "status", "apply",+ }+ assert REGISTRY["propose_update_goal"].parameters["properties"]["status"]["enum"] == [+ "active", "completed", "paused", "archived",+ ]+ assert set(REGISTRY["propose_update_budget"].parameters["properties"]) == {+ "budget_id", "amount", "apply",+ }+ assert set(REGISTRY["propose_delete_budget"].parameters["properties"]) == {+ "budget_id", "apply",+ }+++# --- propose_update_goal ----------------------------------------------------+++async def test_goal_preview_shows_current_values_and_does_not_write(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _call("propose_update_goal")(+ session=session, ctx=ctx, goal_id=str(goal.id),+ current_amount=3500, target_date="2027-12-31", status="paused",+ )++ assert result["kind"] == "update_goal"+ assert result["target"] == {+ "id": str(goal.id),+ "name": "Viagem",+ "target_amount": 10000.0,+ "current_amount": 2000.0,+ "currency": "BRL",+ "target_date": "2027-06-30",+ "status": "active",+ "tracking_type": "manual",+ }+ assert result["changes"] == {+ "current_amount": 3500.0,+ "target_date": "2027-12-31",+ "status": "paused",+ }+ assert result["apply_endpoint"] == f"PATCH /api/goals/{goal.id}"+ assert "applied" not in result+ row = await _goal(session, goal.id)+ assert (row.current_amount, row.status) == (Decimal("2000.00"), "active")+++async def test_goal_changes_leave_out_values_already_stored(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _call("propose_update_goal")(+ session=session, ctx=ctx, goal_id=str(goal.id),+ name=" Viagem ", target_amount=12000, status="active",+ )++ assert result["changes"] == {"target_amount": 12000.0}+++async def test_goal_empty_target_date_removes_the_deadline(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _call("propose_update_goal")(+ session=session, ctx=ext_ctx, goal_id=str(goal.id), target_date="", apply=True+ )++ assert result["changes"] == {"target_date": None}+ assert result.get("applied") is True, result+ assert (await _goal(session, goal.id)).target_date is None+++async def test_goal_no_changes_and_nothing_to_change(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ none_given = await _call("propose_update_goal")(+ session=session, ctx=ctx, goal_id=str(goal.id)+ )+ same_values = await _call("propose_update_goal")(+ session=session, ctx=ctx, goal_id=str(goal.id), current_amount=2000, status="active"+ )++ assert none_given == {"error": "no changes provided"}+ assert "nothing to change" in same_values["error"]+++async def test_goal_invalid_status_is_refused_by_the_schema(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _call("propose_update_goal")(+ session=session, ctx=ext_ctx, goal_id=str(goal.id), status="done", apply=True+ )++ assert "applied" not in result+ assert "status must be active, completed, paused, or archived" in result["error"]+ assert (await _goal(session, goal.id)).status == "active"+++async def test_goal_invalid_values_are_refused(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)+ handler = _call("propose_update_goal")++ blank_name = await handler(session=session, ctx=ctx, goal_id=str(goal.id), name=" ")+ zero_target = await handler(session=session, ctx=ctx, goal_id=str(goal.id), target_amount=0)+ negative = await handler(session=session, ctx=ctx, goal_id=str(goal.id), current_amount=-5)+ bad_date = await handler(session=session, ctx=ctx, goal_id=str(goal.id), target_date="31/12/2027")++ assert blank_name == {"error": "name cannot be empty"}+ assert zero_target == {"error": "target_amount must be greater than zero"}+ assert negative == {"error": "current_amount cannot be negative"}+ assert "invalid target_date" in bad_date["error"]+++async def test_goal_tracking_an_account_refuses_a_manual_amount(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(+ session, user=test_user, ws=test_workspace, tracking_type="net_worth"+ )++ result = await _call("propose_update_goal")(+ session=session, ctx=ext_ctx, goal_id=str(goal.id), current_amount=5000, apply=True+ )++ assert result == {"error": "this goal tracks its net worth, so its progress cannot be set by hand"}+ assert (await _goal(session, goal.id)).current_amount == Decimal("2000.00")+++async def test_goal_unknown_and_cross_workspace(+ session: AsyncSession, ext_ctx: CallContext, test_user, other_workspace+):+ foreign = await _mk_goal(session, user=test_user, ws=other_workspace, name="Carro")++ unknown = await _call("propose_update_goal")(+ session=session, ctx=ext_ctx, goal_id=str(uuid.uuid4()), name="x"+ )+ cross = await _call("propose_update_goal")(+ session=session, ctx=ext_ctx, goal_id=str(foreign.id), status="archived", apply=True+ )++ assert unknown == {"error": "goal not found"}+ assert cross == {"error": "goal not found"}+ assert (await _goal(session, foreign.id)).status == "active"+++async def test_goal_internal_apply_does_not_write(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _call("propose_update_goal")(+ session=session, ctx=ctx, goal_id=str(goal.id), status="completed", apply=True+ )++ assert "applied" not in result+ assert (await _goal(session, goal.id)).status == "active"+++async def test_goal_external_apply_changes_only_the_requested_fields(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_workspace+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _call("propose_update_goal")(+ session=session, ctx=ext_ctx, goal_id=str(goal.id),+ name="Viagem ao Japão", current_amount=4250.5, status="paused", apply=True,+ )++ assert result.get("applied") is True, result+ assert result["id"] == str(goal.id)+ row = await _goal(session, goal.id)+ assert row.name == "Viagem ao Japão"+ assert row.current_amount == Decimal("4250.50")+ assert row.status == "paused"+ assert row.target_amount == Decimal("10000.00")+ assert row.target_date == date(2027, 6, 30)+ assert row.tracking_type == "manual"+++# --- propose_update_budget --------------------------------------------------+++async def test_budget_update_preview_does_not_write(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace, test_categories+):+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0], is_recurring=True+ )++ result = await _call("propose_update_budget")(+ session=session, ctx=ctx, budget_id=str(budget.id), amount=1200+ )++ assert result["kind"] == "update_budget"+ assert result["target"] == {+ "id": str(budget.id),+ "category_id": str(test_categories[0].id),+ "category_name": "Alimentação",+ "month": "2026-10-01",+ "amount": 800.0,+ "currency": "BRL",+ "is_recurring": True,+ }+ assert result["changes"] == {"amount": 1200.0}+ assert result["apply_endpoint"] == f"PATCH /api/budgets/{budget.id}"+ assert "applied" not in result+ assert await _budget_amount(session, budget.id) == Decimal("800.00")+++async def test_budget_update_same_or_invalid_amount(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace, test_categories+):+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0]+ )++ same = await _call("propose_update_budget")(+ session=session, ctx=ctx, budget_id=str(budget.id), amount=800+ )+ zero = await _call("propose_update_budget")(+ session=session, ctx=ctx, budget_id=str(budget.id), amount=0+ )++ assert "nothing to change" in same["error"]+ assert zero == {"error": "amount must be greater than zero"}+++async def test_budget_update_internal_apply_does_not_write(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace, test_categories+):+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0]+ )++ result = await _call("propose_update_budget")(+ session=session, ctx=ctx, budget_id=str(budget.id), amount=950, apply=True+ )++ assert "applied" not in result+ assert await _budget_amount(session, budget.id) == Decimal("800.00")+++async def test_budget_update_external_apply_changes_only_the_amount(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_workspace, test_categories+):+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[1], is_recurring=True+ )+ category_id = test_categories[1].id++ result = await _call("propose_update_budget")(+ session=session, ctx=ext_ctx, budget_id=str(budget.id), amount=650.25, apply=True+ )++ assert result.get("applied") is True, result+ assert result["id"] == str(budget.id)+ row = await _budget(session, budget.id)+ assert row is not None+ assert row.amount == Decimal("650.25")+ assert (row.category_id, row.month, row.is_recurring) == (+ category_id, date(2026, 10, 1), True,+ )+++async def test_budget_update_unknown_and_cross_workspace(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_categories, other_workspace+):+ foreign = await _mk_budget(+ session, user=test_user, ws=other_workspace, category=test_categories[0]+ )++ unknown = await _call("propose_update_budget")(+ session=session, ctx=ext_ctx, budget_id=str(uuid.uuid4()), amount=10+ )+ cross = await _call("propose_update_budget")(+ session=session, ctx=ext_ctx, budget_id=str(foreign.id), amount=10, apply=True+ )++ assert unknown == {"error": "budget not found"}+ assert cross == {"error": "budget not found"}+ assert await _budget_amount(session, foreign.id) == Decimal("800.00")+++# --- propose_delete_budget --------------------------------------------------+++async def test_budget_delete_preview_does_not_delete(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace, test_categories+):+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0]+ )++ result = await _call("propose_delete_budget")(+ session=session, ctx=ctx, budget_id=str(budget.id)+ )++ assert result["kind"] == "delete_budget"+ assert result["target"]["id"] == str(budget.id)+ assert result["target"]["category_name"] == "Alimentação"+ assert result["target"]["is_recurring"] is False+ assert result["apply_endpoint"] == f"DELETE /api/budgets/{budget.id}"+ assert "applied" not in result+ assert await _budget(session, budget.id) is not None+++async def test_budget_delete_internal_apply_does_not_delete(+ session: AsyncSession, ctx: CallContext, test_user, test_workspace, test_categories+):+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0]+ )++ result = await _call("propose_delete_budget")(+ session=session, ctx=ctx, budget_id=str(budget.id), apply=True+ )++ assert "applied" not in result+ assert await _budget(session, budget.id) is not None+++async def test_budget_delete_external_apply_deletes_only_that_budget(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_workspace, test_categories+):+ doomed = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0]+ )+ kept = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[1]+ )+ doomed_id, kept_id = doomed.id, kept.id++ result = await _call("propose_delete_budget")(+ session=session, ctx=ext_ctx, budget_id=str(doomed_id), apply=True+ )++ assert result.get("applied") is True, result+ assert result["deleted"] is True+ assert await _budget(session, doomed_id) is None+ assert await _budget(session, kept_id) is not None+++async def test_budget_delete_unknown_and_cross_workspace(+ session: AsyncSession, ext_ctx: CallContext, test_user, test_categories, other_workspace+):+ foreign = await _mk_budget(+ session, user=test_user, ws=other_workspace, category=test_categories[0]+ )++ unknown = await _call("propose_delete_budget")(+ session=session, ctx=ext_ctx, budget_id=str(uuid.uuid4()), apply=True+ )+ cross = await _call("propose_delete_budget")(+ session=session, ctx=ext_ctx, budget_id=str(foreign.id), apply=True+ )++ assert unknown == {"error": "budget not found"}+ assert cross == {"error": "budget not found"}+ assert await _budget(session, foreign.id) is not None+++# --- Through the /mcp endpoint ----------------------------------------------+++async def _mcp_call(user_id, monkeypatch, name, arguments, *, external=False):+ """Call a tool over JSON-RPC with a minted token, as an MCP client does."""+ import mcp_server.main as mcp_main+ from tests.conftest import TestSessionLocal++ monkeypatch.setattr(mcp_main, "async_session_maker", TestSessionLocal)+ token = mint_token(user_id=user_id, external=external)+ transport = httpx.ASGITransport(app=mcp_main.app)+ async with httpx.AsyncClient(transport=transport, base_url="http://mcp.test") as cli:+ response = await cli.post(+ "/mcp",+ json={+ "jsonrpc": "2.0",+ "id": 1,+ "method": "tools/call",+ "params": {"name": name, "arguments": arguments},+ },+ headers={"Authorization": f"Bearer {token}"},+ )+ result = response.json()["result"]+ assert result["isError"] is False, result+ return result["structuredContent"]+++async def test_mcp_endpoint_internal_token_previews_goal_update(+ session: AsyncSession, test_user, test_workspace, monkeypatch+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)++ result = await _mcp_call(+ test_user.id, monkeypatch, "propose_update_goal",+ {"goal_id": str(goal.id), "current_amount": 3000, "apply": True},+ )++ assert result["changes"] == {"current_amount": 3000.0}+ assert "applied" not in result+ assert (await _goal(session, goal.id)).current_amount == Decimal("2000.00")+++async def test_mcp_endpoint_external_token_applies_after_preview(+ session: AsyncSession, test_user, test_workspace, test_categories, monkeypatch+):+ goal = await _mk_goal(session, user=test_user, ws=test_workspace)+ budget = await _mk_budget(+ session, user=test_user, ws=test_workspace, category=test_categories[0]+ )+ user_id, goal_id, budget_id = test_user.id, goal.id, budget.id++ preview = await _mcp_call(+ user_id, monkeypatch, "propose_update_budget",+ {"budget_id": str(budget_id), "amount": 1000}, external=True,+ )+ assert "applied" not in preview+ assert await _budget_amount(session, budget_id) == Decimal("800.00")++ updated = await _mcp_call(+ user_id, monkeypatch, "propose_update_budget",+ {"budget_id": str(budget_id), "amount": 1000, "apply": True}, external=True,+ )+ goal_done = await _mcp_call(+ user_id, monkeypatch, "propose_update_goal",+ {"goal_id": str(goal_id), "status": "completed", "apply": True}, external=True,+ )+ deleted = await _mcp_call(+ user_id, monkeypatch, "propose_delete_budget",+ {"budget_id": str(budget_id), "apply": True}, external=True,+ )++ assert updated["applied"] is True+ assert goal_done["applied"] is True+ assert deleted["applied"] is True+ assert (await _goal(session, goal_id)).status == "completed"+ assert await _budget(session, budget_id) is Nonediff --git a/frontend/src/components/agents/proposal-card.test.tsx b/frontend/src/components/agents/proposal-card.test.tsxindex 9918b02e..fb37ea9d 100644--- a/frontend/src/components/agents/proposal-card.test.tsx+++ b/frontend/src/components/agents/proposal-card.test.tsx@@ -4,14 +4,17 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'import { renderWithProviders } from '@/test/utils'import { isProposalData } from '@/lib/agent-proposals'-const { linkTransfer, unlinkTransfer } = vi.hoisted(() => ({+const { linkTransfer, unlinkTransfer, updateGoal, updateBudget, deleteBudget } = vi.hoisted(() => ({linkTransfer: vi.fn(),unlinkTransfer: vi.fn(),+ updateGoal: vi.fn(),+ updateBudget: vi.fn(),+ deleteBudget: vi.fn(),}))vi.mock('@/lib/api', () => ({- budgets: {},+ budgets: { update: updateBudget, delete: deleteBudget },categories: {},- goals: {},+ goals: { update: updateGoal },recurring: {},rules: {},transactions: { linkTransfer, unlinkTransfer },@@ -99,3 +102,88 @@ describe('ProposalCard transfer kinds', () => {await waitFor(() => expect(unlinkTransfer).toHaveBeenCalledWith('pair-9'))})})++describe('ProposalCard goal and budget kinds', () => {+ beforeEach(() => {+ localStorage.clear()+ updateGoal.mockReset()+ updateBudget.mockReset()+ deleteBudget.mockReset()+ })++ it('treats the goal and budget previews as proposals', () => {+ expect(isProposalData({ kind: 'update_goal' })).toBe(true)+ expect(isProposalData({ kind: 'update_budget' })).toBe(true)+ expect(isProposalData({ kind: 'delete_budget' })).toBe(true)+ })++ it('shows each goal change before and after, and sends only the changes on Apply', async () => {+ updateGoal.mockResolvedValue({ id: 'goal-1' })+ const { user } = renderWithProviders(+ <ProposalCard+ toolCallId="call-goal"+ data={{+ kind: 'update_goal',+ target: { id: 'goal-1', name: 'Trip', current_amount: 2000, status: 'active', target_date: null },+ changes: { current_amount: 3500, status: 'paused', target_date: '2027-12-31' },+ }}+ />,+ )++ expect(screen.getByText('Update goal')).toBeInTheDocument()+ expect(+ screen.getByText('Trip → current_amount: 2000 → 3500, status: active → paused, target_date: ∅ → 2027-12-31'),+ ).toBeInTheDocument()++ await user.click(screen.getByRole('button', { name: /Apply/ }))++ await waitFor(() =>+ expect(updateGoal).toHaveBeenCalledWith('goal-1', {+ current_amount: 3500,+ status: 'paused',+ target_date: '2027-12-31',+ }),+ )+ })++ it('sends only the new amount when a budget is updated', async () => {+ updateBudget.mockResolvedValue({ id: 'budget-1' })+ const { user } = renderWithProviders(+ <ProposalCard+ toolCallId="call-budget"+ data={{+ kind: 'update_budget',+ target: { id: 'budget-1', category_name: 'Groceries', month: '2026-10-01', amount: 800, currency: 'USD' },+ changes: { amount: 1200 },+ }}+ />,+ )++ expect(screen.getByText('Update budget')).toBeInTheDocument()+ expect(screen.getByText(/^Groceries \(2026-10-01\): .*800.* → .*1,200/)).toBeInTheDocument()++ await user.click(screen.getByRole('button', { name: /Apply/ }))++ await waitFor(() => expect(updateBudget).toHaveBeenCalledWith('budget-1', { amount: 1200 }))+ })++ it('deletes the budget on Apply and says when it covers every month', async () => {+ deleteBudget.mockResolvedValue(undefined)+ const { user } = renderWithProviders(+ <ProposalCard+ toolCallId="call-delete-budget"+ data={{+ kind: 'delete_budget',+ target: { id: 'budget-2', category_name: 'Streaming', month: '2026-01-01', amount: 60, currency: 'USD', is_recurring: true },+ }}+ />,+ )++ expect(screen.getByText('Delete budget')).toBeInTheDocument()+ expect(screen.getByText(/^Streaming: .*60.* every month from 2026-01-01$/)).toBeInTheDocument()++ await user.click(screen.getByRole('button', { name: /Apply/ }))++ await waitFor(() => expect(deleteBudget).toHaveBeenCalledWith('budget-2'))+ })+})diff --git a/frontend/src/components/agents/proposal-card.tsx b/frontend/src/components/agents/proposal-card.tsxindex 84e8fe36..a4ca23ff 100644--- a/frontend/src/components/agents/proposal-card.tsx+++ b/frontend/src/components/agents/proposal-card.tsx@@ -249,6 +249,32 @@ function renderSummary({ from: legLabel(from, dateLocale), to: legLabel(to, dateLocale) },)}+ case 'update_goal': {+ const changes = (d.changes || {}) as Record<string, unknown>+ const lines = Object.entries(changes).map(([k, v]) => {+ const before = tgt[k]+ return `${k}: ${String(before ?? '∅')} → ${String(v ?? '∅')}`+ })+ return t('agents.proposal.summary.updateGoal', {+ name: String(tgt.name ?? '?'),+ changes: lines.join(', ') || '—',+ })+ }+ case 'update_budget': {+ const changes = (d.changes || {}) as Record<string, unknown>+ return t('agents.proposal.summary.updateBudget', {+ category: String((tgt.category_name as string) ?? tgt.category_id ?? '?'),+ month: String(tgt.month ?? '?'),+ before: fmt(tgt.amount, tgt.currency),+ after: fmt(changes.amount, tgt.currency),+ })+ }+ case 'delete_budget':+ return t(tgt.is_recurring ? 'agents.proposal.summary.deleteRecurringBudget' : 'agents.proposal.summary.deleteBudget', {+ category: String((tgt.category_name as string) ?? tgt.category_id ?? '?'),+ amount: fmt(tgt.amount, tgt.currency),+ month: String(tgt.month ?? '?'),+ })default:return ''}@@ -444,5 +470,21 @@ async function applyProposal(data: ProposalData): Promise<string | void> {await transactions.unlinkTransfer(pairId)return pairId}+ case 'update_goal': {+ const id = String((data.target as Record<string, unknown>).id)+ await goals.update(id, (data.changes || {}) as Parameters<typeof goals.update>[1])+ return id+ }+ case 'update_budget': {+ // Only the amount goes out, the same edit the budgets page makes.+ const id = String((data.target as Record<string, unknown>).id)+ await budgets.update(id, { amount: Number((data.changes as Record<string, unknown>).amount) })+ return id+ }+ case 'delete_budget': {+ const id = String((data.target as Record<string, unknown>).id)+ await budgets.delete(id)+ return id+ }}}diff --git a/frontend/src/lib/agent-proposals.ts b/frontend/src/lib/agent-proposals.tsindex 1cfa3dca..348aa083 100644--- a/frontend/src/lib/agent-proposals.ts+++ b/frontend/src/lib/agent-proposals.ts@@ -13,6 +13,9 @@ export type ProposalKind =| 'create_goal'| 'link_transfer'| 'unlink_transfer'+ | 'update_goal'+ | 'update_budget'+ | 'delete_budget'/** One leg of a transfer pair, as the transfer tools preview it. */export interface TransferLeg {@@ -52,6 +55,7 @@ export function isProposalData(data: unknown): data is ProposalData {'create_transaction', 'create_recurring_transaction','update_recurring_transaction', 'cancel_recurring_transaction','create_goal', 'link_transfer', 'unlink_transfer',+ 'update_goal', 'update_budget', 'delete_budget',].includes(k)}diff --git a/frontend/src/locales/cs.json b/frontend/src/locales/cs.jsonindex 6dbe126b..0038b846 100644--- a/frontend/src/locales/cs.json+++ b/frontend/src/locales/cs.json@@ -2922,7 +2922,10 @@"cancel_recurring_transaction": "Zrušit opakovanou transakci","create_goal": "Vytvořit cíl","link_transfer": "Propojit jako převod",- "unlink_transfer": "Zrušit propojení převodu"+ "unlink_transfer": "Zrušit propojení převodu",+ "update_goal": "Upravit cíl",+ "update_budget": "Upravit rozpočet",+ "delete_budget": "Smazat rozpočet"},"summary": {"categorize": "{{count}} transakcí → {{category}}",@@ -2940,7 +2943,11 @@"deleteRecurring": "Natrvalo smazat „{{description}}“","createGoal": "„{{name}}“ — cílová částka {{target}}, termín {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} a {{to}} budou opět běžné transakce"+ "unlinkTransfer": "{{from}} a {{to}} budou opět běžné transakce",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} na {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} každý měsíc od {{month}}"}},"conversation": {diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.jsonindex 2c8ade5f..6645590e 100644--- a/frontend/src/locales/de.json+++ b/frontend/src/locales/de.json@@ -2767,7 +2767,10 @@"cancel_recurring_transaction": "Wiederkehrende Transaktion kündigen","create_goal": "Ziel erstellen","link_transfer": "Als Überweisung verknüpfen",- "unlink_transfer": "Überweisung trennen"+ "unlink_transfer": "Überweisung trennen",+ "update_goal": "Ziel aktualisieren",+ "update_budget": "Budget aktualisieren",+ "delete_budget": "Budget löschen"},"summary": {"categorize": "{{count}} Transaktion(en) → {{category}}",@@ -2781,7 +2784,11 @@"deleteRecurring": "“{{description}}” dauerhaft löschen","createGoal": "“{{name}}” — Ziel {{target}}, Frist {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} und {{to}} werden wieder normale Transaktionen"+ "unlinkTransfer": "{{from}} und {{to}} werden wieder normale Transaktionen",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} für {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} monatlich ab {{month}}"}},"conversation": {diff --git a/frontend/src/locales/el.json b/frontend/src/locales/el.jsonindex 1c95caa6..19d4095e 100644--- a/frontend/src/locales/el.json+++ b/frontend/src/locales/el.json@@ -2766,7 +2766,10 @@"cancel_recurring_transaction": "Ακύρωση επαναλαμβανόμενης συναλλαγής","create_goal": "Δημιουργία στόχου","link_transfer": "Σύνδεση ως μεταφορά",- "unlink_transfer": "Αποσύνδεση μεταφοράς"+ "unlink_transfer": "Αποσύνδεση μεταφοράς",+ "update_goal": "Ενημέρωση στόχου",+ "update_budget": "Ενημέρωση προϋπολογισμού",+ "delete_budget": "Διαγραφή προϋπολογισμού"},"summary": {"categorize": "{{count}} συναλλαγή(ές) → {{category}}",@@ -2780,7 +2783,11 @@"deleteRecurring": "Οριστική διαγραφή του «{{description}}»","createGoal": "«{{name}}» — στόχος {{target}}, προθεσμία {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} και {{to}} γίνονται ξανά κανονικές συναλλαγές"+ "unlinkTransfer": "{{from}} και {{to}} γίνονται ξανά κανονικές συναλλαγές",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} για {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} κάθε μήνα από {{month}}"}},"conversation": {diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.jsonindex 08badc1f..1a22fe31 100644--- a/frontend/src/locales/en.json+++ b/frontend/src/locales/en.json@@ -2766,7 +2766,10 @@"cancel_recurring_transaction": "Cancel recurring transaction","create_goal": "Create goal","link_transfer": "Link as transfer",- "unlink_transfer": "Unlink transfer"+ "unlink_transfer": "Unlink transfer",+ "update_goal": "Update goal",+ "update_budget": "Update budget",+ "delete_budget": "Delete budget"},"summary": {"categorize": "{{count}} transaction(s) → {{category}}",@@ -2780,7 +2783,11 @@"deleteRecurring": "Permanently delete “{{description}}”","createGoal": "“{{name}}” — target {{target}}, deadline {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} and {{to}} go back to regular transactions"+ "unlinkTransfer": "{{from}} and {{to}} go back to regular transactions",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} for {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} every month from {{month}}"}},"conversation": {diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.jsonindex 45d794f8..cc34861d 100644--- a/frontend/src/locales/es.json+++ b/frontend/src/locales/es.json@@ -2754,7 +2754,10 @@"cancel_recurring_transaction": "Cancelar transacción recurrente","create_goal": "Crear objetivo","link_transfer": "Vincular como transferencia",- "unlink_transfer": "Desvincular transferencia"+ "unlink_transfer": "Desvincular transferencia",+ "update_goal": "Actualizar objetivo",+ "update_budget": "Actualizar presupuesto",+ "delete_budget": "Eliminar presupuesto"},"summary": {"categorize": "{{count}} transacción(es) → {{category}}",@@ -2768,7 +2771,11 @@"deleteRecurring": "Eliminar permanentemente “{{description}}”","createGoal": "“{{name}}” — objetivo {{target}}, fecha límite {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} y {{to}} vuelven a ser transacciones normales"+ "unlinkTransfer": "{{from}} y {{to}} vuelven a ser transacciones normales",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} para {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} cada mes desde {{month}}"}},"conversation": {diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.jsonindex 959a69c1..f1ddae50 100644--- a/frontend/src/locales/fr.json+++ b/frontend/src/locales/fr.json@@ -2770,7 +2770,10 @@"cancel_recurring_transaction": "Annuler une transaction récurrente","create_goal": "Créer un objectif","link_transfer": "Lier comme virement",- "unlink_transfer": "Délier le virement"+ "unlink_transfer": "Délier le virement",+ "update_goal": "Mettre à jour un objectif",+ "update_budget": "Mettre à jour un budget",+ "delete_budget": "Supprimer un budget"},"summary": {"categorize": "{{count}} transaction(s) → {{category}}",@@ -2784,7 +2787,11 @@"deleteRecurring": "Supprimer définitivement « {{description}} »","createGoal": "« {{name}} » — cible {{target}}, échéance {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} et {{to}} redeviennent des transactions ordinaires"+ "unlinkTransfer": "{{from}} et {{to}} redeviennent des transactions ordinaires",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}) : {{before}} → {{after}}",+ "deleteBudget": "{{category}} : {{amount}} pour {{month}}",+ "deleteRecurringBudget": "{{category}} : {{amount}} chaque mois à partir de {{month}}"}},"conversation": {diff --git a/frontend/src/locales/hi.json b/frontend/src/locales/hi.jsonindex d9f2f970..d201fd0e 100644--- a/frontend/src/locales/hi.json+++ b/frontend/src/locales/hi.json@@ -2766,7 +2766,10 @@"cancel_recurring_transaction": "आवर्ती लेन-देन रद्द करें","create_goal": "लक्ष्य बनाएँ","link_transfer": "ट्रांसफ़र के रूप में जोड़ें",- "unlink_transfer": "ट्रांसफ़र अलग करें"+ "unlink_transfer": "ट्रांसफ़र अलग करें",+ "update_goal": "लक्ष्य अपडेट करें",+ "update_budget": "बजट अपडेट करें",+ "delete_budget": "बजट हटाएँ"},"summary": {"categorize": "{{count}} लेन-देन → {{category}}",@@ -2780,7 +2783,11 @@"deleteRecurring": "“{{description}}” को स्थायी रूप से हटाएँ","createGoal": "“{{name}}” — लक्ष्य {{target}}, समय-सीमा {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} और {{to}} फिर से सामान्य लेनदेन बन जाएँगे"+ "unlinkTransfer": "{{from}} और {{to}} फिर से सामान्य लेनदेन बन जाएँगे",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{month}} के लिए {{amount}}",+ "deleteRecurringBudget": "{{category}}: {{month}} से हर महीने {{amount}}"}},"conversation": {diff --git a/frontend/src/locales/hu.json b/frontend/src/locales/hu.jsonindex 4ddf731a..23ab3abf 100644--- a/frontend/src/locales/hu.json+++ b/frontend/src/locales/hu.json@@ -2766,7 +2766,10 @@"cancel_recurring_transaction": "Ismétlődő tranzakció leállítása","create_goal": "Cél létrehozása","link_transfer": "Összekapcsolás átvezetésként",- "unlink_transfer": "Átvezetés szétválasztása"+ "unlink_transfer": "Átvezetés szétválasztása",+ "update_goal": "Cél frissítése",+ "update_budget": "Költségkeret frissítése",+ "delete_budget": "Költségkeret törlése"},"summary": {"categorize": "{{count}} tranzakció → {{category}}",@@ -2780,7 +2783,11 @@"deleteRecurring": "„{{description}}” végleges törlése","createGoal": "„{{name}}” — célösszeg: {{target}}, határidő: {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} és {{to}} ismét normál tranzakció lesz"+ "unlinkTransfer": "{{from}} és {{to}} ismét normál tranzakció lesz",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} – {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} havonta, {{month}} kezdettel"}},"conversation": {diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.jsonindex dd36fef8..d4b2dac3 100644--- a/frontend/src/locales/it.json+++ b/frontend/src/locales/it.json@@ -2754,7 +2754,10 @@"cancel_recurring_transaction": "Annulla transazione ricorrente","create_goal": "Crea obiettivo","link_transfer": "Collega come trasferimento",- "unlink_transfer": "Scollega trasferimento"+ "unlink_transfer": "Scollega trasferimento",+ "update_goal": "Aggiorna obiettivo",+ "update_budget": "Aggiorna budget",+ "delete_budget": "Elimina budget"},"summary": {"categorize": "{{count}} transazione/i → {{category}}",@@ -2768,7 +2771,11 @@"deleteRecurring": "Elimina definitivamente “{{description}}”","createGoal": "“{{name}}” — obiettivo {{target}}, scadenza {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} e {{to}} tornano transazioni normali"+ "unlinkTransfer": "{{from}} e {{to}} tornano transazioni normali",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} per {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} ogni mese da {{month}}"}},"conversation": {diff --git a/frontend/src/locales/ja.json b/frontend/src/locales/ja.jsonindex d121da74..91cae94b 100644--- a/frontend/src/locales/ja.json+++ b/frontend/src/locales/ja.json@@ -2766,7 +2766,10 @@"cancel_recurring_transaction": "定期取引を中止","create_goal": "目標を作成","link_transfer": "振替としてリンク",- "unlink_transfer": "振替のリンクを解除"+ "unlink_transfer": "振替のリンクを解除",+ "update_goal": "目標を更新",+ "update_budget": "予算を更新",+ "delete_budget": "予算を削除"},"summary": {"categorize": "{{count}}件の取引 → {{category}}",@@ -2780,7 +2783,11 @@"deleteRecurring": "「{{description}}」を完全に削除","createGoal": "「{{name}}」 — 目標{{target}}、期日{{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} と {{to}} は通常の取引に戻ります"+ "unlinkTransfer": "{{from}} と {{to}} は通常の取引に戻ります",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}}({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{month}}の予算{{amount}}",+ "deleteRecurringBudget": "{{category}}: {{month}}から毎月{{amount}}"}},"conversation": {diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.jsonindex 0fe5f87f..b0acb251 100644--- a/frontend/src/locales/nl.json+++ b/frontend/src/locales/nl.json@@ -2768,7 +2768,10 @@"cancel_recurring_transaction": "Terugkerende transactie annuleren","create_goal": "Doel creëren","link_transfer": "Koppelen als overboeking",- "unlink_transfer": "Overboeking ontkoppelen"+ "unlink_transfer": "Overboeking ontkoppelen",+ "update_goal": "Doel bijwerken",+ "update_budget": "Begroting bijwerken",+ "delete_budget": "Begroting verwijderen"},"summary": {"categorize": "{{count}} transactie(s) → {{category}}",@@ -2782,7 +2785,11 @@"deleteRecurring": "“{{description}}” definitief verwijderen","createGoal": "“{{name}}” — doel {{target}}, deadline {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} en {{to}} worden weer gewone transacties"+ "unlinkTransfer": "{{from}} en {{to}} worden weer gewone transacties",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} voor {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} per maand vanaf {{month}}"}},"conversation": {diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.jsonindex eee1d98d..ad6fccca 100644--- a/frontend/src/locales/pl.json+++ b/frontend/src/locales/pl.json@@ -2857,7 +2857,10 @@"cancel_recurring_transaction": "Anuluj transakcję cykliczną","create_goal": "Utwórz cel","link_transfer": "Połącz jako przelew",- "unlink_transfer": "Rozłącz przelew"+ "unlink_transfer": "Rozłącz przelew",+ "update_goal": "Zaktualizuj cel",+ "update_budget": "Zaktualizuj budżet",+ "delete_budget": "Usuń budżet"},"summary": {"categorize_one": "{{count}} transakcja → {{category}}",@@ -2874,7 +2877,11 @@"deleteRecurring": "Trwale usuń „{{description}}”","createGoal": "„{{name}}” — cel {{target}}, termin {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} i {{to}} znów będą zwykłymi transakcjami"+ "unlinkTransfer": "{{from}} i {{to}} znów będą zwykłymi transakcjami",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} na {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} co miesiąc od {{month}}"}},"conversation": {diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.jsonindex c4f70ecd..32c18436 100644--- a/frontend/src/locales/pt-BR.json+++ b/frontend/src/locales/pt-BR.json@@ -2754,7 +2754,10 @@"cancel_recurring_transaction": "Cancelar transação recorrente","create_goal": "Criar meta","link_transfer": "Vincular como transferência",- "unlink_transfer": "Desvincular transferência"+ "unlink_transfer": "Desvincular transferência",+ "update_goal": "Atualizar meta",+ "update_budget": "Atualizar orçamento",+ "delete_budget": "Excluir orçamento"},"summary": {"categorize": "{{count}} transação(ões) → {{category}}",@@ -2768,7 +2771,11 @@"deleteRecurring": "Excluir permanentemente “{{description}}”","createGoal": "“{{name}}” — meta {{target}}, prazo {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} e {{to}} voltam a ser transações comuns"+ "unlinkTransfer": "{{from}} e {{to}} voltam a ser transações comuns",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} para {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} todo mês a partir de {{month}}"}},"conversation": {diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.jsonindex e3eccdce..ec133a0a 100644--- a/frontend/src/locales/pt-PT.json+++ b/frontend/src/locales/pt-PT.json@@ -2754,7 +2754,10 @@"cancel_recurring_transaction": "Cancelar transação recorrente","create_goal": "Criar objetivo","link_transfer": "Associar como transferência",- "unlink_transfer": "Desassociar transferência"+ "unlink_transfer": "Desassociar transferência",+ "update_goal": "Atualizar objetivo",+ "update_budget": "Atualizar orçamento",+ "delete_budget": "Eliminar orçamento"},"summary": {"categorize": "{{count}} transação(ões) → {{category}}",@@ -2768,7 +2771,11 @@"deleteRecurring": "Eliminar permanentemente “{{description}}”","createGoal": "“{{name}}” — meta {{target}}, prazo {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} e {{to}} voltam a ser transações normais"+ "unlinkTransfer": "{{from}} e {{to}} voltam a ser transações normais",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} para {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} todos os meses a partir de {{month}}"}},"conversation": {diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.jsonindex 4628e3dd..1c8d1899 100644--- a/frontend/src/locales/ru.json+++ b/frontend/src/locales/ru.json@@ -2783,7 +2783,10 @@"cancel_recurring_transaction": "Отменить регулярную транзакцию","create_goal": "Создать цель","link_transfer": "Связать как перевод",- "unlink_transfer": "Разорвать связь перевода"+ "unlink_transfer": "Разорвать связь перевода",+ "update_goal": "Обновить цель",+ "update_budget": "Обновить бюджет",+ "delete_budget": "Удалить бюджет"},"summary": {"categorize": "{{count}} транзакций → {{category}}",@@ -2797,7 +2800,11 @@"deleteRecurring": "Навсегда удалить «{{description}}»","createGoal": "«{{name}}» — цель {{target}}, срок {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} и {{to}} снова станут обычными операциями"+ "unlinkTransfer": "{{from}} и {{to}} снова станут обычными операциями",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} на {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} ежемесячно с {{month}}"}},"conversation": {diff --git a/frontend/src/locales/sk.json b/frontend/src/locales/sk.jsonindex f2bc44e0..e7a01313 100644--- a/frontend/src/locales/sk.json+++ b/frontend/src/locales/sk.json@@ -2906,7 +2906,10 @@"cancel_recurring_transaction": "Zrušiť opakovanú transakciu","create_goal": "Vytvoriť cieľ","link_transfer": "Prepojiť ako prevod",- "unlink_transfer": "Zrušiť prepojenie prevodu"+ "unlink_transfer": "Zrušiť prepojenie prevodu",+ "update_goal": "Upraviť cieľ",+ "update_budget": "Upraviť rozpočet",+ "delete_budget": "Vymazať rozpočet"},"summary": {"categorize": "{{count}} transakcií → {{category}}",@@ -2924,7 +2927,11 @@"deleteRecurring": "Natrvalo vymazať „{{description}}“","createGoal": "„{{name}}“ — cieľová suma {{target}}, termín {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} a {{to}} budú opäť bežné transakcie"+ "unlinkTransfer": "{{from}} a {{to}} budú opäť bežné transakcie",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} na {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} každý mesiac od {{month}}"}},"conversation": {diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.jsonindex fe7a1e84..a25962a8 100644--- a/frontend/src/locales/uk.json+++ b/frontend/src/locales/uk.json@@ -2783,7 +2783,10 @@"cancel_recurring_transaction": "Скасувати регулярну транзакцію","create_goal": "Створити ціль","link_transfer": "Пов'язати як переказ",- "unlink_transfer": "Розірвати зв'язок переказу"+ "unlink_transfer": "Розірвати зв'язок переказу",+ "update_goal": "Оновити ціль",+ "update_budget": "Оновити бюджет",+ "delete_budget": "Видалити бюджет"},"summary": {"categorize": "{{count}} транзакцій → {{category}}",@@ -2797,7 +2800,11 @@"deleteRecurring": "Назавжди видалити «{{description}}»","createGoal": "«{{name}}» — ціль {{target}}, термін {{deadline}}","linkTransfer": "{{from}} → {{to}}",- "unlinkTransfer": "{{from}} і {{to}} знову стануть звичайними операціями"+ "unlinkTransfer": "{{from}} і {{to}} знову стануть звичайними операціями",+ "updateGoal": "{{name}} → {{changes}}",+ "updateBudget": "{{category}} ({{month}}): {{before}} → {{after}}",+ "deleteBudget": "{{category}}: {{amount}} на {{month}}",+ "deleteRecurringBudget": "{{category}}: {{amount}} щомісяця з {{month}}"}},"conversation": {