Skip to content

Bug in nested rebuilding of Config as ConfigDescriptor #213

@jamienoss

Description

@jamienoss

Can reproduced using the following:

from evolver.device import Evolver
from evolver.hardware.standard.temperature import Temperature
from evolver.calibration.standard.calibrators.temperature import TemperatureCalibrator

#calibrator=None
calibrator = TemperatureCalibrator()
x = Evolver(hardware={'test': Temperature(addr='x', calibrator=calibrator)}).config_model
print(x)

Resulting in both the hardware entry and calibrator entry not being ConfigDescriptors as needed.

This could be due to:

  • changes in pydantic
  • us relying on pydantic behavior that isn't safe to rely on

The issue resolves itself, if model fields are only annotated as ConfigDescriptor rather than multiple options as they are, e.g., ConfigDescriptor | HardwareDriver.

This has no bearing on config ingestion, in-memory models are created correctly. However, they are not represented adequately when either printed or written out, which causes the follow on issue that said outputted configurations are not re-ingestible.

See pydnatic docs about union fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfig

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions