Skip to content

RHINENG-26548: remove old workspaces column#2232

Merged
TenSt merged 7 commits into
RedHatInsights:masterfrom
TenSt:stepan/RHINENG-26548-remove-old-workspaces-column
Jun 12, 2026
Merged

RHINENG-26548: remove old workspaces column#2232
TenSt merged 7 commits into
RedHatInsights:masterfrom
TenSt:stepan/RHINENG-26548-remove-old-workspaces-column

Conversation

@TenSt

@TenSt TenSt commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

This PR:

  • Drops system_inventory.workspaces column
  • Removes workspace_backfill job
  • Removes workspace backfill CronJob and dashboard
  • Removes local workspace backfill tooling
  • Removes workspaces field from SystemInventory model
  • Updates test data generator for workspace columns
  • Updates system_inventory database docs

Summary by Sourcery

Remove legacy system_inventory.workspaces support and associated workspace backfill tooling.

Enhancements:

  • Simplify SystemInventory schema and model by dropping the JSONB workspaces column and relying solely on workspace_id/name fields.
  • Update advisory cache refresh logic to aggregate by workspace_id directly instead of expanding JSON workspaces arrays.

Build:

  • Add migration 160 to drop the system_inventory.workspaces column and its index, with a corresponding down migration to restore them and the previous advisory cache function.

Deployment:

  • Remove the workspace-backfill ClowdApp CronJob configuration and related environment parameters.

Documentation:

  • Update database documentation to describe workspace fields without referencing the removed workspaces column.
  • Remove local workspace backfill documentation and helper SQL scripts.

Tests:

  • Remove workspace_backfill tests and test helpers related to the legacy workspaces column.

Chores:

  • Remove workspace backfill job wiring, metrics, and local Docker tooling, including Grafana dashboard panels for workspace backfill metrics.

@TenSt TenSt requested a review from a team as a code owner June 12, 2026 10:37
@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Removes the legacy system_inventory.workspaces JSONB column and the associated workspace backfill job, wiring, metrics, and tooling, consolidating on the single workspace_id/workspace_name fields and updating schema, models, tests, and docs accordingly.

File-Level Changes

Change Details Files
Drop system_inventory.workspaces column and its index via new migration and adjust advisory cache refresh logic to use workspace_id instead of JSON workspaces arrays.
  • Bump schema_migrations current version to 160.
  • Create migration 160_up to drop workspaces column and index, and to update refresh_account_advisory_caches_multi to aggregate by system_inventory.workspace_id.
  • Create migration 160_down to restore workspaces column/index and the previous refresh_account_advisory_caches_multi implementation that expands JSON workspaces.
  • Remove workspaces JSONB column and its GIN index from system_inventory definition in create_schema.sql and rely solely on workspace_id/workspace_name columns.
database_admin/schema/create_schema.sql
database_admin/migrations/160_drop_system_inventory_workspaces.up.sql
database_admin/migrations/160_drop_system_inventory_workspaces.down.sql
Simplify Go data model by removing the Groups JSONB helper type and SystemInventory.Workspaces field now that workspace_id/workspace_name are canonical.
  • Delete inventory.Groups type and its database Valuer/Scanner implementations previously used for system_inventory.workspaces JSONB storage.
  • Remove Workspaces field from the SystemInventory GORM model, leaving only WorkspaceID and WorkspaceName.
  • Prune test helper for generating workspace Groups, keeping only a single test workspace ID constant.
base/inventory/inventory.go
base/models/models.go
base/database/testing.go
Remove the workspace_backfill job, its configuration, metrics, and dashboard panel from the application and deployment configuration.
  • Delete workspace_backfill task implementation, metrics, tests, and related scripts and local tooling, including dev SQL and docker-compose files.
  • Remove workspace_backfill job wiring from main.go runJob switch so it is no longer invocable.
  • Drop workspace-backfill CronJob definition and its parameters/env vars from the ClowdApp deployment YAML.
  • Remove the workspace backfill Grafana panel and its Prometheus metric queries from the patchman-engine general dashboard config.
  • Remove workspace backfill–specific configuration knobs (max rows per run, batch size, sleep ms) from tasks/config.go and the workspace_backfill.env file.
main.go
deploy/clowdapp.yaml
tasks/config.go
dashboards/app-sre/grafana-dashboard-insights-patchman-engine-general.configmap.yaml
conf/workspace_backfill.env
dev/workspace_backfill/prepare_workspace_backfill_test.sql
dev/workspace_backfill/test_generate_system_inventory.sql
dev/workspace_backfill/verify_workspace_backfill.sql
dev/workspace_backfill/workspace_backfill.md
docker-compose.workspace-backfill.yml
scripts/workspace_backfill_e2e.sh
tasks/workspace_backfill/metrics.go
tasks/workspace_backfill/workspace_backfill.go
tasks/workspace_backfill/workspace_backfill_test.go
Align test data generation and database documentation with the new workspace representation.
  • Update dev test_generate_data.sql to stop populating the removed workspaces JSONB column and instead only set workspace_id and workspace_name.
  • Adjust database.md documentation for system_inventory to describe tags and workspace fields separately (no longer tags/workspaces combo description).
dev/test_generate_data.sql
docs/md/database.md

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

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.07%. Comparing base (cdfe0b9) to head (8f57ec8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2232      +/-   ##
==========================================
+ Coverage   58.32%   59.07%   +0.74%     
==========================================
  Files         140      138       -2     
  Lines        8967     8845     -122     
==========================================
- Hits         5230     5225       -5     
+ Misses       3189     3074     -115     
+ Partials      548      546       -2     
Flag Coverage Δ
unittests 59.07% <ø> (+0.74%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@MichaelMraka MichaelMraka self-assigned this Jun 12, 2026
@TenSt TenSt merged commit f386666 into RedHatInsights:master Jun 12, 2026
8 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.

3 participants