Skip to content

Commit 1a4cf2d

Browse files
authored
Merge pull request #3 from Boku-Labs/332_allow_skipping_orig_time_check_for_admin_messages
feat: allow skipping orig time check for admin messages
2 parents 2939930 + ea71330 commit 1a4cf2d

11 files changed

Lines changed: 504 additions & 50 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
with:
5353
fail_ci_if_error: true
5454
token: ${{ secrets.CODECOV_TOKEN }}
55+
dry_run: ${{ vars.CODECOV_DRY_RUN == 'true'}}
5556
flags: core
5657
files: lcov.info
5758

@@ -71,5 +72,6 @@ jobs:
7172
with:
7273
fail_ci_if_error: true
7374
token: ${{ secrets.CODECOV_TOKEN }}
75+
dry_run: ${{ vars.CODECOV_DRY_RUN == 'true'}}
7476
flags: mongodb
7577
files: lcov.info

crates/hotfix/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- possibility to disalbe original sending time(tag 122) for admin messages([#322](https://github.com/Boku-Labs/boku-hotfix/pull/3))
12+
1013
## [0.11.0](https://github.com/Validus-Risk-Management/hotfix/compare/hotfix-v0.10.0...hotfix-v0.11.0) - 2026-03-25
1114

1215
### Added

crates/hotfix/src/config.rs

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,63 @@ pub struct SessionConfig {
114114

115115
/// The schedule configuration for the session
116116
pub schedule: Option<ScheduleConfig>,
117+
118+
/// The validation configuration for the session
119+
#[serde(default)]
120+
pub verification: VerificationConfig,
121+
}
122+
123+
#[derive(Clone, Debug, Deserialize)]
124+
/// The configuration of validation rules.
125+
pub struct VerificationConfig {
126+
/// Specifies whether we should check the original sending time for admin messages.
127+
#[serde(default = "default_true")]
128+
pub check_orig_sending_time_for_admin: bool,
129+
}
130+
131+
impl VerificationConfig {
132+
pub fn builder() -> VerificationConfigBuilder {
133+
VerificationConfigBuilder::default()
134+
}
135+
}
136+
137+
impl Default for VerificationConfig {
138+
fn default() -> Self {
139+
VerificationConfigBuilder::default().build()
140+
}
141+
}
142+
143+
pub struct VerificationConfigBuilder {
144+
check_orig_sending_time_for_admin: bool,
145+
}
146+
147+
impl Default for VerificationConfigBuilder {
148+
fn default() -> Self {
149+
Self {
150+
check_orig_sending_time_for_admin: true,
151+
}
152+
}
153+
}
154+
155+
impl VerificationConfigBuilder {
156+
pub fn new() -> Self {
157+
Self::default()
158+
}
159+
160+
pub fn check_orig_sending_time_for_admin(mut self, value: bool) -> Self {
161+
self.check_orig_sending_time_for_admin = value;
162+
self
163+
}
164+
165+
pub fn build(self) -> VerificationConfig {
166+
VerificationConfig {
167+
check_orig_sending_time_for_admin: self.check_orig_sending_time_for_admin,
168+
}
169+
}
170+
}
171+
172+
fn default_true() -> bool {
173+
true
117174
}
118175

119176
/// Errors that may occur when loading configuration.
@@ -170,6 +227,11 @@ reset_on_logon = false
170227
assert_eq!(session_config.tls_config, Some(expected_tls_config));
171228
assert_eq!(session_config.reconnect_interval, 30);
172229
assert_eq!(session_config.logon_timeout, 10);
230+
assert!(
231+
session_config
232+
.verification
233+
.check_orig_sending_time_for_admin
234+
);
173235
}
174236

175237
#[test]
@@ -439,6 +501,53 @@ end_day = "Friday"
439501
assert_eq!(session_config.reconnect_interval, 15);
440502
}
441503

504+
#[test]
505+
fn test_verification_config_defaults_when_omitted() {
506+
let config_contents = r#"
507+
[[sessions]]
508+
begin_string = "FIX.4.4"
509+
sender_comp_id = "send-comp-id"
510+
target_comp_id = "target-comp-id"
511+
connection_port = 443
512+
connection_host = "127.0.0.1"
513+
heartbeat_interval = 30
514+
"#;
515+
516+
let config: Config = toml::from_str(config_contents).unwrap();
517+
let session_config = config.sessions.first().unwrap();
518+
519+
assert!(
520+
session_config
521+
.verification
522+
.check_orig_sending_time_for_admin
523+
);
524+
}
525+
526+
#[test]
527+
fn test_verification_config_can_disable_admin_orig_sending_time_check() {
528+
let config_contents = r#"
529+
[[sessions]]
530+
begin_string = "FIX.4.4"
531+
sender_comp_id = "send-comp-id"
532+
target_comp_id = "target-comp-id"
533+
connection_port = 443
534+
connection_host = "127.0.0.1"
535+
heartbeat_interval = 30
536+
537+
[sessions.verification]
538+
check_orig_sending_time_for_admin = false
539+
"#;
540+
541+
let config: Config = toml::from_str(config_contents).unwrap();
542+
let session_config = config.sessions.first().unwrap();
543+
544+
assert!(
545+
!session_config
546+
.verification
547+
.check_orig_sending_time_for_admin
548+
);
549+
}
550+
442551
#[test]
443552
fn test_load_from_path_success() {
444553
let config_contents = r#"

crates/hotfix/src/initiator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ async fn establish_connection<Outbound: OutboundMessage>(
157157
mod tests {
158158
use super::*;
159159
use crate::application::{Application, InboundDecision, OutboundDecision};
160+
use crate::config::VerificationConfig;
160161
use crate::message::generate_message;
161162
use crate::message::logon::{Logon, ResetSeqNumConfig};
162163
use crate::message::logout::Logout;
@@ -299,6 +300,7 @@ mod tests {
299300
reconnect_interval: 1, // Short for tests
300301
reset_on_logon: false,
301302
schedule: None,
303+
verification: VerificationConfig::default(),
302304
}
303305
}
304306

0 commit comments

Comments
 (0)