You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build typed control totals from the generated ReportingControlTotal model #1487
_typed_control_totals in the producer builds ReportingControlTotalRecord dataclasses. That class re-declares the schema's name and value patterns and the 32-character unit bound by hand, and serializes with its own to_wire(). The SDK already ships the generated model for the same schema: adcp.types.ReportingControlTotal, with ReportingControlTotal1 (integer) and ReportingControlTotal2 (decimal) carrying the same patterns. The patterns match today. When the schema changes, the generated model picks up the change on the next sync, and the hand-written copy does not.
Evidence
All references are to main at 47084e83a.
src/adcp/reporting/ledger/producer.py:243-265: _typed_control_totals constructs ReportingControlTotalRecord(total.name, total.value, total.value_type, total.unit or units.get(total.name)) for each manifest total.
src/adcp/reporting/evidence.py:196-232: ReportingControlTotalRecord.__post_init__ re-declares the patterns:
src/adcp/types/domains/core/reporting_control_total.py:13-57: ReportingControlTotal1 and ReportingControlTotal2 declare pattern='^[A-Za-z][A-Za-z0-9_.:-]{0,127}$', pattern='^-?(?:0|[1-9][0-9]*)$', pattern='^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$', and max_length=32 on unit.
src/adcp/types/__init__.py:171: ReportingControlTotal is a public export.
No module under src/adcp/reporting/ledger/row_*.py, producer.py, or evidence.py imports adcp.types. Two other ledger modules do (consumer_status.py:460, status_server.py:12), so the dependency direction is established.
Suggested fix
Construct ReportingControlTotal instances in _typed_control_totals and hash their wire form. Keep ReportingControlTotalRecord as a thin adapter (or alias) while the retained evidence column and from_wire depend on it, and delete the duplicated regexes from __post_init__. This is protocol shape, so it is independent of the storage layer.
Activity