fixing build issues after zen upgrade #2518

Merged
mfreeman451 merged 1 commit from refs/pull/2518/head into main 2025-12-08 03:04:27 +00:00
mfreeman451 commented 2025-12-08 02:58:35 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #2074
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2074
Original created: 2025-12-08T02:58:35Z
Original updated: 2025-12-08T03:04:30Z
Original head: carverauto/serviceradar:chore/bump_zen
Original base: main
Original merged: 2025-12-08T03:04:27Z by @mfreeman451

User description

IMPORTANT: Please sign the Developer Certificate of Origin

Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:

Signed-off-by: J. Doe <j.doe@domain.com>

Describe your changes

Code checklist before requesting a review

  • I have signed the DCO?
  • The build completes without errors?
  • All tests are passing when running make test?

PR Type

Enhancement


Description

  • Update zen-engine dependency from 0.47 to 0.52

  • Adapt code to zen-engine API changes in imports and types

  • Update DecisionLoader trait implementation for new signature

  • Improve error handling and messages in message processor


Diagram Walkthrough

flowchart LR
  A["zen-engine 0.47"] -->|"upgrade to"| B["zen-engine 0.52"]
  B -->|"requires"| C["Update imports"]
  B -->|"requires"| D["Adapt trait impl"]
  B -->|"requires"| E["Fix type signatures"]
  C -->|"affects"| F["engine.rs"]
  D -->|"affects"| G["kv_loader.rs"]
  E -->|"affects"| G
  F -->|"enables"| H["message_processor.rs updates"]

File Walkthrough

Relevant files
Dependencies
Cargo.toml
Upgrade zen-engine dependency version                                       

cmd/consumers/zen/Cargo.toml

  • Bump zen-engine dependency from version 0.47 to 0.52
+1/-1     
Enhancement
engine.rs
Update imports and simplify type aliases                                 

cmd/consumers/zen/src/engine.rs

  • Update import path from handler::custom_node_adapter::NoopCustomNode
    to nodes::custom::NoopCustomNode
  • Simplify SharedEngine type alias to use DecisionEngine directly
    instead of generic type parameters
  • Remove intermediate EngineType type alias
+2/-3     
kv_loader.rs
Adapt DecisionLoader trait implementation                               

cmd/consumers/zen/src/kv_loader.rs

  • Add imports for Future and Pin to support new trait signature
  • Update DecisionLoader::load method signature to return Pin
    Future>> instead of async fn
  • Remove .into() calls on LoaderError variants to match new error type
    expectations
  • Wrap async operation with Box::pin() for trait compatibility
+9/-5     
message_processor.rs
Improve error handling and messages                                           

cmd/consumers/zen/src/message_processor.rs

  • Change error pattern matching from le.as_ref() to le for LoaderError
  • Enhance error message to include error details in failed evaluation
    case
  • Simplify error creation using anyhow::anyhow!() macro instead of
    wrapping with context
+3/-3     

