Skip to content

proposal: settlement allocation recomputes when the payment changes - #44

Open
delchev wants to merge 1 commit into
mainfrom
spec/settlement-recompute
Open

proposal: settlement allocation recomputes when the payment changes#44
delchev wants to merge 1 commit into
mainfrom
spec/settlement-recompute

Conversation

@delchev

@delchev delchev commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

proposals/0021-settlement-recompute-on-correction.md. Adds no keys - it specifies when an existing construct runs.

The problem. The spec describes the payment's arrival, and every implementation reads settlements as "allocate once, on create". Payments are not final when they are typed in: one booked for the wrong amount is corrected the next day, one entered from a bank statement is completed once the counter-party is identified, one captured as a draft is amended before anyone treats it as money. The allocation then describes an amount the payment no longer carries, and the invoice's settled figure with it - silently, until a receivables reconciliation months later. The opposite correction is worse: a payment reduced after allocation leaves invoices drawing more from it than it holds.

The proposal. Allocation runs on the payment's create and on every subsequent change, and each run is a recompute of the payment's unallocated balance rather than an addition to it: a positive balance is spread as on create, a zero balance changes nothing, a negative balance releases the excess (newest allocation first, reducing rather than removing the last one it touches) so the allocations sum to the payment again. Releases are ordinary junction writes, so the invoice paid roll-up follows them down.

Because every run recomputes, a re-delivered or replayed change converges instead of double-allocating.

Implementation: eclipse-dirigible/dirigible#6818. Site page: IntentFile/intentfile.github.io#35.

🤖 Generated with Claude Code

A payment booked for the wrong amount and corrected the next day, or
entered from a statement and completed later, was never re-allocated:
the spec described only the payment's arrival. Proposes allocation over
the payment's whole life, as a recompute of its unallocated balance -
including releasing the excess when the payment is reduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant