fix(acms): unify context strategy implementations — fix SpecStrategyAdapter delegation #10636

Open
HAL9000 wants to merge 2 commits from fix/v360/context-strategy-unification into master

2 Commits

Author SHA1 Message Date
HAL9000 7b2cbeb36b fix(acms): rank simple-keyword by overlap, update phase3 tests to unified protocol
CI / lint (pull_request) Successful in 36s
CI / helm (pull_request) Successful in 32s
CI / build (pull_request) Successful in 1m14s
CI / typecheck (pull_request) Successful in 1m21s
CI / security (pull_request) Successful in 1m20s
CI / quality (pull_request) Successful in 1m33s
CI / push-validation (pull_request) Successful in 26s
CI / unit_tests (pull_request) Successful in 10m30s
CI / docker (pull_request) Successful in 2m47s
CI / integration_tests (pull_request) Successful in 18m24s
CI / coverage (pull_request) Failing after 23m31s
CI / status-check (pull_request) Failing after 5s
SimpleKeywordStrategy.assemble now ranks by query-keyword overlap count
first, then by backend relevance score. The previous behaviour sorted
purely by backend score, producing incorrect ordering when a fragment
with fewer keyword matches outscored one with more matches.

Phase 3 integration helpers (ArceStrategy, TemporalArchaeologyStrategy,
PlanDecisionContextStrategy) were exercising the deleted service-layer
API: positional constructor args, single-dict can_handle, and
fragment-list assemble. Rewrite them to use the unified domain-layer
ContextStrategy protocol (ContextRequest + BackendSet + PlanContext
on assemble/can_handle, no constructor args), aligned with the
canonical helper in robot/helper_context_strategies.py.

Apply ruff format to features/steps/acms_pipeline_phase3_steps.py and
robot/helper_context_strategies.py so the CI lint gate is clean.

ISSUES CLOSED: #5495
2026-06-06 04:31:50 -04:00
HAL9000 bace1cae7e fix(acms): consolidate dual context strategy implementations to single canonical protocol
- Delete service-layer re-ranker implementations (context_strategies.py, acms_advanced_strategies.py) and replace with re-exports from canonical domain-model strategy_stubs.py

- Fix SpecStrategyAdapter to properly delegate to wrapped strategy when backends are provided (previously always fell back to relevance-score sorting, ignoring strategy logic)

- Add _configure_spec_adapters() to ACMSPipeline and update assemble() to accept backends and plan_context parameters

- Update ContextAssemblyPipeline.assemble() override to match new signature

- Write comprehensive BDD tests for the unified implementation (context_strategy_unification.feature)

- Update existing tests to use domain-model protocol

Fixes #5495

Relates to #3491

ISSUES CLOSED: #5495
2026-06-06 04:31:50 -04:00