Expand description
turnframe-test — the test kit for Turnframe.
The promise that business effects stay deterministic while the conversation stays natural is worth the tests behind it, and those are hard to write: a plan whose spans must quote the user exactly, a workflow whose invariants must hold in every reachable state, a model double that must refuse to improvise, a receipt that may not claim more than the ledger says. This crate writes that machinery once.
| Module | What it gives you |
|---|---|
executors | the conformance suite for a WorkflowExecutor you wrote, sharpest about the batch that half-committed |
explore | bounded breadth-first exploration of a workflow’s reachable states, with the shortest command path to anything that breaks |
strategies | proptest strategies over the core types, including understandings grounded in a text so every range is words of it |
workflows | three complete sample domains, a travel-disruption desk (trip, traveler, expense claim), each with a pure transition function, an in-memory executor and an exploration model |
providers | a scripted provider that fails loudly on an unscripted call, an UnderstandingBuilder that turns quotes into word ranges, a scripted understanding, and the provider conformance harness |
stores | the in-memory persistence layer with failure injection at named crash boundaries, call counting and a frozen clock |
replay | two executions compared artefact by artefact, and a replay record asked to account for its own turn |
assertions | the checks that keep coming up: no high-risk command without a trusted origin, no receipt without events, one phase per projection |
Doubles for the runtime itself arrive with turnframe-runtime: this crate
never depends on it, so a runtime test can use it without a cycle.
§Example
Explore the trip sample and assert that nothing in its reachable state space breaks a projection invariant.
use turnframe_test::explore::{ExplorationLimits, explore};
use turnframe_test::workflows::trip::{TripModel, TripOutcome, TripWorkflow};
let report = explore(
&TripWorkflow::default(),
&TripModel::default(),
ExplorationLimits::standard(),
);
assert!(report.is_clean(), "{}", report.describe());
assert!(report.reached_outcome(&TripOutcome::Notified));Modules§
- assertions
- Reusable checks over the artefacts a turn produces.
- executors
- An executable statement of the executor contract (I13, I14, spec §23.1).
- explore
- Bounded workflow exploration (spec §8.5).
- prelude
- The items a test file usually wants:
use turnframe_test::prelude::*;. - projection
- Pinning what a projector emits, so a change to it cannot pass unnoticed.
- providers
- Scripted model providers, grounded plan building, and the conformance harness an adapter crate runs (spec §6.1, §20.8, §27.5).
- replay
- Replay assertions: two runs of the same turn, and one record that has to account for itself (spec §26.4, I20).
- stores
- Fake stores: the in-memory persistence layer with the three things a runtime test always ends up needing (spec §27.4, §27.7).
- strategies
propteststrategies over the core types, for every crate to reuse.- workflows
- Complete sample domains, and the pieces they share: a travel-disruption desk.
Macros§
- provider_
conformance_ report - Runs the suite and hands back the report, for a test that judges it itself.
- provider_
conformance_ suite - Declares a conformance test for one provider-model adapter.