Skip to content

fix(evaluator): send always current timestamp in ISO format to inventory views#2238

Merged
jdobes merged 1 commit intoRedHatInsights:masterfrom
jdobes:fix_timestamp
Feb 24, 2026
Merged

fix(evaluator): send always current timestamp in ISO format to inventory views#2238
jdobes merged 1 commit intoRedHatInsights:masterfrom
jdobes:fix_timestamp

Conversation

@jdobes
Copy link
Member

@jdobes jdobes commented Feb 24, 2026

simplifies logic around last_timestamp null value

Secure Coding Practices Checklist GitHub Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

Summary by Sourcery

Ensure inventory view events always include the current UTC timestamp in ISO format and adjust pipeline build resources accordingly.

Bug Fixes:

  • Send the current UTC timestamp in ISO format to inventory views instead of relying on a potentially null last evaluation value.

Build:

  • Increase compute resources for the Tekton build-container task to allocate more CPU and memory.

…ory views

simplifies logic around last_timestamp null value
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the evaluator so that inventory views are always sent with the current UTC timestamp in ISO 8601 format, removes dependency on last_evaluation, and increases build pod resources for the Tekton pipeline build step.

Sequence diagram for evaluator sending inventory views with current ISO timestamp

sequenceDiagram
    participant EvaluatorProcessor as EvaluatorProcessor
    participant SystemPlatform as SystemPlatform
    participant InventoryViews as InventoryViews

    EvaluatorProcessor->>SystemPlatform: _evaluate_system()
    activate SystemPlatform
    SystemPlatform-->>EvaluatorProcessor: inventory_id, org_id, rh_account_id, vulnerability_counts
    deactivate SystemPlatform

    EvaluatorProcessor->>InventoryViews: send_inventory_views(inventory_id, org_id, rh_account_id, total_cves, critical_cves, high_severity_cves, medium_severity_cves, low_severity_cves, other_severity_cves)
    activate InventoryViews
    InventoryViews->>InventoryViews: timestamp = datetime_now_utc_isoformat()
    InventoryViews-->>EvaluatorProcessor: send message with org_id, timestamp, hosts
    deactivate InventoryViews
Loading

File-Level Changes

Change Details Files
Always send current UTC timestamp in ISO 8601 format to inventory views instead of using last_evaluation.
  • Updated send_inventory_views to construct the timestamp using datetime.now with UTC timezone and isoformat() instead of relying on an external last_evaluation value.
  • Removed the last_evaluation parameter from the send_inventory_views function signature.
  • Adjusted all known call sites to stop passing last_evaluation into send_inventory_views.
common/utils.py
evaluator/processor.py
Increase compute resources for the container build step in the Tekton pipeline.
  • Added taskRunSpecs for the build-container pipeline task with specific stepSpecs for the build step.
  • Configured CPU request to 1 core, memory request to 8Gi, and memory limit to 16Gi for the build step.
.tekton/vulnerability-engine-push.yaml

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

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:

  • Now that send_inventory_views always uses the current time, consider injecting a clock or wrapping the timestamp generation in a small helper to make this behavior easier to test deterministically and to avoid time-sensitive test flakiness.
  • Since you no longer use last_evaluation, double-check other callers and any related type hints or documentation for send_inventory_views so they no longer reference or expect that parameter.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that `send_inventory_views` always uses the current time, consider injecting a clock or wrapping the timestamp generation in a small helper to make this behavior easier to test deterministically and to avoid time-sensitive test flakiness.
- Since you no longer use `last_evaluation`, double-check other callers and any related type hints or documentation for `send_inventory_views` so they no longer reference or expect that parameter.

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.

@github-actions
Copy link
Contributor

SC Environment Impact Assessment

Overall Impact:NONE

No SC Environment-specific impacts detected in this PR.

What was checked

This PR was automatically scanned for:

  • Database migrations
  • ClowdApp configuration changes
  • Kessel integration changes
  • AWS service integrations (S3, RDS, ElastiCache)
  • Kafka topic changes
  • Secrets management changes
  • External dependencies

@jdobes jdobes merged commit 7e0baf0 into RedHatInsights:master Feb 24, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants