-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: jq rules engine refactor/tests #589
base: main
Are you sure you want to change the base?
Conversation
|
Minimum allowed line rate is |
pub fn get_event_id_from_method(method: Option<String>) -> Option<u64> { | ||
method.and_then(|m| { | ||
let event: Vec<&str> = m.split('.').collect(); | ||
event.first().and_then(|v| v.parse::<u64>().ok()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some safety for bad methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted, will map/?
it
@@ -502,7 +540,7 @@ pub trait EndpointBroker { | |||
} | |||
|
|||
/// Generic method which takes the given parameters from RPC request and adds rules using rule engine | |||
fn apply_request_rule(rpc_request: &BrokerRequest) -> Result<Value, RippleError> { | |||
fn apply_request_rule(rpc_request: &BrokerRequest) -> Result<Value, JqError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep them as Ripple Error instead of JqError
Ripple error is already an enum which does the same for Deny Reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RippleError is overloaded imho, which is why i leaned into this more rust idiomatic apporach.
pub fn run_broker_workflow( | ||
broker_output: &BrokerOutput, | ||
broker_request: &BrokerRequest, | ||
) -> Result<BrokerWorkflowSuccess, BrokerWorkFlowError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here lets keep RippleError instead of BrokerWorkFlowError and update the Enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, the goal of this approach is to provide more information, with a better chance of figuring out where the error was generated. What is the objective for using RippleError?
What
Default
implementation (both explicit and derived , where possible)Why
Automated testing of jq rules is currently not possible
Errors are obfuscated.
How
Refactor to expose appropriate components, more idiomatic use of rust' type system
Test
cargo test
Checklist