cadrumo.application.provisioning_fitness module

Durable record of each local reader model’s fitness for its role.

A fitness probe costs a model load plus a full answer budget, so a status surface must not run one on every refresh. The verdict is recorded here by the verify action and read back by status. It is keyed by endpoint, model and the runtime’s content digest: a verdict describes exact weights, so a pull that replaces them or a removal drops the record rather than letting it describe different bytes.

The record is operational state about a public model, never taxpayer data, and lives in one fixed file under the storage root.

class RoleFitnessVerdict(*values)[source]

Bases: StrEnum

What a completed fitness probe concluded about a model.

FIT
UNFIT
TIMED_OUT
class RecordedFitnessVerdict(**data)[source]

Bases: BaseModel

One settled probe verdict for exact weights served by one endpoint.

Parameters:

data (Any)

endpoint: str
model: str
digest: str
role: ModelRole
verdict: RoleFitnessVerdict
failed_condition_id: str | None
elapsed_ms: int
recorded_at: datetime
matches(*, endpoint, model, digest, role)[source]

Return whether this record describes exactly the given key.

Return type:

bool

Parameters:
fitness_verdict_path(settings=None)[source]

Return the verdict record’s path under the effective storage root.

Return type:

Path

Parameters:

settings (Settings | None)

read_fitness_verdict(*, endpoint, model, digest, role, settings=None)[source]

Return the recorded verdict for these exact weights, or None when none was recorded.

Return type:

RecordedFitnessVerdict | None

Parameters:
record_fitness_verdict(verdict, settings=None)[source]

Record verdict, replacing any earlier verdict for the same endpoint, model and role.

Return type:

None

Parameters:
invalidate_role_fitness(settings=None)[source]

Drop every recorded verdict for the configured endpoint, after its model store changed.

Return type:

None

Parameters:

settings (Settings | None)