fix(release): restore canonical local gate
req: public_api/001 req: v1_release/007
This commit is contained in:
+10
-6
@@ -1,4 +1,4 @@
|
||||
use hemx_core::{Atom, Effect, EffectBatch, IntoEffect};
|
||||
use hemx_core::{Atom, BuildFingerprint, Effect, EffectBatch, IntoEffect};
|
||||
use serde::{de, Deserialize, Deserializer, Serialize};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
@@ -421,8 +421,13 @@ impl SyncEffect {
|
||||
/// Apply an optimistic projection now and carry the same ordinary batch in
|
||||
/// the durable patch event so the framework sync runtime can replay it
|
||||
/// after reload before acknowledgement.
|
||||
pub fn durable(patch: FlatPatch, projection: EffectBatch) -> Self {
|
||||
pub fn durable(
|
||||
patch: FlatPatch,
|
||||
projection: impl IntoEffect,
|
||||
fingerprint: BuildFingerprint,
|
||||
) -> Self {
|
||||
patch.validate().expect("FlatPatch must remain valid");
|
||||
let projection = projection.into_batch(fingerprint);
|
||||
let projection_wire = projection
|
||||
.to_wire()
|
||||
.iter()
|
||||
@@ -459,10 +464,9 @@ mod tests {
|
||||
let projection = Effect::Emit {
|
||||
name: "projected".into(),
|
||||
payload: "card:1".into(),
|
||||
}
|
||||
.into_batch(hemx_core::BuildFingerprint(7));
|
||||
let batch =
|
||||
SyncEffect::durable(patch, projection).into_batch(hemx_core::BuildFingerprint(7));
|
||||
};
|
||||
let batch = SyncEffect::durable(patch, projection, hemx_core::BuildFingerprint(7))
|
||||
.into_batch(hemx_core::BuildFingerprint(7));
|
||||
assert_eq!(batch.ops.len(), 2);
|
||||
assert!(matches!(&batch.ops[0], Effect::Emit { name, .. } if name == "projected"));
|
||||
assert!(
|
||||
|
||||
Reference in New Issue
Block a user