Skip to content

test(api): cover internal-org participant filter in automation-failure notifiers#3394

Merged
tofikwest merged 1 commit into
mainfrom
tofik/test-automation-failure-participant-filter
Jul 10, 2026
Merged

test(api): cover internal-org participant filter in automation-failure notifiers#3394
tofikwest merged 1 commit into
mainfrom
tofik/test-automation-failure-participant-filter

Conversation

@tofikwest

@tofikwest tofikwest commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Addresses the P3 finding cubic raised on the release PR (#3392): the automation-failure notifiers had no regression coverage for the internal-org participant filter introduced in #3378.

Adds tests for both notifyAutomationFailures and notifyBulkAutomationFailures asserting the recipient member.findMany query applies orgParticipantMemberWhereForFlag:

  • Customer org (isInternal: false) → query excludes platform admins (AND: [{ user: { OR: [{ role: { not: 'admin' } }, { role: null }] } }]).
  • Internal org (isInternal: true) → query has no exclusion (everyone participates).

This guards against a future change to the participation helper silently rerouting automation-failure notifications to the wrong recipients.

Note on the other finding (P2)

cubic's P2 (the isInternal toggle hits a PlatformAdminGuard-gated route rather than RBAC) is intentional, not a bug. The entire admin-organizations controller is platform-admin-gated by design; isInternal rides on the existing PATCH endpoint exactly like backgroundCheckStepEnabled/hasAccess. Marking an org "internal" must stay a Comp AI platform-staff operation — customer custom-roles should not be able to do it — so the current gating is the correct (safer) behavior, and this change introduces no new gap. No code change needed there.

Verify

Test-only change. task-notifier.service.spec.ts passes (12 tests, incl. the 4 new participant-filter cases).

🤖 Generated with Claude Code


Summary by cubic

Add regression tests for notifyAutomationFailures and notifyBulkAutomationFailures to verify the internal-org participant filter on recipient queries. Confirms platform admins are excluded for customer orgs and included for internal orgs, preventing misrouted automation-failure notifications.

Written for commit d3992e5. Summary will update on new commits.

Review in cubic

…e notifiers

Adds regression cases for `notifyAutomationFailures` and
`notifyBulkAutomationFailures` asserting the recipient `member.findMany` query
applies `orgParticipantMemberWhereForFlag`: platform admins are excluded for
customer orgs (isInternal false) and included for internal orgs (isInternal
true). Guards against a future change to the participation helper silently
routing automation-failure notifications to the wrong recipients (cubic P3 on
the release PR #3392).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzEVwhhoFghng6SDMGecMq
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Jul 10, 2026 7:55pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Jul 10, 2026 7:55pm
portal Skipped Skipped Jul 10, 2026 7:55pm

Request Review

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

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

Re-trigger cubic

@tofikwest tofikwest merged commit f37aa34 into main Jul 10, 2026
10 checks passed
@tofikwest tofikwest deleted the tofik/test-automation-failure-participant-filter branch July 10, 2026 19:58
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.101.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