Skip to content

ump_spec.models.lifecycle

module ump-spec

Artifact envelope and the one state machine for every kind (spec §15).

class

class Artifact(StrictModel)

Catalogue row (one per version). doc holds the kind-specific body.

Fields

NameTypeDefaultDescription
idstr
kindArtifactKind
revisionint1Spec §7 revision of the artifact; version is read as an alias.
stateArtifactState'draft'
client_idstr | NoneNone
titlestr | NoneNone
content_hashstr | NoneNone
spec_versionstrSPEC_VERSION
parentslist[str]list()
ownerstr | NoneNone
submitted_bystr | NoneNone
approved_bystr | NoneNone
docdict[str, Any]
gate_resultslist[GateResult]list()
fallbackslist[FallbackEntry]list()
created_atdatetime | NoneNone
updated_atdatetime | NoneNone
Methods and properties (1)

version property

version: int

The older name of revision (kept for one cycle).

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 102

class

class TransitionRequest(StrictModel)

Fields

NameTypeDefaultDescription
toArtifactState
reasonstr | NoneNone
on_gate_failOnGateFail | NoneNone
contextdict[str, Any]dict()

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 130

class

class ApproveRequest(StrictModel)

Fields

NameTypeDefaultDescription
decisionLiteral['approve', 'reject']'approve'
commentstr | NoneNone
acknowledged_fallbackslist[str]list()

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 137

function

def allowed_transitions(state: str) -> list[str]

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 51

function

def can_transition(src: str, dst: str) -> bool

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 55

function

def check_transition(src: str, dst: str) -> None

Raise UmpError(INVALID_TRANSITION) when src -> dst is not allowed.

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 59

function

def principal_kind(principal: str) -> str

user:maya.chen -> user; agent:newton-actor -> agent; token:... -> token.

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 73

function

def check_approval(
*,
submitter: str | None,
approver: str,
approver_roles: list[str] | None = None,
decision: str = 'approve',
comment: str | None = None,
owner: str | None = None,
artifact_kind: str | None = None,
authors: list[str] | None = None,
) -> None

§15 invariants (G-INT-02, hard stop): approver is a human with the approver role, is neither the submitter nor the owner nor an author of the version (the reviewer is “never the builder”), never an agent or API token; only the measurement lead approves calibrations; a rejection needs a comment.

Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 78

NameTypeValueDescription
ArtifactStateLiteral['draft', 'checks_running', 'checks_passed', 'checks_failed', 'awaitin...
ARTIFACT_STATEStuple[str, ...]('draft', 'checks_running', 'checks_passed', 'checks_failed', 'awaiting_appro...
TRANSITIONSdict[str, frozenset[str]]{'draft': frozenset({'checks_running'}), 'checks_running': frozenset({'checks...Allowed transitions. checks_failed -> draft and rejected -> draft let an author revise (a new version); the spec’s arrows are the forward path.
APPROVAL_TRANSITIONSfrozenset[str]frozenset({'validated', 'rejected'})Transitions that need an approval (POST :approve), not a plain :transition.
ArtifactKindLiteral['dataset', 'transform_step', 'model_manifest', 'capability_manifest',...
ARTIFACT_KINDStuple[str, ...]('dataset', 'transform_step', 'model_manifest', 'capability_manifest', 'test_...