OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

workflow.instance.transition

Transition a workflow instance to the next step.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.workflow-system
  • Tags: workflow, instance, transition, state-machine
  • field.key.label
    workflow.instance.transition
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    workflow.instance.transition
    field.description.label

    Transition a workflow instance to the next step.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.workflow-system
  • Tags: workflow, instance, transition, state-machine
  • field.tags.label
    workflow,instance,transition,state-machine
    field.owners.label
    @example.workflow-system
    field.stability.label
    stable

    Transition a workflow instance to the next step.

    Goal

    Move workflow forward based on action.

    Context

    Task completion, approval decisions.

    Emitted Events

    `workflow.step.exited` (v1.0.0)

    `workflow.step.entered` (v1.0.0)

    `workflow.instance.completed` (v1.0.0)

    Source Definition

    import {
    	defineCommand,
    	defineQuery,
    } from '@lssm-tech/lib.contracts-spec/operations';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    import { InstanceStatusEnum } from './instance.enum';
    import {
    	StartWorkflowInputModel,
    	TransitionInputModel,
    	TransitionResultModel,
    	WorkflowInstanceModel,
    } from './instance.schema';
    
    export const TransitionWorkflowContract = defineCommand({
    	meta: {
    		key: 'workflow.instance.transition',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.workflow-system'],
    		tags: ['workflow', 'instance', 'transition', 'state-machine'],
    		description: 'Transition a workflow instance to the next step.',
    		goal: 'Move workflow forward based on action.',
    		context: 'Task completion, approval decisions.',
    	},
    	io: {
    		input: TransitionInputModel,
    		output: TransitionResultModel,
    	},
    	policy: { auth: 'user' },
    	sideEffects: {
    		emits: [
    			{
    				key: 'workflow.step.exited',
    				version: '1.0.0',
    				when: 'Step is exited',
    				payload: WorkflowInstanceModel,
    			},
    			{
    				key: 'workflow.step.entered',
    				version: '1.0.0',
    				when: 'New step is entered',
    				payload: WorkflowInstanceModel,
    			},
    			{
    				key: 'workflow.instance.completed',
    				version: '1.0.0',
    				when: 'Workflow reaches end',
    				payload: WorkflowInstanceModel,
    			},
    		],
    		audit: ['workflow.instance.transitioned'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'transition-workflow-happy-path',
    				given: ['Workflow instance is waiting at step'],
    				when: ['User provides input'],
    				then: ['Instance moves to next step'],
    			},
    		],
    		examples: [
    			{
    				key: 'complete-task',
    				input: {
    					instanceId: 'inst-456',
    					action: 'complete',
    					data: { approved: true },
    				},
    				output: { success: true, nextStep: 'notify-hr' },
    			},
    		],
    	},
    });