Skip to content

base

diapason.learning.spec_search.execute.base

EditApplier ABC, registry, and context types for the execute phase.

Each concrete applier implements validate/apply/rollback for a single EditOp. Appliers are registered in an EditApplierRegistry keyed by EditOp.

See spec §7.1.

ApplyContext dataclass

Shared context passed to all appliers.

ApplyResult dataclass

Result of EditApplier.apply().

EditApplier

Bases: ABC

Abstract base for edit appliers.

Each subclass handles one EditOp. It validates the edit against the current config state, applies the mutation, and can roll back.

apply(edit, ctx) abstractmethod

Mutate the config. Must be idempotent.

rollback(edit, ctx) abstractmethod

Restore pre-edit state. Most appliers delegate to git checkout.

validate(edit, ctx) abstractmethod

Check if the edit can be applied to the current config.

EditApplierRegistry

Registry of EditApplier instances keyed by EditOp.

get(op)

Return the applier for the given op. Raises KeyError if not found.

is_supported(op)

Return True if an applier is registered for the op.

register(applier)

Register an applier instance.

ValidationResult dataclass

Result of EditApplier.validate().