Imported from GitHub pull request. Original GitHub pull request: #2074 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/2074 Original created: 2025-12-08T02:58:35Z Original updated: 2025-12-08T03:04:30Z Original head: carverauto/serviceradar:chore/bump_zen Original base: main Original merged: 2025-12-08T03:04:27Z by @mfreeman451 --- ### **User description** ## IMPORTANT: Please sign the Developer Certificate of Origin Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include a [DCO sign-off statement]( https://developercertificate.org/) indicating the DCO acceptance in one commit message. Here is an example DCO Signed-off-by line in a commit message: ``` Signed-off-by: J. Doe <j.doe@domain.com> ``` ## Describe your changes ## Issue ticket number and link ## Code checklist before requesting a review - [ ] I have signed the DCO? - [ ] The build completes without errors? - [ ] All tests are passing when running make test? ___ ### **PR Type** Enhancement ___ ### **Description** - Update zen-engine dependency from 0.47 to 0.52 - Adapt code to zen-engine API changes in imports and types - Update DecisionLoader trait implementation for new signature - Improve error handling and messages in message processor ___ ### Diagram Walkthrough ```mermaid flowchart LR A["zen-engine 0.47"] -->|"upgrade to"| B["zen-engine 0.52"] B -->|"requires"| C["Update imports"] B -->|"requires"| D["Adapt trait impl"] B -->|"requires"| E["Fix type signatures"] C -->|"affects"| F["engine.rs"] D -->|"affects"| G["kv_loader.rs"] E -->|"affects"| G F -->|"enables"| H["message_processor.rs updates"] ``` <details><summary><h3>File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>Cargo.toml</strong><dd><code>Upgrade zen-engine dependency version</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> cmd/consumers/zen/Cargo.toml - Bump zen-engine dependency from version 0.47 to 0.52 </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2074/files#diff-fcf0c672917b64a5b953a914af013f16dddd6a1d813810236364e32f1ae70382">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>engine.rs</strong><dd><code>Update imports and simplify type aliases</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> cmd/consumers/zen/src/engine.rs <ul><li>Update import path from <code>handler::custom_node_adapter::NoopCustomNode</code> <br>to <code>nodes::custom::NoopCustomNode</code><br> <li> Simplify <code>SharedEngine</code> type alias to use <code>DecisionEngine</code> directly <br>instead of generic type parameters<br> <li> Remove intermediate <code>EngineType</code> type alias</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2074/files#diff-90476c419197f41cf4ea7847c91cefbc25e935ad581ce74e8f6e72ed7398a4ae">+2/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>kv_loader.rs</strong><dd><code>Adapt DecisionLoader trait implementation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> cmd/consumers/zen/src/kv_loader.rs <ul><li>Add imports for <code>Future</code> and <code>Pin</code> to support new trait signature<br> <li> Update <code>DecisionLoader::load</code> method signature to return <code>Pin<Box<dyn </code><br><code>Future>></code> instead of async fn<br> <li> Remove <code>.into()</code> calls on <code>LoaderError</code> variants to match new error type <br>expectations<br> <li> Wrap async operation with <code>Box::pin()</code> for trait compatibility</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2074/files#diff-fc255432d15b644eefe41b55bd9f8de77f0be6ba1ead3401e95da8f527b1a646">+9/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>message_processor.rs</strong><dd><code>Improve error handling and messages</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> cmd/consumers/zen/src/message_processor.rs <ul><li>Change error pattern matching from <code>le.as_ref()</code> to <code>le</code> for <code>LoaderError</code><br> <li> Enhance error message to include error details in failed evaluation <br>case<br> <li> Simplify error creation using <code>anyhow::anyhow!()</code> macro instead of <br>wrapping with context</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2074/files#diff-9fcbc5358a9009e60a8cd22d21e5a9ea652787c727732d0b869e0865495114c3">+3/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tbody></table> </details> ___
qodo-code-review[bot] commented 2025-12-08 02:59:04 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2074#issuecomment-3624361265
Original created: 2025-12-08T02:59:04Z

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Missing audit logs: New error and rule-evaluation paths do not add structured audit logs for critical actions
(rule load/evaluate success/failure), making it unclear who did what and when.

