fix: include created_at and expires_at in SmallOrder conversion#127
fix: include created_at and expires_at in SmallOrder conversion#127grunch merged 1 commit intoMostroP2P:mainfrom
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/order.rs (1)
562-563: Fix properly preserves temporal data during Order to SmallOrder conversion.The change correctly wraps
created_atandexpires_atinSome()when converting fromOrdertoSmallOrder. This preserves the timestamp values for clients to calculate remaining order time, particularly when orders are republished in pending status. The approach aligns with the existingas_new_order()method and maintains backward compatibility sinceSmallOrderfields are alreadyOption<i64>types.Consider adding a regression test to verify timestamp preservation during this conversion:
#[test] fn test_order_to_small_order_preserves_timestamps() { let created_at = 1609459200; let expires_at = 1609545600; let order = Order { created_at, expires_at, ..Default::default() }; let small_order: SmallOrder = order.into(); assert_eq!(small_order.created_at, Some(created_at)); assert_eq!(small_order.expires_at, Some(expires_at)); }
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/order.rs
🧰 Additional context used
📓 Path-based instructions (2)
src/{order,message,user}.rs
📄 CodeRabbit inference engine (AGENTS.md)
Place core domain models and logic in src/order.rs, src/message.rs, and src/user.rs
Files:
src/order.rs
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Use snake_case for functions and modules
Use PascalCase for types and enums
Use SCREAMING_SNAKE_CASE for constants
Document public APIs with /// comments
Keep error enums exhaustive
Avoid leaking internals; prefer exposing a curated surface via the prelude
Place unit tests inline beside modules using #[cfg(test)] mod tests
Name tests descriptively (e.g., test_signature_roundtrip)
Cover failure paths for invalid currencies, dispute resolution, and crypto edge cases
Reuse existing builders/helpers instead of duplicating fixtures
Run cargo fmt and address clippy warnings (clippy -D warnings) before pushing
Files:
src/order.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
fix #126
Include created_at and expires_at when converting Order to SmallOrder to ensure makers receive complete order information in direct messages when orders are republished.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.