UAT: PluginManager missing get_extension_point(name) public method — only O(n) list scan available #3939

Open
opened 2026-04-06 07:38:50 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/plugin-manager-get-extension-point
  • Commit Message: fix(plugins): add get_extension_point(name) public method to PluginManager for O(1) lookup
  • Milestone: Backlog
  • Parent Epic: #585

Summary

The PluginManager class exposes list_extension_points() -> list[ExtensionPoint] but lacks a get_extension_point(name: str) -> ExtensionPoint | None method for direct O(1) lookup by name. The internal _extension_points: dict[str, ExtensionPoint] already supports this, but the public API does not expose it. As a result, callers and feature-test step definitions must perform an O(n) linear scan to retrieve a specific extension point by name.

Bug Details

Feature Area: Plugin and Extension System

Code Location: src/cleveragents/infrastructure/plugins/manager.pyPluginManager class

Expected Behaviour: PluginManager exposes a get_extension_point(name: str) -> ExtensionPoint | None method that delegates to the internal _extension_points dict for O(1) lookup.

Actual Behaviour: Only list_extension_points() -> list[ExtensionPoint] is available. The feature test features/plugin_extension_points.feature works around this with a list comprehension filter:

# Step definition workaround in features/steps/plugin_extension_points_steps.py:
@when('I look up extension point "{name}"')
def step_lookup_by_name(context: Context, name: str) -> None:
    eps = context.ep_manager.list_extension_points()
    matches = [ep for ep in eps if ep.name == name]
    context.ep_lookup_result: ExtensionPoint | None = matches[0] if matches else None

Steps to Reproduce:

from cleveragents.infrastructure.plugins.manager import PluginManager
from cleveragents.infrastructure.plugins.extension_catalog import register_all_extension_points

manager = PluginManager()
register_all_extension_points(manager)

# This works but is O(n):
eps = manager.list_extension_points()
ep = next((e for e in eps if e.name == 'context.strategy'), None)

# This does NOT exist (missing method):
ep = manager.get_extension_point('context.strategy')  # AttributeError

Recommended Fix: Add a get_extension_point(name: str) -> ExtensionPoint | None method to PluginManager that delegates to self._extension_points.get(name).

Subtasks

  • Code: Add get_extension_point(name: str) -> ExtensionPoint | None method to PluginManager in src/cleveragents/infrastructure/plugins/manager.py, delegating to self._extension_points.get(name)
  • Code: Add argument validation (fail-fast) — raise ValueError if name is empty or not a str
  • Behave tests: Update features/plugin_extension_points.feature — add scenario for direct lookup via get_extension_point(name) returning the correct ExtensionPoint
  • Behave tests: Add scenario for get_extension_point(name) returning None when the name does not exist
  • Behave tests: Update step definition in features/steps/plugin_extension_points_steps.py to use get_extension_point(name) directly instead of the O(n) list-scan workaround
  • Quality: coverage ≥97%: Verify via nox -s coverage_report
  • Quality: nox full suite: Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Backlog note: This issue was discovered during autonomous operation on milestone v3.6.0. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/plugin-manager-get-extension-point` - **Commit Message**: `fix(plugins): add get_extension_point(name) public method to PluginManager for O(1) lookup` - **Milestone**: Backlog - **Parent Epic**: #585 ## Summary The `PluginManager` class exposes `list_extension_points() -> list[ExtensionPoint]` but lacks a `get_extension_point(name: str) -> ExtensionPoint | None` method for direct O(1) lookup by name. The internal `_extension_points: dict[str, ExtensionPoint]` already supports this, but the public API does not expose it. As a result, callers and feature-test step definitions must perform an O(n) linear scan to retrieve a specific extension point by name. ## Bug Details **Feature Area**: Plugin and Extension System **Code Location**: `src/cleveragents/infrastructure/plugins/manager.py` — `PluginManager` class **Expected Behaviour**: `PluginManager` exposes a `get_extension_point(name: str) -> ExtensionPoint | None` method that delegates to the internal `_extension_points` dict for O(1) lookup. **Actual Behaviour**: Only `list_extension_points() -> list[ExtensionPoint]` is available. The feature test `features/plugin_extension_points.feature` works around this with a list comprehension filter: ```python # Step definition workaround in features/steps/plugin_extension_points_steps.py: @when('I look up extension point "{name}"') def step_lookup_by_name(context: Context, name: str) -> None: eps = context.ep_manager.list_extension_points() matches = [ep for ep in eps if ep.name == name] context.ep_lookup_result: ExtensionPoint | None = matches[0] if matches else None ``` **Steps to Reproduce**: ```python from cleveragents.infrastructure.plugins.manager import PluginManager from cleveragents.infrastructure.plugins.extension_catalog import register_all_extension_points manager = PluginManager() register_all_extension_points(manager) # This works but is O(n): eps = manager.list_extension_points() ep = next((e for e in eps if e.name == 'context.strategy'), None) # This does NOT exist (missing method): ep = manager.get_extension_point('context.strategy') # AttributeError ``` **Recommended Fix**: Add a `get_extension_point(name: str) -> ExtensionPoint | None` method to `PluginManager` that delegates to `self._extension_points.get(name)`. ## Subtasks - [ ] **Code**: Add `get_extension_point(name: str) -> ExtensionPoint | None` method to `PluginManager` in `src/cleveragents/infrastructure/plugins/manager.py`, delegating to `self._extension_points.get(name)` - [ ] **Code**: Add argument validation (fail-fast) — raise `ValueError` if `name` is empty or not a `str` - [ ] **Behave tests**: Update `features/plugin_extension_points.feature` — add scenario for direct lookup via `get_extension_point(name)` returning the correct `ExtensionPoint` - [ ] **Behave tests**: Add scenario for `get_extension_point(name)` returning `None` when the name does not exist - [ ] **Behave tests**: Update step definition in `features/steps/plugin_extension_points_steps.py` to use `get_extension_point(name)` directly instead of the O(n) list-scan workaround - [ ] **Quality: coverage ≥97%**: Verify via `nox -s coverage_report` - [ ] **Quality: nox full suite**: Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. > **Backlog note:** This issue was discovered during autonomous operation on milestone v3.6.0. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#3939
No description provided.