Deleting an expense in split expenses removes its ledger rows (server/routes/split-expenses.js around lines 311 and 886: DELETE FROM expense_ledger_entries WHERE source_type ... AND source_id = ?). The schema already allows source_type = 'expense_reversal' (server/db.js, expense_ledger_entries), but nothing ever writes it.
Since #1378, a recorded payment is reversed with a counter-entry (settlement_reversal) instead of being removed, so the history keeps what happened. An expense is the other half of the same ledger and still follows the old rule: once deleted, the balance changes and nothing shows why.
Proposal: deleting an expense writes expense_reversal rows (the exact negative of its expense rows, same source_id) and keeps the expense visible in the activity as deleted, the same shape as the payment reversal. Editing an expense would then be reversal plus new booking, or stay as it is; that needs deciding before the build.
This belongs to the same question as #1381 (what deleting means for shared data) and should be decided together with it, not built on its own.
Deleting an expense in split expenses removes its ledger rows (
server/routes/split-expenses.jsaround lines 311 and 886:DELETE FROM expense_ledger_entries WHERE source_type ... AND source_id = ?). The schema already allowssource_type = 'expense_reversal'(server/db.js,expense_ledger_entries), but nothing ever writes it.Since #1378, a recorded payment is reversed with a counter-entry (
settlement_reversal) instead of being removed, so the history keeps what happened. An expense is the other half of the same ledger and still follows the old rule: once deleted, the balance changes and nothing shows why.Proposal: deleting an expense writes
expense_reversalrows (the exact negative of itsexpenserows, samesource_id) and keeps the expense visible in the activity as deleted, the same shape as the payment reversal. Editing an expense would then be reversal plus new booking, or stay as it is; that needs deciding before the build.This belongs to the same question as #1381 (what deleting means for shared data) and should be decided together with it, not built on its own.