-
Notifications
You must be signed in to change notification settings - Fork 5
feat(utils): split MCP and plugin requirements, add plugin integration tests #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
omid-aignostics
wants to merge
22
commits into
main
Choose a base branch
from
feat/split-utils-requirements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a8cf513
feat(utils): split MCP and plugin requirements, add plugin integratio…
omid-aignostics e422566
chore: exclude tests/resources/ from name-tests-test pre-commit hook
omid-aignostics 67ddbf8
chore: fix regex in name-tests-test pre-commit hook exclusion
omid-aignostics 83a52b5
refactor(tests): centralise dummy plugin install fixture in utils con…
omid-aignostics d5a0281
chore: fix YAML escape in pre-commit hook exclusion regex
omid-aignostics 0ed3d00
style: reformat test signature to single line per ruff
omid-aignostics 5008493
style: fix ruff formatting in mcp_test.py
omid-aignostics bb06bc4
chore(deps): upgrade lxml-html-clean to 0.4.4 and authlib to 1.6.9
omid-aignostics 74a5339
fix(tests): address Copilot review feedback on plugin tests
omid-aignostics 01e16f7
docs(requirements): add MCP servers to SHR-UTILS-2 plugin contributio…
omid-aignostics 403ba60
refactor(requirements): restructure UTILS requirements hierarchy
omid-aignostics 5848730
docs(requirements): simplify SWR-UTILS-2-4 wording to match SWR pattern
omid-aignostics 44d08c5
docs(specs): align FR-10 in SPEC-UTILS-SERVICE with SWR-UTILS-2-4
omid-aignostics 2d9cc35
fix(tests): use uv for dummy plugin install to avoid network access
omid-aignostics 01e6b01
docs(requirements): align SWR-UTILS-2-3 and FR-13 with implemented be…
omid-aignostics b3d57bb
fix(tests): make dummy plugin uninstall best-effort in fixture teardown
omid-aignostics 91c808b
fix(tests): update TC-UTILS-MCP-01 traceability tag from SWR-UTILS-1-…
omid-aignostics f0f5472
fix(tests): fall back to pip when uv is unavailable in plugin fixture
omid-aignostics aea6f5c
fix(tests): only suppress uninstall errors when package is already ab…
omid-aignostics ec4c878
docs(tests): align TC-UTILS-PLUGIN-03 feature title with SWR-UTILS-2-…
omid-aignostics f764695
docs(tests): remove function names from Gherkin scenario steps
omid-aignostics 1504e1d
fix(tests): use pip instead of uv for dummy plugin teardown uninstall
omid-aignostics File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| itemId: SHR-UTILS-2 | ||
| itemTitle: SDK Plugin System | ||
| itemType: Requirement | ||
| Requirement type: ENVIRONMENT | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Developers shall be able to extend the SDK with custom plugins. | ||
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| itemId: SWR-UTILS-2-1 | ||
| itemTitle: Plugin Module Discovery and Loading | ||
| itemHasParent: SHR-UTILS-2 | ||
| itemType: Requirement | ||
| Requirement type: FUNCTIONAL | ||
| Layer: System (backend logic) | ||
| --- | ||
|
|
||
| System shall discover and load externally installed plugin modules at runtime, making their functionality available without requiring changes to the core SDK codebase. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| itemId: SWR-UTILS-2-2 | ||
| itemTitle: Plugin CLI Command Integration | ||
| itemHasParent: SHR-UTILS-2 | ||
| itemType: Requirement | ||
| Requirement type: FUNCTIONAL | ||
| Layer: System (backend logic) | ||
| --- | ||
|
|
||
| System shall automatically register CLI commands contributed by plugin modules into the SDK command-line interface. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| itemId: SWR-UTILS-2-3 | ||
| itemTitle: Plugin GUI Navigation Integration | ||
| itemHasParent: SHR-UTILS-2 | ||
| itemType: Requirement | ||
| Requirement type: FUNCTIONAL | ||
| Layer: System (backend logic) | ||
| --- | ||
|
|
||
| System shall automatically register GUI navigation entries contributed by plugin modules into the SDK graphical user interface. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| itemId: SWR-UTILS-2-4 | ||
| itemTitle: Plugin MCP Server Integration | ||
| itemHasParent: SHR-UTILS-2 | ||
| itemType: Requirement | ||
| Requirement type: FUNCTIONAL | ||
| Layer: System (backend logic) | ||
| --- | ||
|
|
||
| System shall automatically register MCP servers contributed by plugin modules into the SDK MCP server. | ||
omid-aignostics marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Feature: Plugin CLI Command Integration | ||
|
|
||
| The SDK automatically registers CLI commands contributed by plugin modules | ||
| into the SDK command-line interface when the plugin is installed. | ||
|
|
||
| @tests:SWR-UTILS-2-2 | ||
| @id:TC-UTILS-PLUGIN-02 | ||
| Scenario: Plugin CLI commands are registered in the SDK CLI after installation | ||
| Given a plugin package registers an entry point under "aignostics.plugins" | ||
| And the plugin exposes a Typer CLI instance | ||
| When the plugin is installed | ||
| Then the plugin's CLI commands are available in the SDK command-line interface |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Feature: Plugin GUI Navigation Integration | ||
|
|
||
| The SDK automatically registers GUI navigation entries contributed by plugin | ||
| modules into the SDK graphical user interface when the plugin is installed. | ||
|
|
||
| @tests:SWR-UTILS-2-3 | ||
| @id:TC-UTILS-PLUGIN-03 | ||
| Scenario: Plugin GUI navigation entries are available in the SDK after installation | ||
| Given a plugin package registers an entry point under "aignostics.plugins" | ||
| And the plugin exposes a BaseNavBuilder subclass | ||
| When the SDK GUI collects navigation groups | ||
| Then the plugin's navigation entries are included in the SDK navigation |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| """Shared fixtures for utils tests.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import importlib | ||
| import shutil | ||
| import site | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| import pytest | ||
|
|
||
| if TYPE_CHECKING: | ||
| from collections.abc import Iterator | ||
|
|
||
| DUMMY_PLUGIN_DIR = Path(__file__).resolve().parents[2] / "resources" / "mcp_dummy_plugin" | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def install_dummy_plugin() -> Iterator[None]: | ||
| """Install the dummy plugin package in editable mode for the test session. | ||
|
|
||
| Refreshes site-packages so the running interpreter sees the new package | ||
| and its entry points without a process restart. | ||
|
|
||
| Note: Plugin discovery caches (discover_plugin_packages, DI caches) may have | ||
| been populated before this fixture runs. Tests that rely on post-install | ||
| discovery must pair this fixture with clear_plugin_caches to ensure caches | ||
| are reset before and after each test. | ||
|
|
||
| Raises: | ||
| subprocess.CalledProcessError: If install fails, or if uninstall fails for | ||
| a reason other than the package already being absent. | ||
| """ | ||
| uv = shutil.which("uv") | ||
| install_cmd = ( | ||
| [uv, "pip", "install", "--no-deps", "-e", str(DUMMY_PLUGIN_DIR)] | ||
| if uv | ||
| else [sys.executable, "-m", "pip", "install", "--no-deps", "-e", str(DUMMY_PLUGIN_DIR)] | ||
| ) | ||
| # Always use pip for uninstall: uv pip uninstall can fail with exit code 2 | ||
| # for editable installs it did not itself create the dist-info for. | ||
| uninstall_cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "mcp-dummy-plugin"] | ||
|
|
||
| subprocess.run(install_cmd, check=True, capture_output=True, text=True) | ||
|
|
||
| importlib.invalidate_caches() | ||
| for sp in site.getsitepackages(): | ||
| site.addsitedir(sp) | ||
|
|
||
omid-aignostics marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| yield | ||
|
|
||
| result = subprocess.run(uninstall_cmd, check=False, capture_output=True, text=True) | ||
| if result.returncode != 0: | ||
| output = (result.stderr or result.stdout or "").lower() | ||
| if not any(marker in output for marker in ("not installed", "no packages found")): | ||
| raise subprocess.CalledProcessError(result.returncode, result.args, result.stdout, result.stderr) | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.