Skip to content

Conversation

@nicoschmdt
Copy link
Contributor

@nicoschmdt nicoschmdt commented Jan 26, 2026

fix #3453

Tested by applying the change in User Custom Settings and leaving Settings with the JSON.parse(). The modification displayed the configurations correctly while the old version was showing duplicates.

Summary by Sourcery

Bug Fixes:

  • Resolve duplicated entries shown for extension permissions and user custom permissions in the settings view by using consistently parsed JSON values.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 26, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors how extension permissions JSON is parsed and displayed in the InstalledExtensionCard by moving JSON.parse calls into typed computed properties, preventing duplicated entries and improving type safety.

Class diagram for updated InstalledExtensionCard computed JSON parsing

classDiagram
  class InstalledExtensionCard {
    +ExtensionData extension
    +InstalledExtensionData installedExtension
    +JSONValue parsed_permissions()
    +JSONValue parsed_user_permissions()
    +string formatVersion()
    +string prettifySize(number size_kb)
  }

  class JSONValue
  class ExtensionData
  class InstalledExtensionData

  InstalledExtensionCard ..> JSONValue : uses
  InstalledExtensionCard ..> ExtensionData : renders
  InstalledExtensionCard ..> InstalledExtensionData : renders
Loading

File-Level Changes

Change Details Files
Route JSON parsing for extension permissions through computed properties instead of inline parsing in the template to avoid duplicated entries and enforce typing.
  • Replaced inline JSON.parse calls in the json-viewer bindings with references to parsed_permissions and parsed_user_permissions computed properties.
  • Introduced parsed_permissions and parsed_user_permissions computed properties that parse the extension.permissions and extension.user_permissions strings with JSON.parse and provide a fallback to an empty object.
  • Imported and used the JSONValue type so the new computed properties have an explicit and safe return type for the parsed JSON values.
core/frontend/src/components/kraken/cards/InstalledExtensionCard.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#3453 Fix the bug where the Extension Manager UI shows duplicated entries under 'User Custom Settings' (and related settings JSON display) for an extension.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-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.

Hey - I've left some high level feedback:

  • Both parsed_permissions and parsed_user_permissions call JSON.parse on potentially user-controlled strings without error handling; consider wrapping them in a try/catch and falling back to {} or null to avoid runtime errors when the JSON is malformed.
  • The two computed properties parsed_permissions and parsed_user_permissions are nearly identical; consider extracting a small helper (e.g., parseJsonOrDefault(this.extension.permissions)) to reduce duplication and keep the parsing logic consistent in one place.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Both `parsed_permissions` and `parsed_user_permissions` call `JSON.parse` on potentially user-controlled strings without error handling; consider wrapping them in a try/catch and falling back to `{}` or `null` to avoid runtime errors when the JSON is malformed.
- The two computed properties `parsed_permissions` and `parsed_user_permissions` are nearly identical; consider extracting a small helper (e.g., `parseJsonOrDefault(this.extension.permissions)`) to reduce duplication and keep the parsing logic consistent in one place.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@nicoschmdt nicoschmdt force-pushed the fix-duplicated-entries-extension branch from 882146a to 09bb6da Compare January 26, 2026 19:31
@patrickelectric patrickelectric merged commit 5c333ee into bluerobotics:master Jan 26, 2026
6 checks passed
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.

[Extension manager] duplicated entries shown under "User Custom Settings"

2 participants