Skip to main content

Module projection

Module projection 

Source
Expand description

Pinning what a projector emits, so a change to it cannot pass unnoticed.

A WorkflowDefinition’s version must change when its projection means something new: replay records and evaluation baselines cite it, and the invariant checker only asks whether a view is coherent. Build a ProjectionFingerprint from a definition and the states worth pinning, then snapshot it:

use turnframe_test::projection::ProjectionFingerprint;
use turnframe_test::workflows::traveler::{self, TravelerWorkflow};

let workflow = TravelerWorkflow::default();
let fingerprint = ProjectionFingerprint::of(&workflow)
    .at("empty", None)
    .at("collecting", Some(traveler::incomplete_draft()))
    .build();

assert_eq!(fingerprint.workflow.as_str(), "traveler");
assert_eq!(fingerprint.version.as_str(), "1");
// In a test: insta::assert_yaml_snapshot!(fingerprint.snapshot_name(), fingerprint);

ProjectionFingerprint::snapshot_name carries the version: a projector changed without a bump fails against its snapshot, and one changed with a bump writes a new file to review. Pinned: phase and owner, obligations, the blocking card and what answering it authorizes, notice codes and severity, the outcome. Prose is not: it is localized and changes freely.

Structs§

FingerprintBuilder
Collects the states a fingerprint covers.
NoticeShape
A notice reduced to its identity.
ProjectedShape
What one projected state looks like, reduced to the parts that are contract rather than copy.
ProjectionFingerprint
Everything one projector emits over a chosen set of states, at one version.
RequiredCard
The part of a required card that is contract rather than copy.