aeat.domain.calculations.registry._parity_tapes module

Scenario tape parity harness for manual AEAT workbook checks.

Loads, runs, and saves parity scenarios using a ValidatedRegistryAuthority to obtain snapshots and evaluate formulas against official AEAT workbooks.

class ParityTapeModel(**data)[source]

Bases: BaseModel

Strict frozen base for parity tape records.

class ParityScenario(**data)[source]

Bases: ParityTapeModel

One manually curated workbook parity scenario.

Parameters:
id: str
modelo: str
revision: str
filing_period: Period | None
filing_year: int
period: str
workbook_path: Path
synthetic_input: SyntheticInputSet
output_cells: dict[WorkbookOutputId, WorkbookCellRef]
registry_outputs: dict[WorkbookOutputId, CasillaId]
date_context: dict[str, date]
relation_values: dict[RelationId, Decimal]
tolerance: Decimal
notes: tuple[str, ...]
class ParityTape(**data)[source]

Bases: ParityTapeModel

Stored trace for one workbook parity execution.

Parameters:
created_at: datetime
scenario_path: str | None
scenario: ParityScenario
workbook: WorkbookArtefactReport
runner: WorkbookRunnerAvailability
report: WorkbookParityRunReport
path: str | None
class ParityTapeReplayReport(**data)[source]

Bases: ParityTapeModel

Replay comparison between an archived tape and the current runtime.

Parameters:
tape_path: str
scenario_id: str
status: ParityStatus
differences: tuple[str, ...]
stored: ParityTape
current: ParityTape
load_parity_scenario(path)[source]

Load one parity scenario from JSON.

Return type:

ParityScenario

Returns:

The validated ParityScenario from the file.

Parameters:

path (Path)

save_parity_scenario(scenario, path)[source]

Persist one parity scenario to JSON.

Return type:

Path

Parameters:
load_parity_tape(path)[source]

Load one ParityTape from JSON.

Return type:

ParityTape

Parameters:

path (Path)

save_parity_tape(tape, path)[source]

Persist one parity tape to JSON.

Return type:

Path

Parameters:
generate_parity_tape_path(root, scenario_id, created_at)[source]

Return a deterministic archive path for one parity tape.

Return type:

Path

Parameters:
run_parity_scenario(scenario, *, registry_root, source_root, scenario_path=None, executable=None)[source]

Execute one scenario against the registry and return a ParityTape.

Return type:

ParityTape

Parameters:
replay_parity_tape(tape, *, registry_root, source_root, tape_path=None, scenario_path=None, executable=None)[source]

Replay an archived tape against the current registry implementation.

Return type:

ParityTapeReplayReport

Returns:

A ParityTapeReplayReport comparing the archived tape to the current output.

Parameters: