gcubed.data.fiscal_contract
Validate in-memory generation contracts and safely bind legacy migration proof.
Source qualification stays in the data package. This module preserves its primitive receipt and checks immutable anchors, selected equations and exact legacy changes. Ordinary runtime CSV loading and conditioning do not read this source evidence or persist fiscal audits. Legacy decoding exists only for safe metadata retirement.
Hash labelled values using the generation receipt's stable CSV representation.
Check the immutable P07 source-target schema and input identity, without refitting.
Validate source proof and final equations, allowing only recorded INTR changes.
Inputs are stored unlogged coordinates. Generation anchors remain immutable; conditioned anchors are derived from the exact persisted managed-cell records. Invalid or stale evidence raises ValueError without mutating the inputs.
Decode the bounded primitive receipt; malformed evidence raises ValueError.
Bind CSV cells and metadata, masking only independently managed INTX year values.
Row presence, order, names, region, units and every column/year remain bound. Fiscal equations do not use INTX. The original whole-file hash remains separate.
Read the existing four-column INTR state, including its reserved companion row.
Restore the process CSV limit after reading realistic source-evidence fields. Legacy states have no reserved row and remain valid four-column cell records.
Bind ordinary cell changes separately from the companion row to avoid a hash cycle.
Decode one reserved state row before ordinary coordinate restoration/counting.
Derive current anchors only from exact state records bound to original evidence.
Validate historical CSV/managed proof before migration, without renewing sources.
Version-one and version-two proof can be retired even when its data sources have changed. Exact CSV, original-backup, marker and managed-cell bindings must still agree. This check establishes safe retirement, not economic acceptance.
Reconstruct an old exact-only CSV from bounded original INTX observation texts.
For cleanup, independent INTX numeric values must already equal the original; only representation is restored. Current masked companions need no such cells.
G-Cubed