Reject disabling unknown plugin IDs in PluginRegistry - #11134
Open
sanjyay wants to merge 1 commit into
Open
Conversation
PluginRegistry.setEnabled previously only checked for a manifest when enabling (value == true). When disabling an unknown plugin ID that has neither an installed manifest nor an entry in shell.json, the function proceeded through shellConfigMutator without finding any entries to remove, bumped registryRevision, emitted pluginsChanged, and returned true. setPluginEnabled in shell.qml therefore answered "ok" instead of "unknown", causing omarchy plugin disable <typo> to falsely report success. Guard disabling against plugin IDs that are neither installed nor present in the active shell configuration, while preserving config cleanup for uninstalled ghost plugins.
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.
What
Guard
PluginRegistry.setEnabledagainst plugin IDs that have neither an installed manifest nor an entry in the active shell configuration when disabling.Why
PluginRegistry.setEnabledpreviously only checked for a manifest when enabling (value == true). When disabling a plugin ID with a typo or one that does not exist, the function skipped the guard, made no modifications inshellConfigMutator, but still incrementedregistryRevision, emittedpluginsChanged, and returnedtrue.As a result,
shell.qml'ssetPluginEnabledreturned"ok"instead of"unknown", andomarchy plugin disable <id>falsely reported success.With this check, disabling an ID with neither a manifest on disk nor a location in
shell.jsonreturnsfalse, while disabling an uninstalled ghost plugin that is still listed inshell.jsoncontinues to clean up the configuration entry.Testing
test/shell.d/plugin-disable-test.shcoveringomarchy plugin disablesuccess, unknown plugin failure, omitted argument, and--help.test/shell.d/fixtures/plugin-registry/shell.qmlfor unknown plugin disable refusal and uninstalled ghost entry cleanup. Verified that reverting the fix causes contract test failure (sabotage check).qmllint shell/services/PluginRegistry.qmlandbash -n test/shell.d/plugin-disable-test.sh.plugin-registry-contract-test.sh,plugin-enable-test.sh,plugin-clone-test.sh,plugins-test.sh,plugin-add-test.sh,plugin-validate-test.sh,menu-plugin-test.sh,bar-test.sh, and./test/cli.omavm):fresh:omarchy plugin disable totally.made.upexited 0 and printedDisabled totally.made.up, andomarchy-shell shell setPluginEnabled totally.made.up falseansweredok./usr/share/omarchy/shell/services/PluginRegistry.qmland restarted the shell.omarchy plugin disable totally.made.upnow exits 1 withplugin 'totally.made.up' is not known; run: omarchy-shell shell rescanPlugins, and raw IPC returnsunknown.omarchy.agents).shell.jsonis cleaned up on the first disable call, and subsequent calls correctly fail withplugin is not known.Related issue
Fixes #11119