Skip to content

fix: Update root key permissions button labels#3880

Merged
chronark merged 2 commits intomainfrom
eng-2009-edit-permissions-probably-would-be-abetter-label-if-it-has
Sep 1, 2025
Merged

fix: Update root key permissions button labels#3880
chronark merged 2 commits intomainfrom
eng-2009-edit-permissions-probably-would-be-abetter-label-if-it-has

Conversation

@perkinsjr
Copy link
Member

@perkinsjr perkinsjr commented Aug 29, 2025

What does this PR do?

The change uses a ternary operator to check:

  1. First, if the component is busy/loading - shows LOADING
  2. If not busy, checks if editMode is true - shows EDIT_PERMISSIONS
  3. Otherwise - shows the default SELECT_PERMISSIONS

This provides a more contextually appropriate button label when users are editing an existing root key versus creating a new one.

Fixes #3823

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Create a Root key and make sure the label shows as "Select Permissions"
  • Edit a Root key and make sure the label shows as "Edit Permissions"

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

Screenshot 2025-08-29 at 07 48 17 Screenshot 2025-08-29 at 07 48 25

Summary by CodeRabbit

  • New Features
    • Root Key dialog: Permissions button label now shows “Edit Permissions” in edit mode and “Select Permissions” when creating, with unchanged loading/disabled behavior.
    • Added UI text for the new “Edit Permissions” label to clarify the permissions workflow.

The change uses a ternary operator to check:

1. First, if the component is busy/loading - shows `LOADING`
2. If not busy, checks if `editMode` is true - shows `EDIT_PERMISSIONS`
3. Otherwise - shows the default `SELECT_PERMISSIONS`

This provides a more contextually appropriate button label when users
are editing an existing root key versus creating a new one.
@linear
Copy link

linear bot commented Aug 29, 2025

@changeset-bot
Copy link

changeset-bot bot commented Aug 29, 2025

⚠️ No Changeset found

Latest commit: 37afaf9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Aug 29, 2025

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

Project Deployment Preview Comments Updated (UTC)
dashboard Ready Ready Preview Comment Aug 29, 2025 0:12am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
engineering Ignored Ignored Preview Aug 29, 2025 0:12am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 29, 2025

📝 Walkthrough

Walkthrough

Adds a new UI message key EDIT_PERMISSIONS and updates RootKeyDialog to show “Edit Permissions” when editMode is true; otherwise it shows “Select Permissions.” Loading/disabled behavior remains governed by isBusy.

Changes

