Skip to content

ROX-33774: broad pattern warnings for file paths#19847

Draft
sachaudh wants to merge 7 commits intomasterfrom
saif/broad-pattern-warnings
Draft

ROX-33774: broad pattern warnings for file paths#19847
sachaudh wants to merge 7 commits intomasterfrom
saif/broad-pattern-warnings

Conversation

@sachaudh
Copy link
Copy Markdown
Contributor

@sachaudh sachaudh commented Apr 6, 2026

Description

Jira: ROX-33774

Add non-blocking warning messages to file path inputs in the policy wizard when users enter glob patterns that are structurally too broad (e.g., /**, /tmp/**). Warnings describe the risk and suggest a narrower alternative.

  • Add warn property to TextDescriptor type
  • Create warnBroadFilePath function detecting root catch-alls, root single-level globs, and high-churn directory globs (/tmp, /proc, /sys, /var/log)
  • Render warnings using PatternFly HelperTextItem variant="warning" with isLiveRegion for accessibility
  • Apply to both deployment event and node event File Path descriptors
  • Validation errors take precedence over warnings

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

How I validated my change

  • 17 unit tests covering the full edge case matrix for warnBroadFilePath
  • All 395 tests in policyCriteriaDescriptors.test.ts pass

Screenshots

Screenshot 2026-04-06 at 12 20 15 PM Screenshot 2026-04-06 at 12 20 22 PM Screenshot 2026-04-06 at 12 20 30 PM Screenshot 2026-04-06 at 12 20 42 PM Screenshot 2026-04-06 at 12 20 58 PM Screenshot 2026-04-06 at 12 21 04 PM Screenshot 2026-04-06 at 12 21 11 PM Screenshot 2026-04-06 at 12 21 16 PM Screenshot 2026-04-06 at 12 21 26 PM Screenshot 2026-04-06 at 12 21 58 PM Screenshot 2026-04-06 at 12 22 08 PM

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 6, 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🚀 Build Images Ready

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

export MAIN_IMAGE_TAG=4.11.x-574-ge16c790726

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.58%. Comparing base (065e233) to head (e16c790).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19847      +/-   ##
==========================================
- Coverage   49.60%   49.58%   -0.02%     
==========================================
  Files        2763     2766       +3     
  Lines      208339   208530     +191     
==========================================
+ Hits       103342   103408      +66     
- Misses      97331    97450     +119     
- Partials     7666     7672       +6     
Flag Coverage Δ
go-unit-tests 49.58% <ø> (-0.02%) ⬇️

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.

Show non-blocking warnings in the policy wizard when users enter
overly broad file path glob patterns (root catch-alls, high-churn
directory globs) to help prevent excessive alert volume.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
@sachaudh sachaudh force-pushed the saif/broad-pattern-warnings branch from a6da532 to 76ef0ca Compare April 6, 2026 19:53
sachaudh added 6 commits April 7, 2026 10:25
Static helper text was unconditionally marked as a live region,
causing screen readers to announce it on initial render. Restrict
aria-live behavior to states where dynamic feedback is present.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
…source of truth

The nested ternary mapping prefixes to activity labels was disconnected
from the array, requiring two updates when adding a prefix. Using a
Record<string, string> co-locates the data and uses Array.find() to
avoid iterator/generator overhead from for-of loops.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
Collapse multi-line ternary expressions to single lines to satisfy
prettier rules flagged by CI style-check.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
…yCriteriaFieldInput

Deduplicate the error > warning > default priority logic that was
expressed twice in the JSX -- once for the validated/variant prop and
once for the displayed message. A single feedbackVariant and
feedbackMessage variable now serves both, preventing the two from
drifting out of sync.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
The /[*]/ regex uses a character class with a single literal character,
which is functionally identical to String.includes('*') but less readable.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
Replace toBeDefined() with toContain() for one representative test per
warning branch so branch-swap bugs are caught without being brittle
to exact wording changes.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
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