ump_spec.models.lifecycle
module ump-spec
Artifact envelope and the one state machine for every kind (spec §15).
Classes
Section titled “Classes”Artifact
Section titled “Artifact”class
class Artifact(StrictModel)Catalogue row (one per version). doc holds the kind-specific body.
Fields
| Name | Type | Default | Description |
|---|---|---|---|
id | str | ||
kind | ArtifactKind | ||
revision | int | 1 | Spec §7 revision of the artifact; version is read as an alias. |
state | ArtifactState | 'draft' | |
client_id | str | None | None | |
title | str | None | None | |
content_hash | str | None | None | |
spec_version | str | SPEC_VERSION | |
parents | list[str] | list() | |
owner | str | None | None | |
submitted_by | str | None | None | |
approved_by | str | None | None | |
doc | dict[str, Any] | ||
gate_results | list[GateResult] | list() | |
fallbacks | list[FallbackEntry] | list() | |
created_at | datetime | None | None | |
updated_at | datetime | None | None |
Methods and properties (1)
version property
version: intThe older name of revision (kept for one cycle).
Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 102
TransitionRequest
Section titled “TransitionRequest”class
class TransitionRequest(StrictModel)Fields
| Name | Type | Default | Description |
|---|---|---|---|
to | ArtifactState | ||
reason | str | None | None | |
on_gate_fail | OnGateFail | None | None | |
context | dict[str, Any] | dict() |
Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 130
ApproveRequest
Section titled “ApproveRequest”class
class ApproveRequest(StrictModel)Fields
| Name | Type | Default | Description |
|---|---|---|---|
decision | Literal['approve', 'reject'] | 'approve' | |
comment | str | None | None | |
acknowledged_fallbacks | list[str] | list() |
Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 137
Functions
Section titled “Functions”allowed_transitions
Section titled “allowed_transitions”function
def allowed_transitions(state: str) -> list[str]Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 51
can_transition
Section titled “can_transition”function
def can_transition(src: str, dst: str) -> boolSource: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 55
check_transition
Section titled “check_transition”function
def check_transition(src: str, dst: str) -> NoneRaise UmpError(INVALID_TRANSITION) when src -> dst is not allowed.
Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 59
principal_kind
Section titled “principal_kind”function
def principal_kind(principal: str) -> struser:maya.chen -> user; agent:newton-actor -> agent; token:... -> token.
Source: packages/ump-spec/src/ump_spec/models/lifecycle.py, line 73
check_approval
Section titled “check_approval”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
Constants
Section titled “Constants”| Name | Type | Value | Description |
|---|---|---|---|
ArtifactState | Literal['draft', 'checks_running', 'checks_passed', 'checks_failed', 'awaitin... | ||
ARTIFACT_STATES | tuple[str, ...] | ('draft', 'checks_running', 'checks_passed', 'checks_failed', 'awaiting_appro... | |
TRANSITIONS | dict[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_TRANSITIONS | frozenset[str] | frozenset({'validated', 'rejected'}) | Transitions that need an approval (POST :approve), not a plain :transition. |
ArtifactKind | Literal['dataset', 'transform_step', 'model_manifest', 'capability_manifest',... | ||
ARTIFACT_KINDS | tuple[str, ...] | ('dataset', 'transform_step', 'model_manifest', 'capability_manifest', 'test_... |