Skip to content

spec(glue): settlement allocation follows the payment, not only its arrival - #35

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

spec(glue): settlement allocation follows the payment, not only its arrival#35
delchev wants to merge 1 commit into
mainfrom
spec/settlement-recompute

Conversation

@delchev

@delchev delchev commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The settlements section described the shape but left the when implicit, and every implementation read it as "once, on arrival". A payment is rarely final when it is 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. The allocation - and with it every invoice's settled figure - was left describing an amount the payment no longer carried.

Specifies allocation over the payment's whole life:

  • it runs on the payment's create and on every subsequent change;
  • each run allocates the payment's unallocated balance (pot less what is already allocated through the junction) rather than the pot again, so a re-delivered or replayed change leaves the allocation unchanged;
  • a negative balance - the payment now covers less than it is allocated to - releases the excess, newest allocation first, reducing rather than removing the last allocation it touches;
  • releases are ordinary junction writes, so the invoice paid roll-up follows them down.

Companion proposal: IntentFile/intent-specification#44. Implementation: eclipse-dirigible/dirigible#6818.

npx vitepress build docs passes.

🤖 Generated with Claude Code

…rrival

Allocation is specified over the payment's whole life: it runs on the
payment's create and on every later change, and each run allocates the
unallocated balance rather than the pot again - so a correction settles
for the amount the payment actually carries, a reduction gives the excess
back newest-first, and a replayed change changes nothing.
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