Skip to content

refactor(tts): split complex command handlers#105005

Merged
vincentkoc merged 1 commit into
mainfrom
refactor-tts-command-handlers
Jul 12, 2026
Merged

refactor(tts): split complex command handlers#105005
vincentkoc merged 1 commit into
mainfrom
refactor-tts-command-handlers

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

handleTtsCommands mixed command dispatch with the full chat override, latest-reply synthesis, and status-reporting implementations. At 368 lines and roughly 100 graph cognitive complexity, it was difficult to scan without crossing unrelated command behavior.

Related: #104982

Why This Change Was Made

  • Extract only the chat, latest-reply, and status action bodies into focused local helpers.
  • Keep the visible action dispatch chain and command-specific branches explicit.
  • Consolidate the identical chat persistence call after mutation.
  • Reuse a local text-result helper and remove redundant argument normalization already guaranteed by parsing.
  • Remove unused internal audio-result fields.
  • Add exact status-field ordering and /tts read latest alias characterization.

User Impact

No intended behavior change. TTS command syntax, authorization, persistence conflicts, synthesis metadata, status output, and reply text remain unchanged. Production code drops by 35 lines; the main handler drops from 368 to 195 lines and roughly halves its decision complexity.

Evidence

  • corepack pnpm test:serial src/auto-reply/reply/commands-tts.test.ts on Blacksmith Testbox tbx_01kxaaxxz7xgh30r4bmva194en: 13 tests passed.
  • corepack pnpm check:changed -- src/auto-reply/reply/commands-tts.ts src/auto-reply/reply/commands-tts.test.ts on the same Testbox: passed.
  • Fresh local autoreview: clean, no accepted/actionable findings.
  • git diff --check: passed.

@vincentkoc vincentkoc self-assigned this Jul 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 12, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready proof:

  • Focused Testbox: corepack pnpm test:serial src/auto-reply/reply/commands-tts.test.ts (13 tests passed).
  • Changed gate on Blacksmith Testbox tbx_01kxaaxxz7xgh30r4bmva194en: corepack pnpm check:changed -- src/auto-reply/reply/commands-tts.ts src/auto-reply/reply/commands-tts.test.ts passed.
  • Fresh autoreview: clean, no accepted/actionable findings.
  • Native review artifacts: validated with no findings; best-fix verdict extracts only the three cohesive large actions and keeps the uneven command branches explicit.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 105005: hosted exact/recent-rebase gates passed.

Known proof gaps: none material for this behavior-preserving internal refactor.

@vincentkoc
vincentkoc marked this pull request as ready for review July 12, 2026 05:23
@vincentkoc
vincentkoc merged commit f696430 into main Jul 12, 2026
89 of 91 checks passed
@vincentkoc
vincentkoc deleted the refactor-tts-command-handlers branch July 12, 2026 05:23
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant