Show which legs a transfer cannot pair, and what would pair them

The transfers screen counted unpaired legs per definition but never said
which transactions they were; finding them meant retyping the definition
into the builder. A ⚠ row now opens onto its legs, newest first, each
naming the missing side and what that side would have had to be:

  revolut → ?  arriving leg  +250.00 in other matching *FROM REVOLUT*,
                             dated 2026-02-01 to 2026-02-11

That description comes from transfers.Engine.Want, next to
bestCounterpart, so it is stated in the terms the pairing actually uses:
the other half of the definition, the window, and the amount -- exact,
widened only by the definition's own tolerance, and "any amount" across
currencies, where amounts are not compared. When the other account has
nothing imported at all, the line says so, since that is the usual cause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 19:43:13 +02:00
co-authored by Claude Opus 5.5
parent 17428a4f51
commit 7f5b4846ef
7 changed files with 240 additions and 14 deletions
+35
View File
@@ -426,3 +426,38 @@ to_desc = "*FROM CHECKING*"
}
}
}
// A ⚠ on the transfers screen opens onto the legs behind it: which side each
// is missing, and what that side would have to be.
func TestTransferListNamesTheMissingLegs(t *testing.T) {
_, h := newTestServer(t, `
[[transfer]]
from_account = "checking"
from_desc = "*TO SAVINGS*"
to_account = "savings"
to_desc = "*FROM CHECKING*"
`,
fixtureTxn{"checking", "2026-02-01", "TO SAVINGS", -1000},
fixtureTxn{"savings", "2026-02-02", "FROM CHECKING", 1000},
fixtureTxn{"checking", "2026-02-20", "TO SAVINGS", -2500},
fixtureTxn{"savings", "2026-01-10", "FROM CHECKING", 700},
)
var list struct {
Transfers []transferRow
Unpaired int
}
call(t, h, "GET", "/api/transfers", nil, http.StatusOK, &list)
legs := list.Transfers[0].Legs
if list.Unpaired != 2 || len(legs) != 2 {
t.Fatalf("unpaired = %d, legs = %+v; want the two lone legs", list.Unpaired, legs)
}
newest, oldest := legs[0], legs[1]
if newest.Movement != "checking → ?" || newest.Missing != "arriving" ||
newest.Want != "+25.00 in savings matching *FROM CHECKING*, dated 2026-02-15 to 2026-02-25" {
t.Errorf("newest leg = %+v", newest)
}
if oldest.Movement != "? → savings" || oldest.Missing != "leaving" ||
oldest.Want != "-7.00 in checking matching *TO SAVINGS*, dated 2026-01-05 to 2026-01-15" {
t.Errorf("oldest leg = %+v", oldest)
}
}