refactor(auto-yes-manager): decompose pollAutoYes() into single-responsibility functions#333
Merged
refactor(auto-yes-manager): decompose pollAutoYes() into single-responsibility functions#333
Conversation
…tions Extract 4 @internal export functions from pollAutoYes() (~139 lines) to improve testability and SRP compliance: - validatePollingContext(): Pre-condition checks - captureAndCleanOutput(): tmux output capture + ANSI cleanup - processStopConditionDelta(): Stop condition delta-based check - detectAndRespondToPrompt(): Prompt detection + auto-response Also add getPollerState() internal helper for consistency with existing getAutoYesState() accessor pattern. pollAutoYes() is now a ~30-line orchestrator. No functional changes - all 82 existing tests pass unchanged. 20 new timer-independent unit tests added (102 total). Refs #323 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace 'manual' as 'expired' type cast with direct 'expired' value in validatePollingContext test. The original cast was misleading since AutoYesStopReason only accepts 'expired' | 'stop_pattern_matched'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Issue #323 (pollAutoYes() refactoring) の pm-auto-issue2dev 全工程の 成果物を追加。Issueレビュー(8段階)→設計方針書→設計レビュー(4段階) →作業計画→TDD自動開発のレポートファイル一式。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pollAutoYes()(139行・7責務・14条件分岐) を4つの単一責務関数に分割し、タイマー非依存の個別テストを追加するリファクタリング。機能変更なし。Closes #323
Changes
Added
validatePollingContext()- ポーリングコンテキスト検証(@internal export)captureAndCleanOutput()- 出力キャプチャとANSIクリーニング(@internal export)processStopConditionDelta()- 停止条件デルタ処理(@internal export)detectAndRespondToPrompt()- プロンプト検出と応答(@internal export)getPollerState()- プライベートgetterヘルパーcreateTestPollerState()テストヘルパーファクトリChanged
pollAutoYes()を139行から42行のオーケストレーターに置換autoYesPollerStates.get()をgetPollerState()に統一Fixed
'manual' as 'expired'→'expired')Test Results
Unit Tests
Lint & Type Check
Build
Checklist
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com