fix(context): replace type: ignore with cast() in ACMSPipeline semantic_chunking registration

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.
This commit is contained in:
2026-04-23 17:36:26 +00:00
committed by Forgejo
parent 7568007e9e
commit 0fa592f24e
@@ -26,7 +26,7 @@ import re
from collections.abc import Sequence
from dataclasses import dataclass
from threading import local
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, runtime_checkable
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, cast, runtime_checkable
import structlog
@@ -785,7 +785,7 @@ class ACMSPipeline:
# Imported lazily to avoid circular imports.
if "semantic_chunking" not in self._strategies:
_sc_cls = _get_semantic_chunking_strategy_class()
self._strategies["semantic_chunking"] = _sc_cls() # type: ignore[assignment]
self._strategies["semantic_chunking"] = cast(ContextStrategy, _sc_cls())
# Register the 6 spec-required built-in strategies via adapters.
# These strategies implement the domain-model ContextStrategy protocol
# (strategy_stubs.py) and are wrapped in SpecStrategyAdapter instances