Lifecycle
Entity types can be assigned a lifecycle map via has_lc_map, governing the valid states and transitions of their instances. The lifecycle system controls which entities are considered released, which are read-only, and which state changes are permitted.
Lifecycle Map (lc_map)
A lifecycle map groups a set of lc_status entries and defines the allowed transitions between them.
| Field | Description |
|---|---|
name | System identifier (key) |
label | Localized display name |
has_lc_status | The statuses belonging to this lifecycle |
Assigning a Lifecycle to an Entity Type
Use has_lc_map on the entity type definition:
"has_lc_map": [
{ "target": "lc_map/EP_Default" }
]
The entity types of the shipped meta model carry lc_map/EP_Default by default.
Types Without a Lifecycle
A type does not need a lifecycle map. This suits configuration-like types, where the default statuses have no meaning and a released status would only make the entity permanently uneditable. Instances of a type without a lifecycle map:
- have no
@statusfield, - are never blocked by a read-only or released status -- they are always writable,
- reject a status change (
PUT /@status) with "Entity has no lifecycle map".
Lifecycle Status (lc_status)
A lifecycle status defines a state an entity can be in.
| Field | Type | Description |
|---|---|---|
name | string | System identifier (key) |
label | localized map | Display name |
number | int | Ordering number (also accepted for status transitions via the API) |
is_released | bool | Whether entities in this status are considered "released" |
is_read_only | bool | If true, content edits (properties, relationships, traits, lists, components) on this branch are blocked |
color | string | Hex color for UI display |
has_lc_transition | relationships | Valid transitions to other statuses |
Transitions (has_lc_transition)
A transition is a relationship instance between two lc_status entities. Only transitions explicitly defined via has_lc_transition are permitted -- the engine rejects any status change that does not follow a declared transition. Its edge properties:
| Property | Meaning |
|---|---|
label | Display name for the transition |
issues_revision | When set, taking this transition also issues the aggregate's next version number. The current version is frozen with the status just reached, and the next version opens with the map's initial status. |
revision_level | Which level of the versioning scheme issues_revision advances (major, minor, …). Empty means the least significant level. Only meaningful with issues_revision. |
issues_revision is set per transition, not derived from a status flagged as released: a map may have several released statuses, none at all, or a released status that can be entered more than once.
Because an issuing transition reopens the aggregate at the initial status, a transition to a released status with issues_revision does not leave the entity released. It leaves it at the initial status; the released status is recorded on the version that was frozen.
The Default Lifecycle: EP_Default
The system provides one built-in lifecycle: lc_map/EP_Default.
Statuses
| Status | Number | Released | Read-Only | Color |
|---|---|---|---|---|
lc_status/new | 0 | no | no | #FF0000 |
lc_status/review | 100 | no | yes | #FFBB00 |
lc_status/released | 200 | yes | yes | #00FF00 |
lc_status/obsolete | 300 | no | yes | #DDDDDD |
State Machine
Valid transitions: new -> review -> released -> obsolete, and review -> new.
Once an entity reaches the review, released, or obsolete status, it becomes read-only (is_read_only: true). The only status that allows saving new commits is new. To make changes to an entity in review, transition it back to new first.
Lifecycle Status Is Per Branch
The lifecycle status is not stored in a commit. It belongs to the branch of the aggregate. This means:
- A status transition does not create a commit -- the History shows only content changes.
- Each branch of an aggregate has its own, independent status.
- Only the target branch's read-only or released status can block a merge; the source branch's status never does. Status transitions are not merged.
- An as-of read (
?as_of=) reports the status the branch had at that instant.
Every Entity Has an Explicit Status
An entity of a type with a lifecycle map always has a stored status: on creation it receives the map's initial status, a new branch takes over the status of its source branch, and the system entities shipped with EP are released. A branch created at a frozen version starts at the initial status instead, because that is done to work on it.
The stored status points at one specific commit of the lc_status entity, so editing a status (for example its label) does not change the status of existing entities. If a stored status cannot be resolved, the entity is treated as read-only rather than becoming editable.
API Interaction
Reading the Current Status
GET /api/v1/by-key/<type>/<key>/@status
Returns the full entity object for the current lc_status.
Response 200: Status entity object.
Response 404: No lifecycle available for this entity.
Transitioning to a New Status
PUT /api/v1/by-key/<type>/<key>/@status
or POST on the same path. The request body is either the status name as a string or the status number:
"review"
or
100
The target status can also be given on the address, without a body: PUT /api/v1/by-key/<type>/<key>/@status/review or …/@status/100.
A transition changes the status of the addressed branch atomically; it does not create a new commit. on_status_change hooks run before (and can veto) and after the transition.
Response 200: Updated entity object.
Response 400: Invalid status, illegal transition, or a veto by a pre-hook.
Response 500: A hook could not be evaluated.
Status in Entity Responses
When an entity has a lifecycle map assigned, its response includes the @status field:
{
"@status": { "name": "new", "number": 0 }
}
If no lifecycle map is assigned, the @status field is absent.
Custom Lifecycle Maps
You can define custom lifecycle maps by creating lc_map and lc_status entities with your own statuses and transitions. The process is:
- Create
lc_statusentities for each state. - Define
has_lc_transitionrelationships between the statuses (optionally withissues_revision). - Create a
lc_mapentity withhas_lc_statusrelationships pointing to the statuses. - Assign the lifecycle map to entity types via
has_lc_map.