Fields it adds

FieldTypeRequiredDescription
status string yes Canonical lifecycle state derived from the states parameter. This is the single source of truth for the entity's current lifecycle position. Consumed by Colorized to resolve visual tokens, and by view extensions to render StatusBadge and StatusTimeline.
state_history StateTransition[] no Chronological log of state transitions. Each entry records the before/after states, timestamp, and (when governance is enabled) the actor, reason, and transition metadata. Rendered by StatusTimeline in the detail and timeline views. Entry structure: - from: string (previous state) - to: string (new state) - timestamp: ISO 8601 datetime - actor_id: string (user/system who triggered the transition, optional) - reason: string (human-readable justification, required when requireTransitionReason is true) - transition_metadata: Record<string, unknown> (arbitrary context, optional) Every recorded change can name who acted, who it acted for and who approved it. All optional, following Relationship's source_id/source_name pattern; only a *_name names a party, and an entry that names no one renders as it always has: - actor_name: string (who acted, as shown: "Billing Agent") - actor_kind: string (person, agent or system: the Actor trait's kinds) - on_behalf_of_name / on_behalf_of_id: string (the person or organization it acted for) - approved_by_name / approved_by_id: string (who approved the change, when someone did) StatusTimeline then reads "Billing Agent for Tidewater Co-op · approved by Ruth Adeyemi". A change someone approved can also say which approval it belongs to and what level of yes it was. Both optional; the id stays in the record's data, a pointer and not a link, and an entry without them renders as it always has: - approval_id: string (the Approval record the yes is kept in) - approval_level: string (the level of yes, one of the levels the product declares: "approval") StatusTimeline then reads "Billing Agent for Tidewater Co-op · approved by Ruth Adeyemi (level: Approval)". A change made as part of a task can also say which task it was. Both optional; the id stays in the record's data, a pointer and not a link, and an entry without them renders as it always has: - task_id: string (the Task record the change was made under) - task_name: string (the task, as shown: "Get INV-2026-0155 paid") StatusTimeline then reads "… · approved by Ruth Adeyemi (level: Approval) · task: Get INV-2026-0155 paid". A change made under a grant, the standing yes an actor acts under for a person or organization, can also say which grant it was. Both optional; the id stays in the record's data, a pointer and not a link, and an entry without them renders as it always has: - grant_id: string (the Grant record the change was made under) - grant_name: string (the grant, as shown: "Resend returned transfers") StatusTimeline names the grant after any approval and before the task: "Billing Agent for Tidewater Co-op · grant: Resend returned transfers".
allowed_transitions string[] no Materialized list of the next states the product allows from the current status, written by the product from the transitionRules parameter. When transitionRules is null (open model), this contains all states except the current one. The detail page's StatusTimeline lists it when the record holds it. A generated StatusSelector reads transitionRules instead: it offers the current state and the moves the order allows (every state where no order is declared).

What it shows in each context

list
StatusBadge
detail
StatusTimeline
form
StatusSelector
card
StatusBadge

Parameters

states string[], required
Ordered list of valid lifecycle states exposed to consumers. The order is semantic — it represents the typical forward progression (e.g., draft → active → archived). All status values must be one of these states.
initialState string, required
State assigned when an entity is created. Must be a member of the states parameter. Typically the first entry in the states list (e.g., "draft").
transitionRules Record<string, string[]>
Allowed state transition map. Keys are source states; values are arrays of permitted target states, and an empty array marks a final state. Every key and target must be one of the states: an order that names a state the lifecycle lacks is refused. Your product enforces the order and rejects any other move. OODS Foundry keeps it as data, and a generated app keeps it in its own store: its status select offers the current state and the moves allowed from it, its store refuses any other move and any move out of a final state, and Cancel and the declared actions are offered only where the order allows. When omitted, a move between any two states is allowed (open model). Example for a subscription lifecycle: draft: [active, archived] active: [paused, archived] paused: [active, archived] archived: []
actions object[]
Named moves a person makes on a record, each to one state of the declared order: its id, the state it moves to (to), the states it is offered from (from; by default every state whose declared targets include to), the verb a person reads (verb), and the event Timestampable records for it (event). It may also name the field its optional note is written to (reasonField), the seat whose _id, _name and _kind fields name who acted when the app is told (bySeat), whether it asks once first (confirm), and the records of the same object that make the same move with it (alsoEnds: { via }). Each action needs transitionRules. A generated screen offers an action only from the states it moves from, and a generated app writes it as one change to its own records when a person asks; it stops nothing. A record whose object declares an action ending it (to a final state) is ended, never deleted, so its detail offers no Delete. Example for a grant: - { id: revoke, to: revoked, verb: Revoke, event: ended, reasonField: ended_reason, bySeat: ended_by, confirm: true, alsoEnds: { via: within_id } } - { id: pause, to: paused, verb: Pause, event: paused } - { id: resume, from: [paused], to: active, verb: Resume, event: resumed }
requireTransitionReason boolean
When true, your product requires a human-readable reason in the state_history entry for each change of state. OODS Foundry keeps the setting. Your product checks the reason.