Referred Code
for key in &rules {
    let dkey = format!("{}/{}/{}", cfg.stream_name, msg.subject, key);
    let resp = match engine.evaluate(&dkey, context.clone().into()).await {
        Ok(r) => r,
        Err(e) => {
            if matches!(
                e.as_ref(),
                zen_engine::EvaluationError::LoaderError(le)
                    if matches!(le, zen_engine::loader::LoaderError::NotFound(_))
            ) {
                debug!("rule {dkey} not found, skipping");
                continue;
            }

            let message = match e.as_ref() {
                zen_engine::EvaluationError::LoaderError(le) => {
                    format!("failed to load rule {dkey}: {le}")
                }
                _ => format!("failed to evaluate rule {dkey}: {e}"),
            };



 ... (clipped 5 lines)

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status:
Detailed errors surfaced: The returned error includes internal details via {e} which might be propagated to users
depending on caller behavior, risking leakage of internal information.

Referred Code
    let message = match e.as_ref() {
        zen_engine::EvaluationError::LoaderError(le) => {
            format!("failed to load rule {dkey}: {le}")
        }
        _ => format!("failed to evaluate rule {dkey}: {e}"),
    };

    return Err(anyhow::anyhow!(message));
}

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Input validation unclear: The code constructs decision keys from external message subjects and evaluates rules
without visible sanitation or validation in the new changes.

Referred Code
for key in &rules {
    let dkey = format!("{}/{}/{}", cfg.stream_name, msg.subject, key);
    let resp = match engine.evaluate(&dkey, context.clone().into()).await {
        Ok(r) => r,
        Err(e) => {
            if matches!(
                e.as_ref(),
                zen_engine::EvaluationError::LoaderError(le)
                    if matches!(le, zen_engine::loader::LoaderError::NotFound(_))
            ) {
                debug!("rule {dkey} not found, skipping");
                continue;
            }

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
- Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/2074#issuecomment-3624361265 Original created: 2025-12-08T02:59:04Z --- ## PR Compliance Guide 🔍 <!-- https://github.com/carverauto/serviceradar/commit/ce62f264fa3815b30160ae801e54d53156ebe26c --> Below is a summary of compliance checks for this PR:<br> <table><tbody><tr><td colspan='2'><strong>Security Compliance</strong></td></tr> <tr><td>🟢</td><td><details><summary><strong>No security concerns identified</strong></summary> No security vulnerabilities detected by AI analysis. Human verification advised for critical code. </details></td></tr> <tr><td colspan='2'><strong>Ticket Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary>🎫 <strong>No ticket provided </strong></summary> - [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true --> </details></td></tr> <tr><td colspan='2'><strong>Codebase Duplication Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>Codebase context is not defined </strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/'>guide</a> to enable codebase context checks. </details></td></tr> <tr><td colspan='2'><strong>Custom Compliance</strong></td></tr> <tr><td rowspan=3>🟢</td><td> <details><summary><strong>Generic: Meaningful Naming and Self-Documenting Code</strong></summary><br> **Objective:** Ensure all identifiers clearly express their purpose and intent, making code <br>self-documenting<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Robust Error Handling and Edge Case Management</strong></summary><br> **Objective:** Ensure comprehensive error handling that provides meaningful context and graceful <br>degradation<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Logging Practices</strong></summary><br> **Objective:** To ensure logs are useful for debugging and auditing without exposing sensitive <br>information like PII, PHI, or cardholder data.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td rowspan=3>⚪</td> <td><details> <summary><strong>Generic: Comprehensive Audit Trails</strong></summary><br> **Objective:** To create a detailed and reliable record of critical system actions for security analysis <br>and compliance.<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/2074/files#diff-9fcbc5358a9009e60a8cd22d21e5a9ea652787c727732d0b869e0865495114c3R32-R57'><strong>Missing audit logs</strong></a>: New error and rule-evaluation paths do not add structured audit logs for critical actions <br>(rule load/evaluate success/failure), making it unclear who did what and when.<br> <details open><summary>Referred Code</summary> ```rust for key in &rules { let dkey = format!("{}/{}/{}", cfg.stream_name, msg.subject, key); let resp = match engine.evaluate(&dkey, context.clone().into()).await { Ok(r) => r, Err(e) => { if matches!( e.as_ref(), zen_engine::EvaluationError::LoaderError(le) if matches!(le, zen_engine::loader::LoaderError::NotFound(_)) ) { debug!("rule {dkey} not found, skipping"); continue; } let message = match e.as_ref() { zen_engine::EvaluationError::LoaderError(le) => { format!("failed to load rule {dkey}: {le}") } _ => format!("failed to evaluate rule {dkey}: {e}"), }; ... (clipped 5 lines) ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td><details> <summary><strong>Generic: Secure Error Handling</strong></summary><br> **Objective:** To prevent the leakage of sensitive system information through error messages while <br>providing sufficient detail for internal debugging.<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/2074/files#diff-9fcbc5358a9009e60a8cd22d21e5a9ea652787c727732d0b869e0865495114c3R46-R54'><strong>Detailed errors surfaced</strong></a>: The returned error includes internal details via <code>{e}</code> which might be propagated to users <br>depending on caller behavior, risking leakage of internal information.<br> <details open><summary>Referred Code</summary> ```rust let message = match e.as_ref() { zen_engine::EvaluationError::LoaderError(le) => { format!("failed to load rule {dkey}: {le}") } _ => format!("failed to evaluate rule {dkey}: {e}"), }; return Err(anyhow::anyhow!(message)); } ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td><details> <summary><strong>Generic: Security-First Input Validation and Data Handling</strong></summary><br> **Objective:** Ensure all data inputs are validated, sanitized, and handled securely to prevent <br>vulnerabilities<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/2074/files#diff-9fcbc5358a9009e60a8cd22d21e5a9ea652787c727732d0b869e0865495114c3R32-R44'><strong>Input validation unclear</strong></a>: The code constructs decision keys from external message subjects and evaluates rules <br>without visible sanitation or validation in the new changes.<br> <details open><summary>Referred Code</summary> ```rust for key in &rules { let dkey = format!("{}/{}/{}", cfg.stream_name, msg.subject, key); let resp = match engine.evaluate(&dkey, context.clone().into()).await { Ok(r) => r, Err(e) => { if matches!( e.as_ref(), zen_engine::EvaluationError::LoaderError(le) if matches!(le, zen_engine::loader::LoaderError::NotFound(_)) ) { debug!("rule {dkey} not found, skipping"); continue; } ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td align="center" colspan="2"> <!-- placeholder --> <!-- /compliance --update_compliance=true --> </td></tr></tbody></table> <details><summary>Compliance status legend</summary> 🟢 - Fully Compliant<br> 🟡 - Partial Compliant<br> 🔴 - Not Compliant<br> ⚪ - Requires Further Human Verification<br> 🏷️ - Compliance label<br> </details>
qodo-code-review[bot] commented 2025-12-08 02:59:54 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2074#issuecomment-3624364388
Original created: 2025-12-08T02:59:54Z

PR Code Suggestions

No code suggestions found for the PR.

Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/2074#issuecomment-3624364388 Original created: 2025-12-08T02:59:54Z --- ## PR Code Suggestions ✨ No code suggestions found for the PR.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2518
No description provided.