Future: dedicated audit table for settlement adjustments (queryable history) #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
v2 (see
#9) stores audit context for in-place settlement adjustments in thedca_settlements.notescolumn (added inm006_add_settlement_notes). This is fine for "operator opens a settlement and reads what happened", but it's a free-text blob and doesn't support queryable history.Currently two kinds of entries land there:
distribution.apply_partial_dispense_and_redistribute) when a partial-dispense recompute overwrites the settlement's monetary fields. Captures the original values + reason + new values, prefixed with a UTC timestamp.POST /api/v1/dca/settlements/{id}/notes) for free-form context — cash-drawer reconciliation, off-LN refunds, etc. Timestamped and tagged with the author's user id.Both append to a single TEXT column with newest-first ordering.
What this is missing
Proposed v2.x —
dca_settlement_audittableMigration path: keep the
notescolumn as a convenience render of the latest few entries (or deprecate it once UI rendering catches up). New writes go to both during a transition window; readers cut over once the dedicated table proves out.Reports this enables
Status
Not blocking v1. v1 ships with the notes-column approach; this issue tracks the upgrade once we have UI need or compliance pressure that the notes blob can't satisfy.
Related
aiolabs/satmachineadmin#9— v2 epicaiolabs/satmachineadmin#3— partial transaction processing (the original feature that motivated the audit story)m006_add_settlement_notesmigration — the current notes-column landing➡️ Migrated to aiolabs/spirekeeper#6 (aiolabs/spirekeeper#6).
The v2-bitspire line of this extension now lives in its own repo,
aiolabs/spirekeeper. Tracking for this issue continues there; closing here. (Issue numbers were reassigned in the new repo.)