Objects that use it

The trait file

traits/lifecycle/Stateful.trait.yaml
trait:
  name: Stateful
  version: 2.5.1
  description: |
    Normalizes lifecycle state transitions, exposes canonical status semantics, and provides
    optional transition governance for production workflows. Many objects compose Stateful
    (User, Subscription and Product among them), and it serves as the data source for the
    Colorized visual trait.

    At its simplest, Stateful defines an ordered list of valid states and tracks the current
    status. With transitionRules, a product also declares which moves between states are allowed,
    for auditable workflows where arbitrary state jumps are not permitted.
    Your product enforces that order on its own records: it checks each change against it and writes
    allowed_transitions. OODS Foundry keeps the order as data, refuses an order that names a state the
    lifecycle lacks and holds its own shipped samples to it. A generated app keeps the order in its own
    store: a generated StatusSelector offers the record's state and the moves the order allows from it,
    and the store refuses any other move and any move out of a final state. In generated React and Vue
    screens, Cancel is offered, and the store accepts it, only from a state the order lets move to where
    cancelling goes. With actions, a lifecycle also names the moves a person makes, such as a grant's
    Revoke, Pause and Resume: each is offered only from the states it moves from, is written as one
    change to the app's own records, and stops nothing. Every recorded change, with an order or without one,
    can name who made it and why.
  category: lifecycle
  tags:
    - lifecycle
    - status
    - workflow
    - state
    - governance
    - audit

parameters:
  - name: states
    type: string[]
    required: true
    description: |
      Ordered list of valid lifecycle states exposed to consumers. The order is semantic —
      it represents the typical forward progression (e.g., draft → active → archived).
      All status values must be one of these states.
    default:
      - draft
      - active
      - paused
      - archived

  - name: initialState
    type: string
    required: true
    description: |
      State assigned when an entity is created. Must be a member of the states parameter.
      Typically the first entry in the states list (e.g., "draft").
    default: draft
    validation:
      enumFromParameter: states

  - name: transitionRules
    type: "Record<string, string[]>"
    required: false
    description: |
      Allowed state transition map. Keys are source states; values are arrays of permitted
      target states, and an empty array marks a final state. Every key and target must be one of
      the states: an order that names a state the lifecycle lacks is refused. Your product enforces
      the order and rejects any other move. OODS Foundry keeps it as data, and a generated app keeps
      it in its own store: its status select offers the current state and the moves allowed from it,
      its store refuses any other move and any move out of a final state, and Cancel and the declared
      actions are offered only where the order allows. When omitted, a move between any two states is
      allowed (open model).

      Example for a subscription lifecycle:
        draft: [active, archived]
        active: [paused, archived]
        paused: [active, archived]
        archived: []
    default: null

  - name: actions
    type: object[]
    required: false
    description: |
      Named moves a person makes on a record, each to one state of the declared order: its id, the state it
      moves to (to), the states it is offered from (from; by default every state whose declared targets include to),
      the verb a person reads (verb), and the event Timestampable records for it (event). It may also name the field its
      optional note is written to (reasonField), the seat whose _id, _name and _kind fields name who acted when the app
      is told (bySeat), whether it asks once first (confirm), and the records of the same object that make the same move
      with it (alsoEnds: { via }). Each action needs transitionRules. A generated screen offers an action only from the
      states it moves from, and a generated app writes it as one change to its own records when a person asks; it stops
      nothing. A record whose object declares an action ending it (to a final state) is ended, never deleted, so its
      detail offers no Delete.
      Example for a grant:
        - { id: revoke, to: revoked, verb: Revoke, event: ended, reasonField: ended_reason, bySeat: ended_by, confirm: true, alsoEnds: { via: within_id } }
        - { id: pause, to: paused, verb: Pause, event: paused }
        - { id: resume, from: [paused], to: active, verb: Resume, event: resumed }
    default: null

  - name: requireTransitionReason
    type: boolean
    required: false
    description: |
      When true, your product requires a human-readable reason in the state_history entry for each change of state.
      OODS Foundry keeps the setting. Your product checks the reason.
    default: false

