Skip to content

Build extension manager catalog UX - #124

Merged
suraj-ranganath merged 2 commits into
feature/eegprep-extension-completionfrom
phase/3-extension-manager-catalog
Jun 3, 2026
Merged

suraj-ranganath merged 2 commits into
feature/eegprep-extension-completionfrom
phase/3-extension-manager-catalog

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Build the Extension Manager around the Phase 1 registry and metadata-only curated catalog. It shows installed, bundled, curated, disabled, incompatible, failed, and missing-dependency states with details and copyable package-manager guidance. Adds catalog docs, help, and regression coverage.

Closes #115

@claude

claude Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 2m 48s —— View job


Code Review — PR #124: Build extension manager catalog UX

  • Read changed files (catalog, plugin_menu, exports, docs, help, tests)
  • Review extension_catalog.py
  • Review plugin_menu.py changes
  • Review tests & docs
  • Check EEGLAB parity & AGENTS.md compliance
  • Post review feedback

Overall this is a well-structured, security-conscious feature. The metadata-only catalog (no code, no archives, no network, shlex.quote'd copyable commands, prominent trust warnings) is exactly the right posture, and it stays standalone (packaged extension_catalog.json + resources/help/plugin_menu.md, no EEGLAB-checkout dependency). State coverage (bundled/installed/curated/disabled/incompatible/failed/missing-dependency/conflict) is thorough and the tests exercise it headlessly. Nice work.

A few findings, mostly low/medium:

1. update_available treats a downgrade as an update (medium)

src/eegprep/functions/adminfunc/plugin_menu.py:442-444

"update_available": bool(
    catalog_entry and version and catalog_entry.version and version != catalog_entry.version
),

This is a raw string inequality, so an installed version newer than the catalog (installed 1.2.0, catalog 1.1.0) is reported as "update available" and surfaces an effective downgrade command. Consider a real version comparison (packaging.version.parse, already a transitive dep) so it only flags strictly-newer catalog versions. Also note string compare is lexicographic — "1.9.0" vs "1.10.0" would misorder even if you only wanted "differs".
Fix this →

2. GUI vs. text disagree on when to show Update commands (medium)

format_plugin_menu gates Update on update_available (plugin_menu.py:309):

if update_commands and plugin.get("update_available"):

but the GUI _command_text gates only on installed (plugin_menu.py:846):

if update_commands and plugin.get("installed"):

So for any installed+curated PyPI extension the GUI command box always shows "Update" commands even when the installed version already matches the catalog (no update available), while the console text does not. I'd align the GUI on update_available for consistency.
Fix this →

3. active computed twice and the record value is discarded (low)

_plugin_from_record sets "active": record.is_active (plugin_menu.py:409, :421), but _normalize_plugin unconditionally overwrites it with _is_active(normalized) (plugin_menu.py:541). The record-derived value is never used. The two definitions also disagree on CURATED: ExtensionRecord.is_active (extensions.py:211) counts CURATED as active when enabled + spec, whereas _is_active additionally requires installed, and CURATED is intentionally absent from _INSTALLED_STATUSES. It works out (catalog-only entries are correctly inactive), but it's subtle — dropping the unused "active" assignment in _plugin_from_record or adding a one-line comment on why _is_active re-derives it would reduce confusion.

4. Update guidance shown for failed/incompatible installed extensions (low)

_command_text shows the Update block for any installed extension, which includes failed_import / incompatible / missing_dependency states (they're in _INSTALLED_STATUSES). Offering "update" commands for a broken import may mislead; _install_guidance already steers these toward "review the errors first," so the command box could stay consistent with that.

5. Confirm intent: archives rejected for local sources too (low / question)

_looks_like_archive (extension_catalog.py:274) rejects source.url ending in .whl/.zip/etc. for all source types, including local. A lab pointing a local entry at a built wheel path would be rejected. This seems intentional (metadata/repo/path, never an archive) and matches the docs, but worth confirming since local .whl is a plausible workflow.

Minor / nits

  • _show_plugin_dialog (plugin_menu.py:603-604): app = ... or QApplication([]); del app — the del is cosmetic; the singleton is held by Qt. Fine, just noting.
  • Worth a quick uv run sphinx-build (or --changed-from) check on docs/source/user_guide/extensions.rst to confirm the section-title underlines (Installing Extensions, Trust and Safety, Catalog Schema) are long enough to avoid Sphinx underline warnings.
  • AGENTS.md note satisfied: EXTERNAL_PLUGIN_NOTICE clearly states the manager never installs/updates/removes — good alignment with the menu-placeholder exclusion convention.

I wasn't able to run the test suite in this environment (sandbox blocked uv run pytest), so the above is from static review; the new tests look correct and comprehensive on read.
· branch phase/3-extension-manager-catalog

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Specification for the Phase 3 Extension Manager PR.

Problem

src/eegprep/functions/adminfunc/plugin_menu.py previously exposed a bundled-only manager surface, so scripts and the GUI could not distinguish installed external extensions, catalog-only entries, disabled/incompatible records, failed imports, missing dependencies, or safe install guidance. Issue #115 also needs local catalog JSON support, metadata conflict reporting, and a details-oriented manager UI.

Approach

src/eegprep/functions/adminfunc/extension_catalog.py:34 adds metadata-only catalog entries, local/env/packaged JSON loading, archive URL rejection, and copyable uv/pip command generation. src/eegprep/functions/adminfunc/plugin_menu.py:142 keeps the EEGLAB-style public APIs while merging Phase 1 registry records with catalog metadata, and src/eegprep/functions/adminfunc/plugin_menu.py:609 builds the two-pane Extension Manager dialog with status rows, details, trust warning, Help, and copy commands. Docs/help resources were added under docs/source/user_guide/extensions.rst and src/eegprep/resources/help/plugin_menu.md.

Key code

def _plugins_from_records(
    records: Sequence[ExtensionRecord],
    catalog: ExtensionCatalog,
    catalog_info: dict[str, Any],
) -> list[dict[str, Any]]:
    by_name = catalog.by_name()
    by_package = catalog.by_package()
    used_catalog_names: set[str] = set()
    plugins: list[dict[str, Any]] = []

    for order, record in enumerate(records):
        catalog_entry = _catalog_for_record(record, by_name, by_package)
        if catalog_entry is not None:
            used_catalog_names.add(_normalize_name(catalog_entry.name))
        plugin = _plugin_from_record(record, catalog_entry, catalog_info)
        plugin["_order"] = order
        plugins.append(plugin)

    for index, catalog_entry in enumerate(catalog.entries):
        if _normalize_name(catalog_entry.name) in used_catalog_names:
            continue
        plugin = _plugin_from_catalog(catalog_entry, catalog_info)
        plugin["_order"] = len(records) + index
        plugins.append(plugin)

Tests

tests/test_plugin_menu.py:112 covers catalog-only install guidance, installed-only private/local extensions, installed-plus-catalog updates, disabled/incompatible/failed/missing-dependency states, catalog conflicts, unavailable catalogs, local JSON loading, archive rejection, env catalog paths, packaged help, and Qt details/copy behavior. Also ran tests/test_extensions.py, tests/test_package_exports.py, a focused main-menu dispatch test, and the help resource tests.

Visual QA

eegprep_extension_manager_phase3.png
eegprep_extension_manager_phase3.png

@suraj-ranganath
suraj-ranganath merged commit fcae587 into feature/eegprep-extension-completion Jun 3, 2026
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.

1 participant