2.3 KiB
2.3 KiB
core/transitions — AGENTS.md
Purpose
FSM/workflow graph execution: defines the WorkflowGraph (stages and transition edges), resolves which transition to take at each step, executes stages, and detects cycles.
Ownership
CORREX kernel team.
Local Contracts
WorkflowGraph— the workflow DAG: stages (StageConfig) connected byTransitionEdges.TransitionResolver/DefaultTransitionResolver— evaluatesTransitionConditions againstEvaluationContextto pick the next stage.TransitionCondition— sealed interface for conditions. Built-in:AlwaysTrue,VariableEquals,ArtifactFieldEquals,ArtifactConditions, and composites (Composites).StageExecutor— executes a single stage given aStageExecutionRequest; returnsStageExecutionResult.StageExecutionEventMapper/DefaultStageExecutionEventMapper— maps stage execution results to domain events.TransitionDecision/TransitionOrdering— decision and ordering types.EvaluationContext— runtime context for condition evaluation.PromptResolver— resolves prompt templates for a stage from config.CycleExtractor/CycleDfs/DetectedCycle/CycleCanonicalizer— detect and canonicalize cycles in the workflow graph (used bycore:validation).DeterministicAdjacencyBuilder/GraphOrdering— deterministic graph traversal for consistent ordering.VisitState— DFS traversal state.
Work Guidance
DefaultTransitionResolveris stateless per call — it readsEvaluationContext, not persisted state.- Stage events are recorded by
DefaultStageExecutionEventMapper; the mapper must emit events for every outcome (success, failure, skip). WorkflowGraphis built from config/TOML at session start; it is immutable during a session.StageConfig.autoBuildGateis a compiler-set request for a runtime build gate; it is used on write-declaring freestyle stages only when no explicit build expectation exists.- Cycle detection (
CycleExtractor) runs during graph validation (core:validation), not at runtime.
Verification
./gradlew :core:transitions:test --rerun-tasks
Tests in testing/transitions/ (DefaultTransitionResolverTest, TransitionFuzzTest, TransitionEventSerializationTest) and testing/replay/ (TransitionReplayIntegrationTest).
Child DOX Index
No child AGENTS.md (leaf module).