Skip to main content

non_convergent_projections_are_excluded_not_failed

Function non_convergent_projections_are_excluded_not_failed 

Source
pub async fn non_convergent_projections_are_excluded_not_failed() -> Result<RuleOutcome, Violation>
Expand description

SY-22. A non-convergent projection is left out of the convergence check, not failed by it.

Two halves. The exclusion is convergent_projection_is_interleaving_independent’s where-clause: a fixture over CostLayers, which makes no declaration, does not compile into it. And the exclusion is needed: this rule runs cost layers through the same machinery the check uses, and requires the two read models to differ, beside StockOnHand over the same events, which must agree. Without the exclusion, an honest projection is failed.

Rejects a convergence check with no exclusion, which fails cost layers; and a check that does not really reorder — one interleaving replayed twice — under which cost layers would agree with itself and every projection would pass. If cost layers is ever expressed convergently, this rule fails too, and that is SY-22’s own falsifier firing.

§Errors

A Violation of SY-22 if stock on hand diverges, if cost layers does not, or if either run fails.

§The exclusion, compiled

A fixture over an undeclared projection is a ConvergenceFixture, and every bound but the check’s still takes it. This is the control:

use happenstance_sync_testkit::{ConvergenceFixture, CostLayersFixture};

fn any_case<F: ConvergenceFixture>(_: &F) {}
any_case(&CostLayersFixture::new());

The check is not one of them. Rustdoc 1.97.1 does not check the error code on a compile_fail fence (RS-62-1), so the E0277 is a statement of intent. Two controls keep the fence from passing on a typo: the any_case control above, which names the same fixture, and the SY-20 rule’s own example, which makes the same call in the same shape:

ⓘ
use happenstance_sync_testkit::{CostLayersFixture, convergence_rules};

let check = convergence_rules::convergent_projection_is_interleaving_independent(
    async || CostLayersFixture::new(),
);
drop(check);