refactor(language): LanguageRepository port + SubtitleKnowledgeBase wired to it
Mirror the MediaProber / FilesystemScanner pattern for language lookup: - New Protocol `LanguageRepository` in alfred.domain.shared.ports covering from_iso, from_any, all, __contains__, __len__ — the surface previously coupled to the concrete LanguageRegistry. - SubtitleKnowledgeBase types its `language_registry` parameter against the Protocol; the concrete LanguageRegistry stays in infrastructure as the YAML-backed adapter and remains the default when no repository is injected. - New unit tests in tests/infrastructure/test_language_registry.py cover the adapter surface (from_iso, from_any, membership, case-insensitivity, non-string inputs). Behaviour is unchanged for existing callers. The split opens the door to in-memory fakes in future tests without loading the full ISO 639 YAML.
This commit is contained in:
@@ -15,8 +15,23 @@ callers).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **`LanguageRepository` port** in `alfred.domain.shared.ports`. Structural
|
||||
Protocol covering `from_iso`, `from_any`, `all`, `__contains__`, `__len__`
|
||||
— the surface previously coupled to the concrete `LanguageRegistry`.
|
||||
Mirrors the `MediaProber` / `FilesystemScanner` pattern: domain code
|
||||
depends on the Protocol, infrastructure provides the YAML-backed
|
||||
adapter. Tests in `tests/infrastructure/test_language_registry.py`.
|
||||
|
||||
### Internal
|
||||
|
||||
- **`SubtitleKnowledgeBase` types `language_registry` against the
|
||||
`LanguageRepository` port** instead of the concrete `LanguageRegistry`
|
||||
class. The default constructor still instantiates the concrete adapter
|
||||
when no repository is injected — behaviour is unchanged for existing
|
||||
callers. Opens the door to in-memory fakes in future tests without
|
||||
loading the full ISO 639 YAML.
|
||||
- **Moved `detect_media_type` and `enrich_from_probe` from
|
||||
`alfred.application.filesystem` to `alfred.application.release`**.
|
||||
They are inspection-pipeline helpers — their natural home is next to
|
||||
|
||||
Reference in New Issue
Block a user