fix(tests): resolve AmbiguousStep conflict and robot helper import path
CI / lint (pull_request) Successful in 1m2s
CI / helm (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 1m10s
CI / typecheck (pull_request) Successful in 1m19s
CI / security (pull_request) Successful in 1m20s
CI / quality (pull_request) Successful in 1m39s
CI / push-validation (pull_request) Successful in 44s
CI / unit_tests (pull_request) Successful in 10m27s
CI / docker (pull_request) Successful in 2m48s
CI / integration_tests (pull_request) Successful in 17m20s
CI / coverage (pull_request) Successful in 22m15s
CI / status-check (pull_request) Successful in 4s
CI / lint (pull_request) Successful in 1m2s
CI / helm (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 1m10s
CI / typecheck (pull_request) Successful in 1m19s
CI / security (pull_request) Successful in 1m20s
CI / quality (pull_request) Successful in 1m39s
CI / push-validation (pull_request) Successful in 44s
CI / unit_tests (pull_request) Successful in 10m27s
CI / docker (pull_request) Successful in 2m48s
CI / integration_tests (pull_request) Successful in 17m20s
CI / coverage (pull_request) Successful in 22m15s
CI / status-check (pull_request) Successful in 4s
Three issues causing CI failures in advanced-context-strategies tests:
1. AmbiguousStep: `@then("the strategy should be {strategy_type}")` in
advanced_context_strategies_steps.py conflicted with the existing
`@then('the strategy should be "{expected_strategy}"')` in
plan_merge_strategy_steps.py:122. Renamed to
`@then("the loaded strategy type should be {strategy_type}")` and
updated all four matching lines in the feature file.
2. Wrong fragment count assertion: scenario "Semantic search strategy
ranks by embedding similarity" expected 3 fragments but
SemanticEmbeddingStrategy (word-overlap Jaccard, min_similarity=0.05)
correctly filters "File input output handler" (0 overlap with
"database connection"). Fixed assertion from 3 to 2.
3. Robot helper import failure: `features.mocks` is not importable when
Robot Framework imports the library because it adds robot/ to
sys.path but not the project root. Added explicit project-root
sys.path.insert before the features.mocks import (same pattern as
helper_lsp_stub.py), with # noqa: E402 on the post-path imports.
ISSUES CLOSED: #7574
This commit is contained in:
@@ -19,7 +19,7 @@ Feature: Advanced Context Strategies Integration Tests
|
||||
And a context budget with max_tokens 1000 and reserved_tokens 0
|
||||
When I search with query "database connection"
|
||||
Then the first result should have uko_node "project://app/db.py"
|
||||
And the result should have 3 fragments
|
||||
And the result should have 2 fragments
|
||||
|
||||
@semantic_search
|
||||
Scenario: Semantic search filters low-similarity results
|
||||
@@ -169,27 +169,27 @@ Feature: Advanced Context Strategies Integration Tests
|
||||
Scenario: Load semantic search strategy from YAML
|
||||
Given a YAML policy with semantic search configuration
|
||||
When I load the strategy from YAML
|
||||
Then the strategy should be "semantic-embedding"
|
||||
Then the loaded strategy type should be "semantic-embedding"
|
||||
And the strategy should have min_similarity configured
|
||||
|
||||
@yaml_config
|
||||
Scenario: Load relevance scoring strategy from YAML
|
||||
Given a YAML policy with relevance scoring configuration
|
||||
When I load the strategy from YAML
|
||||
Then the strategy should be "relevance-scoring"
|
||||
Then the loaded strategy type should be "relevance-scoring"
|
||||
|
||||
@yaml_config
|
||||
Scenario: Load adaptive selector from YAML
|
||||
Given a YAML policy with adaptive selector configuration
|
||||
When I load the strategy from YAML
|
||||
Then the strategy should be "adaptive-selector"
|
||||
Then the loaded strategy type should be "adaptive-selector"
|
||||
And the strategy should have fallback strategy configured
|
||||
|
||||
@yaml_config
|
||||
Scenario: Load context fusion from YAML
|
||||
Given a YAML policy with context fusion configuration
|
||||
When I load the strategy from YAML
|
||||
Then the strategy should be "context-fusion"
|
||||
Then the loaded strategy type should be "context-fusion"
|
||||
And the strategy should have multiple strategies configured
|
||||
|
||||
@yaml_config
|
||||
|
||||
@@ -402,7 +402,7 @@ def step_selected_strategy(context: Context, strategy_name: str) -> None:
|
||||
assert context.selected_name == expected
|
||||
|
||||
|
||||
@then("the strategy should be {strategy_type}")
|
||||
@then("the loaded strategy type should be {strategy_type}")
|
||||
def step_loaded_strategy_type(context: Context, strategy_type: str) -> None:
|
||||
"""Check loaded strategy type."""
|
||||
expected = strategy_type.strip('"')
|
||||
|
||||
@@ -2,19 +2,28 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from features.mocks.advanced_context_strategies_mocks import (
|
||||
# Robot Framework adds the library file's directory (robot/) to sys.path, but
|
||||
# features.mocks lives at the project root. Insert the project root so the
|
||||
# import below resolves correctly regardless of invocation context.
|
||||
_PROJECT_ROOT = str(Path(__file__).resolve().parents[1])
|
||||
if _PROJECT_ROOT not in sys.path:
|
||||
sys.path.insert(0, _PROJECT_ROOT)
|
||||
|
||||
from features.mocks.advanced_context_strategies_mocks import ( # noqa: E402
|
||||
AdaptiveContextSelector,
|
||||
ContextFusionStrategy,
|
||||
RelevanceScoringStrategy,
|
||||
)
|
||||
|
||||
from cleveragents.application.services.context_strategies import (
|
||||
from cleveragents.application.services.context_strategies import ( # noqa: E402
|
||||
BreadthDepthNavigatorStrategy,
|
||||
SemanticEmbeddingStrategy,
|
||||
)
|
||||
from cleveragents.domain.models.core.context_fragment import (
|
||||
from cleveragents.domain.models.core.context_fragment import ( # noqa: E402
|
||||
ContextBudget,
|
||||
ContextFragment,
|
||||
FragmentProvenance,
|
||||
|
||||
Reference in New Issue
Block a user