[BUG] Dual StrategyCapabilities definitions use incompatible field names — pipeline StrategyCapabilities lacks uses_text/uses_vector/uses_graph/uses_temporal; StrategyRegistry.validate_registry() always warns for pipeline-registered strategies #9161

Open
opened 2026-04-14 08:53:08 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(acms): consolidate StrategyCapabilities to single domain model with spec-compliant fields
  • Branch: bugfix/acms-dual-strategy-capabilities-incompatible-fields

Background and Context

Feature Area: ACMS & Context Management
Spec Reference: docs/reference/context_strategies.md — StrategyCapabilities fields: uses_text, uses_vector, uses_graph, uses_temporal, resource_types, quality_score; ADR-014 §42630 — "StrategySelector calls can_handle() on all registered strategies"

There are two incompatible StrategyCapabilities definitions in the codebase:

  1. Domain model (src/cleveragents/domain/models/acms/strategy.py): Pydantic frozen model with spec-compliant fields: uses_text, uses_vector, uses_graph, uses_temporal, uko_levels, resource_types, supports_depth_breadth, supports_plan_hierarchy, supports_temporal, quality_score.

  2. Pipeline service (src/cleveragents/application/services/acms_service.py): Python dataclass with legacy fields: supports_semantic_search, supports_graph_navigation, supports_temporal_archaeology, max_fragments, quality_score. Missing: uses_text, uses_vector, uses_graph, uses_temporal, resource_types.

StrategyRegistry.validate_registry() (in strategy_registry.py) checks caps.uses_text or caps.uses_vector or caps.uses_graph or caps.uses_temporal to verify backend capability declarations. When strategies registered via ACMSPipeline.register_strategy() use the pipeline's StrategyCapabilities dataclass, validate_registry() always produces the warning "Strategy 'X' declares no backend capabilities" — because the dataclass has no uses_text/uses_vector/uses_graph/uses_temporal attributes (they evaluate to False via getattr fallback in SpecStrategyAdapter.capabilities).

Additionally, StrategyRegistry.validate_registry() warns "Strategy 'X' does not declare supported resource types" for any strategy using the pipeline's StrategyCapabilities (which has no resource_types field).

Expected Behavior

A single, unified StrategyCapabilities model with fields uses_text, uses_vector, uses_graph, uses_temporal, resource_types, quality_score as defined in the spec and in src/cleveragents/domain/models/acms/strategy.py. StrategyRegistry.validate_registry() returns no warnings for all 6 built-in strategies.

Acceptance Criteria

  • Only one StrategyCapabilities class exists in the codebase — the domain model in src/cleveragents/domain/models/acms/strategy.py
  • The duplicate StrategyCapabilities dataclass in src/cleveragents/application/services/acms_service.py is removed
  • All strategy implementations (RelevanceStrategy, RecencyStrategy, TieredStrategy, SimpleKeywordStrategy, SemanticEmbeddingStrategy, BreadthDepthNavigatorStrategy) use the domain StrategyCapabilities with correct spec-compliant field names
  • SpecStrategyAdapter.capabilities returns domain StrategyCapabilities directly
  • StrategyRegistry.validate_registry() produces zero warnings for all 6 built-in strategies
  • All pipeline strategies declare at least one of uses_text, uses_vector, uses_graph, or uses_temporal as True
  • All pipeline strategies declare a non-empty resource_types list

Steps to Reproduce

from cleveragents.application.services.acms_service import ACMSPipeline, StrategyCapabilities as PipelineCaps
from cleveragents.domain.models.acms.strategy import StrategyCapabilities as DomainCaps

# Pipeline caps has no uses_text/uses_vector/uses_graph/uses_temporal
caps = PipelineCaps(supports_semantic_search=True)
print(hasattr(caps, 'uses_text'))   # False
print(hasattr(caps, 'resource_types'))  # False

# StrategyRegistry.validate_registry() will warn for all pipeline strategies
from cleveragents.application.services.strategy_registry import StrategyRegistry
registry = StrategyRegistry()
pipeline = ACMSPipeline()
# Register a pipeline strategy into the domain registry
# validate_registry() will warn about missing backend capabilities

