Let reviews see low-confidence suggestions and rebase preview applies
A low-confidence answer was discarded inside Classify, so Analyse showed the row as unchanged instead of a reviewable suggestion; the fallback decision moves to the import path, which keeps the merchant link and the recorded confidence. ApplyPreview now rebases onto the current journal: unrelated commits during a minutes-long paced run no longer invalidate the review, only an edit to a selected transaction itself conflicts, and applied changes are pruned so the rest stay appliable.
This commit is contained in:
@@ -438,7 +438,7 @@ func TestConfiguredPrivateNamesAndIdentifiersRedactWithoutRemovingPayee(t *testi
|
||||
}
|
||||
}
|
||||
|
||||
func TestLowConfidenceKeepsMerchantAndTagsButUsesFallback(t *testing.T) {
|
||||
func TestLowConfidenceKeepsProposalAndRecordsConfidence(t *testing.T) {
|
||||
f, d := fixture()
|
||||
c := mockClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
reply(w, `{"merchant_id":"mer_coffee","new_merchant":null,"category_id":"cat_food","tag_ids":["tag_daily"],"confidence":"low"}`)
|
||||
@@ -447,11 +447,13 @@ func TestLowConfidenceKeepsMerchantAndTagsButUsesFallback(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if p.Enrichment.CategoryID != domain.ExpenseFallback ||
|
||||
// Review flows need the model's suggestion; discarding it is the import
|
||||
// path's decision, not the client's.
|
||||
if p.Enrichment.CategoryID != "cat_food" ||
|
||||
p.Enrichment.MerchantID != "mer_coffee" ||
|
||||
!reflect.DeepEqual(p.Enrichment.TagIDs, []string{"tag_daily"}) ||
|
||||
p.Enrichment.Classification.Confidence != "low" {
|
||||
t.Fatalf("low-confidence proposal was not preserved safely: %+v", p)
|
||||
t.Fatalf("low-confidence proposal was not preserved: %+v", p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user