修复事件跨服务序列化生成空窗口

This commit is contained in:
boris
2026-09-09 23:54:22 +08:00
parent 35acb1c7e7
commit 8edc510a0d
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ pub enum Expr {
Operator {
name: String,
args: Vec<Expr>,
#[serde(default)]
#[serde(default, skip_serializing_if = "Option::is_none")]
window: Option<usize>,
},
}
+5
View File
@@ -248,6 +248,11 @@ mod tests {
use super::*;
use crate::{BenchmarkSnapshot, DailyFactorSnapshot, DailyMarketSnapshot, Instrument};
use serde_json::json;
#[test]
fn normalized_rule_does_not_turn_an_omitted_window_into_explicit_null() {
let expression:Expr=serde_json::from_value(json!({"kind":"operator","name":"GT","args":[{"kind":"field","name":"close"},{"kind":"number","value":1}]})).unwrap();
assert!(serde_json::to_value(expression).unwrap().get("window").is_none());
}
fn data(future: bool, reference: bool) -> DataSet {
let mut days = vec![
NaiveDate::from_ymd_opt(2026, 9, 4).unwrap(),