Skip to content

[dev] [Marfuen] mariano/people-settings-bg-check-toggle#2748

Merged
Marfuen merged 13 commits into
mainfrom
mariano/people-settings-bg-check-toggle
May 5, 2026
Merged

[dev] [Marfuen] mariano/people-settings-bg-check-toggle#2748
Marfuen merged 13 commits into
mainfrom
mariano/people-settings-bg-check-toggle

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 5, 2026

This is an automated pull request to merge mariano/people-settings-bg-check-toggle into dev.
It was created by the [Auto Pull Request] action.


Summary by cubic

Add org-level and per-member background check controls, with permission-gated People Settings and an employee-level exempt toggle. Exempt members count as complete, UI stays in sync across header/list/toggles, and org-level off overrides per-member settings.

  • New Features

    • People > Settings tab: toggle to require background checks (PATCH /v1/organization with backgroundCheckStepEnabled), shown only if the user has organization:update (custom roles supported).
    • Employee profile: toggle to exempt a member (PATCH /v1/people/:id with backgroundCheckExempt), gated by member:update; shows an exempt info card; hides the BG-check counter and verified tick; respects org-level off.
    • People score: exempt members are treated as complete; background-check and exempt queries run only when the step is enabled.
    • API/tests: DTOs/selects now include backgroundCheckExempt; tests added for controllers, people score, header/list UI, settings, and exempt state resync.
  • Migration

    • Adds Member.backgroundCheckExempt BOOLEAN DEFAULT false. Run database migrations; no data changes needed.

Written for commit 3cb8b44. Summary will update on new commits.

Marfuen and others added 10 commits May 5, 2026 10:19
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add getExemptMemberIds helper and update computePeopleScore to skip
the background check requirement for members with backgroundCheckExempt=true.
Both the BG-check query and exempt query are gated behind backgroundCheckStepEnabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add backgroundCheckExempt field to UpdatePeopleDto with @IsOptional + @isboolean decorators
- Add backgroundCheckExempt: true to MemberQueries.MEMBER_SELECT so the field flows to responses
- Add @db mock and backgroundCheckExempt controller test; fix transitive enum mocks so the suite runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace manual role-string parsing with resolveBuiltInPermissions +
hasPermission for the canManageOrgSettings server-side gate, and add
usePermissions self-defense inside PeopleSettings to disable the Switch
when the user lacks organization:update.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add memberBackgroundCheckExempt prop to EmployeeBackgroundCheck with
an ExemptToggleCard that PATCHes /v1/people/:id on change; gate on
member:update permission. Also fix @trycompai/billing vitest alias and
backgroundCheckExempt default in createMockMember.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ull guard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment May 5, 2026 11:40am
comp-framework-editor Ready Ready Preview, Comment May 5, 2026 11:40am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped May 5, 2026 11:40am

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.

2 issues found across 24 files

Confidence score: 3/5

  • There is a concrete user-impacting permission regression in apps/app/src/app/(app)/[orgId]/people/page.tsx: the check ignores custom role permissions, so users with custom organization:update can be incorrectly blocked from the new Settings tab.
  • apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx has a state-sync issue where the verified badge can remain stale after exemption toggles, which can mislead users even if backend state is correct.
  • Given the high confidence and user-facing behavior impact, this sits at moderate merge risk rather than a low-risk cleanup.
  • Pay close attention to apps/app/src/app/(app)/[orgId]/people/page.tsx and apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx - permission gating and UI state synchronization need validation.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/app/src/app/(app)/[orgId]/people/page.tsx">

<violation number="1" location="apps/app/src/app/(app)/[orgId]/people/page.tsx:39">
P2: This check ignores custom role permissions, so users with custom `organization:update` access can be incorrectly blocked from the new Settings tab.</violation>
</file>

<file name="apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx">

<violation number="1" location="apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx:87">
P2: Keep the exemption state in sync with the header; right now the verified badge can stay stale after toggling exemption.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread apps/app/src/app/(app)/[orgId]/people/page.tsx Outdated
Comment thread apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx Outdated
…h header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx">

<violation number="1" location="apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/Employee.tsx:72">
P2: State derived from `memberBackgroundCheckExempt` is not kept in sync with prop updates, which can leave exemption UI stale when upstream data changes.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Apply the React render-time-adjust pattern in Employee.tsx and
EmployeeBackgroundCheck.tsx so that lifted exempt state stays in sync
with the prop after router.refresh() or upstream SWR revalidation.
Add regression test covering the uncontrolled-mode resync path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Marfuen
Copy link
Copy Markdown
Contributor

Marfuen commented May 5, 2026

@cubic-dev-ai review this again

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 5, 2026

@cubic-dev-ai review this again

@Marfuen I have started the AI code review. It will take a few minutes to complete.

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 24 files

Confidence score: 5/5

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

@vercel vercel Bot temporarily deployed to Preview – portal May 5, 2026 11:35 Inactive
@Marfuen Marfuen merged commit bc7ee77 into main May 5, 2026
9 of 14 checks passed
@Marfuen Marfuen deleted the mariano/people-settings-bg-check-toggle branch May 5, 2026 11:36
@claudfuen
Copy link
Copy Markdown
Contributor

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants