Implement client cost attribution

This commit is contained in:
tegwick 2026-08-10 20:32:09 +02:00
parent d2b9bc4b32
commit 33883e0977
15 changed files with 362 additions and 21 deletions

View file

@ -32,8 +32,22 @@ uv run finhub ops-costs tests/fixtures/hosteurope.csv
Cross-hub coupling (`--emit`) posts non-secret progress events to dev-hub when
`STATE_HUB_API` is reachable.
## Client cost attribution
HostEurope CSV rows may include `client_id`, `application_id`, and
`app_instance_id`. All three must be present together. Fin-hub validates them
as external identifiers and derives the stable key
`client:<client_id>|app:<application_id>|instance:<app_instance_id>`; callers
must not invent a second key format. Rows without all three columns remain
explicitly unattributed for backward compatibility.
The SQLite ledger adds the attribution columns automatically when an existing
ledger is opened. The `ops-costs` report retains its per-service view and adds
an `attributions` view separated by currency. Client and application identity
remain authoritative outside fin-hub.
## Related Workplans
- `the-custodian/workplans/CUST-WP-0025-fos-hub-bootstrap.md` — umbrella
- `canon/constitution/bootstrap-protocol_v0.1.md` — funding and roles
- `canon/projects/railiance/business-model-canvas_v0.1.md` — monetization path
- `canon/projects/railiance/business-model-canvas_v0.1.md` — monetization path