Skip to content

feat(plugins): support enum settings - #667

Merged
tadelv merged 4 commits into
mainfrom
odev/issue-255-plugin-enum-setting
Aug 24, 2026
Merged

feat(plugins): support enum settings#667
tadelv merged 4 commits into
mainfrom
odev/issue-255-plugin-enum-setting

Conversation

@ODevStudio

@ODevStudio ODevStudio commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

What changed, and why?

  • Render plugin settings declared as enum with a select control.
  • Normalize only stale stored enum values before saving, using a valid manifest default or an explicit deletion tombstone.
  • Define enum values as a JSON array of strings and share one parser between manifest loading, service validation, and the settings UI.
  • Reject non-null enum settings outside the manifest's declared values in PluginLoaderService, including non-UI callers.

Linked Issue

Fixes #255

Verification

How did you verify the change? Include relevant tests and any manual or hardware testing.

  • flutter test --no-pub test/plugin_loader_service_appstore_test.dart test/plugins_settings_view_appstore_test.dart (42 passed)
  • flutter analyze --no-pub (no issues)
  • flutter test --no-pub (3,220 passed, 1 skipped; the known Windows CRLF-sensitive AsyncAPI schema assertion failed, while CI/Linux uses LF)

Impact

Note any user-visible behavior, compatibility, migration, API/spec, documentation, or security impact. Write None if there is none.

  • Plugin manifests can expose enum settings as a fixed-choice selector. Enum manifests use JSON string arrays, and invalid values are rejected at the service boundary. No migration or security impact.

Contributor Responsibility

AI-assisted development is allowed. The submitter remains responsible for the submitted work.

  • I have reviewed and understand all changes in this PR and take responsibility for their correctness, security, behavior, licensing, and provenance, including any AI-assisted or AI-generated work.

@ODevStudio
ODevStudio marked this pull request as ready for review August 22, 2026 15:22
@ODevStudio
ODevStudio requested a review from tadelv August 22, 2026 15:22

@tadelv tadelv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two changes requested before merge:

  1. enum validation currently exists only in PluginsSettingsView. PluginLoaderService._validateSettings() only checks whether a key exists, so callers outside this UI can still persist arbitrary values for an enum setting. Since this PR introduces enum as a plugin setting type, please move/share enum-value parsing at the settings-schema/service layer and reject non-null values outside the declared enum. The UI should consume the same parsed values so the two paths cannot drift.

  2. Since this defines the manifest contract, please use a JSON array for values (for example "values": ["Light", "Medium", "Dark"]) rather than a pipe-delimited string. The array is structurally valid JSON, avoids delimiter/escaping concerns, and is substantially easier to validate consistently.

The rest of the implementation looks good, including stale-value handling and preserving untouched defaults.

@tadelv
tadelv merged commit 4ab1525 into main Aug 24, 2026
5 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.

Plugin host: add support for enum type setting

2 participants