Skip to content

PM-4010: Let Talent Manager copilots see member emails - #161

Merged
jmgasper merged 1 commit into
developfrom
PM-4010
Oct 9, 2026
Merged

jmgasper merged 1 commit into
developfrom
PM-4010

Conversation

@jmgasper

@jmgasper jmgasper commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Jira: PM-4010

What was broken

Users who have the Talent Manager role and also the copilot role could not see a member's email on the member profile, even though Talent Managers are allowed to see it. Phone numbers were still shown.

The bug only showed up for some of these users. For example, hentry_copilot could see mess's email but sathyajan9 could not, even with the exact same roles.

Root cause

copilotEmailAccess.shouldLimitCopilotEmailAccess limits email access for any caller with the copilot role unless they are an admin. Talent Manager was not exempt, so a TM who is also a copilot was treated like a plain copilot. They could only see the email of members who share a challenge resource with them.

getMember then removed the email that omitMemberAttributes had already allowed for the Talent Manager role. That explains why results differed between users with the same roles: it depended on which challenges each one had copiloted. The same rule also applied to member search.

What was changed

  • shouldLimitCopilotEmailAccess now skips the copilot restriction for any sensitive data role. It uses helper.hasSensitiveDataRole (admin, administrator, Talent Manager) instead of helper.hasAdminRole. This matches the role check omitMemberAttributes already uses for email and phones.
  • Added JSDoc for shouldLimitCopilotEmailAccess.
  • Copilots without the admin or Talent Manager role are unchanged: they still only see emails of members they share a challenge with.

No UI change is needed. The profiles app already shows the email to Talent Managers whenever the API returns it.

Added/updated tests

New test/unit/CopilotEmailAccess.test.js, which stubs the resources Prisma client:

  • a plain copilot is still limited;
  • a Talent Manager + copilot (the role set from the ticket) is not limited and keeps member emails in both canCopilotAccessMemberEmail and stripUnauthorizedCopilotEmails;
  • an administrator + copilot is not limited.

The Talent Manager case fails without this fix.

Unit suite with placeholder DB env vars: 195 passing, 4 failing. Clean develop gives 192 passing, 4 failing. The 4 failures are the same in both: the before all/after all hooks of the MemberService and MemberTraitService suites, which need a live Postgres (Can't reach database server at 127.0.0.1:5432). Lint (eslint on *.ts, src/**/*.ts, prisma/**/*.ts) and nest build both pass.

🤖 Generated with Claude Code

What was broken
Users who have the Talent Manager role and also the copilot role could not
see a member's email on the member profile, even though Talent Managers are
allowed to see it. Phone numbers were still shown. The bug only showed up
for some of these users, depending on which members they had worked with.

Root cause
copilotEmailAccess.shouldLimitCopilotEmailAccess limits email access for any
caller with the copilot role unless they are an admin. Talent Manager was not
exempt, so a TM who is also a copilot was treated like a plain copilot. They
could only see the email of members who share a challenge resource with
them. getMember then removed the email that omitMemberAttributes had already
allowed for the Talent Manager role. The same rule applied to member search.

What was changed
- shouldLimitCopilotEmailAccess now skips the copilot restriction for any
  sensitive data role (helper.hasSensitiveDataRole, which covers admin,
  administrator and Talent Manager) instead of only admin roles. This
  matches the role check omitMemberAttributes already uses for email and
  phones.
- Added JSDoc for shouldLimitCopilotEmailAccess.
- Copilots without the admin or Talent Manager role still only see emails of
  members they share a challenge with.

Added/updated tests
- New test/unit/CopilotEmailAccess.test.js:
  - a plain copilot is still limited;
  - a Talent Manager + copilot (the role set from the ticket) is not
    limited and keeps member emails in getMember and search filtering;
  - an administrator + copilot is not limited.
  The Talent Manager case fails without this fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jmgasper
jmgasper merged commit 9e73fc7 into develop Oct 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant