Harden resource cost evidence contract
This commit is contained in:
parent
080f756fff
commit
00343307fd
22 changed files with 1623 additions and 130 deletions
|
|
@ -116,7 +116,7 @@ prices remain auditable, and duplicate prices require an explicit revision.
|
|||
|
||||
```task
|
||||
id: FIN-WP-0002-T03
|
||||
status: wait
|
||||
status: todo
|
||||
priority: medium
|
||||
state_hub_task_id: "899a5c29-843c-481f-a63a-42d4d327af5d"
|
||||
```
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ status: active
|
|||
owner: codex
|
||||
topic_slug: financials
|
||||
created: "2026-08-10"
|
||||
updated: "2026-08-10"
|
||||
updated: "2026-08-11"
|
||||
related:
|
||||
- FIN-WP-0001
|
||||
- RESOURCE-WP-0002
|
||||
|
|
@ -31,14 +31,16 @@ signals. `resource-control` remains authoritative for resource identity,
|
|||
lifecycle, demand and capacity forecasts, technical usage, allocation evidence,
|
||||
unit economics, and infrastructure optimization cases.
|
||||
|
||||
This is a proposed companion to `RESOURCE-WP-0003` and should move to `ready`
|
||||
only after both repository owners review the authority matrix.
|
||||
This active companion to `RESOURCE-WP-0003` incorporates resource-control's
|
||||
2026-08-11 review. The authority boundary is accepted in principle; the v0.1
|
||||
exchange remains unapproved until T02, T03, T05, and T07–T09 satisfy the
|
||||
review conditions.
|
||||
|
||||
## T01 — Review and record the authority boundary
|
||||
|
||||
```task
|
||||
id: FIN-WP-0004-T01
|
||||
status: progress
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "6616e6a0-b0f3-4b82-a081-083891e2fb6e"
|
||||
```
|
||||
|
|
@ -66,11 +68,23 @@ defines the authority matrix, directional envelopes, identifiers, correction
|
|||
and idempotency rules, reconciliation invariants, and four review questions.
|
||||
Joint resource-control review remains required before completion.
|
||||
|
||||
Review 2026-08-11: resource-control accepted the authority boundary in
|
||||
principle and requested changes before v0.1 approval. The timestamped result is
|
||||
`history/2026-08-11-resource-control-review-fin-wp-0004.md`. T02 and T03 own
|
||||
the envelope refinements; T07-T09 own the implementation-integrity findings.
|
||||
Align `INTENT.md` and remove the proposed/active lifecycle contradiction as
|
||||
part of incorporating the joint review.
|
||||
|
||||
Completed 2026-08-11: incorporated all four review decisions into the
|
||||
contract, aligned `INTENT.md`, and corrected lifecycle language. The authority
|
||||
boundary is jointly reviewed and accepted in principle; implementation
|
||||
acceptance remains gated by T05.
|
||||
|
||||
## T02 — Specify fin-hub to resource-control booked-cost evidence
|
||||
|
||||
```task
|
||||
id: FIN-WP-0004-T02
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "0a90dd6f-b0c9-42dc-b625-cfedf0471143"
|
||||
```
|
||||
|
|
@ -90,11 +104,17 @@ Done when representative Host Europe or other provider rows can be exported
|
|||
idempotently and joined without copying invoice authority into
|
||||
`resource-control`.
|
||||
|
||||
Completed 2026-08-11: `BookedCostEvidence` defines decimal-string money,
|
||||
round-half-even precision, net/discount/tax/gross/effective relationships,
|
||||
unknown-tax handling, signed adjustment semantics, stable fact/document/line
|
||||
identity, fingerprints, corrections, provenance, and join axes. Current
|
||||
HostEurope facts project through this schema without raw invoice content.
|
||||
|
||||
## T03 — Specify resource-control to fin-hub planning evidence
|
||||
|
||||
```task
|
||||
id: FIN-WP-0004-T03
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "ad9dccb4-85be-4f19-b36e-2f7165a879f5"
|
||||
```
|
||||
|
|
@ -111,6 +131,12 @@ forecasts remain queryable for later variance analysis.
|
|||
Done when the PostgreSQL backup forecast can enter fin-hub without being
|
||||
mistaken for an invoice or actual expenditure.
|
||||
|
||||
Completed 2026-08-11: added distinct forecast, usage-observation, allocation,
|
||||
optimization, and commitment-candidate schemas plus an idempotent,
|
||||
append-only `planning_evidence` store outside the booked ledger. The adapter
|
||||
successfully ingested all 12 rows of resource-control's live PostgreSQL backup
|
||||
forecast into a temporary fin-hub ledger.
|
||||
|
||||
## T04 — Expose budgets, commitments, and viability constraints
|
||||
|
||||
```task
|
||||
|
|
@ -170,6 +196,82 @@ unattributed booked cost, stale forecasts, and reconciliation failures.
|
|||
Done when the contract supports storage, compute or cluster capacity, and a
|
||||
shared-service allocation without changing the authority boundary.
|
||||
|
||||
## T07 — Correct cost-report dimensions and currency safety
|
||||
|
||||
```task
|
||||
id: FIN-WP-0004-T07
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "406ce484-db7f-4bb9-b3b3-23217c052e08"
|
||||
```
|
||||
|
||||
Correct service and monthly aggregation so no report adds amounts across
|
||||
currencies or silently combines environments. Define and test the canonical
|
||||
dimensions for service, attribution, period, environment, and currency views.
|
||||
Expose residual and unattributed totals under the same rules.
|
||||
|
||||
Done when mixed-currency and mixed-environment fixtures remain separate, all
|
||||
rollups reconcile per currency, and no result inherits a misleading currency
|
||||
or environment label from its first row.
|
||||
|
||||
Completed 2026-08-11: service buckets now key on service, environment, and
|
||||
currency; attribution buckets include environment and currency; period totals
|
||||
are currency-separated; and explicit unattributed residuals use the same
|
||||
dimensions. Mixed fixtures are covered by regression tests.
|
||||
|
||||
## T08 — Establish idempotent booked-fact imports and corrections
|
||||
|
||||
```task
|
||||
id: FIN-WP-0004-T08
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "aded815d-75a2-4496-9676-b44b5e4dc49a"
|
||||
```
|
||||
|
||||
Replace file-path-and-mtime deduplication as the financial identity boundary.
|
||||
Define stable `financial_fact_id`, source-document and source-line identity,
|
||||
content fingerprint, duplicate-delivery behavior, and append-only correction,
|
||||
reversal, and replacement semantics. Preserve raw provenance without storing
|
||||
secret invoice material in exchange records.
|
||||
|
||||
Done when unchanged, renamed, touched, corrected, and force-reimported inputs
|
||||
cannot double-count a fact; corrections change effective totals exactly once
|
||||
while predecessors remain auditable.
|
||||
|
||||
Completed 2026-08-11: ledger rows now carry stable financial-fact,
|
||||
source-document, and source-line identities, content fingerprints,
|
||||
`correction_of`, and single-current state. Renamed, touched, duplicate, and
|
||||
forced unchanged deliveries are idempotent; changed facts require an explicit
|
||||
forced correction and effective totals include exactly one current version.
|
||||
`reverse_financial_fact` appends a provenance-bearing reversal that zeroes the
|
||||
effective fact without deleting its predecessor.
|
||||
|
||||
## T09 — Unify money and engagement-price domain invariants
|
||||
|
||||
```task
|
||||
id: FIN-WP-0004-T09
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "c52d79b9-cbad-4d06-bd54-9b06125e12a0"
|
||||
```
|
||||
|
||||
Use one domain validation path for SQLite commands and SQLAlchemy models.
|
||||
Enforce attribution-key consistency, valid periods, normalized currency,
|
||||
non-negative engagement prices, decimal money, effective-date rules, source
|
||||
provenance, and a concurrency-safe append-only revision chain. Add equivalent
|
||||
database constraints where practical.
|
||||
|
||||
Done when both persistence paths reject the same invalid records, concurrent
|
||||
revisions cannot create two current prices for one basis, and calculations use
|
||||
documented precision and rounding.
|
||||
|
||||
Completed 2026-08-11: shared money, currency, period, attribution, and price
|
||||
validation now serves SQLite and SQLAlchemy. Calculations use integer minor
|
||||
units or `Decimal(18,2)` with round-half-even; price revisions use immediate
|
||||
transactions and partial unique current-basis indexes. ORM constraints cover
|
||||
non-negative price, effective dates, currency, canonical attribution, and one
|
||||
current reporting-month basis.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- [ ] One reviewed authority matrix is linked from both repositories.
|
||||
|
|
@ -182,3 +284,6 @@ shared-service allocation without changing the authority boundary.
|
|||
- [ ] Backup completes a reconciled round trip with no double counting.
|
||||
- [ ] At least one non-storage and one shared-service case validate the
|
||||
generalized contract.
|
||||
- [ ] Cost reports never mix currency or environment dimensions.
|
||||
- [ ] Booked-fact import and corrections are idempotent under changed delivery.
|
||||
- [ ] SQLite and SQLAlchemy paths enforce the same money and price invariants.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue