test(api): cover internal-org participant filter in automation-failure notifiers#3394
Merged
Merged
Conversation
…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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
🎉 This PR is included in version 3.101.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
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
notifyAutomationFailuresandnotifyBulkAutomationFailuresasserting the recipientmember.findManyquery appliesorgParticipantMemberWhereForFlag:isInternal: false) → query excludes platform admins (AND: [{ user: { OR: [{ role: { not: 'admin' } }, { role: null }] } }]).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
isInternaltoggle hits aPlatformAdminGuard-gated route rather than RBAC) is intentional, not a bug. The entireadmin-organizationscontroller is platform-admin-gated by design;isInternalrides on the existing PATCH endpoint exactly likebackgroundCheckStepEnabled/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.tspasses (12 tests, incl. the 4 new participant-filter cases).🤖 Generated with Claude Code
Summary by cubic
Add regression tests for
notifyAutomationFailuresandnotifyBulkAutomationFailuresto 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.