Skip to content

Migration synthesis

didactic.api.synthesise_migration

synthesise_migration(
    source: type[Model],
    target: type[Model],
    *,
    stringency: str | None = None,
) -> SynthesisResult

Auto-generate a candidate migration lens from source to target.

Parameters:

Name Type Description Default
source type[Model]

The earlier Model class.

required
target type[Model]

The later Model class.

required
stringency str | None

One of "strict", "balanced", "lenient", "exploratory" (case-insensitive). None uses panproto's default ("balanced").

None

Returns:

Type Description
SynthesisResult

The generated lens, its quality score, and any coercion proposals (only at "exploratory").

Notes

The synthesiser's output is a candidate, not a guaranteed correct migration. Always review before registering. For high-stakes migrations, prefer authoring the lens by hand and using the synthesiser only as a starting point.

didactic.api.SynthesisResult dataclass

SynthesisResult(
    lens: object,
    score: float,
    proposals: tuple[JsonObject, ...],
)

The output of synthesise_migration.

Parameters:

Name Type Description Default
lens object

A panproto lens object. Treat as opaque; pass to didactic.api.register_migration wrapped in a didactic.api.Lens subclass that delegates to it.

required
score float

Alignment quality in [0.0, 1.0]. Higher is better.

required
proposals tuple[JsonObject, ...]

Auxiliary coercion proposals emitted under "exploratory" stringency; empty for stricter levels. Each proposal documents a candidate value-coercion suggested by the synthesiser.

required