cadrumo.application.modelo._ledger_anchor_capture module¶
Project a calculation revision into its bundled ledger fact basis.
Three paths need the same bundle and for the same reason: a revision that reaches a sealed state must carry the ledger facts it was computed from, or nothing downstream can say whether the filing still matches the books. Verify captures it at the moment it grants, the amendment path captures it at the moment it stands in for verify, and the evidence-recapture verb rebuilds it over facts that have not moved.
They differ only in which fingerprint the bundle is pegged to, so that is the argument rather than the difference: verify and amend peg to a snapshot they have just taken, and recapture pegs to the one already sealed. Everything else – which refs ground the bundle, which operator inputs become manual fact-basis entries – is one rule, and it lives here rather than being spelled out at each call site, where two of the three copies had already drifted into being maintained separately.
- normalised_observation_refs(observations, field_name)[source]¶
Return the distinct non-empty refs across
observations, refusing none.An empty result is refused rather than returned: a bundle grounded in no legal or source reference cannot be traced back to the authority it claims, and an empty tuple would look like a deliberate absence.
Core types:
CasillaObservation.- Return type:
- Parameters:
observations (Iterable[CasillaObservation | None])
field_name (str)
- manual_fact_basis_entries(input_values_by_casilla_id, observations, *, m210_gross_income_source_mode)[source]¶
Project a revision’s operator casilla inputs into manual fact-basis entries.
input_values_by_casilla_idholds the caller-supplied (operator-entered) casilla values that are not ledger-derived; each non-empty entry is part of the fact basis a filing artefact must explain. Blank values are skipped (they carry no fact). The M210 ledger-derivedrendimientos_integrosinput is deliberately excluded: it is present in the replay map so formula replay is exact, but its fact basis is the fingerprinted transaction evidence rather than a manual declaration.Core types:
CasillaObservation.- Return type:
- Parameters:
observations (Iterable[CasillaObservation])
m210_gross_income_source_mode (M210GrossIncomeSourceMode | None)
- capture_revision_ledger_evidence(*, revision, catalogue, snapshot_fingerprint, captured_at)[source]¶
Bundle
revision’s fact basis, pegged tosnapshot_fingerprint.The contributor set is the revision’s own
source_transaction_ids, so the bundle describes exactly the rows the calculation used. The caller supplies the fingerprint because that is the one thing the three callers legitimately disagree about: a fresh capture pegs to the snapshot it just took, while a recapture pegs to the one already sealed so the bundle stays bound to the facts the filing asserts.- Parameters:
revision (
CalculationRevision) – The revision whose fact basis is bundled.catalogue (
TransactionCatalogue) – The live transaction catalogue to project rows from.snapshot_fingerprint (
str) – The snapshot address this bundle belongs to.captured_at (
datetime) – Timestamp recorded on the bundle.
- Return type:
- Returns:
The bundled
LedgerFilingEvidence.
Core types:
CalculationRevision,TransactionCatalogue.