Skip to content

[comp] Production Deploy#2902

Merged
tofikwest merged 11 commits into
releasefrom
main
May 21, 2026
Merged

[comp] Production Deploy#2902
tofikwest merged 11 commits into
releasefrom
main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.


Summary by cubic

Let orgs toggle the Employee Compliance obligation on built‑in roles (Owner, Admin) via per‑org overrides, with a simple toggle in the system role page and consistent enforcement across API, UI, and background jobs.

  • New Features

    • Added GET /v1/roles/built-in/:name/obligations and PATCH /v1/roles/built-in/:name/obligations to read/update built‑in role obligations; only owner and admin are editable.
    • System role pages now show an editable Compliance toggle for Owner/Admin; permissions remain read‑only. PermissionMatrix supports obligationsEditable.
    • listRoles surfaces effective obligations on built‑in roles and hides override rows from custom roles.
  • Bug Fixes

    • Unified override fallback: only an explicit compliance in the DB override beats the built‑in default. Applied across the API resolver, use-permissions, compliance member filtering, portal access, and policy digest helpers.
    • Override rows no longer count toward the 20 custom‑role limit; Admin’s default matches @trycompai/auth (no compliance by default).
    • Stronger validation and UX: boolean DTO for obligations and state resync when navigating between system role pages.

Written for commit 8c06afb. Summary will update on new commits. Review in cubic

tofikwest and others added 11 commits May 21, 2026 17:43
… roles

Customers can now turn the Employee Compliance obligation on/off for built-in
roles (owner, admin, etc.) directly from the system role detail page. The
toggle was previously locked, so an organization had no way to disable the
compliance tasks owners are required to complete by default — or to opt admins
into them — without creating a custom role.

Storage reuses the existing `organization_role.obligations` JSON column: an
upserted row keyed by the built-in role name acts as a per-org override and
wins over `BUILT_IN_ROLE_OBLIGATIONS` in every read path (compliance member
filter, portal access, frontend permissions hook, policy acknowledgment
digest). Permissions stay sourced from the hardcoded defaults — only the
obligation is overridable. Override rows are filtered out of `listRoles`'s
custom-roles list and surfaced as effective obligations on the built-in
entries instead.

New API endpoints:
- GET  /v1/roles/built-in/:name/obligations
- PATCH /v1/roles/built-in/:name/obligations

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The customer request was specifically about Admin and Owner — keep the
toggle locked for auditor, employee, and contractor so we don't expand the
surface beyond what was asked. Enforced both client-side
(`obligationsEditable` only flips on for owner/admin in the system role
page) and server-side (`updateBuiltInObligations` rejects the rest with a
400).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts the change to the inlined BUILT_IN_ROLE_OBLIGATIONS in the digest
helper — the stale `admin: { compliance: true }` was pre-existing and not
in scope for this PR. The override merge logic stays so the owner/admin
toggle still flows through to the digest when an override row exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ackage

The inlined snapshot still said `admin: { compliance: true }` even though
the auth package itself was changed to `admin: {}` in 9316c6d — so the
toggle on the Admin role page had no effect on digest emails. Sync them so
turning the toggle off actually stops admin reminders.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses two issues from review:

- DTO now uses a nested class with @isboolean on `compliance`, so non-boolean
  values are rejected at validation time instead of being stored in the
  JSON column.
- System role detail resyncs `currentObligations` when `roleName` changes,
  so navigating between built-in role pages without a hard reload doesn't
  display stale toggle state from the previous role.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…allback

Two review fixes:

- The 20-custom-role limit now ignores rows that exist only as obligation
  overrides for built-in roles (name in BUILT_IN_ROLES), so toggling owner
  or admin doesn't shrink the customer's custom-role budget.
- Override semantics tightened: a DB row whose obligations JSON has no
  `compliance` key falls back to the hardcoded built-in default instead of
  silently disabling it. Only an explicit true/false on the override now
  wins over the default. Applied in all 4 read paths (compliance member
  filter, portal access, digest helper, roles.service.getObligationsForRoles).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Centralize the override-resolution rule in `resolveEffectiveObligations`
so the UI (`getBuiltInObligations`, `listRoles`) and the enforcement
path (`getObligationsForRoles`) all apply the same fallback: a DB row
only wins when `compliance` is explicitly set, otherwise fall back to
the built-in default.

Previously a row stored as `{}` would make the UI show the toggle as
off while the enforcement layer kept treating the role as carrying the
built-in compliance obligation — a divergence cubic flagged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Track obligations in the resync effect so the toggle reflects updates
when the parent re-fetches (e.g., after router.refresh or a parallel tab
mutating the same role).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…bligations

feat(rbac): allow toggling employee compliance on built-in roles
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

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

Project Deployment Actions Updated (UTC)
app (staging) Ready Ready Preview, Comment May 21, 2026 10:49pm
comp-framework-editor (staging) Ready Ready Preview, Comment May 21, 2026 10:49pm
portal (staging) Ready Ready Preview, Comment May 21, 2026 10:49pm

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

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 89f5373 into release May 21, 2026
14 checks passed
@claudfuen
Copy link
Copy Markdown
Contributor

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