Skip to content

fix(ui): centralize default muted findings filter on finding groups#10818

Merged
jfagoagas merged 3 commits into
masterfrom
fix/default-muted-filter-finding-groups
Apr 21, 2026
Merged

fix(ui): centralize default muted findings filter on finding groups#10818
jfagoagas merged 3 commits into
masterfrom
fix/default-muted-filter-finding-groups

Conversation

@alejandrobailo
Copy link
Copy Markdown
Contributor

Context

The "include muted findings" checkbox default was enforced inline on the findings SSR page but not on the finding-group resource drill-down, so a user without the toggle could still see muted findings when expanding a group. This PR centralizes the default behind a shared helper and wires both surfaces through it.

This is the minimal standalone fix for the muted-filter regression. The broader filter/sort refactor (shared composeSort, splitCsvFilterValues, overview widgets migration, etc.) remains in #10803.

Description

  • Add ui/lib/findings-filters.ts with MUTED_FILTER (const object) and applyDefaultMutedFilter<T>(filters: T): T. The helper spreads filter[muted]=false BEFORE the caller filters so any explicit value ("false" or the \"include\" opt-in from the checkbox) wins and never gets silently overwritten.
  • Export the helper from ui/lib/index.ts.
  • Wire applyDefaultMutedFilter into ui/app/(prowler)/findings/page.tsx by wrapping the result of resolveFindingScanDateFilters so metadata, fetch, and table all receive the same defaulted filters.
  • Wire applyDefaultMutedFilter into ui/hooks/use-finding-group-resource-state.ts via a derived effectiveFilters const passed to useFindingGroupResources, so the drill-down honors the same default as the top-level page.
  • Add unit tests for the helper (default injection, opt-in preserved, explicit \"false\" preserved, no input mutation, empty input).
  • Extend source-level assertions in page.test.ts and use-finding-group-resource-state.test.ts to lock in the wiring.
  • Add a changelog entry under [1.25.0]🐞 Fixed in ui/CHANGELOG.md.

Steps to review

  1. Read ui/lib/findings-filters.ts and ui/lib/findings-filters.test.ts to confirm the spread order (default first, caller last) guarantees opt-in wins.
  2. In ui/app/(prowler)/findings/page.tsx, verify that filtersWithScanDates is now the result of applyDefaultMutedFilter(await resolveFindingScanDateFilters(...)) so every downstream consumer (metadata info, fetch finding groups, client table) receives the defaulted value.
  3. In ui/hooks/use-finding-group-resource-state.ts, verify that effectiveFilters = applyDefaultMutedFilter(filters) is derived once and passed to useFindingGroupResources. The hardcoded includeMutedInOtherFindings: true for the drawer is intentionally unchanged (pre-existing behavior for the "Other Findings for this resource" tab).
  4. Load /findings locally without the muted checkbox toggled: confirm no muted rows appear in either the top-level list or inside any expanded group.
  5. Toggle the "include muted findings" checkbox and confirm muted rows appear in both surfaces.
  6. Run `pnpm --filter ui exec vitest run lib/findings-filters.test.ts hooks/use-finding-group-resource-state.test.ts 'app/(prowler)/findings/page.test.ts'` — 12 tests across 3 files should pass.

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? No

UI

  • All issue/task requirements work as expected on the UI
  • Screenshots/Video of the functionality flow (if applicable) - Mobile (X < 640px)
  • Screenshots/Video of the functionality flow (if applicable) - Table (640px > X < 1024px)
  • Screenshots/Video of the functionality flow (if applicable) - Desktop (X > 1024px)
  • Ensure new entries are added to CHANGELOG.md, if applicable.

API

  • All issue/task requirements work as expected on the API
  • Endpoint response output (if applicable)
  • EXPLAIN ANALYZE output for new/modified queries or indexes (if applicable)
  • Performance test results (if applicable)
  • Any other relevant evidence of the implementation (if applicable)
  • Verify if API specs need to be regenerated.
  • Check if version updates are required (e.g., specs, Poetry, etc.).
  • Ensure new entries are added to CHANGELOG.md, if applicable.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- add `applyDefaultMutedFilter` helper + `MUTED_FILTER` constant in
  `ui/lib/findings-filters.ts`
- wire helper into the findings SSR page and the finding-group resource
  drill-down so muted findings stay hidden unless the "include muted"
  checkbox is opted in
- cover the helper with unit tests (default injection, opt-in preserved,
  explicit `false` preserved, no mutation) and extend source-level
  assertions on page.tsx and use-finding-group-resource-state.ts
@alejandrobailo alejandrobailo requested a review from a team as a code owner April 21, 2026 11:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

✅ All necessary CHANGELOG.md files have been updated.

@alejandrobailo alejandrobailo self-assigned this Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

🔒 Container Security Scan

Image: prowler-ui:ba3dee3
Last scan: 2026-04-21 12:24:51 UTC

✅ No Vulnerabilities Detected

The container image passed all security checks. No known CVEs were found.

📋 Resources:

Comment thread ui/CHANGELOG.md Outdated
Comment thread ui/CHANGELOG.md Outdated
Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
@jfagoagas jfagoagas self-requested a review April 21, 2026 12:19
@jfagoagas jfagoagas added the backport-to-v5.24 Backport PR to the v5.24 branch label Apr 21, 2026
@jfagoagas jfagoagas merged commit bcce8d6 into master Apr 21, 2026
40 checks passed
@jfagoagas jfagoagas deleted the fix/default-muted-filter-finding-groups branch April 21, 2026 12:26
@prowler-bot prowler-bot added the was-backported The PR was successfully backported to the target branch label Apr 21, 2026
@prowler-bot
Copy link
Copy Markdown
Collaborator

💚 All backports created successfully

Status Branch Result
v5.24

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v5.24 Backport PR to the v5.24 branch component/ui was-backported The PR was successfully backported to the target branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants