Layers
create_app() takes every adapter as an optional argument, which is exactly
how the tests inject the fakes — no monkeypatching, no network.
A module is a class with its dependencies passed in, not one more mixin on
BridgeService: PartnerVerzeichnis(makoflow, audit) is built from the
clients the service holds and can be tested on its own. The roles’ routines
read partner data through it, never from the gateway or the
partin_email ledger directly. LrvModul is built the same way, with a
narrow Bruecke to the cases inbox and the contract records.
Code size
A Python file holds at most 400 lines; 200 to 400 is the aim (tests/test_dateigroesse.py, for src/, tests/ and scripts/). The
files that were longer when the rule came in are pinned at that length:
they may shrink, never grow, and leave the list once within the limit.
The Engrate adapter
The client implements Engrate’s documented Create Schedule endpoint: onePOST /schedule-management/v1/schedules per TSO per delivery date, API
key raw in the authorization header, amounts as average power in MW per quarter-hour,
direction encoded via out_party/in_party EIC codes. Series mapping:
All market identifiers come from config (
AREA_MARKET_IDS); nothing else in
the service knows Engrate’s shape, so contract changes stay in one file.