Skip to content

Conversation

@jcrossley3
Copy link
Contributor

@jcrossley3 jcrossley3 commented Sep 30, 2025

Downstream issue: https://issues.redhat.com/browse/TC-2958

Summary by Sourcery

Disable automatic garbage collection for orphaned packages by default by setting the GC frequency to zero and updating related logging and documentation

New Features:

  • Disable automatic database garbage collection by default

Enhancements:

  • Change default GC frequency constant to zero seconds
  • Update warning log message to reflect disabled GC state

Documentation:

  • Document that TRUSTD_GC_FREQ is disabled by default with a default value of 0s

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 30, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR disables database garbage collection by default by setting the GC frequency to zero seconds both in code and documentation, and updates the warning log to explicitly reference garbage collection.

Class diagram for updated GC scheduling logic

classDiagram
    class API {
    }
    class Database {
    }
    class "GC Scheduler" {
        - GC_FREQ: Duration
        + schedule_db_tasks(db: Database)
    }
    API --> "GC Scheduler" : uses
    "GC Scheduler" --> Database : schedules tasks
Loading

Flow diagram for updated GC frequency configuration

flowchart TD
    A[Start API server] --> B[Read TRUSTD_GC_FREQ env var]
    B --> C{Is GC_FREQ < 1s?}
    C -- Yes --> D[Log: Garbage collection is disabled]
    C -- No --> E[Log: GC frequency set]
    E --> F[Schedule GC task]
    D --> G[Do not schedule GC task]
Loading

File-Level Changes

Change Details Files
Disable garbage collection by default
  • Set GC_FREQ constant from 1h to 0s
  • Retain existing threshold check to skip GC when freq <1s
  • Update TRUSTD_GC_FREQ default value to 0s in docs
server/src/profile/api.rs
docs/env-vars.md
Clarify disabled GC in log output
  • Change warning message to “Garbage collection is disabled” instead of “GC is disabled”
server/src/profile/api.rs

Possibly linked issues


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
Contributor

@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 there - I've reviewed your changes - here's some feedback:

  • Consider introducing a dedicated flag or Option to represent a disabled GC state instead of using a Duration of zero as a sentinel value.
  • Update the changelog or release notes to highlight that garbage collection is now disabled by default so operators are aware of the new behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider introducing a dedicated flag or Option<Duration> to represent a disabled GC state instead of using a Duration of zero as a sentinel value.
- Update the changelog or release notes to highlight that garbage collection is now disabled by default so operators are aware of the new behavior.

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.

@jcrossley3 jcrossley3 added the backport release/0.4.z Backport (0.4.z) label Sep 30, 2025
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.30%. Comparing base (7da2e0c) to head (aac0b7b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2009      +/-   ##
==========================================
- Coverage   68.30%   68.30%   -0.01%     
==========================================
  Files         359      359              
  Lines       19930    19930              
  Branches    19930    19930              
==========================================
- Hits        13614    13613       -1     
- Misses       5531     5534       +3     
+ Partials      785      783       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jcrossley3 jcrossley3 added this pull request to the merge queue Oct 1, 2025
Merged via the queue into guacsec:main with commit df18dbb Oct 1, 2025
8 of 9 checks passed
@jcrossley3 jcrossley3 deleted the TC-2958 branch October 1, 2025 13:20
@jcrossley3
Copy link
Contributor Author

/backport

@trustify-ci-bot
Copy link

Successfully created backport PR for release/0.4.z:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/0.4.z Backport (0.4.z)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants