Skip to content

Tech-debt: remove dead code (error subsystem ~1800 lines, dead SRT translator, dead placeholder correction) #227

Description

@hydropix

Summary

The tree carries several large blocks of dead code from abandoned refactors. They inflate src/core by roughly 10%, mislead readers about how the system works, and contain latent bugs that would bite anyone who wires them back in. This is a cleanup / tech-debt tracking issue.

Dead error-handling subsystem (~1,800 lines)

  • src/core/adapters/retry_manager.py (401), error_recovery.py (525), error_handler.py (432), error_logger.py (442)
  • Exported from adapters/__init__.py but instantiated by no pipeline (verified repo-wide). The real retry logic lives in translator.py / xhtml_translator.py.
  • Latent bugs if revived: GracefulDegradation.merge_partial_results sorts unit ids lexicographically (chunk_10 < chunk_2, error_recovery.py:524); RetryManager retries LLMRateLimitError with sleeps instead of integrating with the auto-pause contract.

Dead SRT translator (full second implementation)

  • src/core/subtitle_translator.py: translate_subtitles and translate_subtitles_in_blocks have no callers. translate_subtitles would crash on first use — it passes custom_instructions= to generate_translation_request (:104), which has no such parameter (translator.py:418), proving it never runs. Only refine_subtitle_translations is live.

Dead placeholder-correction machinery (~200 lines, EPUB)

  • src/core/epub/xhtml_translator.py:266-385: attempt_placeholder_correction, build_specific_error_details, extract_corrected_text have zero callers; MAX_PLACEHOLDER_CORRECTION_ATTEMPTS = 0. It still branches on five retired placeholder formats. TranslationMetrics.correction_attempts/success are serialized but can never change.

Other dead modules

  • src/core/epub/xml_helpers.py: four public functions, no callers; rebuild_element_from_translated_content sets element.tail = None (would delete following text if used).
  • src/core/common/parallel.py:23-60 (iter_ordered_windows / gather_window): used only by tests; iter_ordered_concurrent is the sole production scheduler.
  • src/web/static/js/ui/form-manager.js:691-788 (getTranslationConfig/validateConfig): never called, and drifted (missing Mistral/DeepSeek/Poe/NIM keys, plain_text_mode, glossary, refine).

Suggested approach

Delete (don't comment out) the confirmed-dead modules; the live code paths are translator.py/xhtml_translator.py for retry, SrtAdapter/srt_refiner for SRT, iter_ordered_concurrent for parallelism. Removing these eliminates the most misleading code in the tree.

Side note (separate but cheap): translation_orchestrator.py and docx_translation_adapter.py have French docstrings, which violates the English-only policy in CLAUDE.md.


Found during the June 2026 repo audit. Severity: tech-debt. Confidence: certain (dead).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cleanup / tech-debtaudit-2026-06Found during the June 2026 repo audittech-debtDead code, duplication, architecture cleanup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions