Repository navigation
Resolve permission constants dynamically from schemas - #20354
leecalcote merged 16 commits into
Conversation
Signed-off-by: Rishi Raj <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request refactors permission_constants.ts to dynamically resolve permission details from @meshery/schemas instead of using hardcoded UUIDs, bridging legacy SCREAMING_SNAKE_CASE keys with PascalCase definitions. Feedback includes correcting a copy-paste mapping error for UNINSTALL_EXTENSION and improving TypeScript type safety by avoiding the use of any in the accumulator of the reduce function.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR refactors the UI permission constants layer to resolve permission action UUIDs and subject strings dynamically from @meshery/schemas, replacing the previous large block of hardcoded permission metadata while aiming to preserve legacy SCREAMING_SNAKE_CASE exports.
Changes:
- Imports
PermissionDetailsfrom@meshery/schemas/permissionsand builds legacy aliases at runtime. - Adds a legacy-to-schema key mapping (
legacyToPascal) to bridgeSCREAMING_SNAKE_CASEto schema-aligned PascalCase names. - Exports a combined
keysobject intended to support both schema keys and legacy keys (currently introduces conflicts/duplication concerns).
Signed-off-by: Rishi Raj <[email protected]>
Signed-off-by: Rishi Raj <[email protected]>
Signed-off-by: Rishi Raj <[email protected]>
|
@aabidsofi19 , please take another look at the PR when you get a chance. I've updated it. There isn't a wrapper anymore. The file now just re-exports the generated permission keys and types from |
Hardcoded Permission UUIDs vs.
|
…s imports Signed-off-by: Rishi Raj <[email protected]>
1c5d7e1 to
b6df4c9
Compare
Signed-off-by: Rishi Raj <[email protected]>
8ee755e to
3fac11f
Compare
|
Commit SHA: END-TO-END TESTS
📦 Test Result Summary
⌛ Duration: 6 minutes and 26 seconds Overall Result: 👎 Some tests failed. [Show/Hide] Test Result Details
❌ Failed Test Details The following tests failed. Click on each to see the failure reason: ❌ Performance dashboard controls (Local - chromium-local-provider)File Location: Error Message: Code Snippet: ❌ Charts (Grafana) page loads (Local - chromium-local-provider)File Location: Error Message: 🔗 Relationship Tests [Show/Hide] Relationship Test Details (18 tests)
|
Feedback incoporated.
Description
This PR completes the migration of the permission constants architecture. It removes the legacy compatibility layer (
ui/utils/permission_constants.ts) entirely, migrating components to import and resolve all permission UUIDs (actions) and human-readable function names (subjects) directly from the@meshery/schemaspackage at runtime.This eliminates hardcoded UUIDs, subject strings, and the legacy bridging layer from the UI repository, establishing
@meshery/schemasas the single source of truth for permission details.What is changing?
SCREAMING_SNAKE_CASEkeys (such askeys.SHARE_DESIGN) with their canonical schema-alignedPascalCasenames (such asKeys.CatalogManagementShareDesign) across all 86 frontend source files (pages, components, and tests).ui/utils/permission_constants.tsfile completely and resolved all components to importKeysdirectly from@meshery/schemas/permissions.ui/utils/__tests__/permission_constants.test.tssince the legacy mapping file was deleted.MainViewsContent.tsx(VIEW_ACTIONS) andMainDesignsContent.tsx(DESIGN_ACTIONS) to follow a consistentSCREAMING_SNAKE_CASEnaming convention (DELETE_VIEW,EXPORT_DESIGN,SHARE_DESIGN), resolving mixed casing styles.Fixes #20402
Signed commits