Skip to content

ROX-33816: deployment datastore support for soft deletes#20015

Draft
stehessel wants to merge 12 commits intoROX-33816/soft-deletes-db-migrationfrom
ROX-33816/soft-deletes-datastore
Draft

ROX-33816: deployment datastore support for soft deletes#20015
stehessel wants to merge 12 commits intoROX-33816/soft-deletes-db-migrationfrom
ROX-33816/soft-deletes-datastore

Conversation

@stehessel
Copy link
Copy Markdown
Collaborator

@stehessel stehessel commented Apr 15, 2026

Description

Mark removed deployments as soft deleted and set the state. Query for active deployments where deleted deployments should be ignored.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

change me!

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 15, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch from 522ccb8 to 90048bc Compare April 15, 2026 09:08
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from 02f70ba to 011f0e7 Compare April 15, 2026 09:08
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

🚀 Build Images Ready

Images are ready for commit bb40042. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.11.x-680-gbb40042bed

@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch from 90048bc to 4c83dd0 Compare April 15, 2026 09:32
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch 2 times, most recently from 23ecb01 to 8f8fba3 Compare April 15, 2026 12:47
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch from 4c83dd0 to d702474 Compare April 15, 2026 13:09
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from 8f8fba3 to f7af9d5 Compare April 15, 2026 13:09
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch 2 times, most recently from d986287 to 8e552f2 Compare April 15, 2026 15:23
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from 3b04417 to 4cac521 Compare April 15, 2026 15:26
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch 2 times, most recently from d29d52b to 9e736fa Compare April 16, 2026 07:51
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from 4cac521 to b468d8a Compare April 16, 2026 07:51
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch from 9e736fa to 20dcd65 Compare April 16, 2026 14:13
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from fce7186 to 238cbf5 Compare April 16, 2026 14:15
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch from 20dcd65 to 8992b27 Compare April 16, 2026 15:06
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from d4a6876 to dd8ec2d Compare April 16, 2026 15:07
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-db-migration branch from 8992b27 to b357241 Compare April 16, 2026 18:30
stehessel and others added 4 commits April 16, 2026 20:30
Replace incorrect `Deployment_STATE_*` with correct `DeploymentState_STATE_*`
in files that were not caught during the interactive rebase.

Affected files:
- central/deployment/datastore/datastore.go
- central/deployment/datastore/datastore_impl.go
- pkg/protoconv/resources/resources_test.go

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When a deployment is soft-deleted, it should be immediately removed from
all ranking systems to ensure ranking data reflects only active deployments.

Changes:
- Remove deployment from deploymentRanker when soft-deleted
- Update namespace ranker by subtracting the deployment's risk score
- Update cluster ranker by subtracting the deployment's risk score

This ensures consistency with query filtering (which excludes deleted
deployments) and prevents ranking data from including stale deployments.

User request: "should soft deleted deployments be immediately removed
from the deploymentranker?"

Why: Namespace and cluster rankers were not being updated when deployments
were soft-deleted, leading to incorrect aggregate risk scores that included
deleted deployments. The deployment ranker also retained entries for
soft-deleted deployments despite them being filtered from all queries.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed the GraphQL deployment loader's CountAll method to count
deployments across all states (active and soft-deleted) instead of
only active deployments.

Rationale: The name "CountAll" semantically implies counting everything,
while CountFromQuery is available for filtered counts. This makes the
API more intuitive:
- CountAll() → all deployments regardless of state
- CountFromQuery(query) → filtered deployments (can include active filter)

Note: CountAll is currently unused in the codebase but is part of the
common loader interface pattern. If it's ever used in the future, it
will now return the total count across all states as the name implies.

User request: "let CountAll actually count all deployments of all
states - including soft deleted ones."

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@stehessel stehessel force-pushed the ROX-33816/soft-deletes-datastore branch from dd8ec2d to a78082d Compare April 16, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant