Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Skipping CI for Draft Pull Request. |
|
Images are ready for the commit at b6823f8. To use with deploy scripts, first |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19616 +/- ##
==========================================
+ Coverage 49.26% 49.37% +0.10%
==========================================
Files 2735 2744 +9
Lines 206138 207017 +879
==========================================
+ Hits 101550 102210 +660
- Misses 97041 97211 +170
- Partials 7547 7596 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a60eba3 to
1a9c89c
Compare
1a9c89c to
b6823f8
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="migrator/migrations/m_222_to_m_223_add_compliance_profile_operator_kind/migration_test.go" line_range="36" />
<code_context>
+}
+
+func (s *migrationTestSuite) TestMigration() {
+ batchSize = 2 // Force multiple batches
+
+ dbs := &types.Databases{
</code_context>
<issue_to_address>
**issue (testing):** Reset the global batchSize after the test to avoid leaking state across tests
Because `batchSize` is a package-level variable, changing it here without restoring it can cause flaky behavior in other tests depending on run order. Capture the original value and restore it with a `defer`, for example:
```go
o := batchSize
batchSize = 2
defer func() { batchSize = o }()
```
This keeps the test isolated and avoids leaking global state between tests.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| } | ||
|
|
||
| func (s *migrationTestSuite) TestMigration() { | ||
| batchSize = 2 // Force multiple batches |
There was a problem hiding this comment.
issue (testing): Reset the global batchSize after the test to avoid leaking state across tests
Because batchSize is a package-level variable, changing it here without restoring it can cause flaky behavior in other tests depending on run order. Capture the original value and restore it with a defer, for example:
o := batchSize
batchSize = 2
defer func() { batchSize = o }()This keeps the test isolated and avoids leaking global state between tests.
Description
This PR adds
operator_kindas a dedicated column to thecompliance_operator_profile_v2table so it can be used as a search/filter field in the API (e.g.Compliance Profile Operator Kind:PROFILE).Previously,
operator_kindonly existed inside the serialized protobuf blob, making it invisible to SQL queries. This extracts it into its own column with a migration that backfills existing rows from the blob.User-facing documentation
Testing and quality
Automated testing
How I validated my change
CI, and I deployed stackrox before this change, then upgraded to a new build from this PR, verified that the migration runs correctly and the field can be queried by the API.