Skip to content

chore: include underlying error when logging failed exploit intelligence job reason [Backport release/0.6.z] - #2572

Merged
Strum355 merged 1 commit into
release/0.6.zfrom
backport-2568-to-release/0.6.z
Aug 12, 2026
Merged

chore: include underlying error when logging failed exploit intelligence job reason [Backport release/0.6.z]#2572
Strum355 merged 1 commit into
release/0.6.zfrom
backport-2568-to-release/0.6.z

Conversation

@trustify-ci-bot

@trustify-ci-bot trustify-ci-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

Description

Backport of #2568 to release/0.6.z.

Summary by Sourcery

Improve exploit intelligence runner error propagation to preserve underlying error details in analysis failures.

Bug Fixes:

  • Include underlying request error details when converting exploit intelligence request errors into analysis errors instead of generic user-facing messages.

Enhancements:

  • Simplify exploit intelligence analysis error mapping by removing the user_message helper and relying directly on error payloads for logging.

@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Backport PR updates how exploit intelligence request errors are mapped into analysis errors so that underlying error details are preserved in logs and job failure reasons, and simplifies error handling in the SBOM upload path.

Sequence diagram for updated upload_sbom error handling

sequenceDiagram
    participant upload_sbom
    participant classify_response_error
    participant AnalysisError

    upload_sbom->>classify_response_error: classify_response_error(label, request_send_await)
    classify_response_error-->>upload_sbom: Ok(response) or Err(EiRequestError)
    alt Err(EiRequestError)
        upload_sbom->>AnalysisError: AnalysisError_from(EiRequestError)
        AnalysisError-->>upload_sbom: Err(AnalysisError)
    end
Loading

File-Level Changes

Change Details Files
Preserve underlying error details when converting EiRequestError into AnalysisError for exploit intelligence runner.
  • Removed EiRequestError::user_message helper that produced generic or user-facing strings detached from the original error details.
  • Updated From for AnalysisError to pattern-match on each variant and carry through the underlying error or message: Transient now wraps the detail string in a retryable anyhow error, Rejected now wraps its detail string in a permanent anyhow error, and Permanent now passes through the underlying anyhow::Error unchanged.
modules/exploit-intelligence/src/runner/mod.rs
Simplify SBOM upload error handling to rely directly on AnalysisError conversion while still allowing classified logging elsewhere.
  • Changed upload_sbom to use map_err(AnalysisError::from) on classify_response_error(label, request.send().await) instead of in-place tracing::warn logging and manual AnalysisError construction.
  • Delegated error logging and classification responsibilities to the error conversion and caller, reducing duplication in this function.
modules/exploit-intelligence/src/runner/analysis.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In From<EiRequestError> for AnalysisError, wrapping Transient(anyhow::Error) with anyhow::anyhow!("{detail}") discards the original error context; consider passing the existing anyhow::Error through directly (e.g., Self::Retryable(detail)) to preserve the error chain.
  • Replacing the map_err block in upload_sbom with map_err(AnalysisError::from) removes the tracing::warn! logging of EI upload failures; if those logs are still useful for operations, consider moving the logging into AnalysisError::from or classify_response_error rather than dropping it entirely.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `From<EiRequestError> for AnalysisError`, wrapping `Transient(anyhow::Error)` with `anyhow::anyhow!("{detail}")` discards the original error context; consider passing the existing `anyhow::Error` through directly (e.g., `Self::Retryable(detail)`) to preserve the error chain.
- Replacing the `map_err` block in `upload_sbom` with `map_err(AnalysisError::from)` removes the `tracing::warn!` logging of EI upload failures; if those logs are still useful for operations, consider moving the logging into `AnalysisError::from` or `classify_response_error` rather than dropping it entirely.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Strum355
Strum355 merged commit f82efe1 into release/0.6.z Aug 12, 2026
9 checks passed
@Strum355
Strum355 deleted the backport-2568-to-release/0.6.z branch August 12, 2026 14:46
@github-project-automation github-project-automation Bot moved this to Done in Trustify Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant