From 4c4434c30915eef6a1059ff977817700a0c05b66 Mon Sep 17 00:00:00 2001 From: Artem Akymenko Date: Tue, 21 Jul 2026 09:18:51 +0000 Subject: [PATCH] fix: sanitize_output_stem signature + audio_sink import Two pre-existing bugs found during test coverage analysis: 1. sanitize_output_stem() only accepted 1 arg but resolve_project_layout passed 2 args (name, index) via sanitize_fn parameter. Fix: added optional index parameter to sanitize_output_stem. 2. audio_sink.py imported get_internal_cache_path from abogen.infrastructure.cache which doesn't exist. Fix: import from abogen.utils where the function lives. --- abogen/domain/audio_sink.py | 2 +- abogen/domain/output_paths.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/abogen/domain/audio_sink.py b/abogen/domain/audio_sink.py index 0fe9bd7..44cf939 100644 --- a/abogen/domain/audio_sink.py +++ b/abogen/domain/audio_sink.py @@ -54,7 +54,7 @@ def _ensure_ffmpeg() -> None: def _get_ffmpeg_cache_root() -> str: - from abogen.infrastructure.cache import get_internal_cache_path + from abogen.utils import get_internal_cache_path return get_internal_cache_path("ffmpeg") diff --git a/abogen/domain/output_paths.py b/abogen/domain/output_paths.py index 58c6f9a..4b79d40 100644 --- a/abogen/domain/output_paths.py +++ b/abogen/domain/output_paths.py @@ -76,7 +76,7 @@ def sanitize_filename_for_chapter(title: str, index: int, max_len: int = 80) -> return f"{index:02d}_{sanitized}" -def sanitize_output_stem(name: str) -> str: +def sanitize_output_stem(name: str, index: int = 0) -> str: base = Path(name or "").stem sanitized = _OUTPUT_SANITIZE_RE.sub("_", base).strip("_") return sanitized or "output"