Implement FIN-WP-0006-T01 settlement statement join; mark FIN-WP-0004/0005 blocked
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 6s

Add SettlementStatement schema and a dedicated settlement_statements store
(ingest_settlement_statement, current_settlement_statements) so
resource-control internal transfer settlements join as a referenced
projection without ever entering the booked-cost ledger. exchange_health
now surfaces a current statement with payment_recognition=unknown as a
settlement_awaiting_payment_join residual instead of booked cost. Adds
CLI commands finhub ledger ingest-settlement / settlements.

FIN-WP-0006-T01 is done; the workplan is finished.

Reviewed all other open workplans for closeable work: FIN-WP-0004's only
remaining task (T05) waits on an external provider fact from
resource-control, and every FIN-WP-0005 task waits on operator/Steuerbüro
confirmation or a non-production DATEV tenant. Neither has actionable
in-repo work right now, so both move to status: blocked.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: sonnet
Assistant-Process: 242919@bnt-lap001
Assistant-Session: 286d235a-1654-40ff-b8fd-eee4e2ff9ea6
This commit is contained in:
tegwick 2026-09-27 21:50:54 +02:00
parent 4ef6fec8ff
commit 91d62f6430
8 changed files with 377 additions and 8 deletions

View file

@ -4,12 +4,12 @@ type: workplan
title: "Consume resource-control internal transfer settlement"
domain: financials
repo: fin-hub
status: proposed
status: finished
flavor: residual
owner: codex
topic_slug: financials
created: "2026-08-14"
updated: "2026-08-14"
updated: "2026-09-27"
related:
- FIN-WP-0004
- RESOURCE-WP-0005
@ -43,7 +43,7 @@ Origin: `RESOURCE-WP-0005-T07`. Terms live in
```task
id: FIN-WP-0006-T01
status: todo
status: done
flavor: residual
priority: high
state_hub_task_id: "9ef3fab5-51a6-57ef-8121-b9714298c502"
@ -57,3 +57,23 @@ a provider invoice.
Done when an inbound fixture can be stored as a referenced projection
and `exchange_health` shows statements lacking a payment join as a
visible residual, not as booked cost.
Completed 2026-09-27: added `SettlementStatement`
(`src/fin_hub/schemas/exchange.py`) matching resource-control's v0.1
`settlement-statement.schema.json`, with a dedicated
`settlement_statements` table (`services/exchange.py`) that never touches
`ledger_entries`. `ingest_settlement_statement` validates and stores each
statement keyed by `financial_entity_id` + `procuring_entity_id` + `period`
+ `statement_date`, idempotent on identical resubmission, and superseding
the prior current statement for the same entity/period pair on a later
`statement_date`. `exchange_health` now emits
`settlement_awaiting_payment_join` (severity `warning`) for any current
statement with `payment_recognition: "unknown"`, listing its outstanding
amount as a residual rather than booked cost.
`current_settlement_statements` exposes the stored projection for
reporting. CLI: `finhub ledger ingest-settlement` and
`finhub ledger settlements`. Fixture:
`tests/fixtures/settlement-statement-2026-08.json`. Tests:
`tests/test_exchange.py::test_settlement_statement_*` and
`::test_exchange_health_surfaces_settlement_without_payment_join_as_residual`.
Full suite: 102 passed.