schema:
  status:
    type: string
    required: true
    description: |
      Canonical lifecycle state derived from the states parameter. This is the single source
      of truth for the entity's current lifecycle position. Consumed by Colorized to resolve
      visual tokens, and by view extensions to render StatusBadge and StatusTimeline.
    validation:
      enumFromParameter: states

  state_history:
    type: StateTransition[]
    required: false
    description: |
      Chronological log of state transitions. Each entry records the before/after states,
      timestamp, and (when governance is enabled) the actor, reason, and transition metadata.
      Rendered by StatusTimeline in the detail and timeline views.

      Entry structure:
        - from: string (previous state)
        - to: string (new state)
        - timestamp: ISO 8601 datetime
        - actor_id: string (user/system who triggered the transition, optional)
        - reason: string (human-readable justification, required when requireTransitionReason is true)
        - transition_metadata: Record<string, unknown> (arbitrary context, optional)

      Every recorded change can name who acted, who it acted for and who approved it. All optional,
      following Relationship's source_id/source_name pattern; only a *_name names a party, and an entry that names
      no one renders as it always has:
        - actor_name: string (who acted, as shown: "Billing Agent")
        - actor_kind: string (person, agent or system: the Actor trait's kinds)
        - on_behalf_of_name / on_behalf_of_id: string (the person or organization it acted for)
        - approved_by_name / approved_by_id: string (who approved the change, when someone did)
      StatusTimeline then reads "Billing Agent for Tidewater Co-op · approved by Ruth Adeyemi".

      A change someone approved can also say which approval it belongs to and what level of yes it was. Both
      optional; the id stays in the record's data, a pointer and not a link, and an entry without them renders as it
      always has:
        - approval_id: string (the Approval record the yes is kept in)
        - approval_level: string (the level of yes, one of the levels the product declares: "approval")
      StatusTimeline then reads "Billing Agent for Tidewater Co-op · approved by Ruth Adeyemi (level: Approval)".

      A change made as part of a task can also say which task it was. Both optional; the id stays in the record's
      data, a pointer and not a link, and an entry without them renders as it always has:
        - task_id: string (the Task record the change was made under)
        - task_name: string (the task, as shown: "Get INV-2026-0155 paid")
      StatusTimeline then reads "… · approved by Ruth Adeyemi (level: Approval) · task: Get INV-2026-0155 paid".

      A change made under a grant, the standing yes an actor acts under for a person or organization, can also say
      which grant it was. Both optional; the id stays in the record's data, a pointer and not a link, and an entry
      without them renders as it always has:
        - grant_id: string (the Grant record the change was made under)
        - grant_name: string (the grant, as shown: "Resend returned transfers")
      StatusTimeline names the grant after any approval and before the task: "Billing Agent for Tidewater Co-op ·
      grant: Resend returned transfers".
    default: []

  allowed_transitions:
    type: string[]
    required: false
    description: |
      Materialized list of the next states the product allows from the current status, written
      by the product from the transitionRules parameter. When transitionRules is null (open model),
      this contains all states except the current one. The detail page's StatusTimeline lists it
      when the record holds it. A generated StatusSelector reads transitionRules instead: it offers the
      current state and the moves the order allows (every state where no order is declared).
    default: []

semantics:
  status:
    semantic_type: status.state
    token_mapping: tokenMap(status.state.*)
    ui_hints:
      component: StatusBadge
      showIcon: true
  state_history:
    semantic_type: timeline.state_transition
    token_mapping: tokenMap(timeline.status.*)
    ui_hints:
      component: StatusTimeline
      collapseWhenEmpty: true
  allowed_transitions:
    semantic_type: status.navigation
    token_mapping: computed
    ui_hints:
      component: StatusSelector
      description: The next states the product allows, as the product writes them; listed on the detail page, never used to disable an option.

view_extensions:
  list:
    - component: StatusBadge
      props:
        field: status
        tone: lifecycle
  detail:
    - component: StatusTimeline
      position: top
      priority: 40
      props:
        field: status
        historyField: state_history
        statesParameter: states
        showActorId: true
        showReason: true
  form:
    - component: StatusSelector
      position: top
      props:
        field: status
        optionsParameter: states
        initialParameter: initialState
        allowedTransitionsField: allowed_transitions
        requireReasonParameter: requireTransitionReason
  # s222-m03: no timeline recipe. A timeline's rail lists the state history itself (recordCollectionEvents).
  card:
    - component: StatusBadge
      position: before
      props:
        field: status
        variant: subtle

tokens:
  status.state.default.bg: "var(--status-neutral-bg)"
  status.state.default.text: "var(--status-neutral-text)"
  status.timeline.connector: "var(--border-subtle)"
  status.timeline.node.bg: "var(--sys-surface-raised)"
  status.timeline.node.border: "var(--sys-border-default)"
  status.timeline.actor.text: "var(--sys-text-secondary)"
  status.timeline.reason.text: "var(--sys-text-tertiary)"
  status.timeline.reason.bg: "var(--sys-surface-neutral)"

dependencies: []

metadata:
  created: "2025-10-12"
  updated: "2026-11-16"
  owners:
    - Design team
    - Engineering team
  maturity: stable
  composedBy:
    count: 18
    notable:
      - User
      - Subscription
      - Product
      - Order
      - Organization
      - Article
  accessibility:
    keyboard: |
      StatusSelector is a labelled native select: arrow keys move through the states it offers, the
      current state and the moves the declared order allows (every state where none is declared). It
      disables none.
    screenreader: |
      StatusBadge announces the current state ("Status: Active"). StateTransitionEvent entries
      announce from-state, to-state, actor, and reason.
  regionsUsed:
    - list
    - detail
    - form
    - card
  examples:
    - Subscription
    - Project Workflow
    - Order
    - User
    - Invoice
  governanceExamples:
    # Illustrative only. The LIVE authority for the subscription machine is
    # src/domain/billing/states.ts (SUBSCRIPTION_TRANSITIONS); transitionRules here
    # is documentation and is intentionally NOT wired into the runtime machine, to
    # avoid a second source of truth (see the s126-m01 single-source guard). Mirrors
    # the extend-8 set: terminated is terminal ([]) and pending_cancellation is
    # reversible back to active.
    - name: Subscription lifecycle
      transitionRules:
        future: [trialing, active, terminated]
        trialing: [active, terminated]
        active: [paused, pending_cancellation, past_due, terminated]
        paused: [active, terminated]
        pending_cancellation: [active, terminated]
        past_due: [active, unpaid, terminated]
        unpaid: [terminated]
        terminated: []
      requireTransitionReason: true
    - name: Content publishing
      transitionRules:
        draft: [review]
        review: [draft, published]
        published: [archived]
        archived: [draft]
      requireTransitionReason: false
  references:
    - "Trait Engine Spec v0.1 section 2"
    - "objects/provenance.v1.json#/references/ref-ca663a7c5731 — tone resolution for Colorized integration"
    - "objects/provenance.v1.json#/references/ref-be33a98177f7 — domain status mapping"