Subtasks

  • Consolidate to a single StrategyCapabilities class — use the domain model (strategy.py) as the canonical definition
  • Remove the duplicate StrategyCapabilities dataclass from acms_service.py
  • Update RelevanceStrategy, RecencyStrategy, TieredStrategy, SimpleKeywordStrategy, SemanticEmbeddingStrategy, BreadthDepthNavigatorStrategy in context_strategies.py and acms_service.py to use domain StrategyCapabilities with correct field names
  • Update SpecStrategyAdapter.capabilities to return domain StrategyCapabilities directly
  • Verify StrategyRegistry.validate_registry() passes for all built-in strategies
  • Tests (Behave): Add @tdd_issue scenario capturing the duplicate-definition bug (tagged @tdd_expected_fail until fixed)
  • Tests (Behave): Add regression scenario for validate_registry() on all 6 built-in strategies
  • Run nox (all default sessions), fix any errors
  • Verify coverage ≥97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • Single StrategyCapabilities definition used throughout the codebase
  • StrategyRegistry.validate_registry() returns no warnings for all 6 built-in strategies
  • All pipeline strategies declare uses_text, uses_vector, uses_graph, or uses_temporal correctly
  • All pipeline strategies declare non-empty resource_types
  • Existing tests pass; new regression test added for validate_registry() on built-in strategies
  • 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.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `fix(acms): consolidate StrategyCapabilities to single domain model with spec-compliant fields` - **Branch**: `bugfix/acms-dual-strategy-capabilities-incompatible-fields` ## Background and Context **Feature Area**: ACMS & Context Management **Spec Reference**: `docs/reference/context_strategies.md` — StrategyCapabilities fields: `uses_text`, `uses_vector`, `uses_graph`, `uses_temporal`, `resource_types`, `quality_score`; ADR-014 §42630 — "StrategySelector calls can_handle() on all registered strategies" There are **two incompatible `StrategyCapabilities` definitions** in the codebase: 1. **Domain model** (`src/cleveragents/domain/models/acms/strategy.py`): Pydantic frozen model with spec-compliant fields: `uses_text`, `uses_vector`, `uses_graph`, `uses_temporal`, `uko_levels`, `resource_types`, `supports_depth_breadth`, `supports_plan_hierarchy`, `supports_temporal`, `quality_score`. 2. **Pipeline service** (`src/cleveragents/application/services/acms_service.py`): Python dataclass with legacy fields: `supports_semantic_search`, `supports_graph_navigation`, `supports_temporal_archaeology`, `max_fragments`, `quality_score`. **Missing**: `uses_text`, `uses_vector`, `uses_graph`, `uses_temporal`, `resource_types`. `StrategyRegistry.validate_registry()` (in `strategy_registry.py`) checks `caps.uses_text or caps.uses_vector or caps.uses_graph or caps.uses_temporal` to verify backend capability declarations. When strategies registered via `ACMSPipeline.register_strategy()` use the pipeline's `StrategyCapabilities` dataclass, `validate_registry()` always produces the warning "Strategy 'X' declares no backend capabilities" — because the dataclass has no `uses_text`/`uses_vector`/`uses_graph`/`uses_temporal` attributes (they evaluate to `False` via `getattr` fallback in `SpecStrategyAdapter.capabilities`). Additionally, `StrategyRegistry.validate_registry()` warns "Strategy 'X' does not declare supported resource types" for any strategy using the pipeline's `StrategyCapabilities` (which has no `resource_types` field). ## Expected Behavior A single, unified `StrategyCapabilities` model with fields `uses_text`, `uses_vector`, `uses_graph`, `uses_temporal`, `resource_types`, `quality_score` as defined in the spec and in `src/cleveragents/domain/models/acms/strategy.py`. `StrategyRegistry.validate_registry()` returns no warnings for all 6 built-in strategies. ## Acceptance Criteria - [ ] Only one `StrategyCapabilities` class exists in the codebase — the domain model in `src/cleveragents/domain/models/acms/strategy.py` - [ ] The duplicate `StrategyCapabilities` dataclass in `src/cleveragents/application/services/acms_service.py` is removed - [ ] All strategy implementations (`RelevanceStrategy`, `RecencyStrategy`, `TieredStrategy`, `SimpleKeywordStrategy`, `SemanticEmbeddingStrategy`, `BreadthDepthNavigatorStrategy`) use the domain `StrategyCapabilities` with correct spec-compliant field names - [ ] `SpecStrategyAdapter.capabilities` returns domain `StrategyCapabilities` directly - [ ] `StrategyRegistry.validate_registry()` produces zero warnings for all 6 built-in strategies - [ ] All pipeline strategies declare at least one of `uses_text`, `uses_vector`, `uses_graph`, or `uses_temporal` as `True` - [ ] All pipeline strategies declare a non-empty `resource_types` list ## Steps to Reproduce ```python from cleveragents.application.services.acms_service import ACMSPipeline, StrategyCapabilities as PipelineCaps from cleveragents.domain.models.acms.strategy import StrategyCapabilities as DomainCaps # Pipeline caps has no uses_text/uses_vector/uses_graph/uses_temporal caps = PipelineCaps(supports_semantic_search=True) print(hasattr(caps, 'uses_text')) # False print(hasattr(caps, 'resource_types')) # False # StrategyRegistry.validate_registry() will warn for all pipeline strategies from cleveragents.application.services.strategy_registry import StrategyRegistry registry = StrategyRegistry() pipeline = ACMSPipeline() # Register a pipeline strategy into the domain registry # validate_registry() will warn about missing backend capabilities ``` ## Subtasks - [ ] Consolidate to a single `StrategyCapabilities` class — use the domain model (`strategy.py`) as the canonical definition - [ ] Remove the duplicate `StrategyCapabilities` dataclass from `acms_service.py` - [ ] Update `RelevanceStrategy`, `RecencyStrategy`, `TieredStrategy`, `SimpleKeywordStrategy`, `SemanticEmbeddingStrategy`, `BreadthDepthNavigatorStrategy` in `context_strategies.py` and `acms_service.py` to use domain `StrategyCapabilities` with correct field names - [ ] Update `SpecStrategyAdapter.capabilities` to return domain `StrategyCapabilities` directly - [ ] Verify `StrategyRegistry.validate_registry()` passes for all built-in strategies - [ ] Tests (Behave): Add `@tdd_issue` scenario capturing the duplicate-definition bug (tagged `@tdd_expected_fail` until fixed) - [ ] Tests (Behave): Add regression scenario for `validate_registry()` on all 6 built-in strategies - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage ≥97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - [ ] Single `StrategyCapabilities` definition used throughout the codebase - [ ] `StrategyRegistry.validate_registry()` returns no warnings for all 6 built-in strategies - [ ] All pipeline strategies declare `uses_text`, `uses_vector`, `uses_graph`, or `uses_temporal` correctly - [ ] All pipeline strategies declare non-empty `resource_types` - [ ] Existing tests pass; new regression test added for `validate_registry()` on built-in strategies - [ ] 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. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added this to the v3.4.0 milestone 2026-04-14 09:05:07 +00:00
