fix(ui): hide muted finding groups immediately on /findings#11170
Open
HugoPBrito wants to merge 3 commits into
Open
fix(ui): hide muted finding groups immediately on /findings#11170HugoPBrito wants to merge 3 commits into
HugoPBrito wants to merge 3 commits into
Conversation
- Track optimistically-muted check_ids in sessionStorage with 90s TTL - Wire row-action and floating-mute paths through selection context - Hide expanded group when its last unmuted resource is muted - Honor Include muted findings filter to stay in sync with reload
…immediately-after-muting-a-group
Member
Author
Screen.Recording.2026-05-14.at.11.13.37.mov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Muting a finding group on
/findingsleft the row visible until the user reloaded manually. The default/finding-groups/latestendpoint reads fromFindingGroupDailySummary, which is rebuilt asynchronously by the Celery chain queued inMuteRuleViewSet.create(mute_historical_findings_task→reaggregate_all_finding_group_summaries_task). Arouter.refresh()fired right afterPOST /mute-rulestherefore returns the same stale aggregate, so the row reappears even though the mute was applied. After a slower manual reload the chain has typically finished and the row disappears, which matches what users expect.A previous attempt to make the reaggregation synchronous inside the request handler added 100ms–2s to every mute and scaled poorly on tenants with many scans, so the fix lives entirely in the UI.
Description
UI-only optimistic hide with a short
sessionStoragesafety net so a fast reload does not break the illusion while the Celery chain catches up:ui/lib/optimistic-muted-groups.ts(+ unit tests): persists mutedcheck_ids underprowler:optimistic-muted-groupswith a 90s TTL per entry. Each entry tracks its ownexpiresAt(no shared TTL extension across mutes), expired entries are pruned on read, defensive againstsessionStorageexceptions (Safari private mode, quota).findings-group-table.tsx: hydrates the optimisticSet<string>from storage on mount, derivesvisibleDatafromdata⊖ optimistic set, and clears entries from storage when the server payload no longer includes acheck_id(the natural confirmation signal). Replaces every previoussafeDatareference withvisibleDataso selection indices, row counts and the table stay coherent. Honorsfilter[muted]=include: when the user opted in to seeing muted groups, the row stays visible (with the muted indicator) so the optimistic state does not diverge from the post-reload view.FloatingMuteButton(checkbox + bulk button) – existing path.data-table-row-actions.tsxnow readsonMuteCompletefrom the selection context as a fallback so the parentFindingsGroupTableis notified (previously fell back to a barerouter.refresh()).onResourceMuteCompletedprop onInlineResourceContainer, withcolumn-finding-resources.tsxpassing the muted finding IDs through the context.willResourceMuteEmptyGroup: when a resource-level mute leaves the expanded group fully muted on the server (every unmuted FAIL covered AND no unmuted PASS/MANUAL), we hide the group too. Conservative on purpose so we do not pre-hide a group that would still be visible post-reload.findings-selection-context.tsx:onMuteCompletesignature widened to(mutedIds?: string[]) => void. Backward-compatible.No API, MCP, or SDK changes. The Celery chain in
MuteRuleViewSet.createcontinues to run untouched.Steps to review
cd ui && pnpm installpnpm vitest run lib/optimistic-muted-groups.test.ts components/findings/table/findings-group-table.test.tsx components/findings/table/data-table-row-actions.test.tsx components/findings/table/column-finding-resources.test.tsx components/findings/table/column-finding-groups.test.tsx→ 35 tests pass.pnpm run typecheck && pnpm run lint:check→ clean./findings.Mute, submit modal → rows disappear instantly.…menu pickMute Finding Group→ row disappears instantly.sessionStoragewas hydrated on mount.Include muted findingstoggle: muted groups reappear with the muted indicator and the optimistic hide does not kick in (no divergence from post-reload state).sessionStorageentry is auto-removed (no leftover state).Checklist
Community Checklist
UI (if applicable)
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.