When a user corrects a category the AI assigned, the system now records
the correction as a deterministic, forward-looking automation rule so the
same merchant — or the same distinctive description — is never
mis-categorized the same way again. The next matching transaction is
caught by the rule before the model ever runs, ending the
correct-it-every-time loop.
- New RuleOrigin::Correction: rules learned from corrections, protected
from the AI self-heal and editable like any rule in settings.
- AiRuleLearner::learnFromCorrection keys on the merchant when present
(stable as the description varies), otherwise on the description's
distinctive tokens, guarded against over-broad description rules that
could silently mis-file en masse.
- A key lives in exactly one correction rule, so changing your mind moves
it to the new category. Correcting a transaction a prior correction
rule categorized is also learnable, so correction rules stay fixable.
- Extract DescriptionTokenizer, shared by RuleSuggestionAggregator and the
learner, removing the duplicated distinctive-token logic.
- TransactionMatcher::countMatchingAll backs the over-broad guard.
- The update endpoint returns the learned rule; the transactions table
shows a toast with an instant Undo.