Author
Owner

Triage: Verified [AUTO-OWNR-1]

Valid bug: There are dual StrategyCapabilities definitions with incompatible field names — the pipeline StrategyCapabilities lacks uses_text/uses_vector/uses_graph/uses_temporal fields, causing StrategyRegistry.validate_registry() to always warn for pipeline-registered strategies. This is a structural inconsistency that affects strategy validation.

Assigning to v3.4.0 (ACMS v1 + Context Scaling) as this is core ACMS strategy infrastructure. Priority High — causes persistent validation warnings and may mask real issues.

MoSCoW: Should Have — strategy validation correctness is important for ACMS reliability.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Triage: Verified** [AUTO-OWNR-1] Valid bug: There are dual `StrategyCapabilities` definitions with incompatible field names — the pipeline `StrategyCapabilities` lacks `uses_text/uses_vector/uses_graph/uses_temporal` fields, causing `StrategyRegistry.validate_registry()` to always warn for pipeline-registered strategies. This is a structural inconsistency that affects strategy validation. Assigning to **v3.4.0** (ACMS v1 + Context Scaling) as this is core ACMS strategy infrastructure. Priority **High** — causes persistent validation warnings and may mask real issues. MoSCoW: **Should Have** — strategy validation correctness is important for ACMS reliability. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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#9161
No description provided.