## Precondition


One thing that must still hold when a plan is applied.


Usage

``` python
Precondition(
    kind,
    expected=None,
    key=None,
    params=dict(),
    detail="",
)
```


The drift contract in data: a plan records what it saw (a manifest hash, a branch head, a history digest) and apply refuses with `~tether.errors.StalePlanError` if the world says otherwise. Kept out of [context](upgrade.Plan.md#tether.upgrade.Plan.context) so the checks are typed, listed, and run in one place rather than re-implemented per command.


## Attributes


`kind: str`  
One of `PRECONDITION_KINDS`.

`expected: Any`  
The value seen at plan time (a hash, a state, a commit id).

`key: str | None`  
The object key, for per-object checks.

`params: dict[str, Any]`  
What the check needs to look again (`locator`, `backend`, [ref](handles.DoltHandle.md#tether.handles.DoltHandle.ref), `rev`, [pin](testing.ObjectBackend.md#tether.testing.ObjectBackend.pin), [bookmark](PullReport.md#tether.PullReport.bookmark)).

`detail: str`  
The refusal message; may use `{observed}`.
