= test-transitions

== purpose

Tests for transition resolution and event serialization in the workflow graph. Verifies that the `DefaultTransitionResolver` correctly evaluates conditions and selects the next stage, and that transition events survive serialization round-trips.

== responsibilities

* Test `DefaultTransitionResolver` with various condition evaluators and workflow graph configurations
* Test `TransitionEvent` and related event types for serialization round-trip correctness

== non-responsibilities

* Does not test the orchestration engine's integration with transitions
* Does not test complex condition logic (uses simple always-true evaluators)
* Does not test cycle detection or graph validation (covered by `testing:deterministic`)

== key types

=== DefaultTransitionResolverTest
* **kind**: JUnit 5 test class
* **purpose**: Tests that `DefaultTransitionResolver` correctly resolves the next stage given a `WorkflowGraph`, current stage, and condition evaluator. Tests linear chains, branching, and terminal stages.

=== TransitionEventSerializationTest
* **kind**: JUnit 5 test class
* **purpose**: Tests that `TransitionExecutedEvent` and related events serialize and deserialize correctly through `kotlinx.serialization`.

== event flow

*inbound:* Constructed `WorkflowGraph` instances and `TransitionConditionEvaluator` functions.

*outbound:* Assertions on resolved `TransitionResult` (next stage ID) and serialization round-trip fidelity.

== integration points

* `:core:transitions` — `DefaultTransitionResolver`, `TransitionResolver`, `WorkflowGraph`, `TransitionEdge`, `TransitionExecutedEvent`
* `:core:events` — event payload types, `StoredEvent`
* `:testing:fixtures` — `TransitionFixtures`, `WorkflowFixtures`

== invariants

* A terminal stage (no outgoing transitions) resolves to no next stage
* A stage with a single outgoing transition resolves to that target when the condition is true
* Transition events survive a full JSON encode/decode round-trip

== PlantUML diagram

[plantuml, test-transitions, "png"]
----
include::../../diagrams/test-transitions.puml[]
----




== known issues

* Tests only cover always-true conditions — no tests for conditional or guarded transitions
* `TransitionEventSerializationTest` uses serialization only, no deserialization context with the polymorphic `eventModule`

== open questions

* Should transition resolver tests cover multi-condition evaluation with AND/OR semantics?
* Should negative conditions (evaluate to false) be tested for fallback behavior?
