A visible plugin should not silently begin work. After reading the actual registration service and UI entry points, I built a small registry for examining preference transitions in isolation. It never runs a program and its records contain synthetic values only. The example makes each boundary inspectable without borrowing the original browser or its sessions.
Keep definitions separate from project preferences
The definition catalog contains only inert identifiers and names. A profile/project tuple owns registration, enabled and pinned preferences plus dismissal markers. Disabling a definition in one project leaves another project's settings alone. That tuple organizes this example; supplying its labels is not authentication or proof that a caller may operate a real project.
The original application has a bridge that exposes project preferences through a profile-like object. Reading only an older profile-based document would misdescribe the current storage scope. This module isolates the state distinction rather than copying that bridge. Production integration still needs an authenticated current-project binding and an owned durable store; neither is supplied by this in-memory class.
Pinning controls placement; enabling controls availability
Enabled and pinned are independent. An enabled pinned entry appears in both toolbar and menu; an enabled unpinned one appears only in the menu. Disabling hides both while retaining the pin, so enabling can restore the previous placement. The module does not implement the original UI's alphabetical sorting or drag-based pin ordering; its returned lists show only the stated visibility rules.
A pinned=False registration request does not unpin an existing entry: unpin is a separate action. Automatic registration likewise retains a deliberately disabled preference. Refreshing the environment should not rewrite a person's choices. Diagnostic snapshots and definition exports are deep copies, preventing accidental mutation through a returned object. This is local object isolation, not a concurrency guarantee.
Opening is preparation; a cancellation intent is not a result
Open checks enabled state and returns prepared=True with executed=False. Preparing a launcher differs from validating current inputs, mode and account before starting work. This package contains no execution function. The original pluginRun path has separate start checks and a runner call, so a registration receipt cannot honestly be presented as successful task execution.
Disable and remove optionally accept an invented active record. This example requests cancellation only when profile, project and program all match. It neither invokes a runner nor confirms that work stopped. A particular original branch compares profile and program instead, so this example's narrower tuple match must not be advertised as a guarantee across the original runtime. Bind and verify cancellation in the real owner before relying on it.
Explore the implementation
Complete independent synthetic implementation
"""Independent, in-memory synthetic registry. No task execution or persistence."""
from copy import deepcopy
def identifier(value):
if not isinstance(value, str) or not value or len(value) > 80:
raise ValueError("IDENTIFIER")
if not all(c.isascii() and (c.isalnum() or c in "-_") for c in value):
raise ValueError("IDENTIFIER")
return value
class Registry:
def __init__(self, definitions):
self._definitions = {}
for definition in definitions:
if set(definition) != {"id", "name"}:
raise ValueError("DEFINITION")
key = identifier(definition["id"])
if key in self._definitions or not isinstance(definition["name"], str) or not definition["name"].strip():
raise ValueError("DEFINITION")
self._definitions[key] = deepcopy(definition)
self._projects = {}
def _scope(self, scope):
if not isinstance(scope, tuple) or len(scope) != 2:
raise ValueError("SCOPE")
return tuple(identifier(part) for part in scope)
def _definition(self, key):
identifier(key)
if key not in self._definitions:
raise ValueError("MISSING_DEFINITION")
def _state(self, scope):
return self._projects.setdefault(self._scope(scope), {"preferences": {}, "dismissed": []})
def definitions(self):
return deepcopy(list(self._definitions.values()))
def snapshot(self, scope):
return deepcopy(self._state(scope))
def register(self, scope, key, *, automatic=False, pinned=False):
self._scope(scope)
self._definition(key)
if type(automatic) is not bool or type(pinned) is not bool:
raise ValueError("BOOLEAN")
state = self._state(scope)
if automatic and key in state["dismissed"]:
return {"registered": False, "enabled": False, "pinned": False, "reused": True, "executed": False}
existing = key in state["preferences"]
pref = state["preferences"].setdefault(key, {"enabled": True, "pinned": False})
if not automatic:
if pinned:
pref["pinned"] = True
state["dismissed"] = [item for item in state["dismissed"] if item != key]
return {"registered": True, **pref, "reused": existing, "executed": False}
def action(self, scope, key, action, *, active=None):
scope = self._scope(scope)
self._definition(key)
if action not in {"enable", "disable", "pin", "unpin", "open", "remove"}:
raise ValueError("ACTION")
if active is not None:
if not isinstance(active, dict) or set(active) != {"profile", "project", "program"}:
raise ValueError("ACTIVE_SHAPE")
for value in active.values():
identifier(value)
state = self._state(scope)
if key not in state["preferences"]:
raise ValueError("NOT_REGISTERED")
pref = state["preferences"][key]
if action == "open" and not pref["enabled"]:
raise ValueError("DISABLED")
if action == "remove":
del state["preferences"][key]
if key not in state["dismissed"]:
state["dismissed"].append(key)
elif action in {"enable", "disable"}:
pref["enabled"] = action == "enable"
elif action in {"pin", "unpin"}:
pref["pinned"] = action == "pin"
# An intent only: the caller must bind and cancel the real runner.
matching = active == {"profile": scope[0], "project": scope[1], "program": key}
return {"action": action, "prepared": action == "open", "executed": False,
"cancel_requested": bool(action in {"disable", "remove"} and matching)}
def visible(self, scope):
state = self._state(scope)
menu, toolbar = [], []
for key, pref in state["preferences"].items():
if pref["enabled"]:
menu.append(key)
if pref["pinned"]:
toolbar.append(key)
return {"menu": menu, "toolbar": toolbar}
Do not automatically resurrect a removed entry
Remove deletes the project's preference and adds a dismissal marker. It leaves the definition catalog intact. A later automatic registration of the same identifier returns registered=False without recreating the entry. A small explicit rule prevents initialization from repeatedly undoing a user's menu cleanup.
An explicit register call instead clears the marker and creates a registration. This example keeps no separate archive of the removed pin, so restoration defaults to unpinned. The recorded scenarios expose that detail rather than implying restoration of every former setting. Preserving an inert definition demonstrates a state boundary; it is not a backup or deletion tool for the original application's files, sessions, results or operating data.
What twenty-four tests and five records actually establish
Tests cover registration reuse, pin retention, disabled-open refusal, automatic restoration blocking and explicit restoration. They separate projects under one profile and separate profiles as well. Missing definitions and invalid actions, flags or active-record shapes are rejected; failed requests must leave existing settings unchanged. No simulated external-success message stands in for an action the package cannot perform.
Twenty-four source-package tests ran locally, and the packaging procedure repeats those twenty-four tests after extracting the distribution ZIP. Five records come from actual local calls to this class. The selector only reads those saved results. They do not establish the original UI, real runner cancellation or authorization behavior. Existing Northstar tests were read as design evidence, not newly executed by this content task.
Responsibilities that remain when attaching a real manager
Code, tests, record generation and documentation permit modification and reuse. State exists only in memory and disappears after process restart. An exported snapshot is diagnostic, not a recoverable storage format or an import protocol. Concurrent writers and persistence failures are outside this example's contract rather than silently claimed to be handled.
A service integration must attach authenticated current scope, durable persistence, conflict handling and confirmation of real execution cancellation. My purpose is to explain a settings interaction separately from the business action it may eventually prepare. The package stays small enough to inspect what every return value changed and which facts it has not established. The download carries those boundaries alongside the implementation.