Skip to content

ROX-33943: Replace createStructuredSelector in PolicyPage#19805

Open
pedrottimark wants to merge 2 commits intomasterfrom
ROX-33943-createStructuredSelector-PolicyPage
Open

ROX-33943: Replace createStructuredSelector in PolicyPage#19805
pedrottimark wants to merge 2 commits intomasterfrom
ROX-33943-createStructuredSelector-PolicyPage

Conversation

@pedrottimark
Copy link
Copy Markdown
Contributor

Description

Follow up lint rule with ignores array in #19581

Objectives

When we delete deprecated container folders, we intend to delete obsolete dependencies.

Create policy from risk search filter without Redux is prototype for create scheduled report from image vulnerabilities search filter (which does not require a request, by the way).

Problem

If non-deprecated files still depend on the dependencies (pardon pun) any additional unplanned technical investment might block deletion, because the effort will compete with other unplanned tasks.

Analysis

This is the only occurrence of policies and formMessages reducers.

Form messages for errors do not appear, whether because of navigate call or just plain broken.

Solution

  1. Edit PolicyPage.tsx file.

    • Move generatePolicyFromSearch and adapt business logic.
    • Include comment by David Vail so information is not lost.
    • Delete severity: null because so default severity is Low like ordinary create action.
  2. Add GeneratedPolicyErrorModal.tsx file.

    • Display errors from attempt to generate policy.
  3. Edit CreatePolicyFromSearch.tsx file.

    • Append search filter to ?action=generate in query string.
  4. Delete obsolete reducer files.

User-facing documentation

  • CHANGELOG.md update is not needed
  • documentation PR is not needed

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

  1. npm run tsc in ui/apps/platform folder.
  2. npm run lint:fast-dev in ui/apps/platform folder.
  3. npm run start in ui/apps/platform folder with staging demo as central

Manual testing of baseline

  1. Visit /main/risk select Cluster staging-secured-cluster and Namespace stackrox in search filter, and then click Create policy

    Risk

    Request first:

    POST /v1/policies/from-search

    searchParams: "Cluster:staging-secured-cluster+Namespace:stackrox+Orchestrator Component:false"

    Push browser history second:

    /main/policy-management/policies?action=generate

  2. Advance to Scope step of policy wizard

    Before changes, see Inclusion scope card.
    Policy_Scope

Manual testing of replaced

  1. Visit /main/risk select Cluster staging-secured-cluster and Namespace stackrox and also Vulnerability State observed (which is irrelevant for policies) in search filter, and then click Create policy

    Push browser history first with search filter:

    /main/policy-management/policies?action=generate&s[Cluster]=staging-secured-cluster&s[Namespace]=stackrox&s[Vulnerability%20State]=OBSERVED

    Request second:

    POST /v1/policies/from-search

    Payload
    searchParams: "Cluster:staging-secured-cluster+Namespace:stackrox+Vulnerability State:OBSERVED"

    Data
    alteredSearchTerms: ["Vulnerability State"]
    hasNestedFields: false

    See modal if search filter has errors.
    GeneratedPolicyErrorModal

  2. Advance to Scope step of policy wizard

    After changes, see Inclusion scope card.

  3. Advance to Review step of policy wizard
    Review

@pedrottimark pedrottimark requested a review from a team as a code owner April 2, 2026 19:40
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.60%. Comparing base (02759e7) to head (2f3499c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19805   +/-   ##
=======================================
  Coverage   49.60%   49.60%           
=======================================
  Files        2763     2763           
  Lines      208271   208271           
=======================================
+ Hits       103317   103319    +2     
+ Misses      97288    97287    -1     
+ Partials     7666     7665    -1     
Flag Coverage Δ
go-unit-tests 49.60% <ø> (+<0.01%) ⬆️

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

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pedrottimark pedrottimark force-pushed the ROX-33943-createStructuredSelector-PolicyPage branch from ae313bc to 2f3499c Compare April 2, 2026 21:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🚀 Build Images Ready

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

export MAIN_IMAGE_TAG=4.11.x-555-g2f3499c78c

@sachaudh sachaudh requested review from bradr5 and sachaudh and removed request for a team and sachaudh April 3, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant