Skip to content

fix: correctly serialize RFC3339 datetimes in EI API types [Backport release/0.6.z] - #2577

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

fix: correctly serialize RFC3339 datetimes in EI API types [Backport release/0.6.z]#2577
Strum355 merged 1 commit into
release/0.6.zfrom
backport-2565-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 #2565 to release/0.6.z.

Summary by Sourcery

Ensure exploit intelligence API timestamps are serialized as RFC3339 strings and adjust tests to validate the new JSON representation.

Enhancements:

  • Add RFC3339 serialization for created and updated timestamp fields in exploit intelligence job and component API models.

Tests:

  • Update exploit intelligence endpoint tests to assert string-based status, finding, and timestamp fields, including RFC3339-compliant datetime formats.

@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Backport to release/0.6.z that ensures Exploit Intelligence API models serialize OffsetDateTime fields as RFC3339 strings and updates the job completion endpoint test to validate the new JSON representation, including datetime formatting and field values.

File-Level Changes

Change Details Files
Ensure Exploit Intelligence API datetime fields are serialized in RFC3339 format.
  • Added serde RFC3339 serialization attributes to created and updated fields in ExploitIntelligenceJobSummary.
  • Added serde RFC3339 serialization attributes to created and updated fields in ExploitIntelligenceJobDetails.
  • Added serde RFC3339 serialization attributes to created and updated fields in ComponentResult.
modules/exploit-intelligence/src/model/mod.rs
Update job completion endpoint test to assert on JSON structure and RFC3339-formatted datetime fields.
  • Switched test response deserialization from typed ExploitIntelligenceJobDetails to generic serde_json::Value.
  • Adjusted assertions to compare string and integer values directly from JSON fields.
  • Added OffsetDateTime RFC3339 parsing checks for created and updated fields in the response body.
  • Imported serde_json::Value and Rfc3339 format description from time.
modules/exploit-intelligence/src/endpoints/test.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 the get_job_completed test, the second RFC3339 assertion uses the message "created should be valid RFC3339" while validating updated, which can be confusing when debugging failures; consider adjusting the message to reference the correct field.
  • The JSON field assertions in get_job_completed (e.g., body["id"], body["status"]) rely on implicit PartialEq with Value; for stronger type safety and clearer failure messages, consider extracting the underlying string/number via as_str() / as_i64() (with expect) before comparing.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `get_job_completed` test, the second RFC3339 assertion uses the message "created should be valid RFC3339" while validating `updated`, which can be confusing when debugging failures; consider adjusting the message to reference the correct field.
- The JSON field assertions in `get_job_completed` (e.g., `body["id"]`, `body["status"]`) rely on implicit `PartialEq` with `Value`; for stronger type safety and clearer failure messages, consider extracting the underlying string/number via `as_str()` / `as_i64()` (with `expect`) before comparing.

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 23e3a0e into release/0.6.z Aug 12, 2026
9 checks passed
@Strum355
Strum355 deleted the backport-2565-to-release/0.6.z branch August 12, 2026 20:00
@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