Skip to content

[AI] Fix append/prepend notes rules on new transactions - #8300

Merged
MatissJanis merged 1 commit into
masterfrom
fix-append-notes-idempotent
Jun 22, 2026
Merged

MatissJanis merged 1 commit into
masterfrom
fix-append-notes-idempotent

Conversation

@MatissJanis

@MatissJanis MatissJanis commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

Description

For some reason bots (presumably) really love solving this issue. But all of the solutions were incomplete.

When you add a new transaction that already has a note and a rule is set up to add text to that note, the app re-runs rules repeatedly as you fill in the transaction.. Once for each field you touch and again when you save. The two existing fixes make the rule's text get added, but they don't stop it from being added again on each of those repeats, so a note that should read "Coffee and cake - paid" ends up as "Coffee and cake - paid - paid - paid," with the rule's text duplicated several times.

Related issue(s)

#8003
#8296

Fixes #7303

Testing

unit tests added and manual verification done

Checklist

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I have read every line of this diff and can explain what each change does and why it is needed

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 28 13.02 MB → 13.02 MB (+594 B) +0.00%
loot-core 1 4.82 MB 0%
api 2 3.87 MB 0%
cli 1 8.02 MB 0%
crdt 1 11.12 kB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
28 13.02 MB → 13.02 MB (+594 B) +0.00%
Changeset
File Δ Size
src/components/transactions/table/utils.ts 📈 +631 B (+34.59%) 1.78 kB → 2.4 kB
package.json 📈 +89 B (+0.93%) 9.39 kB → 9.47 kB
src/components/mobile/transactions/TransactionEdit.tsx 📉 -63 B (-0.09%) 71.92 kB → 71.86 kB
src/components/transactions/TransactionList.tsx 📉 -63 B (-0.36%) 17.32 kB → 17.26 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 7.63 MB → 7.63 MB (+594 B) +0.01%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/AppliedFilters.js 36.47 kB 0%
static/js/BackgroundImage.js 121.09 kB 0%
static/js/FormulaEditor.js 735.67 kB 0%
static/js/PayeeRuleCountLabel.js 7.1 kB 0%
static/js/ReportRouter.js 1.23 MB 0%
static/js/TransactionList.js 85.19 kB 0%
static/js/ca.js 179.71 kB 0%
static/js/da.js 100.19 kB 0%
static/js/de.js 177.24 kB 0%
static/js/en-GB.js 9.25 kB 0%
static/js/en.js 200.55 kB 0%
static/js/es.js 171.82 kB 0%
static/js/extends.js 435.39 kB 0%
static/js/fr.js 173.26 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 158.13 kB 0%
static/js/narrow.js 358.79 kB 0%
static/js/nb-NO.js 141.55 kB 0%
static/js/nl.js 119.14 kB 0%
static/js/pt-BR.js 181.5 kB 0%
static/js/th.js 173.33 kB 0%
static/js/theme.js 31.02 kB 0%
static/js/uk.js 209.97 kB 0%
static/js/useTransactionBatchActions.js 9.71 kB 0%
static/js/wide.js 305.04 kB 0%
static/js/workbox-window.prod.es5.js 7.21 kB 0%
static/js/zh-Hans.js 113.26 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 4.82 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.CdbreuPy.js 4.82 MB 0%

api

Total

Files count Total bundle size % Changed
2 3.87 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 3.87 MB 0%
models.js 0 B 0%

cli

Total

Files count Total bundle size % Changed
1 8.02 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
cli.js 8.02 MB 0%

crdt

Total

Files count Total bundle size % Changed
1 11.12 kB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 11.12 kB 0%

