[PR #6591] Fix sync error when applying rules with invalid actions #6621

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

Original Pull Request: https://github.com/actualbudget/actual/pull/6591

State: closed
Merged: No


Fix synchronization error upon rule application

Original Problem (Fixed)

When updating a rule by adding more strings to match in the "note" field and applying it to matched transactions, a synchronization error occurs. The error message is: "We had problems syncing your changes."

Root Cause: The rule-apply-actions handler can return null when there's a parsing error in the actions. The frontend code didn't handle this null case and tried to call .errors.forEach() on null, which threw an error that propagated up and triggered a sync error notification.

Solution: Added proper null checking and error handling in RuleEditor.tsx.


Multi-Tab Issue (Architectural Limitation)

The comment requested investigation into why multiple browser tabs break sync.

Finding: This is a fundamental limitation of the browser storage architecture:

  • Actual uses absurd-sql with IndexedDBBackend for SQLite persistence in browsers
  • IndexedDB can only be safely written to by one connection at a time
  • When a second tab attempts to write, the backend triggers a fallback-write-error to prevent data corruption
  • The app already detects this scenario and shows a warning (see global-events.ts line 108-122)

Potential Solutions (all require significant architectural changes):

  1. Tab synchronization via BroadcastChannel/SharedWorker
  2. Leader election to designate one tab as write-master
  3. Read-only mode for secondary tabs with real-time updates
  4. LocalStorage lock to prevent multiple tabs

This is a separate architectural issue beyond the scope of the original bug fix.


Changes Made

  • Fixed null handling in rule-apply-actions (commit 8fd23cf)
  • Fixed spelling in release notes (commit 07a1b72)
  • Investigated and documented multi-tab limitation
  • All tests passing
  • Security scan passed
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: syncronisation error upon rule application</issue_title>
<issue_description>### Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

every time i update a rule by adding one more strring to match in field "note" upon apply on matched transaction i get this error message

Image Image

How can we reproduce the issue?

every time i update a rule by adding one more strring to match in field "note" upon apply on matched transaction i get the error message

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Chrome

Operating System

Mac OSX</issue_description>

Comments on the Issue (you are @copilot in this section)

@youngcw My guess is that this isn't because of rules but because you are having syncing problems in general. Make sure your server is accessible by your client. @youngcw Having 2 browser tabs open breaks syncing in general, its a known issue.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

**Original Pull Request:** https://github.com/actualbudget/actual/pull/6591 **State:** closed **Merged:** No --- ## Fix synchronization error upon rule application ### Original Problem (Fixed) When updating a rule by adding more strings to match in the "note" field and applying it to matched transactions, a synchronization error occurs. The error message is: "We had problems syncing your changes." **Root Cause**: The `rule-apply-actions` handler can return `null` when there's a parsing error in the actions. The frontend code didn't handle this null case and tried to call `.errors.forEach()` on null, which threw an error that propagated up and triggered a sync error notification. **Solution**: Added proper null checking and error handling in `RuleEditor.tsx`. --- ### Multi-Tab Issue (Architectural Limitation) The comment requested investigation into why multiple browser tabs break sync. **Finding**: This is a fundamental limitation of the browser storage architecture: - Actual uses `absurd-sql` with `IndexedDBBackend` for SQLite persistence in browsers - IndexedDB can only be safely written to by one connection at a time - When a second tab attempts to write, the backend triggers a `fallback-write-error` to prevent data corruption - The app already detects this scenario and shows a warning (see `global-events.ts` line 108-122) **Potential Solutions** (all require significant architectural changes): 1. Tab synchronization via BroadcastChannel/SharedWorker 2. Leader election to designate one tab as write-master 3. Read-only mode for secondary tabs with real-time updates 4. LocalStorage lock to prevent multiple tabs This is a separate architectural issue beyond the scope of the original bug fix. --- ### Changes Made - [x] Fixed null handling in `rule-apply-actions` (commit 8fd23cf) - [x] Fixed spelling in release notes (commit 07a1b72) - [x] Investigated and documented multi-tab limitation - [x] All tests passing - [x] Security scan passed <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[Bug]: syncronisation error upon rule application</issue_title> > <issue_description>### Verified issue does not already exist? > > - [x] I have searched and found no existing issue > > ### What happened? > > every time i update a rule by adding one more strring to match in field "note" upon apply on matched transaction i get this error message > > <img width="946" height="222" alt="Image" src="https://github.com/user-attachments/assets/59da1390-dd36-4f79-90d5-be6a7749a60c" /> > > <img width="607" height="138" alt="Image" src="https://github.com/user-attachments/assets/6cad916a-32c6-4390-af0c-73492969aad6" /> > > ### How can we reproduce the issue? > > every time i update a rule by adding one more strring to match in field "note" upon apply on matched transaction i get the error message > > > > ### Where are you hosting Actual? > > Docker > > ### What browsers are you seeing the problem on? > > Chrome > > ### Operating System > > Mac OSX</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@youngcw</author><body> > My guess is that this isn't because of rules but because you are having syncing problems in general. Make sure your server is accessible by your client. </body></comment_new> > <comment_new><author>@youngcw</author><body> > Having 2 browser tabs open breaks syncing in general, its a known issue.</body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes actualbudget/actual#6556 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
GiteaMirror added the pull-request label 2026-02-28 21:30:47 -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#6621