cadrumo.adapters.outbound.aeat.export.registry_record_renderer module

Render a registry-declared fixed-width record into fichero-BOE bytes.

This is the bridge between the registry’s declarative export layout (domain.calculations.registry.schema_exports.ExportRecordDefinition, which says what each field is and where it sits) and the public registry fixed-width codec (which says how a field becomes bytes). It exists so an application-layer caller can hand over a record declaration plus the values an operator entered and receive wire bytes, without naming a single wire-format type itself.

The translation is deliberately generic rather than modelo-specific: every input it reads - field coordinates, kind, data_type, justification, padding, signed, encoding - is a registry declaration, so any modelo whose layout is fixed-width renders through the same path. Modelo 145 is the first caller, not a special case.

Failures surface as ModeloExportError. The renderer sits behind an application-declared port, and a port that leaked an adapter-owned error type would force its callers to import the adapter to catch it - reintroducing the coupling the port removes. The domain error carries the same diagnosis in its context.

See also

application.modelo._ports.FicheroBoeRecordRenderer

The structural port this class satisfies.

domain.calculations.registry.fixed_width_codec.render_fixed_width_export_field()

The canonical exact-width field codec reused by this renderer.

class RegistryFixedWidthRecordRenderer[source]

Bases: object

Renders any fixed-width registry record; satisfies the modelo renderer port.

Stateless, so one instance is safe to share across callers and threads.

render_record_body(record, *, field_values)[source]

Return the encoded body for record, without a line terminator.

Return type:

bytes

Parameters: