Feat: Existing permissions banner with list#288
Merged
Conversation
…ucture and clarity
- Updated mock implementations for ExistingPermissionsService to include methods for getting existing permissions status and creating existing permissions content. - Set default mock return values for existing permissions service methods to improve test reliability. - Adjusted tests to utilize the new existing permissions status in the PermissionRequestLifecycleOrchestrator tests.
This was referenced Mar 22, 2026
packages/gator-permissions-snap/src/core/existingpermissions/existingPermissionsService.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
packages/gator-permissions-snap/src/core/permissionRequestLifecycleOrchestrator.ts
Outdated
Show resolved
Hide resolved
jeffsmale90
reviewed
Mar 23, 2026
Contributor
jeffsmale90
left a comment
There was a problem hiding this comment.
Looking great!
I think it would be good if we could reduce the refetches of existing granted permissions, as they shouldn't ever change during the lifecycle of a permissions request.
packages/gator-permissions-snap/src/core/existingpermissions/existingPermissionsContent.tsx
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/core/existingpermissions/existingPermissionsService.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/core/existingpermissions/existingPermissionsService.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/core/existingpermissions/existingPermissionsService.ts
Show resolved
Hide resolved
packages/gator-permissions-snap/src/core/existingpermissions/existingPermissionsService.ts
Outdated
Show resolved
Hide resolved
…rove existing permissions handling
…xistingPermissionsContent.tsx Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
…xistingPermissionsService.ts Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This PR improves the permission confirmation experience when a dApp origin already has active (non-revoked) granted permissions stored in profile sync.
User-facing behavior
Implementation notes
ExistingPermissionsServiceand supporting UI (existingPermissionsContent,PermissionCard,permissionFormatter) integrated viaPermissionRequestLifecycleOrchestratorandPermissionHandler(event handlers for show/hide existing-permissions views).showExistingPermissionsonBaseContext(avoids requiring everybuildContextto set it); suffix-based stream/periodic categorization (-stream/-periodic); structuredloggerusage on storage failures and debug logging when token metadata formatting fails; alignedextractDescriptorNameimport with the rest of the snap; removed unused constructor dependency; fixed invalid barrel type export; expanded unit tests (existingPermissionsService,permissionFormatter).Related issues
Fixes:
Manual testing steps
yarn prepare:snap(if needed),yarn build, thenyarn startand open the dev site (e.g. http://localhost:8000) with MetaMask Flask and the local snaps (kernel / gator) connected.Screenshots/Recordings
Before
After
Screen.Recording.2026-03-23.at.3.58.00.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes the permission confirmation UI flow and orchestration (including async updates and button handling), which could impact users’ ability to grant/cancel requests if edge cases regress. Data/security impact is limited since it only reads stored grants and adjusts UI/state.
Overview
Adds an existing-permissions banner + review subview to the permission confirmation experience: when stored non-revoked grants exist for the requesting origin, the confirmation screen shows an info/warning banner (similar vs dissimilar stream/periodic) with a
Review themaction that swaps to a read-only, account-grouped list of existing permissions and aBack to requestcontrol.Refactors confirmation rendering so the footer grant/cancel buttons live inside
PermissionHandlerContent(notConfirmationDialog), and updates the orchestrator to prefetch a single profile-sync snapshot for both banner state and list rendering, with skeleton + fallback UI and improved logging/error handling. Updates permission formatting/display (PermissionCard,permissionFormatter) to support structured labeled fields and token-amount formatting, and expands tests to cover status classification, formatting behavior, and failure paths.Written by Cursor Bugbot for commit 62fddda. This will update automatically on new commits. Configure here.