Cohort / File(s) Summary
Root key UI labels
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts, apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx
Added ROOT_KEY_MESSAGES.UI.EDIT_PERMISSIONS; button label logic now uses EDIT_PERMISSIONS when editMode is true, otherwise SELECT_PERMISSIONS. Loading/disabled behavior unchanged.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Dialog as RootKeyDialog
    participant Btn as PermissionsButton

    User->>Dialog: Open dialog
    Note over Dialog: compute state: isBusy, editMode
    Dialog->>Btn: Render with label
    alt isBusy
        Btn-->>User: Show loading / disabled
    else not busy
        alt editMode == true
            Btn-->>User: "Edit Permissions"
        else
            Btn-->>User: "Select Permissions"
        end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Use “Edit Permissions” label when permissions are attached (#3823)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
None

Suggested labels

Bug

Suggested reviewers

  • mcstepp
  • chronark
  • ogzhanolguncu

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8082853 and 37afaf9.

📒 Files selected for processing (1)
  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{js,jsx,ts,tsx}: Use Biome for formatting and linting in TypeScript/JavaScript projects
Prefer named exports over default exports in TypeScript/JavaScript, except for Next.js pages

Files:

  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow strict TypeScript configuration
Use Zod for runtime validation in TypeScript projects

Files:

  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
**/*.{env,js,ts,go}

📄 CodeRabbit inference engine (CLAUDE.md)

All environment variables must follow the format: UNKEY_<SERVICE_NAME>_VARNAME

Files:

  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: perkinsjr
PR: unkeyed/unkey#3880
File: apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx:137-141
Timestamp: 2025-08-29T12:08:57.461Z
Learning: Root keys in the Unkey system require at least one permission at minimum, so there is no valid case where a root key would have zero permissions. This means checking for permission existence when determining UI labels is unnecessary.
Learnt from: MichaelUnkey
PR: unkeyed/unkey#3173
File: apps/docs/security/delete-protection.mdx:32-36
Timestamp: 2025-04-22T17:33:28.162Z
Learning: In the Unkey dashboard UI for delete protection, the button/link to initiate the process is labeled "Disable Delete Protection" while the confirmation button is labeled "Disable API Delete Protection". The documentation should maintain these different labels to match the actual UI.
Learnt from: MichaelUnkey
PR: unkeyed/unkey#3173
File: apps/docs/security/delete-protection.mdx:21-24
Timestamp: 2025-04-22T17:34:04.438Z
Learning: In the Unkey dashboard UI for enabling delete protection, the button/link to initiate the process is labeled "Enable Delete Protection" while the confirmation button is labeled "Enable API Delete Protection". The documentation should maintain these different labels to match the actual UI.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Build / Build
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1)

33-33: Punctuation parity resolved; label reads correctly.

Adding the ellipsis keeps it consistent with SELECT_PERMISSIONS and accurately signals a follow-up dialog. Looks good.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch eng-2009-edit-permissions-probably-would-be-abetter-label-if-it-has

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel vercel bot temporarily deployed to Preview – dashboard August 29, 2025 11:49 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2025

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx (1)

90-93: Don’t block clearing all permissions in edit mode

Disabling the primary action when selectedPermissions.length is 0 prevents users from removing all permissions on an existing key. Require at least one permission only for create flows.

Apply:

-              disabled={!hasChanges || isMutating || !selectedPermissions.length}
+              disabled={
+                !hasChanges ||
+                isMutating ||
+                (!editMode && selectedPermissions.length === 0)
+              }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ad1877c and 8082853.

📒 Files selected for processing (2)
  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{js,jsx,ts,tsx}: Use Biome for formatting and linting in TypeScript/JavaScript projects
Prefer named exports over default exports in TypeScript/JavaScript, except for Next.js pages

Files:

  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx
  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow strict TypeScript configuration
Use Zod for runtime validation in TypeScript projects

Files:

  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx
  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
**/*.{env,js,ts,go}

📄 CodeRabbit inference engine (CLAUDE.md)

All environment variables must follow the format: UNKEY_<SERVICE_NAME>_VARNAME

Files:

  • apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: MichaelUnkey
PR: unkeyed/unkey#3173
File: apps/docs/security/delete-protection.mdx:32-36
Timestamp: 2025-04-22T17:33:28.162Z
Learning: In the Unkey dashboard UI for delete protection, the button/link to initiate the process is labeled "Disable Delete Protection" while the confirmation button is labeled "Disable API Delete Protection". The documentation should maintain these different labels to match the actual UI.
Learnt from: MichaelUnkey
PR: unkeyed/unkey#3173
File: apps/docs/security/delete-protection.mdx:21-24
Timestamp: 2025-04-22T17:34:04.438Z
Learning: In the Unkey dashboard UI for enabling delete protection, the button/link to initiate the process is labeled "Enable Delete Protection" while the confirmation button is labeled "Enable API Delete Protection". The documentation should maintain these different labels to match the actual UI.
🧬 Code graph analysis (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1)
  • ROOT_KEY_MESSAGES (9-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Build / Build
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1)

31-35: Confirm documentation for root-key permissions labels
No occurrences of “Select Permissions…” or “Edit Permissions” were found under apps/docs. Verify whether any related docs or screenshots require updating to match the UI labels.

…y/constants.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – dashboard August 29, 2025 12:12 Inactive
@chronark chronark merged commit b952802 into main Sep 1, 2025
17 checks passed
@chronark chronark deleted the eng-2009-edit-permissions-probably-would-be-abetter-label-if-it-has branch September 1, 2025 10:13
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.

Edit Permissions probably would be abetter label if it has permissions attached

2 participants