[PR #5532] [MERGED] Add backend logic to support automations UI #5985

Closed
opened 2026-02-28 21:22:05 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/5532
Author: @jfdoming
Created: 8/9/2025
Status: Merged
Merged: 8/12/2025
Merged by: @jfdoming

Base: masterHead: jfdoming/automations-ui-backend


📝 Commits (10+)

📊 Changes

19 files changed (+154 additions, -67 deletions)

View changed files

📝 packages/desktop-client/src/components/budget/goals/BudgetAutomation.tsx (+3 -2)
📝 packages/desktop-client/src/components/budget/goals/actions.ts (+2 -2)
📝 packages/desktop-client/src/components/budget/goals/editor/HistoricalAutomation.tsx (+2 -2)
📝 packages/desktop-client/src/components/budget/goals/reducer.ts (+19 -10)
📝 packages/desktop-client/src/components/modals/BudgetAutomationsModal.tsx (+10 -2)
packages/loot-core/migrations/1754611200000_add_category_template_settings.sql (+5 -0)
📝 packages/loot-core/src/server/aql/schema/index.ts (+1 -0)
📝 packages/loot-core/src/server/budget/app.ts (+11 -0)
📝 packages/loot-core/src/server/budget/category-template-context.test.ts (+5 -0)
📝 packages/loot-core/src/server/budget/category-template-context.ts (+3 -1)
📝 packages/loot-core/src/server/budget/goal-template.ts (+36 -6)
📝 packages/loot-core/src/server/budget/schedule-template.test.ts (+4 -2)
📝 packages/loot-core/src/server/budget/statements.ts (+2 -0)
📝 packages/loot-core/src/server/budget/template-notes.test.ts (+8 -7)
📝 packages/loot-core/src/server/budget/template-notes.ts (+10 -15)
📝 packages/loot-core/src/server/db/types/index.ts (+1 -0)
📝 packages/loot-core/src/types/models/category.ts (+1 -0)
📝 packages/loot-core/src/types/models/templates.ts (+25 -18)
upcoming-release-notes/5532.md (+6 -0)

📄 Description

WARNING: This PR contains a migration—don't connect it to a server you care about.

My current migration plan is:

  1. Roll out automations UI and let users opt in on a per-category basis. In a future PR I'll add a "migration" modal for both directions; for now notes-based templates will get displayed in the UI, and if you hit 'Save' they are converted to UI automations.
  2. At some point in a future release once we have full support in the UI and expect most users have migrated to the UI, remove the ability to populate notes-based templates during application. This means effectively you can't create notes-based templates and can only migrate them to the UI. We could potentially release both experimental features at this point.
  3. At some point far in the future, remove the ability to migrate. At this point anyone with unmigrated notes-based templates will need to upgrade to an intermediate release, migrate, and then move to the latest release.

Three changes here to facilitate Step 1:

  1. Marked priority and directive as required, because without them templates don't actually get run.
  2. Added a template_source attribute to categories and updated database logic in resetCategoryGoalDefsWithNoTemplates/getCategoriesWithTemplateNotes to ignore non-notes-based templates.
  3. Extracted some notes-specific logic into separate functions and exposed non-notes-specific logic via send.

Looking for feedback on the migration plan as well as the shape of changes added here! Also check out this PR and this preview link for the usage of the logic added to this PR. Note that you will need to run localStorage.setItem("devEnableGoalTemplatesUI", "true") in the console AND enable both experimental features in order to see the updated logic.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/5532 **Author:** [@jfdoming](https://github.com/jfdoming) **Created:** 8/9/2025 **Status:** ✅ Merged **Merged:** 8/12/2025 **Merged by:** [@jfdoming](https://github.com/jfdoming) **Base:** `master` ← **Head:** `jfdoming/automations-ui-backend` --- ### 📝 Commits (10+) - [`584e3e8`](https://github.com/actualbudget/actual/commit/584e3e8747af1d725566d43e9a031f50b02d5c00) Add backend logic to support automations UI - [`a05fb33`](https://github.com/actualbudget/actual/commit/a05fb3365d5525bfeb42087acef1713d97793a31) Fix tests - [`f7b8f9e`](https://github.com/actualbudget/actual/commit/f7b8f9ec703fd19cdad0d6fe1684ef77970c921f) Add release notes - [`8f71172`](https://github.com/actualbudget/actual/commit/8f71172e8097fdeaf407b370f41a75c4ff9e1923) PR feedback: default priority - [`6e571d2`](https://github.com/actualbudget/actual/commit/6e571d2ac712d6e04f6c241ce07015733024308b) PR feedback: template_settings - [`651d1aa`](https://github.com/actualbudget/actual/commit/651d1aaf1389a2622ad3093a468ad6d538e490d6) PR feedback: batch - [`11414b8`](https://github.com/actualbudget/actual/commit/11414b8cff805805a755660be6800178888704bc) PR feedback: no remainder special-casing - [`58bd279`](https://github.com/actualbudget/actual/commit/58bd279300c9902271707a244d6728274eb46fc7) Simplify SQL - [`a24c998`](https://github.com/actualbudget/actual/commit/a24c9987fe6eb4213e040d01796488d313cb4d25) Fix tests - [`35f2470`](https://github.com/actualbudget/actual/commit/35f2470953d3bf3aa8cbddeea40d25e3c1658d95) Coderabbit ### 📊 Changes **19 files changed** (+154 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/budget/goals/BudgetAutomation.tsx` (+3 -2) 📝 `packages/desktop-client/src/components/budget/goals/actions.ts` (+2 -2) 📝 `packages/desktop-client/src/components/budget/goals/editor/HistoricalAutomation.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/budget/goals/reducer.ts` (+19 -10) 📝 `packages/desktop-client/src/components/modals/BudgetAutomationsModal.tsx` (+10 -2) ➕ `packages/loot-core/migrations/1754611200000_add_category_template_settings.sql` (+5 -0) 📝 `packages/loot-core/src/server/aql/schema/index.ts` (+1 -0) 📝 `packages/loot-core/src/server/budget/app.ts` (+11 -0) 📝 `packages/loot-core/src/server/budget/category-template-context.test.ts` (+5 -0) 📝 `packages/loot-core/src/server/budget/category-template-context.ts` (+3 -1) 📝 `packages/loot-core/src/server/budget/goal-template.ts` (+36 -6) 📝 `packages/loot-core/src/server/budget/schedule-template.test.ts` (+4 -2) 📝 `packages/loot-core/src/server/budget/statements.ts` (+2 -0) 📝 `packages/loot-core/src/server/budget/template-notes.test.ts` (+8 -7) 📝 `packages/loot-core/src/server/budget/template-notes.ts` (+10 -15) 📝 `packages/loot-core/src/server/db/types/index.ts` (+1 -0) 📝 `packages/loot-core/src/types/models/category.ts` (+1 -0) 📝 `packages/loot-core/src/types/models/templates.ts` (+25 -18) ➕ `upcoming-release-notes/5532.md` (+6 -0) </details> ### 📄 Description ## WARNING: This PR contains a migration—don't connect it to a server you care about. My current migration plan is: 1. Roll out automations UI and let users opt in on a per-category basis. In a future PR I'll add a "migration" modal for both directions; for now notes-based templates will get displayed in the UI, and if you hit 'Save' they are converted to UI automations. 2. At some point in a future release once we have full support in the UI and expect most users have migrated to the UI, remove the ability to populate notes-based templates during application. This means effectively you can't create notes-based templates and can only migrate them to the UI. We could potentially release both experimental features at this point. 3. At some point far in the future, remove the ability to migrate. At this point anyone with unmigrated notes-based templates will need to upgrade to an intermediate release, migrate, and then move to the latest release. Three changes here to facilitate Step 1: 1. Marked `priority` and `directive` as required, because without them templates don't actually get run. 2. Added a `template_source` attribute to categories and updated database logic in `resetCategoryGoalDefsWithNoTemplates`/`getCategoriesWithTemplateNotes` to ignore non-notes-based templates. 3. Extracted some notes-specific logic into separate functions and exposed non-notes-specific logic via `send`. Looking for feedback on the migration plan as well as the shape of changes added here! Also check out [this PR](https://github.com/actualbudget/actual/pull/5533) and [this preview link](https://deploy-preview-5533.demo.actualbudget.org/budget) for the usage of the logic added to this PR. Note that you will need to run `localStorage.setItem("devEnableGoalTemplatesUI", "true")` in the console AND enable both experimental features in order to see the updated logic. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:22:05 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#5985