Append/prepend notes rules were ignored when adding a new transaction
that already had a note, because rule changes are only applied to fields
the user left empty (so manual input isn't overwritten).

Add a shared `shouldApplyRuleChange` helper that still protects
user-entered values but lets the notes field through when the rule result
preserves the existing note as a prefix or suffix (append/prepend). The
check is idempotent: rules re-run on every keystroke during entry, so it
refuses to re-add text that a previous run already applied, preventing the
appended text from duplicating.

Used by both the desktop register and the mobile transaction editor.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@netlify

netlify Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 9db1933
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/6a3955535ad37f0008da22f3
😎 Deploy Preview https://deploy-preview-8300.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fe417d64-61c6-4d27-a519-a1ff0ef8b11e

📥 Commits

Reviewing files that changed from the base of the PR and between be28944 and 9db1933.

📒 Files selected for processing (6)
  • packages/desktop-client/package.json
  • packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
  • packages/desktop-client/src/components/transactions/TransactionList.tsx
  • packages/desktop-client/src/components/transactions/table/utils.test.ts
  • packages/desktop-client/src/components/transactions/table/utils.ts
  • upcoming-release-notes/fix-append-prepend-notes-rules-new-transaction.md

📝 Walkthrough

Walkthrough

A new exported helper shouldApplyRuleChange is added to transactions/table/utils.ts and registered as a module alias in package.json. Both TransactionList.tsx (desktop) and TransactionEdit.tsx (mobile) replace inline empty-value checks with calls to this helper, which adds idempotent notes append/prepend support. Tests and a release note are included.

Changes

Rule-field application fix for append/prepend notes

Layer / File(s) Summary
shouldApplyRuleChange helper and tests
packages/desktop-client/package.json, packages/desktop-client/src/components/transactions/table/utils.ts, packages/desktop-client/src/components/transactions/table/utils.test.ts
Exports shouldApplyRuleChange from utils.ts; returns true for empty/falsy fields; for the notes field allows application only when the next value contains the current value verbatim and the added prefix/suffix hasn't already been applied (idempotency). Registers the #components/transactions/table/utils alias. Tests cover empty fields, non-empty preservation, prepend/append concatenation with and without separators, idempotency, replacement blocking, and field restriction.
Desktop and mobile editor integration
packages/desktop-client/src/components/transactions/TransactionList.tsx, packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx, upcoming-release-notes/fix-append-prepend-notes-rules-new-transaction.md
Imports shouldApplyRuleChange and replaces inline null/''/0/false checks in onApplyRules (desktop) and the rule-diff loop (mobile) with calls to the helper. Release note documents the bugfix.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • matt-fidd
  • joel-jeremy

Poem

🐰 A rule said "append!" but the note said "no way!"
The helper now checks if the text is already there.
Idempotent hops keep duplicates at bay,
With prefix and suffix a perfectly matched pair.
New transactions rejoice — your notes now play fair! 🌿

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concisely describes the main fix: preventing append/prepend notes rules from being applied multiple times on new transactions.
Description check ✅ Passed Description thoroughly explains the bug (duplicate rule text on repeated re-runs), the problem with previous attempts, and that tests and manual verification were performed.
Linked Issues check ✅ Passed The PR successfully implements idempotent rule application for notes fields with logic to detect already-applied rule text and prevent duplication while preserving user entries.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the notes rule duplication issue: new utility function, test coverage, import aliases, and affected transaction components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-append-notes-idempotent

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@matt-fidd matt-fidd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this one, hopefully that'll stem some of the spam

@MatissJanis
MatissJanis added this pull request to the merge queue Jun 22, 2026
Merged via the queue into master with commit 98c096a Jun 22, 2026
45 checks passed
@MatissJanis
MatissJanis deleted the fix-append-notes-idempotent branch June 22, 2026 16:48
RafaelEspino pushed a commit to RafaelEspino/actual that referenced this pull request Oct 28, 2026
…#8300)

Append/prepend notes rules were ignored when adding a new transaction
that already had a note, because rule changes are only applied to fields
the user left empty (so manual input isn't overwritten).

Add a shared `shouldApplyRuleChange` helper that still protects
user-entered values but lets the notes field through when the rule result
preserves the existing note as a prefix or suffix (append/prepend). The
check is idempotent: rules re-run on every keystroke during entry, so it
refuses to re-add text that a previous run already applied, preventing the
appended text from duplicating.

Used by both the desktop register and the mobile transaction editor.

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Append to notes rule not working if a note already exists

2 participants