Skip to content

feat(observability): fold TTS_FAULT into Settings and enforce the never-log rule - #22

Merged
prateekchaplot merged 1 commit into
mainfrom
arch/tts/t4.3
Nov 24, 2026
Merged

prateekchaplot merged 1 commit into
mainfrom
arch/tts/t4.3

Conversation

@prateekchaplot

Copy link
Copy Markdown
Owner

Task T4.3 from docs/ARCHITECTURE.md §14 (refs §11, NFR-06).

What changed

  • Settings gains fault (TTS_FAULT, default none); config.py is now the only environment reader for the fault hook (§7.1 field list updated in this PR per §14.4). Unknown values warn and disable injection; arming the fault logs a warning.
  • jobs/manager.py reads self._settings.fault instead of os.environ; both failure branches use a new _log_preview() helper capped at 80 characters.
  • New tests/unit/test_observability.py: a failed generation logs the §9.1 code + reason + 80-char preview and never the full input (difflib.SequenceMatcher longest common run <= 80), with no timing JSON; Settings.load() fault parsing (default/override/unknown) is pinned; a manager built with fault='none' succeeds even when TTS_FAULT=engine is set in the environment.
  • Dependent fault tests moved from env mutation to fault-enabled fixtures: unit fault_harness and integration fault_environment.

Verification

  • python -m ruff format --check src/tts tests — 53 files
  • python -m ruff check src/tts tests
  • python -m mypy --strict src/tts
  • pytest tests/unit --basetemp .venv/ptmp-t43 — 201 passed (5 new)
  • TTS_DATA_DIR=.venv/tts-data pytest tests/integration/test_jobs_pipeline.py -m integration — 7 passed against real en_US-lessac-medium (injected fault still leaves no .wav/.part)
  • git diff --check

Decisions

  • Fault injection is configuration, not an ad-hoc env read: Settings.fault is validated (none/engine), normalized for case/whitespace, and an unknown value falls back to none with a warning.
  • The 80-char preview now lives in one helper (_log_preview) and the never-log rule is enforced by a longest-common-substring assertion instead of a brittle string search.

@prateekchaplot
prateekchaplot merged commit 6734b22 into main Nov 24, 2026
5 checks passed
@prateekchaplot
prateekchaplot deleted the arch/tts/t4.3 branch November 24, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant