Skip to content

Conversation

@sirily11
Copy link
Contributor

…ment; add scope utilities and tests

Copilot AI review requested due to automatic review settings January 18, 2026 05:07
@vercel
Copy link

vercel bot commented Jan 18, 2026

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

Project Deployment Review Updated (UTC)
rxlab-auth Ready Ready Preview, Comment Jan 18, 2026 5:17am

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the OAuth system with dynamic scope management, replacing hardcoded scope definitions with a flexible, metadata-rich approach. It introduces a new scope utilities module that defines scopes with icons, titles, and subtitles, implements resource-based scopes with read/write operations (e.g., read:profile, write:profile), and provides helper functions for scope management.

Changes:

  • Introduced centralized scope management system with UI metadata (lib/scopes.ts)
  • Enhanced OAuth client form with improved scope selection UI showing grouped resources and operations
  • Updated OAuth consent card to use dynamic scope information

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lib/scopes.ts New utility module defining scope resources, special scopes, and helper functions for scope management
lib/scopes.test.ts Comprehensive test coverage for scope utilities and helper functions
lib/validations/oauth.ts Updated to import scope definitions from centralized module
components/auth/oauth-consent-card.tsx Migrated from hardcoded SCOPE_INFO to dynamic getScope()
components/admin/client-form.tsx Enhanced with grouped resource-based scope selection UI and added data-testid attributes
e2e/oauth/consent.spec.ts Updated scope selection to use testid-based selectors
e2e/admin/clients.spec.ts New comprehensive E2E tests for scope selection functionality
e2e/fixtures/test-helpers.ts Updated helper to use testid-based selectors with improved comments
playwright.config.ts Formatting changes (indentation) and reuseExistingServer configuration update
CLAUDE.md Added testing documentation section with patterns and commands
app/favicon.ico Updated favicon (binary file)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

subtitle: "Authenticate your identity",
icon: Key,
required: true,
},
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

The offline_access scope is missing from SPECIAL_SCOPES. Previously, this scope was supported in the SUPPORTED_SCOPES array (as seen in the old lib/validations/oauth.ts). This is a breaking change that will cause existing OAuth clients using offline_access to fail. Additionally, the tests in lib/scopes.test.ts expect this scope to exist (lines 56 and 68), which means these tests will fail. Add the offline_access scope entry to SPECIAL_SCOPES.

Suggested change
},
},
{
key: "offline_access",
title: "Offline access",
subtitle: "Access your data when you're not online",
icon: Shield,
},

Copilot uses AI. Check for mistakes.
url: "http://localhost:3000",
timeout: 30 * 1000,
reuseExistingServer: !process.env.CI,
reuseExistingServer: false,
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

The change from reuseExistingServer: !process.env.CI to reuseExistingServer: false means the dev server will always be restarted, even in local development. This will slow down E2E test iterations during development. If this change is intentional, consider keeping the CI-aware behavior for better developer experience, or document the reason for this change.

Suggested change
reuseExistingServer: false,
reuseExistingServer: !process.env.CI,

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +46
await page.getByTestId('profile').click();
await page.getByTestId('email').click();
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

Inconsistent test selector usage. Lines 45-46 now use testid-based selectors (getByTestId('profile') and getByTestId('email')), but lines 41-42 above (not shown in diff) still use old selectors. Additionally, lines 51-52 (not shown) still use generic locator('input[readonly]') selectors instead of the new testid-based approach (getByTestId("client-id-display") and getByTestId("client-secret-display")). For consistency with the test-helpers.ts changes and better test reliability, consider updating all selectors in this test setup to use testids.

Copilot uses AI. Check for mistakes.
</Button>
))}
<div className="space-y-3">
{/* Special Scopes (openid, offline_access) */}
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

The comment mentions "offline_access" but this scope is missing from SPECIAL_SCOPES in lib/scopes.ts. This is inconsistent with the actual implementation. Update the comment to reflect the actual special scopes available, or add the missing offline_access scope to SPECIAL_SCOPES.

Suggested change
{/* Special Scopes (openid, offline_access) */}
{/* Special Scopes */}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,119 @@
import { Key, User, Mail, Shield, Eye, Pencil } from "lucide-react";
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

Unused import Shield.

Suggested change
import { Key, User, Mail, Shield, Eye, Pencil } from "lucide-react";
import { Key, User, Mail, Eye, Pencil } from "lucide-react";

Copilot uses AI. Check for mistakes.
@sirily11 sirily11 merged commit 6ccfdce into main Jan 18, 2026
4 checks passed
@sirily11 sirily11 deleted the permission branch January 18, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants