Files
cleveragents-core/features
HAL9000 475e2a7843 fix(context): repair three errored semantic context search BDD scenarios
Three scenarios in features/semantic_context_search.feature were erroring
during behave execution, surfacing as test setup/teardown errors in CI's
unit_tests gate. Each had a distinct root cause:

1. "Filter fragments by minimum similarity threshold" (line 30) referenced
   context.ranked_fragments inside step_filter_by_threshold, but the
   scenario filters directly without first running the "rank fragments"
   step that populates that attribute. The filter step now computes
   per-fragment similarity inline from context.fragments +
   context.query_embedding so it works regardless of whether a prior
   ranking step ran.

2. "Semantic strategy selects relevant files" (line 41) constructed
   ContextFragment with a FragmentProvenance imported from
   cleveragents.domain.models.acms.crp. The core ContextFragment's
   provenance field is annotated with the core FragmentProvenance subclass
   (which adds resource_type), and pydantic v2's strict model_type check
   rejects a bare CRP-base instance. Switched the import to the core
   FragmentProvenance so the type matches.

3. "Embedding provider configuration" (line 53) stored its provider config
   on context.config. Behave's Context reserves the config attribute for
   its own Configuration object; user assignment raises KeyError inside
   Behave's scope-tracking __setattr__. Renamed to embedding_config.

Verified locally: behave on features/semantic_context_search.feature now
reports 6 scenarios passed / 0 errored. lint + typecheck both pass.

ISSUES CLOSED: #5254
2026-06-18 01:17:23 -04:00
..