The `{count:d} semantic chunking fragments should be returned` step
patterns collided with the pre-existing `{count} fragments should be
returned` step in advanced_context_strategies_steps.py:365 — behave's
default `{count}` parser matches `.+?` (non-greedy any char) and
captured "N semantic chunking", failing the registry's ambiguity
check at module-load time. The crash aborted load_step_definitions
for the entire unit_tests session, errored all 8 features in the
behave-parallel worker, and produced the CI failure with verdict
"0 features passed, 0 failed, 8 errored".
Rephrase the two ambiguous step patterns to put unique anchor words
first ("the semantic chunking result should contain {count:d}
fragments" / "...should contain at most {count:d} fragments") and
update the feature file's three call sites to match. Also mark two
defensive private-helper early-return branches with `# pragma: no
cover` — they are unreachable through the public ContextStrategy API
(`_default_embedding("")` is gated by `if not self._anchor` in
`assemble`; `_cosine_similarity` size mismatch is impossible because
all `_get_embedding` callers receive same-length vectors from the
same `embedding_fn`).
Local gates: lint, typecheck, full unit_tests (16 scenarios / 56
steps in the semantic_chunking feature pass; full suite passes),
integration_tests — all green.
ISSUES CLOSED: #9996
Adds a public __all__ list to semantic_chunking_strategy.py to explicitly declare the module's public API, consistent with the project's module documentation conventions.
This commit also triggers a fresh CI run to clear stale CI statuses that were incorrectly associated with this PR's head SHA from an unrelated issues-event CI run (run 14959, commit 658b86c9).
Replace BUILTIN_STRATEGIES ClassVar type annotation with dict[str, type[Any]]
to eliminate type: ignore[dict-item] suppressions on RelevanceStrategy, RecencyStrategy, and TieredStrategy entries.
Replace SpecStrategyAdapter type: ignore[assignment] with cast(ContextStrategy, ...)
for proper structural subtype annotation, consistent with the SemanticChunkingStrategy
registration fix applied in the previous commit.
All type: ignore comments are now removed from acms_service.py.
Pyright strict: 0 errors, 3 warnings (pre-existing langchain import warnings).
Use typing.cast(ContextStrategy, _sc_cls()) instead of a # type: ignore[assignment]
comment when registering SemanticChunkingStrategy in ACMSPipeline.__init__.
This eliminates the type suppression comment and makes the structural subtype
relationship explicit to the type checker.
Applied ruff auto-formatting to fix CI lint gate failure. The format check (ruff format --check) was failing on features/steps/semantic_chunking_strategy_steps.py due to list formatting and line length violations.
ISSUES CLOSED: #9996
Implementation summary:
- Created semantic_chunking_strategy.py with SemanticChunkingStrategy implementing
the ContextStrategy protocol with configurable embedding_model and top_k,
cosine similarity ranking against anchor message, embedding caching, token
budget enforcement, and relevance fallback when no anchor is provided
- Updated acms_service.py to register SemanticChunkingStrategy in ACMSPipeline
under key 'semantic_chunking' via lazy import
- Added features/semantic_chunking_strategy.feature with 16 BDD scenarios
covering all acceptance criteria from issue #9996
- Added features/steps/semantic_chunking_strategy_steps.py with step definitions
ISSUES CLOSED: #9996