Repository navigation
[AI] Fix append notes rules on new transactions - #8003
kikiminyes wants to merge 1 commit into
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hello contributor! We would love to review your PR! Before we can do that, please make sure:
We do this to reduce the TOIL the core contributor team has to go through for each PR and to allow for speedy reviews and merges. For more information, please see our Contributing Guide. |
📝 WalkthroughWalkthroughAdds a new applyRuleDiff module to conditionally apply rule diffs to transactions (with notes-merge rules), integrates it into desktop and mobile editors, includes unit tests, and adds a release-note entry documenting the bugfix. ChangesRule Diff Application and Integration
sequenceDiagram
participant UI as TransactionList / TransactionEdit
participant RulesEngine as rules-run
participant applyRuleDiff as applyRuleDiffToTransaction
participant Storage as Transaction state
UI->>RulesEngine: run rules on transaction
RulesEngine-->>UI: return diff
UI->>applyRuleDiff: applyRuleDiffToTransaction(transaction, diff, updatedFieldName)
applyRuleDiff-->>Storage: return cloned updated transaction
UI-->>Storage: save/update transaction
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/desktop-client/src/components/transactions/applyRuleDiff.ts`:
- Around line 36-43: The isNotesMerge helper currently treats any substring
match as a merge because it uses nextValue.includes(currentValue); change this
to only treat true prepend/append merges by checking that nextValue startsWith
or endsWith currentValue (i.e., replace the includes check with
nextValue.startsWith(currentValue) || nextValue.endsWith(currentValue)) while
keeping the other guards (typeof checks, non-empty, and inequality) in the
isNotesMerge function.
In `@packages/desktop-client/src/components/transactions/TransactionList.tsx`:
- Around line 536-538: The call that creates newTransaction currently invokes
applyRuleDiffToTransaction(transaction, diff) and drops the updatedFieldName,
which prevents the payee special-case in shouldApplyRuleDiff from running;
update that call to pass the field name (updatedFieldName) through to
applyRuleDiffToTransaction so the helper and ultimately shouldApplyRuleDiff
receive the field context and preserve payee-driven rule behavior (ensure any
applyRuleDiffToTransaction signature changes are propagated to where it's
defined and to callers expecting the extra parameter).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2685c108-41c4-433e-a04a-8603ec6ba0f5
📒 Files selected for processing (6)
packages/desktop-client/package.jsonpackages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsxpackages/desktop-client/src/components/transactions/TransactionList.tsxpackages/desktop-client/src/components/transactions/applyRuleDiff.test.tspackages/desktop-client/src/components/transactions/applyRuleDiff.tsupcoming-release-notes/8003.md
03da6ab to
564f39e
Compare
564f39e to
6b526a2
Compare
|
Closing in favour of #8300 |
Fixes #7303
Summary
Testing
corepack yarn workspace @actual-app/web test src/components/transactions/applyRuleDiff.test.tscorepack yarn workspace @actual-app/web typecheckcorepack yarn oxfmt --check packages/desktop-client/package.json packages/desktop-client/src/components/transactions/applyRuleDiff.ts packages/desktop-client/src/components/transactions/applyRuleDiff.test.ts packages/desktop-client/src/components/transactions/TransactionList.tsx packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx upcoming-release-notes/8003.mdcorepack yarn oxlint --type-aware packages/desktop-client/src/components/transactions/applyRuleDiff.ts packages/desktop-client/src/components/transactions/applyRuleDiff.test.ts packages/desktop-client/src/components/transactions/TransactionList.tsx packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx(0 errors; existingno-unsafe-type-assertionwarnings remain in touched files)PR_NUMBER=8003 node packages\ci-actions\bin\release-notes-check.mjsBundle Stats
View detailed bundle stats
desktop-client
Total
Changeset
src/components/transactions/applyRuleDiff.tspackage.jsonlocale/en.jsonsrc/components/mobile/transactions/TransactionEdit.tsxsrc/components/transactions/TransactionList.tsxView detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
Smaller
Unchanged
loot-core
Total
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
api
Total
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
cli
Total
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
crdt
Total
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
Related work
Related to #7568, which also targets #7303. This PR keeps the fix in the transaction-entry diff application path and currently has a passing release note/check setup. Happy to close or adjust if maintainers prefer reviving the earlier PR.