Skip to content

fix: skip missing extensions gracefully instead of crashing#2536

Merged
k9ert merged 4 commits intocryptoadvance:masterfrom
al-munazzim:fix-extension-missing-module
Mar 21, 2026
Merged

fix: skip missing extensions gracefully instead of crashing#2536
k9ert merged 4 commits intocryptoadvance:masterfrom
al-munazzim:fix-extension-missing-module

Conversation

@al-munazzim
Copy link
Copy Markdown
Contributor

EXTENSION_LIST in ProductionConfig includes optional extensions like liquidissuer that are not shipped with source installs. When any listed module is missing, get_classlist_of_type_clazz_from_modulelist() raises a SpecterError and prevents startup entirely.

Fix: Replace the raise SpecterError(...) with logger.warning(...) + continue, so missing extensions are skipped with a clear log message while the rest of the application loads normally.

Before:

SpecterError: Module cryptoadvance.specterext.liquidissuer.service could not be found...

After:

WARNING: Skipping extension cryptoadvance.specterext.liquidissuer.service: module not found (No module named 'cryptoadvance.specterext.liquidissuer'). Install it with: pip3 install <package-name>

One-line logic change in src/cryptoadvance/specter/util/reflection.py.

Closes #2496

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 5, 2026

Deploy Preview for specter-desktop-docs canceled.

Name Link
🔨 Latest commit 7fe4f44
🔍 Latest deploy log https://app.netlify.com/projects/specter-desktop-docs/deploys/69be7c9974f048000870a2a9

@k9ert k9ert force-pushed the fix-extension-missing-module branch from bac17f2 to ce383fc Compare March 19, 2026 13:13
@k9ert k9ert requested a review from Copilot March 19, 2026 13:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts extension/module reflection so Specter can start even when optional extensions listed in ProductionConfig.EXTENSION_LIST aren’t installed (regression fix for #2496), and adds tests to ensure missing modules are skipped rather than crashing startup.

Changes:

  • Update get_classlist_of_type_clazz_from_modulelist() to log a warning and skip missing modules instead of raising SpecterError.
  • Add regression tests ensuring missing modules are skipped and an empty list is returned when all modules are missing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/cryptoadvance/specter/util/reflection.py Changes missing-module handling from raising to warning+continue during static module/class discovery.
tests/test_util_reflection.py Adds regression coverage for skipping missing modules and returning an empty list when all are missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/cryptoadvance/specter/util/reflection.py Outdated
Comment thread src/cryptoadvance/specter/util/reflection.py Outdated
@al-munazzim al-munazzim force-pushed the fix-extension-missing-module branch from fde563a to f10a6bf Compare March 19, 2026 14:06
al-munazzim and others added 4 commits March 21, 2026 12:10
EXTENSION_LIST in ProductionConfig includes optional extensions like
liquidissuer that are not installed in source/development setups.
Previously, a missing module raised SpecterError and prevented startup.

Now logs a warning and continues loading the remaining extensions.
This follows the principle that optional extensions should be optional.

Fixes cryptoadvance#2496
…e#2496)

Two test cases:
- Missing module in middle of list: skipped with warning, others load fine
- All modules missing: returns empty list, no crash
- Make skip-on-missing behavior opt-in via skip_missing parameter
  (default False preserves strict behavior for non-extension callers)
- Only skip when e.name matches the module being imported; re-raise
  if an installed module has broken internal imports
- Use 'Skipping module' instead of 'Skipping extension' since the
  function is also used for device modules
- Add test for strict (default) behavior
- Pass skip_missing=True at Extension call sites in service_manager

Addresses Copilot review comments.
@k9ert k9ert force-pushed the fix-extension-missing-module branch from f10a6bf to 7fe4f44 Compare March 21, 2026 11:10
@k9ert k9ert merged commit 485bbbf into cryptoadvance:master Mar 21, 2026
9 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.

Bug: ModuleNotFoundError: No module named 'cryptoadvance.specterext.liquidissuer' Due to Uninstalled Extension in EXTENSION_LIST

3 participants