test(optimization): allow output-contract and request-schema names

Additional changes
- Describe contract names and roles in the skill, MIGRATION.md and ADRs 0004 and 0007.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
Bobby Noelte
2026-11-27 13:55:41 +01:00
co-authored by Claude Opus 5.5
parent 8c06245e8b
commit b108335ee4
5 changed files with 169 additions and 35 deletions
@@ -29,7 +29,11 @@ optimizer, not even its package.
- The output contract still lives in `optimization/optimization.py` together with
`OptimizationCommonSettings`; it moves to a module of its own during the migration. Until then
only the contract classes (`OptimizationSolution`) may be imported from there outside parameter
preparation; the architecture test lists them.
preparation; the architecture test lists them. The same holds for the contract types that live
in otherwise banned modules: the solution's `PydanticDateTimeDataFrame`, the operation-mode enums
the plan's instructions name and the request schema's time windows (`TimeWindow`,
`TimeWindowSequence`), but only in the modules that build the output or define the request; the
parameters and the simulation never see them.
- The operation-mode enums and settings-side resolution stay shared because they describe the
configuration, not an optimizer; an optimizer translates them into its own types during
parameter preparation.
parameter preparation, and uses the enums again only to name operation modes in its output.
@@ -24,10 +24,12 @@ The test holds the one authoritative list of these modules and names, including
the configuration, the server (`akkudoktoreos.server`,
[0011](0011-optimizer-api-visualization-and-wizard-get-no-exception.md)), the shared device
configuration (`devices.settings`, `devices.profile`, `devices.devices`, `devices.devicesabc`) and
the contract classes that may be imported from a module that mixes them with configuration
(`optimization.optimization`). Parameter preparation is recognized by its file name,
`optimization/<name>/<name>prepare.py` or a subpackage `optimization/<name>/prepare/` (a plain
module `prepare.py` does not count); the settings
the contract names that may be imported from a module that mixes them with configuration or
Pydantic (`optimization.optimization`, `core.pydantic`, `devices.devicesabc`, `config.configabc`):
the output contract and the public request schema, which every optimizer needs, allowed only in the
modules that build the output or define the request. Parameter
preparation is recognized by its file name, `optimization/<name>/<name>prepare.py` or a
subpackage `optimization/<name>/prepare/` (a plain module `prepare.py` does not count); the settings
model `optimization/<name>/<name>settings.py` may import `config.configabc` to define
`optimization.<name>`. The test discovers the optimizers (every package under `optimization/`), so
adding one does not touch it; until the simulation devices have moved into the optimizer