Skip to main content

commit_rejects_a_foreign_batch

Function commit_rejects_a_foreign_batch 

pub async fn commit_rejects_a_foreign_batch<F: ProjectionFixture>(
    open: impl AsyncFn() -> F,
) -> RuleOutcome
Expand description

A batch begun on one store instance is rejected by another, and neither store moves.

PS-15. The check is at run time by a stamp minted per store instance, because the type-level fix was compiled and refuted: a lifetime names a region rather than an instance, so two &Store references unify and b.commit(begin_ok(&a).await, …) still type-checks. The only construction that names an instance is a generative brand, which forbids the batch escaping the closure that began it — defeating the caller the hazard is about.

Rejects: TypeStampedBatchStore — an adapter whose batch carries an identity minted per type rather than per instance, so every store of that type accepts every other’s batch and corrupts silently.

§Why this rule does not spell must!(F: SECOND_HANDLE)

It does not want a second handle. It wants two isolated stores, which is what two open() calls on the impl AsyncFn() -> F every rule is handed already produce — and that is exactly the affordance the fixture contract bought (crates/happenstance-testkit/src/registry.rs:45-49). A fixture that declines SECOND_HANDLE still runs this rule and still passes it, which is correct: the capability it declined is not the one this rule spends.