Skip to content

fix(cloud-security): scope Cloud Tests findings to the selected account#3043

Merged
tofikwest merged 2 commits into
mainfrom
tofik/cloud-tests-account-filter
Jun 5, 2026
Merged

fix(cloud-security): scope Cloud Tests findings to the selected account#3043
tofikwest merged 2 commits into
mainfrom
tofik/cloud-tests-account-filter

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented Jun 5, 2026

Summary

Customers with multiple AWS accounts reported they can't filter the Cloud Tests findings list down to a single account — "we still can't filter the list down by account… would be good if the list filtered to the problems with that account when we select it."

It wasn't by design — it's a multi-account filtering bug.

Root cause

CloudTestsSection.tsx scoped findings with:

.filter((f) => f.providerSlug === providerSlug || f.connectionId === connectionId)

That's an OR, and the first clause (f.providerSlug === providerSlug) matches every finding of the provider — so the connection (account) clause never narrowed anything. The account selector switched the active connectionId, but the filter ignored it, so the list always showed all accounts' findings merged. (Looks like the filter predates multi-account support.)

Fix

  • Extract filterFindingsByConnection(findings, connectionId) and use it for both the findings list and the project-name pills, scoping strictly to the selected connection (= selected account).
  • Safe because every Finding carries a required connectionId (types.ts) and each section is rendered with the selected connection's id (ProviderTabs.tsx:163) — so nothing is hidden; the list (and the Passed/Failed/Total stats derived from it) now reflect the selected account.

Effect for the customer

Selecting an account in the connection selector now narrows the findings, stats, and "Looking good"/empty states to that account — exactly the per-account focus they asked for.

Tests

  • finding-filters.test.ts: scopes to one account, and a regression guard that it does not leak another account of the same provider. 4 passing; changed files typecheck clean.

Note

This sharpens scoping to one account at a time (matching the existing selector UX). If we later want an explicit "All accounts" aggregate view, that's a follow-up — out of scope here.

🤖 Generated with Claude Code


Summary by cubic

Scopes Cloud Tests findings, stats, and project pills to the selected account. Adds a clear label to the connection selector so it’s obvious it filters by account.

  • Bug Fixes

    • Extracted and used filterFindingsByConnection(findings, connectionId) for findings and project-name pills; replaced the providerSlug || connectionId logic with strict connectionId scoping.
    • Added tests to prevent cross-account leakage and verify empty results.
  • New Features

    • Labeled the connection selector in ProviderTabs with provider-aware terms (“Account” for AWS, “Subscription” for Azure, “Connection” for GCP) and matching placeholder.

Written for commit 2d1404e. Summary will update on new commits.

Review in cubic

Customers with multiple AWS accounts couldn't filter the findings list down to
one account — selecting a different account in the connection selector did
nothing, the list always showed every account's findings merged.

Root cause: the per-section findings filter used
`f.providerSlug === providerSlug || f.connectionId === connectionId`. The first
clause matches EVERY finding of the provider, so the connection (account) clause
never narrowed anything. The selector switched the active connectionId, but the
filter ignored it.

- Extract `filterFindingsByConnection(findings, connectionId)` and use it for
  both the findings list and the project-name pills in CloudTestsSection, so the
  view is scoped strictly to the selected connection (= selected account).
  Every finding carries a required connectionId and each section renders with
  the selected connection's id, so this is safe (nothing is hidden).
- Test: filterFindingsByConnection scopes to one account and does not leak
  another account of the same provider (regression guard).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 5, 2026 3:01pm
comp-framework-editor Ready Ready Preview, Comment Jun 5, 2026 3:01pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Jun 5, 2026 3:01pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

The connection selector doubles as the account filter, but it had no label, so
it wasn't obvious that picking an item scopes the findings to that account.
Add a provider-aware label next to it — "Account" for AWS, "Subscription" for
Azure, "Connection" for GCP — and use the same term in the placeholder.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel vercel Bot temporarily deployed to Preview – portal June 5, 2026 14:57 Inactive
@tofikwest tofikwest merged commit 3543aa1 into main Jun 5, 2026
9 of 10 checks passed
@tofikwest tofikwest deleted the tofik/cloud-tests-account-filter branch June 5, 2026 15:00
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.72.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

2 participants